Skip to content

Commit

Permalink
fix(tts): remove unnecessary filename param
Browse files Browse the repository at this point in the history
  • Loading branch information
apaparazzi0329 committed Jun 2, 2021
1 parent b0c93b8 commit 5dd1346
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions Sources/TextToSpeechV1/TextToSpeech.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,6 @@ public class TextToSpeech {
* The prompt audio must be in WAV format and must have a minimum sampling rate of 16 kHz. The service accepts
audio with higher sampling rates. The service transcodes all audio to 16 kHz before processing it.
* The length of the prompt audio is limited to 30 seconds.
- parameter filename: The filename for file.
- parameter headers: A dictionary of request headers to be sent with this request.
- parameter completionHandler: A function executed when the request completes with a successful result or error
*/
Expand All @@ -1351,7 +1350,6 @@ public class TextToSpeech {
promptID: String,
metadata: PromptMetadata,
file: Data,
filename: String,
headers: [String: String]? = nil,
completionHandler: @escaping (WatsonResponse<Prompt>?, WatsonError?) -> Void)
{
Expand All @@ -1363,7 +1361,7 @@ public class TextToSpeech {
}
multipartFormData.append(metadataJSON, withName: "metadata", mimeType: "application/json")

multipartFormData.append(file, withName: "file", mimeType: "audio/wav", fileName: filename)
multipartFormData.append(file, withName: "file", mimeType: "audio/wav", fileName: "filename")
guard let body = try? multipartFormData.toData() else {
completionHandler(nil, RestError.serialization(values: "request multipart form data"))
return
Expand Down
3 changes: 1 addition & 2 deletions Tests/TextToSpeechV1Tests/TextToSpeechTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,7 @@ class TextToSpeechTests: XCTestCase {
let promptMetadata = PromptMetadata(promptText: "Hello, how are you today?")
let file = Bundle(for: type(of: self)).url(forResource: "custom_prompt_audio", withExtension: "wav")!
let fileData = try! Data(contentsOf: file)
let filename = "custom_prompt_audio.wav"
textToSpeech.addCustomPrompt(customizationID: customizationID, promptID: promptID, metadata: promptMetadata, file: fileData, filename: filename) {
textToSpeech.addCustomPrompt(customizationID: customizationID, promptID: promptID, metadata: promptMetadata, file: fileData) {
response, error in
if let error = error {
if !error.localizedDescription.contains(self.litePlanMessage) {
Expand Down

0 comments on commit 5dd1346

Please sign in to comment.