Merge remote-tracking branch 'origin' into 7.0.x

This commit is contained in:
William Cheng
2023-03-03 21:52:50 +08:00
10595 changed files with 418520 additions and 73194 deletions

View File

@@ -11,7 +11,7 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat
## Requires
* Kotlin 1.6.10
* Kotlin 1.7.21
* Gradle 7.5
## Build
@@ -80,13 +80,6 @@ Class | Method | HTTP request | Description
<a name="documentation-for-authorization"></a>
## Documentation for Authorization
<a name="api_key"></a>
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
<a name="petstore_auth"></a>
### petstore_auth
@@ -97,3 +90,10 @@ Class | Method | HTTP request | Description
- write:pets: modify pets in your account
- read:pets: read your pets
<a name="api_key"></a>
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header

View File

@@ -7,7 +7,7 @@ wrapper {
}
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.7.21'
repositories {
maven { url "https://repo1.maven.org/maven2" }
@@ -21,6 +21,7 @@ buildscript {
apply plugin: 'kotlin'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlinx-serialization'
apply plugin: 'maven-publish'
repositories {
maven { url "https://repo1.maven.org/maven2" }
@@ -32,7 +33,7 @@ test {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1"
implementation "com.squareup.okhttp3:okhttp:4.10.0"
testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2"
}

View File

@@ -108,7 +108,7 @@ Configure api_key:
Find purchase order by ID
For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
### Example
```kotlin

View File

@@ -111,6 +111,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
body = localVariableBody
)
}
@@ -182,6 +183,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
)
}
@@ -260,6 +262,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
path = "/pet/findByTags",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
body = localVariableBody
)
}
@@ -335,6 +338,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
path = "/pet/getAll",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
body = localVariableBody
)
}
@@ -405,6 +409,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
)
}
@@ -473,6 +478,7 @@ class PetApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = A
path = "/pet",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
body = localVariableBody
)
}
@@ -548,6 +554,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
)
}
@@ -626,6 +633,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
)
}

View File

@@ -109,6 +109,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
)
}
@@ -176,13 +177,14 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/store/inventory",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
body = localVariableBody
)
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
* @param orderId ID of pet that needs to be fetched
* @return Order
* @throws IllegalStateException If the request is not correctly configured
@@ -213,7 +215,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
* @param orderId ID of pet that needs to be fetched
* @return ApiResponse<Order?>
* @throws IllegalStateException If the request is not correctly configured
@@ -246,6 +248,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
)
}
@@ -316,6 +319,7 @@ class StoreApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/store/order",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}

View File

@@ -109,6 +109,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/user",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
@@ -176,6 +177,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
@@ -243,6 +245,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
@@ -310,6 +313,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
)
}
@@ -380,6 +384,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
)
}
@@ -457,6 +462,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/user/login",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
@@ -521,6 +527,7 @@ class UserApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient =
path = "/user/logout",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = false,
body = localVariableBody
)
}
@@ -591,6 +598,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
)
}

View File

@@ -149,6 +149,11 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
}
protected fun <T> updateAuthParams(requestConfig: RequestConfig<T>) {
if (requestConfig.headers[Authorization].isNullOrEmpty()) {
accessToken?.let { accessToken ->
requestConfig.headers[Authorization] = "Bearer $accessToken "
}
}
if (requestConfig.headers["api_key"].isNullOrEmpty()) {
if (apiKey["api_key"] != null) {
if (apiKeyPrefix["api_key"] != null) {
@@ -158,11 +163,6 @@ open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClie
}
}
}
if (requestConfig.headers[Authorization].isNullOrEmpty()) {
accessToken?.let { accessToken ->
requestConfig.headers[Authorization] = "Bearer $accessToken "
}
}
}
protected inline fun <reified I, reified T: Any?> request(requestConfig: RequestConfig<I>): ApiResponse<T?> {

View File

@@ -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
)