Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,15 @@ import com.squareup.moshi.adapter
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,15 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,15 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,15 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,15 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,15 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,15 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,15 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,15 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,15 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,15 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,15 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,15 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,15 @@ public open class ApiClient(public val baseUrl: String, public val client: Call.
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,15 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,15 @@ open class ApiClient(val baseUrl: String, val client: Call.Factory = defaultClie
.toRequestBody((mediaType ?: JSON_MEDIA_TYPE).toMediaTypeOrNull())
}
mediaType == XML_MEDIA_TYPE -> throw UnsupportedOperationException("xml not currently supported.")
mediaType == TEXT_MEDIA_TYPE && content is String ->
content.toRequestBody(TEXT_MEDIA_TYPE.toMediaTypeOrNull())
mediaType == TEXT_MEDIA_TYPE -> {
val textualContent = when (content) {
is Char, is CharSequence -> content.toString()
is Number -> content.toString()
is Boolean -> content.toString()
else -> throw UnsupportedOperationException("requestBody currently only supports text body containing primitive types: characters, numbers, or booleans.")
}
textualContent.toRequestBody(mediaType.toMediaTypeOrNull())
}
// TODO: this should be extended with other serializers
else -> throw UnsupportedOperationException("requestBody currently only supports JSON body, text body, byte body and File body.")
}
Expand Down
Loading
Loading