Skip to content

Commit

Permalink
fix(SpeechToTextV1): Change contentType parameter to optional in cert…
Browse files Browse the repository at this point in the history
…ain methods
  • Loading branch information
Anthony Oliveri committed Jan 16, 2019
1 parent 3345b46 commit e033cff
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Source/SpeechToTextV1/SpeechToText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public class SpeechToText {
*/
public func recognize(
audio: Data,
contentType: String,
contentType: String? = nil,
model: String? = nil,
languageCustomizationID: String? = nil,
acousticCustomizationID: String? = nil,
Expand Down Expand Up @@ -373,7 +373,9 @@ public class SpeechToText {
headerParameters.merge(headers) { (_, new) in new }
}
headerParameters["Accept"] = "application/json"
headerParameters["Content-Type"] = contentType
if let contentType = contentType {
headerParameters["Content-Type"] = contentType
}

// construct query parameters
var queryParameters = [URLQueryItem]()
Expand Down Expand Up @@ -744,7 +746,7 @@ public class SpeechToText {
*/
public func createJob(
audio: Data,
contentType: String,
contentType: String? = nil,
model: String? = nil,
callbackURL: String? = nil,
events: String? = nil,
Expand Down Expand Up @@ -776,7 +778,9 @@ public class SpeechToText {
headerParameters.merge(headers) { (_, new) in new }
}
headerParameters["Accept"] = "application/json"
headerParameters["Content-Type"] = contentType
if let contentType = contentType {
headerParameters["Content-Type"] = contentType
}

// construct query parameters
var queryParameters = [URLQueryItem]()
Expand Down Expand Up @@ -2555,7 +2559,7 @@ public class SpeechToText {
customizationID: String,
audioName: String,
audioResource: Data,
contentType: String,
contentType: String? = nil,
containedContentType: String? = nil,
allowOverwrite: Bool? = nil,
headers: [String: String]? = nil,
Expand All @@ -2570,7 +2574,9 @@ public class SpeechToText {
headerParameters.merge(headers) { (_, new) in new }
}
headerParameters["Accept"] = "application/json"
headerParameters["Content-Type"] = contentType
if let contentType = contentType {
headerParameters["Content-Type"] = contentType
}
if let containedContentType = containedContentType {
headerParameters["Contained-Content-Type"] = containedContentType
}
Expand Down

0 comments on commit e033cff

Please sign in to comment.