Skip to content

Commit

Permalink
[kotlin][client] add info if endpoints requires authentication or not (
Browse files Browse the repository at this point in the history
…#14445)

* [kotlin][client] add info if endpoints requires authentication or not

* [kotlin][client] update sample projects

* [kotlin][client] add info if endpoints requires authentication or not

* [kotlin][client] update sample projects
  • Loading branch information
4brunu authored Jan 13, 2023
1 parent b6ad68b commit d348754
Show file tree
Hide file tree
Showing 86 changed files with 406 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ package {{packageName}}.infrastructure
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf(),
val requiresAuthentication: Boolean,
val body: T? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ import com.fasterxml.jackson.databind.ObjectMapper
RequestMethod.{{httpMethod}},
"{{path}}"{{#pathParams}}.replace("{" + "{{baseName}}" + "}", "${{{paramName}}}"){{/pathParams}},
query = localVariableQuery,
headers = localVariableHeaders
headers = localVariableHeaders,
requiresAuthentication = {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}},
)

return {{#hasBodyParam}}jsonRequest{{/hasBodyParam}}{{^hasBodyParam}}{{#hasFormParams}}{{#isMultipart}}multipartFormRequest{{/isMultipart}}{{^isMultipart}}urlEncodedFormRequest{{/isMultipart}}{{/hasFormParams}}{{^hasFormParams}}request{{/hasFormParams}}{{/hasBodyParam}}(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ import {{packageName}}.infrastructure.toMultiValue
path = "{{path}}"{{#pathParams}}.replace("{"+"{{baseName}}"+"}", encodeURIComponent({{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}{{{paramName}}}{{#isEnum}}.value{{/isEnum}}.toString(){{/isContainer}})){{/pathParams}},
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}},
body = localVariableBody
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ import kotlinx.serialization.encoding.*
RequestMethod.{{httpMethod}},
"{{path}}"{{#pathParams}}.replace("{" + "{{baseName}}" + "}", {{#isContainer}}{{paramName}}.joinToString(","){{/isContainer}}{{^isContainer}}"${{{paramName}}}"{{/isContainer}}){{/pathParams}},
query = localVariableQuery,
headers = localVariableHeaders
headers = localVariableHeaders,
requiresAuthentication = {{#hasAuthMethods}}true{{/hasAuthMethods}}{{^hasAuthMethods}}false{{/hasAuthMethods}},
)

return {{#hasBodyParam}}jsonRequest{{/hasBodyParam}}{{^hasBodyParam}}{{#hasFormParams}}{{#isMultipart}}multipartFormRequest{{/isMultipart}}{{^isMultipart}}urlEncodedFormRequest{{/isMultipart}}{{/hasFormParams}}{{^hasFormParams}}request{{/hasFormParams}}{{/hasBodyParam}}(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class BirdApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/v1/bird/{id}".replace("{"+"id"+"}", encodeURIComponent(id.toString())),
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ data class RequestConfig<T>(
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf(),
val requiresAuthentication: Boolean,
val body: T? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient
path = "/{ids}".replace("{"+"ids"+"}", encodeURIComponent(ids.joinToString(","))),
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ data class RequestConfig<T>(
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf(),
val requiresAuthentication: Boolean,
val body: T? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient
path = "/{ids}".replace("{"+"ids"+"}", encodeURIComponent(ids.joinToString(","))),
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ data class RequestConfig<T>(
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf(),
val requiresAuthentication: Boolean,
val body: T? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ open class DefaultApi(
RequestMethod.GET,
"/{ids}".replace("{" + "ids" + "}", ids.joinToString(",")),
query = localVariableQuery,
headers = localVariableHeaders
headers = localVariableHeaders,
requiresAuthentication = false,
)

return request(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ data class RequestConfig<T>(
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf(),
val requiresAuthentication: Boolean,
val body: T? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ open class DefaultApi(
RequestMethod.POST,
"/test",
query = localVariableQuery,
headers = localVariableHeaders
headers = localVariableHeaders,
requiresAuthentication = false,
)

return jsonRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ data class RequestConfig<T>(
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf(),
val requiresAuthentication: Boolean,
val body: T? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient
path = "/test",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ data class RequestConfig<T>(
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf(),
val requiresAuthentication: Boolean,
val body: T? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient
path = "/test".replace("{"+"pi0"+"}", encodeURIComponent(pi0.toString())).replace("{"+"pi1"+"}", encodeURIComponent(pi1.toString())).replace("{"+"pn0"+"}", encodeURIComponent(pn0.toString())).replace("{"+"pn1"+"}", encodeURIComponent(pn1.toString())),
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ data class RequestConfig<T>(
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf(),
val requiresAuthentication: Boolean,
val body: T? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient
path = "/test".replace("{"+"pi0"+"}", encodeURIComponent(pi0.toString())).replace("{"+"pi1"+"}", encodeURIComponent(pi1.toString())).replace("{"+"pn0"+"}", encodeURIComponent(pn0.toString())).replace("{"+"pn1"+"}", encodeURIComponent(pn1.toString())),
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ data class RequestConfig<T>(
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf(),
val requiresAuthentication: Boolean,
val body: T? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ open class DefaultApi(
RequestMethod.POST,
"/test".replace("{" + "pi0" + "}", "$pi0").replace("{" + "pi1" + "}", "$pi1").replace("{" + "pn0" + "}", "$pn0").replace("{" + "pn1" + "}", "$pn1"),
query = localVariableQuery,
headers = localVariableHeaders
headers = localVariableHeaders,
requiresAuthentication = false,
)

return multipartFormRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ data class RequestConfig<T>(
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf(),
val requiresAuthentication: Boolean,
val body: T? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient
path = "/",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ data class RequestConfig<T>(
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf(),
val requiresAuthentication: Boolean,
val body: T? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
body = localVariableBody
)
}
Expand Down Expand Up @@ -181,6 +182,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
body = localVariableBody
)
}
Expand Down Expand Up @@ -263,6 +265,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
path = "/pet/findByStatus",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
body = localVariableBody
)
}
Expand Down Expand Up @@ -341,6 +344,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
path = "/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
body = localVariableBody
)
}
Expand Down Expand Up @@ -411,6 +415,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
body = localVariableBody
)
}
Expand Down Expand Up @@ -479,6 +484,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
body = localVariableBody
)
}
Expand Down Expand Up @@ -554,6 +560,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
path = "/pet/{petId}".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
body = localVariableBody
)
}
Expand Down Expand Up @@ -632,6 +639,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", encodeURIComponent(petId.toString())),
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
body = localVariableBody
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down Expand Up @@ -175,6 +176,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
body = localVariableBody
)
}
Expand Down Expand Up @@ -245,6 +247,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/store/order/{orderId}".replace("{"+"orderId"+"}", encodeURIComponent(orderId.toString())),
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down Expand Up @@ -315,6 +318,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/store/order",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/user",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down Expand Up @@ -175,6 +176,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down Expand Up @@ -242,6 +244,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down Expand Up @@ -309,6 +312,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down Expand Up @@ -379,6 +383,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down Expand Up @@ -456,6 +461,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/user/login",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down Expand Up @@ -520,6 +526,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/user/logout",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down Expand Up @@ -590,6 +597,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ data class RequestConfig<T>(
val path: String,
val headers: MutableMap<String, String> = mutableMapOf(),
val query: MutableMap<String, List<String>> = mutableMapOf(),
val requiresAuthentication: Boolean,
val body: T? = null
)
Loading

0 comments on commit d348754

Please sign in to comment.