@@ -60,7 +60,7 @@ class Client @JvmOverloads constructor(
6060 internal lateinit var http: OkHttpClient
6161
6262 internal val headers: MutableMap<String , String >
63-
63+
6464 val config: MutableMap<String , String >
6565
6666 internal val cookieJar = ListenableCookieJar(CookieManager(
@@ -87,14 +87,14 @@ class Client @JvmOverloads constructor(
8787 "x-sdk-platform" to "{{ sdk .platform }}",
8888 "x-sdk-language" to "{{ language .name | caseLower }}",
8989 "x-sdk-version" to "{{ sdk .version }}"{% if spec .global .defaultHeaders | length > 0 %},{% endif %}
90-
90+
9191{% for key ,header in spec .global .defaultHeaders %}
9292 "{{ key | caseLower }}" to "{{ header }}"{% if not loop .last %},{% endif %}
9393{% endfor %}
9494
9595 )
9696 config = mutableMapOf()
97-
97+
9898 setSelfSigned(selfSigned)
9999 }
100100
@@ -119,10 +119,10 @@ class Client @JvmOverloads constructor(
119119{% endfor %}
120120 /**
121121 * Set self Signed
122- *
122+ *
123123 * @param status
124124 *
125- * @return this
125+ * @return this
126126 */
127127 fun setSelfSigned(status: Boolean): Client {
128128 selfSigned = status
@@ -171,10 +171,10 @@ class Client @JvmOverloads constructor(
171171
172172 /**
173173 * Set endpoint and realtime endpoint.
174- *
174+ *
175175 * @param endpoint
176176 *
177- * @return this
177+ * @return this
178178 */
179179 fun setEndpoint(endpoint: String): Client {
180180 this.endpoint = endpoint
@@ -200,11 +200,11 @@ class Client @JvmOverloads constructor(
200200
201201 /**
202202 * Add Header
203- *
203+ *
204204 * @param key
205205 * @param value
206206 *
207- * @return this
207+ * @return this
208208 */
209209 fun addHeader(key: String, value: String): Client {
210210 headers[key] = value
@@ -232,19 +232,19 @@ class Client @JvmOverloads constructor(
232232
233233 /**
234234 * Send the HTTP request
235- *
235+ *
236236 * @param method
237237 * @param path
238238 * @param headers
239239 * @param params
240240 *
241- * @return [T]
241+ * @return [T]
242242 */
243243 @Throws({{ spec .title | caseUcfirst }}Exception::class)
244244 suspend fun <T > call(
245- method: String,
246- path: String,
247- headers: Map<String , String > = mapOf(),
245+ method: String,
246+ path: String,
247+ headers: Map<String , String > = mapOf(),
248248 params: Map<String , Any ?> = mapOf(),
249249 responseType: Class<T >,
250250 converter: ((Any) -> T)? = null
@@ -382,7 +382,7 @@ class Client @JvmOverloads constructor(
382382 var offset = 0L
383383 var result: Map< *, *>? = null
384384
385- if (idParamName?.isNotEmpty() == true && params[idParamName] != "unique()" ) {
385+ if (idParamName?.isNotEmpty() == true) {
386386 // Make a request to check if a file already exists
387387 val current = call(
388388 method = "GET",
@@ -479,14 +479,14 @@ class Client @JvmOverloads constructor(
479479 .charStream()
480480 .buffered()
481481 .use(BufferedReader::readText)
482-
482+
483483 val error = if (response.headers["content-type"]?.contains("application/json") == true) {
484484 val map = body.fromJson<Map <String , Any >>()
485485
486486 {{ spec .title | caseUcfirst }}Exception(
487- map["message"] as? String ?: "",
487+ map["message"] as? String ?: "",
488488 (map["code"] as Number).toInt(),
489- map["type"] as? String ?: "",
489+ map["type"] as? String ?: "",
490490 body
491491 )
492492 } else {
@@ -546,4 +546,4 @@ class Client @JvmOverloads constructor(
546546 }
547547 })
548548 }
549- }
549+ }
0 commit comments