diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/openapitools.json b/examples/cactus-example-carbon-accounting-business-logic-plugin/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/openapitools.json +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES index 449474f95a..5a3b78468c 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -6,7 +6,7 @@ settings.gradle src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -14,6 +14,7 @@ src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/README.md b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/README.md index 00c512ea75..8dd7afe77b 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -1,9 +1,18 @@ # org.openapitools.client - Kotlin client library for Hyperledger Cactus Example - Carbon Accounting App +Demonstrates how a business use case can be satisfied with Cactus when multiple distinct ledgers are involved. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 0.2.0 +- Package version: +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + ## Requires -* Kotlin 1.4.30 -* Gradle 6.8.3 +* Kotlin 1.7.21 +* Gradle 7.5 ## Build diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/build.gradle b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/build.gradle index 3de8b45b13..66a3c68b89 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/build.gradle +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/build.gradle @@ -2,12 +2,12 @@ group 'org.openapitools' version '1.0.0' wrapper { - gradleVersion = '6.8.3' + gradleVersion = '7.5' distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } buildscript { - ext.kotlin_version = '1.5.10' + ext.kotlin_version = '1.7.21' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -18,6 +18,7 @@ buildscript { } apply plugin: 'kotlin' +apply plugin: 'maven-publish' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -30,8 +31,8 @@ test { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "com.squareup.moshi:moshi-kotlin:1.12.0" - implementation "com.squareup.moshi:moshi-adapters:1.12.0" - implementation "com.squareup.okhttp3:okhttp:4.9.1" + implementation "com.squareup.moshi:moshi-kotlin:1.13.0" + implementation "com.squareup.moshi:moshi-adapters:1.13.0" + implementation "com.squareup.okhttp3:okhttp:4.10.0" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 20e96437b9..6649d6df96 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Example - Carbon Accounting App - * - * Demonstrates how a business use case can be satisfied with Cactus when multiple distinct ledgers are involved. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -20,49 +15,55 @@ package org.openapitools.client.apis +import java.io.IOException +import okhttp3.OkHttpClient +import okhttp3.HttpUrl + import org.openapitools.client.models.DaoTokenGetAllowanceNotFoundResponse import org.openapitools.client.models.DaoTokenGetAllowanceRequest import org.openapitools.client.models.DaoTokenGetAllowanceResponse import org.openapitools.client.models.EnrollAdminV1Request import org.openapitools.client.models.EnrollAdminV1Response +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://localhost") + System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost") } } /** - * Get the number of tokens `spender` is approved to spend on behalf of `account` - * - * @param daoTokenGetAllowanceRequest (optional) - * @return DaoTokenGetAllowanceResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Get the number of tokens `spender` is approved to spend on behalf of `account` + * + * @param daoTokenGetAllowanceRequest (optional) + * @return DaoTokenGetAllowanceResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun daoTokenGetAllowanceV1(daoTokenGetAllowanceRequest: DaoTokenGetAllowanceRequest?) : DaoTokenGetAllowanceResponse { - val localVariableConfig = daoTokenGetAllowanceV1RequestConfig(daoTokenGetAllowanceRequest = daoTokenGetAllowanceRequest) - - val localVarResponse = request( - localVariableConfig - ) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun daoTokenGetAllowanceV1(daoTokenGetAllowanceRequest: DaoTokenGetAllowanceRequest? = null) : DaoTokenGetAllowanceResponse { + val localVarResponse = daoTokenGetAllowanceV1WithHttpInfo(daoTokenGetAllowanceRequest = daoTokenGetAllowanceRequest) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as DaoTokenGetAllowanceResponse @@ -80,42 +81,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation daoTokenGetAllowanceV1 - * - * @param daoTokenGetAllowanceRequest (optional) - * @return RequestConfig - */ + * Get the number of tokens `spender` is approved to spend on behalf of `account` + * + * @param daoTokenGetAllowanceRequest (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun daoTokenGetAllowanceV1WithHttpInfo(daoTokenGetAllowanceRequest: DaoTokenGetAllowanceRequest?) : ApiResponse { + val localVariableConfig = daoTokenGetAllowanceV1RequestConfig(daoTokenGetAllowanceRequest = daoTokenGetAllowanceRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation daoTokenGetAllowanceV1 + * + * @param daoTokenGetAllowanceRequest (optional) + * @return RequestConfig + */ fun daoTokenGetAllowanceV1RequestConfig(daoTokenGetAllowanceRequest: DaoTokenGetAllowanceRequest?) : RequestConfig { val localVariableBody = daoTokenGetAllowanceRequest val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-example-carbon-accounting-backend/dao-token/get-allowance", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Registers an admin account within the Fabric organization specified. - * - * @param enrollAdminV1Request (optional) - * @return EnrollAdminV1Response - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Registers an admin account within the Fabric organization specified. + * + * @param enrollAdminV1Request (optional) + * @return EnrollAdminV1Response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun enrollAdminV1(enrollAdminV1Request: EnrollAdminV1Request?) : EnrollAdminV1Response { - val localVariableConfig = enrollAdminV1RequestConfig(enrollAdminV1Request = enrollAdminV1Request) - - val localVarResponse = request( - localVariableConfig - ) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun enrollAdminV1(enrollAdminV1Request: EnrollAdminV1Request? = null) : EnrollAdminV1Response { + val localVarResponse = enrollAdminV1WithHttpInfo(enrollAdminV1Request = enrollAdminV1Request) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as EnrollAdminV1Response @@ -133,23 +153,47 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation enrollAdminV1 - * - * @param enrollAdminV1Request (optional) - * @return RequestConfig - */ + * Registers an admin account within the Fabric organization specified. + * + * @param enrollAdminV1Request (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun enrollAdminV1WithHttpInfo(enrollAdminV1Request: EnrollAdminV1Request?) : ApiResponse { + val localVariableConfig = enrollAdminV1RequestConfig(enrollAdminV1Request = enrollAdminV1Request) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation enrollAdminV1 + * + * @param enrollAdminV1Request (optional) + * @return RequestConfig + */ fun enrollAdminV1RequestConfig(enrollAdminV1Request: EnrollAdminV1Request?) : RequestConfig { val localVariableBody = enrollAdminV1Request val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/utilityemissionchannel/registerEnroll/admin", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index b359be1e41..757080d7ed 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -10,21 +10,26 @@ import okhttp3.ResponseBody import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import okhttp3.Headers +import okhttp3.Headers.Companion.toHeaders import okhttp3.MultipartBody +import okhttp3.Call +import okhttp3.Callback +import okhttp3.Response +import okhttp3.internal.EMPTY_REQUEST import java.io.BufferedWriter import java.io.File import java.io.FileWriter +import java.io.IOException import java.net.URLConnection import java.time.LocalDate import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter -open class ApiClient(val baseUrl: String) { +open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) { companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" @@ -39,9 +44,10 @@ open class ApiClient(val baseUrl: String) { var username: String? = null var password: String? = null var accessToken: String? = null + const val baseUrlKey = "org.openapitools.client.baseUrl" @JvmStatic - val client: OkHttpClient by lazy { + val defaultClient: OkHttpClient by lazy { builder.build() } @@ -60,48 +66,50 @@ open class ApiClient(val baseUrl: String) { return contentType ?: "application/octet-stream" } - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + protected inline fun requestBody(content: T, mediaType: String?): RequestBody = when { - content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull()) - mediaType == FormDataMediaType -> { + content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) + mediaType == FormDataMediaType -> MultipartBody.Builder() .setType(MultipartBody.FORM) .apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" + (content as Map>).forEach { (name, part) -> + if (part.body is File) { + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${part.body.name}\"") + val fileMediaType = guessContentTypeFromFile(part.body).toMediaTypeOrNull() + addPart( + partHeaders.toHeaders(), + part.body.asRequestBody(fileMediaType) ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"") addPart( - partHeaders, - parameterToString(value).toRequestBody(null) + partHeaders.toHeaders(), + parameterToString(part.body).toRequestBody(null) ) } } }.build() - } mediaType == FormUrlEncMediaType -> { FormBody.Builder().apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) + (content as Map>).forEach { (name, part) -> + add(name, parameterToString(part.body)) } }.build() } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) + mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> + if (content == null) { + EMPTY_REQUEST + } else { + Serializer.moshi.adapter(T::class.java).toJson(content) + .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) + } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -112,31 +120,35 @@ open class ApiClient(val baseUrl: String) { if(body == null) { return null } + if (T::class.java == File::class.java) { + // return tempFile + // Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options + val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() + tempFile.deleteOnExit() + body.byteStream().use { inputStream -> + tempFile.outputStream().use { tempFileOutputStream -> + inputStream.copyTo(tempFileOutputStream) + } + } + return tempFile as T + } val bodyContent = body.string() if (bodyContent.isEmpty()) { return null } - if (T::class.java == File::class.java) { - // return tempfile - val f = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() - f.deleteOnExit() - val out = BufferedWriter(FileWriter(f)) - out.write(bodyContent) - out.close() - return f as T - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) + .addEncodedPathSegments(requestConfig.path.trimStart('/')) .apply { requestConfig.query.forEach { query -> query.value.forEach { queryValue -> @@ -146,7 +158,7 @@ open class ApiClient(val baseUrl: String) { }.build() // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { + if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) { requestConfig.headers[ContentType] = JsonMediaType } if (requestConfig.headers[Accept].isNullOrEmpty()) { @@ -154,16 +166,16 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { + if (headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + val contentType = if (headers[ContentType] != null) { + // TODO: support multiple contentType options here. + (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + } else { + null + } val request = when (requestConfig.method) { RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) @@ -178,6 +190,7 @@ open class ApiClient(val baseUrl: String) { }.build() val response = client.newCall(request).execute() + val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault()) // TODO: handle specific mapping types. e.g. Map> @@ -215,7 +228,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 0000000000..cf2cfaa95d --- /dev/null +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt index fb2c972cf8..064b57fc6b 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt @@ -14,4 +14,4 @@ class BigDecimalAdapter { fun fromJson(value: String): BigDecimal { return BigDecimal(value) } -} \ No newline at end of file +} diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt index 4b6963110c..7df6057b45 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt @@ -14,4 +14,4 @@ class BigIntegerAdapter { fun fromJson(value: String): BigInteger { return BigInteger(value) } -} \ No newline at end of file +} diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 0000000000..be00e38fba --- /dev/null +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 7e948e1dd0..625a19002b 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -13,5 +13,6 @@ data class RequestConfig( val path: String, val headers: MutableMap = mutableMapOf(), val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, val body: T? = null ) \ No newline at end of file diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AuthzJwtClaim.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AuthzJwtClaim.kt index 3f4836b17a..9912d13e9f 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AuthzJwtClaim.kt +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AuthzJwtClaim.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Example - Carbon Accounting App - * - * Demonstrates how a business use case can be satisfied with Cactus when multiple distinct ledgers are involved. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -47,12 +42,12 @@ enum class AuthzJwtClaim(val value: kotlin.String) { /** * Converts the provided [data] to a [String] on success, null otherwise. */ - fun encode(data: Any?): kotlin.String? = if (data is AuthzJwtClaim) "$data" else null + fun encode(data: kotlin.Any?): kotlin.String? = if (data is AuthzJwtClaim) "$data" else null /** * Returns a valid [AuthzJwtClaim] for [data], null otherwise. */ - fun decode(data: Any?): AuthzJwtClaim? = data?.let { + fun decode(data: kotlin.Any?): AuthzJwtClaim? = data?.let { val normalizedData = "$it".lowercase() values().firstOrNull { value -> it == value || normalizedData == "$value".lowercase() diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AuthzScope.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AuthzScope.kt index 55bf835d82..59dad5a032 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AuthzScope.kt +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AuthzScope.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Example - Carbon Accounting App - * - * Demonstrates how a business use case can be satisfied with Cactus when multiple distinct ledgers are involved. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -50,12 +45,12 @@ enum class AuthzScope(val value: kotlin.String) { /** * Converts the provided [data] to a [String] on success, null otherwise. */ - fun encode(data: Any?): kotlin.String? = if (data is AuthzScope) "$data" else null + fun encode(data: kotlin.Any?): kotlin.String? = if (data is AuthzScope) "$data" else null /** * Returns a valid [AuthzScope] for [data], null otherwise. */ - fun decode(data: Any?): AuthzScope? = data?.let { + fun decode(data: kotlin.Any?): AuthzScope? = data?.let { val normalizedData = "$it".lowercase() values().firstOrNull { value -> it == value || normalizedData == "$value".lowercase() diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Checkpoint.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Checkpoint.kt index 11aed701b6..09ef10e250 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Checkpoint.kt +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Checkpoint.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Example - Carbon Accounting App - * - * Demonstrates how a business use case can be satisfied with Cactus when multiple distinct ledgers are involved. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param votes */ + data class Checkpoint ( @Json(name = "fromBlock") diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DaoTokenGetAllowanceNotFoundResponse.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DaoTokenGetAllowanceNotFoundResponse.kt index 5f08e0e31c..58ec7f2709 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DaoTokenGetAllowanceNotFoundResponse.kt +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DaoTokenGetAllowanceNotFoundResponse.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Example - Carbon Accounting App - * - * Demonstrates how a business use case can be satisfied with Cactus when multiple distinct ledgers are involved. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param spenderFound Indicates whether the spender was found or not. */ + data class DaoTokenGetAllowanceNotFoundResponse ( /* Indicates whether the account was found or not. */ diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DaoTokenGetAllowanceRequest.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DaoTokenGetAllowanceRequest.kt index 4a5657ef9a..f99c232f22 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DaoTokenGetAllowanceRequest.kt +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DaoTokenGetAllowanceRequest.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Example - Carbon Accounting App - * - * Demonstrates how a business use case can be satisfied with Cactus when multiple distinct ledgers are involved. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param spender The address of the account spending the funds */ + data class DaoTokenGetAllowanceRequest ( /* The address of the account holding the funds */ diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DaoTokenGetAllowanceResponse.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DaoTokenGetAllowanceResponse.kt index 6acb5f77cb..9a64bcd543 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DaoTokenGetAllowanceResponse.kt +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DaoTokenGetAllowanceResponse.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Example - Carbon Accounting App - * - * Demonstrates how a business use case can be satisfied with Cactus when multiple distinct ledgers are involved. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param allowance The number of tokens approved */ + data class DaoTokenGetAllowanceResponse ( /* The number of tokens approved */ diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EnrollAdminInfo.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EnrollAdminInfo.kt index 677280b609..fc7f152377 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EnrollAdminInfo.kt +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EnrollAdminInfo.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Example - Carbon Accounting App - * - * Demonstrates how a business use case can be satisfied with Cactus when multiple distinct ledgers are involved. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -50,12 +45,12 @@ enum class EnrollAdminInfo(val value: kotlin.String) { /** * Converts the provided [data] to a [String] on success, null otherwise. */ - fun encode(data: Any?): kotlin.String? = if (data is EnrollAdminInfo) "$data" else null + fun encode(data: kotlin.Any?): kotlin.String? = if (data is EnrollAdminInfo) "$data" else null /** * Returns a valid [EnrollAdminInfo] for [data], null otherwise. */ - fun decode(data: Any?): EnrollAdminInfo? = data?.let { + fun decode(data: kotlin.Any?): EnrollAdminInfo? = data?.let { val normalizedData = "$it".lowercase() values().firstOrNull { value -> it == value || normalizedData == "$value".lowercase() diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EnrollAdminV1Request.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EnrollAdminV1Request.kt index 1f393eecee..3e5537e942 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EnrollAdminV1Request.kt +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EnrollAdminV1Request.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Example - Carbon Accounting App - * - * Demonstrates how a business use case can be satisfied with Cactus when multiple distinct ledgers are involved. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param orgName */ + data class EnrollAdminV1Request ( @Json(name = "orgName") diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EnrollAdminV1Response.kt b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EnrollAdminV1Response.kt index ddd4e4f237..ffaed858f7 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EnrollAdminV1Response.kt +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/EnrollAdminV1Response.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Example - Carbon Accounting App - * - * Demonstrates how a business use case can be satisfied with Cactus when multiple distinct ledgers are involved. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -33,6 +28,7 @@ import com.squareup.moshi.Json * @param identityId The key under which the identity created will be persisted to the keychain for later retrieval. */ + data class EnrollAdminV1Response ( @Json(name = "info") diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/api.ts b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/api.ts index f1574b9fcb..c209b14122 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * Stores global constants related to the authorization of the application. Specifically enumerates the claims to validate for as per RFC 7519, section 4.1. See: https://tools.ietf.org/html/rfc7519#section-4.1 @@ -27,12 +29,15 @@ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } fr * @enum {string} */ -export enum AuthzJwtClaim { +export const AuthzJwtClaim = { /** * The "iss" (issuer) claim identifies the principal that issued the JWT. The processing of this claim is generally application specific. The "iss" value is a case-sensitive string containing a StringOrURI value. Use of this claim is OPTIONAL. */ - iss = 'Hyperledger Labs - Carbon Accounting Tool' -} + iss: 'Hyperledger Labs - Carbon Accounting Tool' +} as const; + +export type AuthzJwtClaim = typeof AuthzJwtClaim[keyof typeof AuthzJwtClaim]; + /** * @@ -40,16 +45,19 @@ export enum AuthzJwtClaim { * @enum {string} */ -export enum AuthzScope { +export const AuthzScope = { /** * Identities with the group:admin scope are administrators of the system. */ - GroupAdmin = 'group:admin', + GroupAdmin: 'group:admin', /** * Identities with the group:user scope are end users of the system who only have authorization to perform a limited set of actions. */ - GroupUser = 'group:user' -} + GroupUser: 'group:user' +} as const; + +export type AuthzScope = typeof AuthzScope[keyof typeof AuthzScope]; + /** * @@ -62,13 +70,13 @@ export interface Checkpoint { * @type {number} * @memberof Checkpoint */ - fromBlock: number; + 'fromBlock': number; /** * * @type {string} * @memberof Checkpoint */ - votes: string; + 'votes': string; } /** * @@ -81,13 +89,13 @@ export interface DaoTokenGetAllowanceNotFoundResponse { * @type {boolean} * @memberof DaoTokenGetAllowanceNotFoundResponse */ - accountFound: boolean; + 'accountFound': boolean; /** * Indicates whether the spender was found or not. * @type {boolean} * @memberof DaoTokenGetAllowanceNotFoundResponse */ - spenderFound: boolean; + 'spenderFound': boolean; } /** * @@ -100,13 +108,13 @@ export interface DaoTokenGetAllowanceRequest { * @type {string} * @memberof DaoTokenGetAllowanceRequest */ - account: string; + 'account': string; /** * The address of the account spending the funds * @type {string} * @memberof DaoTokenGetAllowanceRequest */ - spender: string; + 'spender': string; } /** * @@ -119,7 +127,7 @@ export interface DaoTokenGetAllowanceResponse { * @type {number} * @memberof DaoTokenGetAllowanceResponse */ - allowance: number; + 'allowance': number; } /** * @@ -127,10 +135,13 @@ export interface DaoTokenGetAllowanceResponse { * @enum {string} */ -export enum EnrollAdminInfo { - SUCCESSFULLY_ENROLLED_ADMIN = 'Successfully enrolled admin user and imported it into the wallet', - ORG_ADMIN_REGISTERED = 'ORG ADMIN REGISTERED' -} +export const EnrollAdminInfo = { + SUCCESSFULLY_ENROLLED_ADMIN: 'Successfully enrolled admin user and imported it into the wallet', + ORG_ADMIN_REGISTERED: 'ORG ADMIN REGISTERED' +} as const; + +export type EnrollAdminInfo = typeof EnrollAdminInfo[keyof typeof EnrollAdminInfo]; + /** * @@ -143,7 +154,7 @@ export interface EnrollAdminV1Request { * @type {string} * @memberof EnrollAdminV1Request */ - orgName: string; + 'orgName': string; } /** * @@ -156,31 +167,31 @@ export interface EnrollAdminV1Response { * @type {string} * @memberof EnrollAdminV1Response */ - info: string; + 'info': string; /** * * @type {string} * @memberof EnrollAdminV1Response */ - orgName: string; + 'orgName': string; /** * * @type {string} * @memberof EnrollAdminV1Response */ - msp: string; + 'msp': string; /** * * @type {string} * @memberof EnrollAdminV1Response */ - caName: string; + 'caName': string; /** * The key under which the identity created will be persisted to the keychain for later retrieval. * @type {string} * @memberof EnrollAdminV1Response */ - identityId?: string; + 'identityId'?: string; } /** @@ -196,7 +207,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - daoTokenGetAllowanceV1: async (daoTokenGetAllowanceRequest?: DaoTokenGetAllowanceRequest, options: any = {}): Promise => { + daoTokenGetAllowanceV1: async (daoTokenGetAllowanceRequest?: DaoTokenGetAllowanceRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-example-carbon-accounting-backend/dao-token/get-allowance`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -213,7 +224,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(daoTokenGetAllowanceRequest, localVarRequestOptions, configuration) @@ -230,7 +241,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - enrollAdminV1: async (enrollAdminV1Request?: EnrollAdminV1Request, options: any = {}): Promise => { + enrollAdminV1: async (enrollAdminV1Request?: EnrollAdminV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/utilityemissionchannel/registerEnroll/admin`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -247,7 +258,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(enrollAdminV1Request, localVarRequestOptions, configuration) @@ -274,7 +285,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async daoTokenGetAllowanceV1(daoTokenGetAllowanceRequest?: DaoTokenGetAllowanceRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async daoTokenGetAllowanceV1(daoTokenGetAllowanceRequest?: DaoTokenGetAllowanceRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.daoTokenGetAllowanceV1(daoTokenGetAllowanceRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -285,7 +296,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async enrollAdminV1(enrollAdminV1Request?: EnrollAdminV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async enrollAdminV1(enrollAdminV1Request?: EnrollAdminV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.enrollAdminV1(enrollAdminV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -337,7 +348,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public daoTokenGetAllowanceV1(daoTokenGetAllowanceRequest?: DaoTokenGetAllowanceRequest, options?: any) { + public daoTokenGetAllowanceV1(daoTokenGetAllowanceRequest?: DaoTokenGetAllowanceRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).daoTokenGetAllowanceV1(daoTokenGetAllowanceRequest, options).then((request) => request(this.axios, this.basePath)); } @@ -349,7 +360,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public enrollAdminV1(enrollAdminV1Request?: EnrollAdminV1Request, options?: any) { + public enrollAdminV1(enrollAdminV1Request?: EnrollAdminV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).enrollAdminV1(enrollAdminV1Request, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/base.ts b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/base.ts index 151aa84c48..f07809e7af 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/common.ts b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/common.ts index 2fd1610612..4af08e2336 100644 --- a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; } diff --git a/extensions/cactus-plugin-htlc-coordinator-besu/openapitools.json b/extensions/cactus-plugin-htlc-coordinator-besu/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/extensions/cactus-plugin-htlc-coordinator-besu/openapitools.json +++ b/extensions/cactus-plugin-htlc-coordinator-besu/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/api.ts b/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/api.ts index eab062fa06..1b33940fb2 100644 --- a/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * @@ -32,48 +34,53 @@ export interface CounterpartyHTLCRequest { * @type {HtlcPackage} * @memberof CounterpartyHTLCRequest */ - htlcPackage: HtlcPackage; + 'htlcPackage': HtlcPackage; /** * connector Instance Id for the connector plugin * @type {string} * @memberof CounterpartyHTLCRequest */ - connectorInstanceId: string; + 'connectorInstanceId': string; /** * keychainId for the keychain plugin * @type {string} * @memberof CounterpartyHTLCRequest */ - keychainId: string; + 'keychainId': string; /** * Id for the HTLC * @type {string} * @memberof CounterpartyHTLCRequest */ - htlcId: string; + 'htlcId': string; /** * * @type {Web3SigningCredential} * @memberof CounterpartyHTLCRequest */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * * @type {number} * @memberof CounterpartyHTLCRequest */ - gas?: number; + 'gas'?: number; } + + /** * * @export * @enum {string} */ -export enum HtlcPackage { - Besu = 'BESU', - BesuErc20 = 'BESU_ERC20' -} +export const HtlcPackage = { + Besu: 'BESU', + BesuErc20: 'BESU_ERC20' +} as const; + +export type HtlcPackage = typeof HtlcPackage[keyof typeof HtlcPackage]; + /** * @@ -86,86 +93,88 @@ export interface OwnHTLCRequest { * @type {HtlcPackage} * @memberof OwnHTLCRequest */ - htlcPackage: HtlcPackage; + 'htlcPackage': HtlcPackage; /** * connector Instance Id for the connector plugin * @type {string} * @memberof OwnHTLCRequest */ - connectorInstanceId: string; + 'connectorInstanceId': string; /** * keychainId for the keychain plugin * @type {string} * @memberof OwnHTLCRequest */ - keychainId: string; + 'keychainId': string; /** * * @type {Array} * @memberof OwnHTLCRequest */ - constructorArgs: Array; + 'constructorArgs': Array; /** * * @type {Web3SigningCredential} * @memberof OwnHTLCRequest */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * Input amount to lock * @type {number} * @memberof OwnHTLCRequest */ - inputAmount: number; + 'inputAmount': number; /** * Output amount to lock * @type {number} * @memberof OwnHTLCRequest */ - outputAmount: number; + 'outputAmount': number; /** * Timestamp to expire the contract * @type {number} * @memberof OwnHTLCRequest */ - expiration: number; + 'expiration': number; /** * Hashlock needed to refund the amount * @type {string} * @memberof OwnHTLCRequest */ - hashLock: string; + 'hashLock': string; /** * The token address * @type {string} * @memberof OwnHTLCRequest */ - tokenAddress: string; + 'tokenAddress': string; /** * The receiver address * @type {string} * @memberof OwnHTLCRequest */ - receiver: string; + 'receiver': string; /** * The output network id * @type {string} * @memberof OwnHTLCRequest */ - outputNetwork: string; + 'outputNetwork': string; /** * The output addreess to receive the tokens * @type {string} * @memberof OwnHTLCRequest */ - outputAddress: string; + 'outputAddress': string; /** * * @type {number} * @memberof OwnHTLCRequest */ - gas?: number; + 'gas'?: number; } + + /** * @type Web3SigningCredential * @export @@ -183,26 +192,28 @@ export interface Web3SigningCredentialCactusKeychainRef { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialCactusKeychainRef */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; /** * The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication. * @type {string} * @memberof Web3SigningCredentialCactusKeychainRef */ - ethAccount: string; + 'ethAccount': string; /** * The key to use when looking up the the keychain entry holding the secret pointed to by the keychainEntryKey parameter. * @type {string} * @memberof Web3SigningCredentialCactusKeychainRef */ - keychainEntryKey: string; + 'keychainEntryKey': string; /** * The keychain ID to use when looking up the the keychain plugin instance that will be used to retrieve the secret pointed to by the keychainEntryKey parameter. * @type {string} * @memberof Web3SigningCredentialCactusKeychainRef */ - keychainId: string; + 'keychainId': string; } + + /** * Using this denotes that there is no signing required because the transaction is pre-signed. * @export @@ -214,8 +225,10 @@ export interface Web3SigningCredentialNone { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialNone */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; } + + /** * * @export @@ -227,32 +240,37 @@ export interface Web3SigningCredentialPrivateKeyHex { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialPrivateKeyHex */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; /** * The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication. * @type {string} * @memberof Web3SigningCredentialPrivateKeyHex */ - ethAccount: string; + 'ethAccount': string; /** * The HEX encoded private key of an eth account. * @type {string} * @memberof Web3SigningCredentialPrivateKeyHex */ - secret: string; + 'secret': string; } + + /** * * @export * @enum {string} */ -export enum Web3SigningCredentialType { - CactusKeychainRef = 'CACTUS_KEYCHAIN_REF', - GethKeychainPassword = 'GETH_KEYCHAIN_PASSWORD', - PrivateKeyHex = 'PRIVATE_KEY_HEX', - None = 'NONE' -} +export const Web3SigningCredentialType = { + CactusKeychainRef: 'CACTUS_KEYCHAIN_REF', + GethKeychainPassword: 'GETH_KEYCHAIN_PASSWORD', + PrivateKeyHex: 'PRIVATE_KEY_HEX', + None: 'NONE' +} as const; + +export type Web3SigningCredentialType = typeof Web3SigningCredentialType[keyof typeof Web3SigningCredentialType]; + /** * @@ -265,51 +283,53 @@ export interface WithdrawCounterpartyRequest { * @type {HtlcPackage} * @memberof WithdrawCounterpartyRequest */ - htlcPackage: HtlcPackage; + 'htlcPackage': HtlcPackage; /** * connector Instance Id for the connector plugin * @type {string} * @memberof WithdrawCounterpartyRequest */ - connectorInstanceId: string; + 'connectorInstanceId': string; /** * keychainId for the keychain plugin * @type {string} * @memberof WithdrawCounterpartyRequest */ - keychainId: string; + 'keychainId': string; /** * contractId for the contract * @type {string} * @memberof WithdrawCounterpartyRequest */ - contractId?: string; + 'contractId'?: string; /** * * @type {Web3SigningCredential} * @memberof WithdrawCounterpartyRequest */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * Id for the HTLC * @type {string} * @memberof WithdrawCounterpartyRequest */ - htlcId: string; + 'htlcId': string; /** * Counterparty HTLC secret * @type {string} * @memberof WithdrawCounterpartyRequest */ - secret: string; + 'secret': string; /** * * @type {number} * @memberof WithdrawCounterpartyRequest */ - gas?: number; + 'gas'?: number; } + + /** * DefaultApi - axios parameter creator * @export @@ -323,7 +343,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - counterpartyHtlcV1: async (counterpartyHTLCRequest?: CounterpartyHTLCRequest, options: any = {}): Promise => { + counterpartyHtlcV1: async (counterpartyHTLCRequest?: CounterpartyHTLCRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-htlc-coordinator-besu/counterparty-htlc`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -340,7 +360,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(counterpartyHTLCRequest, localVarRequestOptions, configuration) @@ -357,7 +377,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - ownHtlcV1: async (ownHTLCRequest?: OwnHTLCRequest, options: any = {}): Promise => { + ownHtlcV1: async (ownHTLCRequest?: OwnHTLCRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-htlc-coordinator-besu/own-htlc`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -374,7 +394,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(ownHTLCRequest, localVarRequestOptions, configuration) @@ -391,7 +411,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - withdrawCounterpartyV1: async (withdrawCounterpartyRequest?: WithdrawCounterpartyRequest, options: any = {}): Promise => { + withdrawCounterpartyV1: async (withdrawCounterpartyRequest?: WithdrawCounterpartyRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-htlc-coordinator-besu/withdraw-counterparty`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -408,7 +428,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(withdrawCounterpartyRequest, localVarRequestOptions, configuration) @@ -435,7 +455,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async counterpartyHtlcV1(counterpartyHTLCRequest?: CounterpartyHTLCRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async counterpartyHtlcV1(counterpartyHTLCRequest?: CounterpartyHTLCRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.counterpartyHtlcV1(counterpartyHTLCRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -446,7 +466,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async ownHtlcV1(ownHTLCRequest?: OwnHTLCRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async ownHtlcV1(ownHTLCRequest?: OwnHTLCRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.ownHtlcV1(ownHTLCRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -457,7 +477,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async withdrawCounterpartyV1(withdrawCounterpartyRequest?: WithdrawCounterpartyRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async withdrawCounterpartyV1(withdrawCounterpartyRequest?: WithdrawCounterpartyRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.withdrawCounterpartyV1(withdrawCounterpartyRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -519,7 +539,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public counterpartyHtlcV1(counterpartyHTLCRequest?: CounterpartyHTLCRequest, options?: any) { + public counterpartyHtlcV1(counterpartyHTLCRequest?: CounterpartyHTLCRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).counterpartyHtlcV1(counterpartyHTLCRequest, options).then((request) => request(this.axios, this.basePath)); } @@ -531,7 +551,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public ownHtlcV1(ownHTLCRequest?: OwnHTLCRequest, options?: any) { + public ownHtlcV1(ownHTLCRequest?: OwnHTLCRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).ownHtlcV1(ownHTLCRequest, options).then((request) => request(this.axios, this.basePath)); } @@ -543,7 +563,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public withdrawCounterpartyV1(withdrawCounterpartyRequest?: WithdrawCounterpartyRequest, options?: any) { + public withdrawCounterpartyV1(withdrawCounterpartyRequest?: WithdrawCounterpartyRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).withdrawCounterpartyV1(withdrawCounterpartyRequest, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/base.ts b/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/base.ts index aededdda88..8d44905c81 100644 --- a/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "https://www.cactus.stream".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/common.ts b/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/common.ts index cfdff6d070..d84dc089c3 100644 --- a/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; } diff --git a/packages/cactus-cmd-api-server/openapitools.json b/packages/cactus-cmd-api-server/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/packages/cactus-cmd-api-server/openapitools.json +++ b/packages/cactus-cmd-api-server/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES index eae4f1a10a..9354990b61 100644 --- a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -6,7 +6,7 @@ settings.gradle src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -14,6 +14,7 @@ src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt diff --git a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION +++ b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/README.md index 1665b8308c..82e7e96d21 100644 --- a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -1,9 +1,18 @@ # org.openapitools.client - Kotlin client library for Hyperledger Cactus API +Interact with a Cactus deployment through HTTP. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 0.0.1 +- Package version: +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + ## Requires -* Kotlin 1.4.30 -* Gradle 6.8.3 +* Kotlin 1.7.21 +* Gradle 7.5 ## Build diff --git a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/build.gradle b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/build.gradle index 3de8b45b13..66a3c68b89 100644 --- a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/build.gradle +++ b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/build.gradle @@ -2,12 +2,12 @@ group 'org.openapitools' version '1.0.0' wrapper { - gradleVersion = '6.8.3' + gradleVersion = '7.5' distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } buildscript { - ext.kotlin_version = '1.5.10' + ext.kotlin_version = '1.7.21' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -18,6 +18,7 @@ buildscript { } apply plugin: 'kotlin' +apply plugin: 'maven-publish' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -30,8 +31,8 @@ test { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "com.squareup.moshi:moshi-kotlin:1.12.0" - implementation "com.squareup.moshi:moshi-adapters:1.12.0" - implementation "com.squareup.okhttp3:okhttp:4.9.1" + implementation "com.squareup.moshi:moshi-kotlin:1.13.0" + implementation "com.squareup.moshi:moshi-adapters:1.13.0" + implementation "com.squareup.okhttp3:okhttp:4.10.0" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 30aee70509..149d4c6e63 100644 --- a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus API - * - * Interact with a Cactus deployment through HTTP. - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -20,44 +15,50 @@ package org.openapitools.client.apis +import java.io.IOException +import okhttp3.OkHttpClient +import okhttp3.HttpUrl + import org.openapitools.client.models.HealthCheckResponse +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://localhost") + System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost") } } /** - * Can be used to verify liveness of an API server instance - * Returns the current timestamp of the API server as proof of health/liveness - * @return HealthCheckResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Can be used to verify liveness of an API server instance + * Returns the current timestamp of the API server as proof of health/liveness + * @return HealthCheckResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getHealthCheckV1() : HealthCheckResponse { - val localVariableConfig = getHealthCheckV1RequestConfig() - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = getHealthCheckV1WithHttpInfo() return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as HealthCheckResponse @@ -75,40 +76,57 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation getHealthCheckV1 - * - * @return RequestConfig - */ + * Can be used to verify liveness of an API server instance + * Returns the current timestamp of the API server as proof of health/liveness + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getHealthCheckV1WithHttpInfo() : ApiResponse { + val localVariableConfig = getHealthCheckV1RequestConfig() + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getHealthCheckV1 + * + * @return RequestConfig + */ fun getHealthCheckV1RequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.GET, path = "/api/v1/api-server/healthcheck", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Get the Prometheus Metrics - * - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Get the Prometheus Metrics + * + * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPrometheusMetricsV1() : kotlin.String { - val localVariableConfig = getPrometheusMetricsV1RequestConfig() - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = getPrometheusMetricsV1WithHttpInfo() return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String @@ -126,22 +144,43 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation getPrometheusMetricsV1 - * - * @return RequestConfig - */ + * Get the Prometheus Metrics + * + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getPrometheusMetricsV1WithHttpInfo() : ApiResponse { + val localVariableConfig = getPrometheusMetricsV1RequestConfig() + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getPrometheusMetricsV1 + * + * @return RequestConfig + */ fun getPrometheusMetricsV1RequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/api/v1/api-server/get-prometheus-exporter-metrics", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index b359be1e41..757080d7ed 100644 --- a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -10,21 +10,26 @@ import okhttp3.ResponseBody import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import okhttp3.Headers +import okhttp3.Headers.Companion.toHeaders import okhttp3.MultipartBody +import okhttp3.Call +import okhttp3.Callback +import okhttp3.Response +import okhttp3.internal.EMPTY_REQUEST import java.io.BufferedWriter import java.io.File import java.io.FileWriter +import java.io.IOException import java.net.URLConnection import java.time.LocalDate import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter -open class ApiClient(val baseUrl: String) { +open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) { companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" @@ -39,9 +44,10 @@ open class ApiClient(val baseUrl: String) { var username: String? = null var password: String? = null var accessToken: String? = null + const val baseUrlKey = "org.openapitools.client.baseUrl" @JvmStatic - val client: OkHttpClient by lazy { + val defaultClient: OkHttpClient by lazy { builder.build() } @@ -60,48 +66,50 @@ open class ApiClient(val baseUrl: String) { return contentType ?: "application/octet-stream" } - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + protected inline fun requestBody(content: T, mediaType: String?): RequestBody = when { - content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull()) - mediaType == FormDataMediaType -> { + content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) + mediaType == FormDataMediaType -> MultipartBody.Builder() .setType(MultipartBody.FORM) .apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" + (content as Map>).forEach { (name, part) -> + if (part.body is File) { + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${part.body.name}\"") + val fileMediaType = guessContentTypeFromFile(part.body).toMediaTypeOrNull() + addPart( + partHeaders.toHeaders(), + part.body.asRequestBody(fileMediaType) ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"") addPart( - partHeaders, - parameterToString(value).toRequestBody(null) + partHeaders.toHeaders(), + parameterToString(part.body).toRequestBody(null) ) } } }.build() - } mediaType == FormUrlEncMediaType -> { FormBody.Builder().apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) + (content as Map>).forEach { (name, part) -> + add(name, parameterToString(part.body)) } }.build() } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) + mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> + if (content == null) { + EMPTY_REQUEST + } else { + Serializer.moshi.adapter(T::class.java).toJson(content) + .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) + } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -112,31 +120,35 @@ open class ApiClient(val baseUrl: String) { if(body == null) { return null } + if (T::class.java == File::class.java) { + // return tempFile + // Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options + val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() + tempFile.deleteOnExit() + body.byteStream().use { inputStream -> + tempFile.outputStream().use { tempFileOutputStream -> + inputStream.copyTo(tempFileOutputStream) + } + } + return tempFile as T + } val bodyContent = body.string() if (bodyContent.isEmpty()) { return null } - if (T::class.java == File::class.java) { - // return tempfile - val f = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() - f.deleteOnExit() - val out = BufferedWriter(FileWriter(f)) - out.write(bodyContent) - out.close() - return f as T - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) + .addEncodedPathSegments(requestConfig.path.trimStart('/')) .apply { requestConfig.query.forEach { query -> query.value.forEach { queryValue -> @@ -146,7 +158,7 @@ open class ApiClient(val baseUrl: String) { }.build() // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { + if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) { requestConfig.headers[ContentType] = JsonMediaType } if (requestConfig.headers[Accept].isNullOrEmpty()) { @@ -154,16 +166,16 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { + if (headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + val contentType = if (headers[ContentType] != null) { + // TODO: support multiple contentType options here. + (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + } else { + null + } val request = when (requestConfig.method) { RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) @@ -178,6 +190,7 @@ open class ApiClient(val baseUrl: String) { }.build() val response = client.newCall(request).execute() + val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault()) // TODO: handle specific mapping types. e.g. Map> @@ -215,7 +228,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 0000000000..cf2cfaa95d --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt index fb2c972cf8..064b57fc6b 100644 --- a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +++ b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt @@ -14,4 +14,4 @@ class BigDecimalAdapter { fun fromJson(value: String): BigDecimal { return BigDecimal(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt index 4b6963110c..7df6057b45 100644 --- a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt +++ b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt @@ -14,4 +14,4 @@ class BigIntegerAdapter { fun fromJson(value: String): BigInteger { return BigInteger(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 0000000000..be00e38fba --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 7e948e1dd0..625a19002b 100644 --- a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -13,5 +13,6 @@ data class RequestConfig( val path: String, val headers: MutableMap = mutableMapOf(), val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, val body: T? = null ) \ No newline at end of file diff --git a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HealthCheckResponse.kt b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HealthCheckResponse.kt index f6075426de..395ee1db0c 100644 --- a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HealthCheckResponse.kt +++ b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HealthCheckResponse.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus API - * - * Interact with a Cactus deployment through HTTP. - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -32,6 +27,7 @@ import com.squareup.moshi.Json * @param success */ + data class HealthCheckResponse ( @Json(name = "createdAt") diff --git a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/MemoryUsage.kt b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/MemoryUsage.kt index 35b5c5e32f..4cc9572408 100644 --- a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/MemoryUsage.kt +++ b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/MemoryUsage.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus API - * - * Interact with a Cactus deployment through HTTP. - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -33,6 +28,7 @@ import com.squareup.moshi.Json * @param arrayBuffers */ + data class MemoryUsage ( @Json(name = "rss") diff --git a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/WatchHealthcheckV1.kt b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/WatchHealthcheckV1.kt index 35dcc9a359..78ebf05433 100644 --- a/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/WatchHealthcheckV1.kt +++ b/packages/cactus-cmd-api-server/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/WatchHealthcheckV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus API - * - * Interact with a Cactus deployment through HTTP. - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -59,12 +54,12 @@ enum class WatchHealthcheckV1(val value: kotlin.String) { /** * Converts the provided [data] to a [String] on success, null otherwise. */ - fun encode(data: Any?): kotlin.String? = if (data is WatchHealthcheckV1) "$data" else null + fun encode(data: kotlin.Any?): kotlin.String? = if (data is WatchHealthcheckV1) "$data" else null /** * Returns a valid [WatchHealthcheckV1] for [data], null otherwise. */ - fun decode(data: Any?): WatchHealthcheckV1? = data?.let { + fun decode(data: kotlin.Any?): WatchHealthcheckV1? = data?.let { val normalizedData = "$it".lowercase() values().firstOrNull { value -> it == value || normalizedData == "$value".lowercase() diff --git a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/VERSION b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/VERSION +++ b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/README.md b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/README.md index e8f8c7b355..c3dba388ed 100644 --- a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/README.md +++ b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/README.md @@ -3,7 +3,7 @@ Interact with a Cactus deployment through HTTP. ## Overview -These files were generated by the [OpenAPI Generator](https://openapi-generator.tech) project. +These files were generated by the [OpenAPI Generator](https://openapi-generator.tech) project. - API version: 0.0.1 - Package version: @@ -16,9 +16,9 @@ Below are some usage examples for Go and Ruby. For other languages, please refer ### Go ``` # assuming `protoc-gen-go` has been installed with `go get -u github.com/golang/protobuf/protoc-gen-go` -mkdir /var/tmp/go/ -protoc --go_out=/var/tmp/go/ services/* -protoc --go_out=/var/tmp/go/ models/* +mkdir /var/tmp/go/org.hyperledger.cactus.cmd_api_server +protoc --go_out=/var/tmp/go/org.hyperledger.cactus.cmd_api_server services/* +protoc --go_out=/var/tmp/go/org.hyperledger.cactus.cmd_api_server models/* ``` ### Ruby diff --git a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/health_check_response_pb.proto b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/health_check_response_pb.proto index 2a4fc3b992..eea2f52229 100644 --- a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/health_check_response_pb.proto +++ b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/health_check_response_pb.proto @@ -1,10 +1,10 @@ /* Hyperledger Cactus API - + Interact with a Cactus deployment through HTTP. - + The version of the OpenAPI document: 0.0.1 - + Generated by OpenAPI Generator: https://openapi-generator.tech */ diff --git a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/memory_usage_pb.proto b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/memory_usage_pb.proto index 0124db27e7..8cb150470b 100644 --- a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/memory_usage_pb.proto +++ b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/memory_usage_pb.proto @@ -1,10 +1,10 @@ /* Hyperledger Cactus API - + Interact with a Cactus deployment through HTTP. - + The version of the OpenAPI document: 0.0.1 - + Generated by OpenAPI Generator: https://openapi-generator.tech */ diff --git a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/watch_healthcheck_v1_pb.proto b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/watch_healthcheck_v1_pb.proto index 51fc928a96..62bea96f6b 100644 --- a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/watch_healthcheck_v1_pb.proto +++ b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/models/watch_healthcheck_v1_pb.proto @@ -1,10 +1,10 @@ /* Hyperledger Cactus API - + Interact with a Cactus deployment through HTTP. - + The version of the OpenAPI document: 0.0.1 - + Generated by OpenAPI Generator: https://openapi-generator.tech */ diff --git a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/services/default_service.proto b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/services/default_service.proto index 59155057a7..b6e0723fbd 100644 --- a/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/services/default_service.proto +++ b/packages/cactus-cmd-api-server/src/main/proto/generated/openapi/services/default_service.proto @@ -1,10 +1,10 @@ /* Hyperledger Cactus API - + Interact with a Cactus deployment through HTTP. - + The version of the OpenAPI document: 0.0.1 - + Generated by OpenAPI Generator: https://openapi-generator.tech */ diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/api.ts index 23bbaf0050..66c5d2c1be 100644 --- a/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * @@ -32,19 +34,19 @@ export interface HealthCheckResponse { * @type {boolean} * @memberof HealthCheckResponse */ - success?: boolean; + 'success'?: boolean; /** * * @type {string} * @memberof HealthCheckResponse */ - createdAt: string; + 'createdAt': string; /** * * @type {MemoryUsage} * @memberof HealthCheckResponse */ - memoryUsage: MemoryUsage; + 'memoryUsage': MemoryUsage; } /** * @@ -57,31 +59,31 @@ export interface MemoryUsage { * @type {number} * @memberof MemoryUsage */ - rss?: number; + 'rss'?: number; /** * * @type {number} * @memberof MemoryUsage */ - heapTotal?: number; + 'heapTotal'?: number; /** * * @type {number} * @memberof MemoryUsage */ - heapUsed?: number; + 'heapUsed'?: number; /** * * @type {number} * @memberof MemoryUsage */ - external?: number; + 'external'?: number; /** * * @type {number} * @memberof MemoryUsage */ - arrayBuffers?: number; + 'arrayBuffers'?: number; } /** * @@ -89,13 +91,16 @@ export interface MemoryUsage { * @enum {string} */ -export enum WatchHealthcheckV1 { - Subscribe = 'org.hyperledger.cactus.api.async.besu.WatchHealthcheckV1.Subscribe', - Next = 'org.hyperledger.cactus.api.async.besu.WatchHealthcheckV1.Next', - Unsubscribe = 'org.hyperledger.cactus.api.async.besu.WatchHealthcheckV1.Unsubscribe', - Error = 'org.hyperledger.cactus.api.async.besu.WatchHealthcheckV1.Error', - Complete = 'org.hyperledger.cactus.api.async.besu.WatchHealthcheckV1.Complete' -} +export const WatchHealthcheckV1 = { + Subscribe: 'org.hyperledger.cactus.api.async.besu.WatchHealthcheckV1.Subscribe', + Next: 'org.hyperledger.cactus.api.async.besu.WatchHealthcheckV1.Next', + Unsubscribe: 'org.hyperledger.cactus.api.async.besu.WatchHealthcheckV1.Unsubscribe', + Error: 'org.hyperledger.cactus.api.async.besu.WatchHealthcheckV1.Error', + Complete: 'org.hyperledger.cactus.api.async.besu.WatchHealthcheckV1.Complete' +} as const; + +export type WatchHealthcheckV1 = typeof WatchHealthcheckV1[keyof typeof WatchHealthcheckV1]; + /** @@ -110,7 +115,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getHealthCheckV1: async (options: any = {}): Promise => { + getHealthCheckV1: async (options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/api-server/healthcheck`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -125,7 +130,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -140,7 +145,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getPrometheusMetricsV1: async (options: any = {}): Promise => { + getPrometheusMetricsV1: async (options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/api-server/get-prometheus-exporter-metrics`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -155,7 +160,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -180,7 +185,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getHealthCheckV1(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getHealthCheckV1(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getHealthCheckV1(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -190,7 +195,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getPrometheusMetricsV1(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getPrometheusMetricsV1(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getPrometheusMetricsV1(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -239,7 +244,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getHealthCheckV1(options?: any) { + public getHealthCheckV1(options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getHealthCheckV1(options).then((request) => request(this.axios, this.basePath)); } @@ -250,7 +255,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getPrometheusMetricsV1(options?: any) { + public getPrometheusMetricsV1(options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getPrometheusMetricsV1(options).then((request) => request(this.axios, this.basePath)); } } diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/base.ts index 47259b0f15..5dadf8db6b 100644 --- a/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/common.ts index 0cc7f68adc..83860e982e 100644 --- a/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/packages/cactus-cmd-api-server/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; } diff --git a/packages/cactus-core-api/openapitools.json b/packages/cactus-core-api/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/packages/cactus-core-api/openapitools.json +++ b/packages/cactus-core-api/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES index 5dbcb919c1..a5d2479a17 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -5,7 +5,7 @@ gradlew.bat settings.gradle src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -13,6 +13,7 @@ src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/README.md index 60d5e00042..c102e2b51c 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -1,9 +1,18 @@ # org.openapitools.client - Kotlin client library for Hyperledger Core API +Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 0.2.0 +- Package version: +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + ## Requires -* Kotlin 1.4.30 -* Gradle 6.8.3 +* Kotlin 1.7.21 +* Gradle 7.5 ## Build diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/build.gradle b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/build.gradle index 3de8b45b13..66a3c68b89 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/build.gradle +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/build.gradle @@ -2,12 +2,12 @@ group 'org.openapitools' version '1.0.0' wrapper { - gradleVersion = '6.8.3' + gradleVersion = '7.5' distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } buildscript { - ext.kotlin_version = '1.5.10' + ext.kotlin_version = '1.7.21' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -18,6 +18,7 @@ buildscript { } apply plugin: 'kotlin' +apply plugin: 'maven-publish' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -30,8 +31,8 @@ test { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "com.squareup.moshi:moshi-kotlin:1.12.0" - implementation "com.squareup.moshi:moshi-adapters:1.12.0" - implementation "com.squareup.okhttp3:okhttp:4.9.1" + implementation "com.squareup.moshi:moshi-kotlin:1.13.0" + implementation "com.squareup.moshi:moshi-adapters:1.13.0" + implementation "com.squareup.okhttp3:okhttp:4.10.0" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index b359be1e41..757080d7ed 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -10,21 +10,26 @@ import okhttp3.ResponseBody import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import okhttp3.Headers +import okhttp3.Headers.Companion.toHeaders import okhttp3.MultipartBody +import okhttp3.Call +import okhttp3.Callback +import okhttp3.Response +import okhttp3.internal.EMPTY_REQUEST import java.io.BufferedWriter import java.io.File import java.io.FileWriter +import java.io.IOException import java.net.URLConnection import java.time.LocalDate import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter -open class ApiClient(val baseUrl: String) { +open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) { companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" @@ -39,9 +44,10 @@ open class ApiClient(val baseUrl: String) { var username: String? = null var password: String? = null var accessToken: String? = null + const val baseUrlKey = "org.openapitools.client.baseUrl" @JvmStatic - val client: OkHttpClient by lazy { + val defaultClient: OkHttpClient by lazy { builder.build() } @@ -60,48 +66,50 @@ open class ApiClient(val baseUrl: String) { return contentType ?: "application/octet-stream" } - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + protected inline fun requestBody(content: T, mediaType: String?): RequestBody = when { - content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull()) - mediaType == FormDataMediaType -> { + content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) + mediaType == FormDataMediaType -> MultipartBody.Builder() .setType(MultipartBody.FORM) .apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" + (content as Map>).forEach { (name, part) -> + if (part.body is File) { + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${part.body.name}\"") + val fileMediaType = guessContentTypeFromFile(part.body).toMediaTypeOrNull() + addPart( + partHeaders.toHeaders(), + part.body.asRequestBody(fileMediaType) ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"") addPart( - partHeaders, - parameterToString(value).toRequestBody(null) + partHeaders.toHeaders(), + parameterToString(part.body).toRequestBody(null) ) } } }.build() - } mediaType == FormUrlEncMediaType -> { FormBody.Builder().apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) + (content as Map>).forEach { (name, part) -> + add(name, parameterToString(part.body)) } }.build() } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) + mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> + if (content == null) { + EMPTY_REQUEST + } else { + Serializer.moshi.adapter(T::class.java).toJson(content) + .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) + } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -112,31 +120,35 @@ open class ApiClient(val baseUrl: String) { if(body == null) { return null } + if (T::class.java == File::class.java) { + // return tempFile + // Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options + val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() + tempFile.deleteOnExit() + body.byteStream().use { inputStream -> + tempFile.outputStream().use { tempFileOutputStream -> + inputStream.copyTo(tempFileOutputStream) + } + } + return tempFile as T + } val bodyContent = body.string() if (bodyContent.isEmpty()) { return null } - if (T::class.java == File::class.java) { - // return tempfile - val f = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() - f.deleteOnExit() - val out = BufferedWriter(FileWriter(f)) - out.write(bodyContent) - out.close() - return f as T - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) + .addEncodedPathSegments(requestConfig.path.trimStart('/')) .apply { requestConfig.query.forEach { query -> query.value.forEach { queryValue -> @@ -146,7 +158,7 @@ open class ApiClient(val baseUrl: String) { }.build() // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { + if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) { requestConfig.headers[ContentType] = JsonMediaType } if (requestConfig.headers[Accept].isNullOrEmpty()) { @@ -154,16 +166,16 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { + if (headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + val contentType = if (headers[ContentType] != null) { + // TODO: support multiple contentType options here. + (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + } else { + null + } val request = when (requestConfig.method) { RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) @@ -178,6 +190,7 @@ open class ApiClient(val baseUrl: String) { }.build() val response = client.newCall(request).execute() + val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault()) // TODO: handle specific mapping types. e.g. Map> @@ -215,7 +228,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 0000000000..cf2cfaa95d --- /dev/null +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt index fb2c972cf8..064b57fc6b 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt @@ -14,4 +14,4 @@ class BigDecimalAdapter { fun fromJson(value: String): BigDecimal { return BigDecimal(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt index 4b6963110c..7df6057b45 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt @@ -14,4 +14,4 @@ class BigIntegerAdapter { fun fromJson(value: String): BigInteger { return BigInteger(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 0000000000..be00e38fba --- /dev/null +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 7e948e1dd0..625a19002b 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -13,5 +13,6 @@ data class RequestConfig( val path: String, val headers: MutableMap = mutableMapOf(), val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, val body: T? = null ) \ No newline at end of file diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CactusNode.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CactusNode.kt index 0312c38ca8..4f9aeca4d8 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CactusNode.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CactusNode.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -20,8 +15,6 @@ package org.openapitools.client.models -import org.openapitools.client.models.CactusNodeAllOf -import org.openapitools.client.models.CactusNodeMeta import com.squareup.moshi.Json @@ -37,6 +30,7 @@ import com.squareup.moshi.Json * @param pluginInstanceIds */ + data class CactusNode ( @Json(name = "nodeApiHost") diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CactusNodeAllOf.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CactusNodeAllOf.kt index 8c312ec0ca..c95e11a81c 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CactusNodeAllOf.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CactusNodeAllOf.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -33,6 +28,7 @@ import com.squareup.moshi.Json * @param pluginInstanceIds */ + data class CactusNodeAllOf ( @Json(name = "id") diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CactusNodeMeta.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CactusNodeMeta.kt index 2b0c24a324..906806ba7d 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CactusNodeMeta.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CactusNodeMeta.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param publicKeyPem The PEM encoded public key that was used to generate the JWS included in the response (the jws property) */ + data class CactusNodeMeta ( @Json(name = "nodeApiHost") diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsensusAlgorithmFamiliesWithOutTxFinality.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsensusAlgorithmFamiliesWithOutTxFinality.kt index 52530e457a..a008ba206f 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsensusAlgorithmFamiliesWithOutTxFinality.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsensusAlgorithmFamiliesWithOutTxFinality.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -47,12 +42,12 @@ enum class ConsensusAlgorithmFamiliesWithOutTxFinality(val value: kotlin.String) /** * Converts the provided [data] to a [String] on success, null otherwise. */ - fun encode(data: Any?): kotlin.String? = if (data is ConsensusAlgorithmFamiliesWithOutTxFinality) "$data" else null + fun encode(data: kotlin.Any?): kotlin.String? = if (data is ConsensusAlgorithmFamiliesWithOutTxFinality) "$data" else null /** * Returns a valid [ConsensusAlgorithmFamiliesWithOutTxFinality] for [data], null otherwise. */ - fun decode(data: Any?): ConsensusAlgorithmFamiliesWithOutTxFinality? = data?.let { + fun decode(data: kotlin.Any?): ConsensusAlgorithmFamiliesWithOutTxFinality? = data?.let { val normalizedData = "$it".lowercase() values().firstOrNull { value -> it == value || normalizedData == "$value".lowercase() diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsensusAlgorithmFamiliesWithTxFinality.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsensusAlgorithmFamiliesWithTxFinality.kt index 3750303bdb..b94a5cce53 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsensusAlgorithmFamiliesWithTxFinality.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsensusAlgorithmFamiliesWithTxFinality.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -50,12 +45,12 @@ enum class ConsensusAlgorithmFamiliesWithTxFinality(val value: kotlin.String) { /** * Converts the provided [data] to a [String] on success, null otherwise. */ - fun encode(data: Any?): kotlin.String? = if (data is ConsensusAlgorithmFamiliesWithTxFinality) "$data" else null + fun encode(data: kotlin.Any?): kotlin.String? = if (data is ConsensusAlgorithmFamiliesWithTxFinality) "$data" else null /** * Returns a valid [ConsensusAlgorithmFamiliesWithTxFinality] for [data], null otherwise. */ - fun decode(data: Any?): ConsensusAlgorithmFamiliesWithTxFinality? = data?.let { + fun decode(data: kotlin.Any?): ConsensusAlgorithmFamiliesWithTxFinality? = data?.let { val normalizedData = "$it".lowercase() values().firstOrNull { value -> it == value || normalizedData == "$value".lowercase() diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsensusAlgorithmFamily.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsensusAlgorithmFamily.kt index 3cf2558665..47a1aa755f 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsensusAlgorithmFamily.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsensusAlgorithmFamily.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -53,12 +48,12 @@ enum class ConsensusAlgorithmFamily(val value: kotlin.String) { /** * Converts the provided [data] to a [String] on success, null otherwise. */ - fun encode(data: Any?): kotlin.String? = if (data is ConsensusAlgorithmFamily) "$data" else null + fun encode(data: kotlin.Any?): kotlin.String? = if (data is ConsensusAlgorithmFamily) "$data" else null /** * Returns a valid [ConsensusAlgorithmFamily] for [data], null otherwise. */ - fun decode(data: Any?): ConsensusAlgorithmFamily? = data?.let { + fun decode(data: kotlin.Any?): ConsensusAlgorithmFamily? = data?.let { val normalizedData = "$it".lowercase() values().firstOrNull { value -> it == value || normalizedData == "$value".lowercase() diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Consortium.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Consortium.kt index bb67d2b44d..ed9b6db5c9 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Consortium.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Consortium.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -32,6 +27,7 @@ import com.squareup.moshi.Json * @param memberIds The collection (array) of primary keys of consortium member entities that belong to this Consortium. */ + data class Consortium ( @Json(name = "id") diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsortiumDatabase.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsortiumDatabase.kt index 81ba024132..16d6618457 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsortiumDatabase.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsortiumDatabase.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -38,6 +33,7 @@ import com.squareup.moshi.Json * @param pluginInstance The complete collection of all plugin instance entities in existence within the consortium. */ + data class ConsortiumDatabase ( /* A collection of Consortium entities. In practice this should only ever contain a single consortium, but we defined it as an array to keep the convention up with the rest of the collections defined in the Consortium data in general. Also, if we ever decide to somehow have some sort of consortium to consortium integration (which does not make much sense in the current frame of mind of the author in the year 2020) then having this as an array will have proven itself to be an excellent long term compatibility/extensibility decision indeed. */ diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsortiumMember.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsortiumMember.kt index df60652e5c..ce80b41053 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsortiumMember.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ConsortiumMember.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -31,6 +26,7 @@ import com.squareup.moshi.Json * @param nodeIds */ + data class ConsortiumMember ( @Json(name = "id") diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Constants.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Constants.kt index 1800cbaaf3..45ccad4e63 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Constants.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Constants.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -47,12 +42,12 @@ enum class Constants(val value: kotlin.String) { /** * Converts the provided [data] to a [String] on success, null otherwise. */ - fun encode(data: Any?): kotlin.String? = if (data is Constants) "$data" else null + fun encode(data: kotlin.Any?): kotlin.String? = if (data is Constants) "$data" else null /** * Returns a valid [Constants] for [data], null otherwise. */ - fun decode(data: Any?): Constants? = data?.let { + fun decode(data: kotlin.Any?): Constants? = data?.let { val normalizedData = "$it".lowercase() values().firstOrNull { value -> it == value || normalizedData == "$value".lowercase() diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt index 50e4f7ddec..058005f566 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key for the entry to check the presence of on the keychain. */ + data class DeleteKeychainEntryRequestV1 ( /* The key for the entry to check the presence of on the keychain. */ diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt index ea78f0b377..ac544c44ef 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key that was deleted from the keychain. */ + data class DeleteKeychainEntryResponseV1 ( /* The key that was deleted from the keychain. */ diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt index aa5ec39626..82f324d68f 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key for the entry to get from the keychain. */ + data class GetKeychainEntryRequestV1 ( /* The key for the entry to get from the keychain. */ diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt index 0d0652fb5e..294cc6d743 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value associated with the requested key on the keychain. */ + data class GetKeychainEntryResponseV1 ( /* The key that was used to retrieve the value from the keychain. */ diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetObjectRequestV1.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetObjectRequestV1.kt index f1e5659299..595921a80d 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetObjectRequestV1.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetObjectRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key for the entry to get from the object store. */ + data class GetObjectRequestV1 ( /* The key for the entry to get from the object store. */ diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetObjectResponseV1.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetObjectResponseV1.kt index b1a7df0315..45643c183d 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetObjectResponseV1.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetObjectResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value associated with the requested key in the object store as a string. */ + data class GetObjectResponseV1 ( /* The key that was used to retrieve the value from the object store. */ diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt index 0646068dfc..4f7b976c95 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key to check for presence in the keychain. */ + data class HasKeychainEntryRequestV1 ( /* The key to check for presence in the keychain. */ diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt index ff6a0987b9..34f773aea5 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -31,6 +26,7 @@ import com.squareup.moshi.Json * @param isPresent The boolean true or false indicating the presence or absence of an entry under 'key'. */ + data class HasKeychainEntryResponseV1 ( /* The key that was used to check the presence of the value in the entry store. */ diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasObjectRequestV1.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasObjectRequestV1.kt index 55ad823516..0f4ec48ad8 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasObjectRequestV1.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasObjectRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key to check for presence in the object store. */ + data class HasObjectRequestV1 ( /* The key to check for presence in the object store. */ diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasObjectResponseV1.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasObjectResponseV1.kt index 1724cd763a..29c3602a4a 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasObjectResponseV1.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasObjectResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -31,6 +26,7 @@ import com.squareup.moshi.Json * @param isPresent The boolean true or false indicating the presence or absence of an object under 'key'. */ + data class HasObjectResponseV1 ( /* The key that was used to check the presence of the value in the object store. */ diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSGeneral.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSGeneral.kt index 96a16e0f99..e32c81a50f 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSGeneral.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSGeneral.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -31,6 +26,7 @@ import com.squareup.moshi.Json * @param signatures */ + data class JWSGeneral ( @Json(name = "payload") diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSRecipient.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSRecipient.kt index 9fb27a6aeb..9b428d7dd8 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSRecipient.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSRecipient.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -31,6 +26,7 @@ import com.squareup.moshi.Json * @param header */ + data class JWSRecipient ( @Json(name = "signature") diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Ledger.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Ledger.kt index 8a047f69c9..dde4711b4d 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Ledger.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Ledger.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -32,6 +27,7 @@ import com.squareup.moshi.Json * @param consortiumMemberId */ + data class Ledger ( @Json(name = "id") diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LedgerType.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LedgerType.kt index cd3f6682f0..4d40727ed4 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LedgerType.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LedgerType.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -68,12 +63,12 @@ enum class LedgerType(val value: kotlin.String) { /** * Converts the provided [data] to a [String] on success, null otherwise. */ - fun encode(data: Any?): kotlin.String? = if (data is LedgerType) "$data" else null + fun encode(data: kotlin.Any?): kotlin.String? = if (data is LedgerType) "$data" else null /** * Returns a valid [LedgerType] for [data], null otherwise. */ - fun decode(data: Any?): LedgerType? = data?.let { + fun decode(data: kotlin.Any?): LedgerType? = data?.let { val normalizedData = "$it".lowercase() values().firstOrNull { value -> it == value || normalizedData == "$value".lowercase() diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginImport.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginImport.kt index 8084b0b95c..4e0bbc6ecf 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginImport.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginImport.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -34,6 +29,7 @@ import com.squareup.moshi.Json * @param options */ + data class PluginImport ( @Json(name = "packageName") diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginImportAction.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginImportAction.kt index 06e8196e21..ecfa75c92e 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginImportAction.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginImportAction.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -50,12 +45,12 @@ enum class PluginImportAction(val value: kotlin.String) { /** * Converts the provided [data] to a [String] on success, null otherwise. */ - fun encode(data: Any?): kotlin.String? = if (data is PluginImportAction) "$data" else null + fun encode(data: kotlin.Any?): kotlin.String? = if (data is PluginImportAction) "$data" else null /** * Returns a valid [PluginImportAction] for [data], null otherwise. */ - fun decode(data: Any?): PluginImportAction? = data?.let { + fun decode(data: kotlin.Any?): PluginImportAction? = data?.let { val normalizedData = "$it".lowercase() values().firstOrNull { value -> it == value || normalizedData == "$value".lowercase() diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginImportType.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginImportType.kt index 061f6a5ca0..df3c6dd342 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginImportType.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginImportType.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -50,12 +45,12 @@ enum class PluginImportType(val value: kotlin.String) { /** * Converts the provided [data] to a [String] on success, null otherwise. */ - fun encode(data: Any?): kotlin.String? = if (data is PluginImportType) "$data" else null + fun encode(data: kotlin.Any?): kotlin.String? = if (data is PluginImportType) "$data" else null /** * Returns a valid [PluginImportType] for [data], null otherwise. */ - fun decode(data: Any?): PluginImportType? = data?.let { + fun decode(data: kotlin.Any?): PluginImportType? = data?.let { val normalizedData = "$it".lowercase() values().firstOrNull { value -> it == value || normalizedData == "$value".lowercase() diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginInstance.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginInstance.kt index 43249c35ae..742d41f98b 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginInstance.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PluginInstance.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param packageName */ + data class PluginInstance ( @Json(name = "id") diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt index a45a7b7bec..b02d8928b9 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value that will be associated with the key on the keychain. */ + data class SetKeychainEntryRequestV1 ( /* The key for the entry to set on the keychain. */ diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt index 07b7e73375..32c97773c4 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key that was used to set the value on the keychain. */ + data class SetKeychainEntryResponseV1 ( /* The key that was used to set the value on the keychain. */ diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetObjectRequestV1.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetObjectRequestV1.kt index 22a7fa2307..106f5d227c 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetObjectRequestV1.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetObjectRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value that will be associated with the key in the object store. */ + data class SetObjectRequestV1 ( /* The key for the entry to set in the object store. */ diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetObjectResponseV1.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetObjectResponseV1.kt index ad4bcd8832..35dd54d5d0 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetObjectResponseV1.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetObjectResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Core API - * - * Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc.. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key that was used to set the value in the object store. */ + data class SetObjectResponseV1 ( /* The key that was used to set the value in the object store. */ diff --git a/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/api.ts index b9a0957d35..5eadbfacdf 100644 --- a/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * A Cactus node can be a single server, or a set of servers behind a load balancer acting as one. @@ -32,43 +34,43 @@ export interface CactusNode { * @type {string} * @memberof CactusNode */ - nodeApiHost: string; + 'nodeApiHost': string; /** * The PEM encoded public key that was used to generate the JWS included in the response (the jws property) * @type {string} * @memberof CactusNode */ - publicKeyPem: string; + 'publicKeyPem': string; /** * * @type {string} * @memberof CactusNode */ - id: string; + 'id': string; /** * * @type {string} * @memberof CactusNode */ - consortiumId: string; + 'consortiumId': string; /** * * @type {string} * @memberof CactusNode */ - memberId: string; + 'memberId': string; /** * Stores an array of Ledger entity IDs that are reachable (routable) via this Cactus Node. This information is used by the client side SDK API client to figure out at runtime where to send API requests that are specific to a certain ledger such as requests to execute transactions. * @type {Array} * @memberof CactusNode */ - ledgerIds: Array; + 'ledgerIds': Array; /** * * @type {Array} * @memberof CactusNode */ - pluginInstanceIds: Array; + 'pluginInstanceIds': Array; } /** * @@ -81,31 +83,31 @@ export interface CactusNodeAllOf { * @type {string} * @memberof CactusNodeAllOf */ - id: string; + 'id': string; /** * * @type {string} * @memberof CactusNodeAllOf */ - consortiumId: string; + 'consortiumId': string; /** * * @type {string} * @memberof CactusNodeAllOf */ - memberId: string; + 'memberId': string; /** * Stores an array of Ledger entity IDs that are reachable (routable) via this Cactus Node. This information is used by the client side SDK API client to figure out at runtime where to send API requests that are specific to a certain ledger such as requests to execute transactions. * @type {Array} * @memberof CactusNodeAllOf */ - ledgerIds: Array; + 'ledgerIds': Array; /** * * @type {Array} * @memberof CactusNodeAllOf */ - pluginInstanceIds: Array; + 'pluginInstanceIds': Array; } /** * A Cactus node meta information @@ -118,13 +120,13 @@ export interface CactusNodeMeta { * @type {string} * @memberof CactusNodeMeta */ - nodeApiHost: string; + 'nodeApiHost': string; /** * The PEM encoded public key that was used to generate the JWS included in the response (the jws property) * @type {string} * @memberof CactusNodeMeta */ - publicKeyPem: string; + 'publicKeyPem': string; } /** * Enumerates a list of consensus algorithm families that do not provide immediate finality @@ -132,9 +134,12 @@ export interface CactusNodeMeta { * @enum {string} */ -export enum ConsensusAlgorithmFamiliesWithOutTxFinality { - WORK = 'org.hyperledger.cactus.consensusalgorithm.PROOF_OF_WORK' -} +export const ConsensusAlgorithmFamiliesWithOutTxFinality = { + WORK: 'org.hyperledger.cactus.consensusalgorithm.PROOF_OF_WORK' +} as const; + +export type ConsensusAlgorithmFamiliesWithOutTxFinality = typeof ConsensusAlgorithmFamiliesWithOutTxFinality[keyof typeof ConsensusAlgorithmFamiliesWithOutTxFinality]; + /** * Enumerates a list of consensus algorithm families that provide immediate finality @@ -142,10 +147,13 @@ export enum ConsensusAlgorithmFamiliesWithOutTxFinality { * @enum {string} */ -export enum ConsensusAlgorithmFamiliesWithTxFinality { - Authority = 'org.hyperledger.cactus.consensusalgorithm.PROOF_OF_AUTHORITY', - Stake = 'org.hyperledger.cactus.consensusalgorithm.PROOF_OF_STAKE' -} +export const ConsensusAlgorithmFamiliesWithTxFinality = { + Authority: 'org.hyperledger.cactus.consensusalgorithm.PROOF_OF_AUTHORITY', + Stake: 'org.hyperledger.cactus.consensusalgorithm.PROOF_OF_STAKE' +} as const; + +export type ConsensusAlgorithmFamiliesWithTxFinality = typeof ConsensusAlgorithmFamiliesWithTxFinality[keyof typeof ConsensusAlgorithmFamiliesWithTxFinality]; + /** * Enumerates a list of consensus algorithm families in existence. Does not intend to be an exhaustive list, just a practical one, meaning that we only include items here that are relevant to Hyperledger Cactus in fulfilling its own duties. This can be extended later as more sophisticated features of Cactus get implemented. This enum is meant to be first and foremost a useful abstraction for achieving practical tasks, not an encyclopedia and therefore we ask of everyone that this to be extended only in ways that serve a practical purpose for the runtime behavior of Cactus or Cactus plugins in general. The bottom line is that we can accept this enum being not 100% accurate as long as it 100% satisfies what it was designed to do. @@ -153,11 +161,14 @@ export enum ConsensusAlgorithmFamiliesWithTxFinality { * @enum {string} */ -export enum ConsensusAlgorithmFamily { - Authority = 'org.hyperledger.cactus.consensusalgorithm.PROOF_OF_AUTHORITY', - Stake = 'org.hyperledger.cactus.consensusalgorithm.PROOF_OF_STAKE', - Work = 'org.hyperledger.cactus.consensusalgorithm.PROOF_OF_WORK' -} +export const ConsensusAlgorithmFamily = { + Authority: 'org.hyperledger.cactus.consensusalgorithm.PROOF_OF_AUTHORITY', + Stake: 'org.hyperledger.cactus.consensusalgorithm.PROOF_OF_STAKE', + Work: 'org.hyperledger.cactus.consensusalgorithm.PROOF_OF_WORK' +} as const; + +export type ConsensusAlgorithmFamily = typeof ConsensusAlgorithmFamily[keyof typeof ConsensusAlgorithmFamily]; + /** * @@ -170,25 +181,25 @@ export interface Consortium { * @type {string} * @memberof Consortium */ - id: string; + 'id': string; /** * * @type {string} * @memberof Consortium */ - name: string; + 'name': string; /** * * @type {string} * @memberof Consortium */ - mainApiHost: string; + 'mainApiHost': string; /** * The collection (array) of primary keys of consortium member entities that belong to this Consortium. * @type {Array} * @memberof Consortium */ - memberIds: Array; + 'memberIds': Array; } /** * @@ -201,31 +212,31 @@ export interface ConsortiumDatabase { * @type {Array} * @memberof ConsortiumDatabase */ - consortium: Array; + 'consortium': Array; /** * The complete collection of all ledger entities in existence within the consortium. * @type {Array} * @memberof ConsortiumDatabase */ - ledger: Array; + 'ledger': Array; /** * The complete collection of all consortium member entities in existence within the consortium. * @type {Array} * @memberof ConsortiumDatabase */ - consortiumMember: Array; + 'consortiumMember': Array; /** * The complete collection of all cactus nodes entities in existence within the consortium. * @type {Array} * @memberof ConsortiumDatabase */ - cactusNode: Array; + 'cactusNode': Array; /** * The complete collection of all plugin instance entities in existence within the consortium. * @type {Array} * @memberof ConsortiumDatabase */ - pluginInstance: Array; + 'pluginInstance': Array; } /** * @@ -238,19 +249,19 @@ export interface ConsortiumMember { * @type {string} * @memberof ConsortiumMember */ - id: string; + 'id': string; /** * The human readable name a Consortium member can be referred to while making it easy for humans to distinguish this particular consortium member entity from any other ones. * @type {string} * @memberof ConsortiumMember */ - name: string; + 'name': string; /** * * @type {Array} * @memberof ConsortiumMember */ - nodeIds: Array; + 'nodeIds': Array; } /** * @@ -258,9 +269,12 @@ export interface ConsortiumMember { * @enum {string} */ -export enum Constants { - SocketIoConnectionPathV1 = '/api/v1/async/socket-io/connect' -} +export const Constants = { + SocketIoConnectionPathV1: '/api/v1/async/socket-io/connect' +} as const; + +export type Constants = typeof Constants[keyof typeof Constants]; + /** * @@ -273,7 +287,7 @@ export interface DeleteKeychainEntryRequestV1 { * @type {string} * @memberof DeleteKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -286,7 +300,7 @@ export interface DeleteKeychainEntryResponseV1 { * @type {string} * @memberof DeleteKeychainEntryResponseV1 */ - key: string; + 'key': string; } /** * @@ -299,7 +313,7 @@ export interface GetKeychainEntryRequestV1 { * @type {string} * @memberof GetKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -312,13 +326,13 @@ export interface GetKeychainEntryResponseV1 { * @type {string} * @memberof GetKeychainEntryResponseV1 */ - key: string; + 'key': string; /** * The value associated with the requested key on the keychain. * @type {string} * @memberof GetKeychainEntryResponseV1 */ - value: string; + 'value': string; } /** * @@ -331,7 +345,7 @@ export interface GetObjectRequestV1 { * @type {string} * @memberof GetObjectRequestV1 */ - key: string; + 'key': string; } /** * @@ -344,13 +358,13 @@ export interface GetObjectResponseV1 { * @type {string} * @memberof GetObjectResponseV1 */ - key: string; + 'key': string; /** * The value associated with the requested key in the object store as a string. * @type {string} * @memberof GetObjectResponseV1 */ - value: string; + 'value': string; } /** * @@ -363,7 +377,7 @@ export interface HasKeychainEntryRequestV1 { * @type {string} * @memberof HasKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -376,19 +390,19 @@ export interface HasKeychainEntryResponseV1 { * @type {string} * @memberof HasKeychainEntryResponseV1 */ - key: string; + 'key': string; /** * Date and time encoded as JSON when the presence check was performed by the plugin backend. * @type {string} * @memberof HasKeychainEntryResponseV1 */ - checkedAt: string; + 'checkedAt': string; /** * The boolean true or false indicating the presence or absence of an entry under \'key\'. * @type {boolean} * @memberof HasKeychainEntryResponseV1 */ - isPresent: boolean; + 'isPresent': boolean; } /** * @@ -401,7 +415,7 @@ export interface HasObjectRequestV1 { * @type {string} * @memberof HasObjectRequestV1 */ - key: string; + 'key': string; } /** * @@ -414,19 +428,19 @@ export interface HasObjectResponseV1 { * @type {string} * @memberof HasObjectResponseV1 */ - key: string; + 'key': string; /** * Date and time encoded as JSON when the presence check was performed by the plugin backend. * @type {string} * @memberof HasObjectResponseV1 */ - checkedAt: string; + 'checkedAt': string; /** * The boolean true or false indicating the presence or absence of an object under \'key\'. * @type {boolean} * @memberof HasObjectResponseV1 */ - isPresent: boolean; + 'isPresent': boolean; } /** * @@ -439,13 +453,13 @@ export interface JWSGeneral { * @type {string} * @memberof JWSGeneral */ - payload: string; + 'payload': string; /** * * @type {Array} * @memberof JWSGeneral */ - signatures: Array; + 'signatures': Array; } /** * A JSON Web Signature. See: https://tools.ietf.org/html/rfc7515 for info about standard. @@ -458,19 +472,19 @@ export interface JWSRecipient { * @type {string} * @memberof JWSRecipient */ - signature: string; + 'signature': string; /** * * @type {string} * @memberof JWSRecipient */ - protected?: string; + 'protected'?: string; /** * - * @type {{ [key: string]: object; }} + * @type {{ [key: string]: any; }} * @memberof JWSRecipient */ - header?: { [key: string]: object; }; + 'header'?: { [key: string]: any; }; } /** * @@ -483,36 +497,41 @@ export interface Ledger { * @type {string} * @memberof Ledger */ - id: string; + 'id': string; /** * * @type {LedgerType} * @memberof Ledger */ - ledgerType: LedgerType; + 'ledgerType': LedgerType; /** * * @type {string} * @memberof Ledger */ - consortiumMemberId?: string; + 'consortiumMemberId'?: string; } + + /** * Enumerates the different ledger vendors and their major versions encoded within the name of the LedgerType. For example \"BESU_1X\" involves all of the [1.0.0;2.0.0) where 1.0.0 is included and anything up until, but not 2.0.0. See: https://stackoverflow.com/a/4396303/698470 for further explanation. * @export * @enum {string} */ -export enum LedgerType { - Besu1X = 'BESU_1X', - Besu2X = 'BESU_2X', - Burrow0X = 'BURROW_0X', - Corda4X = 'CORDA_4X', - Fabric14X = 'FABRIC_14X', - Fabric2 = 'FABRIC_2', - Quorum2X = 'QUORUM_2X', - Sawtooth1X = 'SAWTOOTH_1X' -} +export const LedgerType = { + Besu1X: 'BESU_1X', + Besu2X: 'BESU_2X', + Burrow0X: 'BURROW_0X', + Corda4X: 'CORDA_4X', + Fabric14X: 'FABRIC_14X', + Fabric2: 'FABRIC_2', + Quorum2X: 'QUORUM_2X', + Sawtooth1X: 'SAWTOOTH_1X' +} as const; + +export type LedgerType = typeof LedgerType[keyof typeof LedgerType]; + /** * @@ -525,36 +544,41 @@ export interface PluginImport { * @type {string} * @memberof PluginImport */ - packageName: string; + 'packageName': string; /** * * @type {PluginImportType} * @memberof PluginImport */ - type: PluginImportType; + 'type': PluginImportType; /** * * @type {PluginImportAction} * @memberof PluginImport */ - action: PluginImportAction; + 'action': PluginImportAction; /** * * @type {any} * @memberof PluginImport */ - options?: any | null; + 'options'?: any; } + + /** * * @export * @enum {string} */ -export enum PluginImportAction { - Instantiate = 'org.hyperledger.cactus.plugin_import_action.INSTANTIATE', - Install = 'org.hyperledger.cactus.plugin_import_action.INSTALL' -} +export const PluginImportAction = { + Instantiate: 'org.hyperledger.cactus.plugin_import_action.INSTANTIATE', + Install: 'org.hyperledger.cactus.plugin_import_action.INSTALL' +} as const; + +export type PluginImportAction = typeof PluginImportAction[keyof typeof PluginImportAction]; + /** * @@ -562,10 +586,13 @@ export enum PluginImportAction { * @enum {string} */ -export enum PluginImportType { - Local = 'org.hyperledger.cactus.plugin_import_type.LOCAL', - Remote = 'org.hyperledger.cactus.plugin_import_type.REMOTE' -} +export const PluginImportType = { + Local: 'org.hyperledger.cactus.plugin_import_type.LOCAL', + Remote: 'org.hyperledger.cactus.plugin_import_type.REMOTE' +} as const; + +export type PluginImportType = typeof PluginImportType[keyof typeof PluginImportType]; + /** * @@ -578,13 +605,13 @@ export interface PluginInstance { * @type {string} * @memberof PluginInstance */ - id: string; + 'id': string; /** * * @type {string} * @memberof PluginInstance */ - packageName: string; + 'packageName': string; } /** * @@ -597,13 +624,13 @@ export interface SetKeychainEntryRequestV1 { * @type {string} * @memberof SetKeychainEntryRequestV1 */ - key: string; + 'key': string; /** * The value that will be associated with the key on the keychain. * @type {string} * @memberof SetKeychainEntryRequestV1 */ - value: string; + 'value': string; } /** * @@ -616,7 +643,7 @@ export interface SetKeychainEntryResponseV1 { * @type {string} * @memberof SetKeychainEntryResponseV1 */ - key: string; + 'key': string; } /** * @@ -629,13 +656,13 @@ export interface SetObjectRequestV1 { * @type {string} * @memberof SetObjectRequestV1 */ - key: string; + 'key': string; /** * The value that will be associated with the key in the object store. * @type {string} * @memberof SetObjectRequestV1 */ - value: string; + 'value': string; } /** * @@ -648,6 +675,6 @@ export interface SetObjectResponseV1 { * @type {string} * @memberof SetObjectResponseV1 */ - key: string; + 'key': string; } diff --git a/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/base.ts index 5edc9104b8..e524b97310 100644 --- a/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/common.ts index a36a5f763c..6f0195c9af 100644 --- a/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; } diff --git a/packages/cactus-plugin-consortium-manual/openapitools.json b/packages/cactus-plugin-consortium-manual/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/packages/cactus-plugin-consortium-manual/openapitools.json +++ b/packages/cactus-plugin-consortium-manual/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES index a41778b486..56a034831a 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -6,7 +6,7 @@ settings.gradle src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -14,6 +14,7 @@ src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt diff --git a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION +++ b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/README.md index dc5ac6e84b..ca25788b96 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -1,9 +1,18 @@ # org.openapitools.client - Kotlin client library for Hyperledger Cactus Plugin - Consortium Web Service +Manage a Cactus consortium through the APIs. Needs administrative privileges. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 0.0.1 +- Package version: +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + ## Requires -* Kotlin 1.4.30 -* Gradle 6.8.3 +* Kotlin 1.7.21 +* Gradle 7.5 ## Build diff --git a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/build.gradle b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/build.gradle index 3de8b45b13..66a3c68b89 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/build.gradle +++ b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/build.gradle @@ -2,12 +2,12 @@ group 'org.openapitools' version '1.0.0' wrapper { - gradleVersion = '6.8.3' + gradleVersion = '7.5' distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } buildscript { - ext.kotlin_version = '1.5.10' + ext.kotlin_version = '1.7.21' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -18,6 +18,7 @@ buildscript { } apply plugin: 'kotlin' +apply plugin: 'maven-publish' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -30,8 +31,8 @@ test { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "com.squareup.moshi:moshi-kotlin:1.12.0" - implementation "com.squareup.moshi:moshi-adapters:1.12.0" - implementation "com.squareup.okhttp3:okhttp:4.9.1" + implementation "com.squareup.moshi:moshi-kotlin:1.13.0" + implementation "com.squareup.moshi:moshi-adapters:1.13.0" + implementation "com.squareup.okhttp3:okhttp:4.10.0" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 40008966c3..d22519032a 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Consortium Web Service - * - * Manage a Cactus consortium through the APIs. Needs administrative privileges. - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -20,46 +15,52 @@ package org.openapitools.client.apis +import java.io.IOException +import okhttp3.OkHttpClient +import okhttp3.HttpUrl + import org.openapitools.client.models.GetConsortiumJwsResponse import org.openapitools.client.models.GetNodeJwsResponse +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://localhost") + System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost") } } /** - * Retrieves a consortium JWS - * The JWS asserting the consortium metadata (pub keys and hosts of nodes) - * @param body (optional) - * @return GetConsortiumJwsResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Retrieves a consortium JWS + * The JWS asserting the consortium metadata (pub keys and hosts of nodes) + * @param body (optional) + * @return GetConsortiumJwsResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getConsortiumJwsV1(body: kotlin.Any?) : GetConsortiumJwsResponse { - val localVariableConfig = getConsortiumJwsV1RequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getConsortiumJwsV1(body: kotlin.Any? = null) : GetConsortiumJwsResponse { + val localVarResponse = getConsortiumJwsV1WithHttpInfo(body = body) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as GetConsortiumJwsResponse @@ -77,42 +78,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation getConsortiumJwsV1 - * - * @param body (optional) - * @return RequestConfig - */ + * Retrieves a consortium JWS + * The JWS asserting the consortium metadata (pub keys and hosts of nodes) + * @param body (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getConsortiumJwsV1WithHttpInfo(body: kotlin.Any?) : ApiResponse { + val localVariableConfig = getConsortiumJwsV1RequestConfig(body = body) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getConsortiumJwsV1 + * + * @param body (optional) + * @return RequestConfig + */ fun getConsortiumJwsV1RequestConfig(body: kotlin.Any?) : RequestConfig { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/consortium/jws", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Retrieves the JWT of a Cactus Node - * - * @param body (optional) - * @return GetNodeJwsResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Retrieves the JWT of a Cactus Node + * + * @param body (optional) + * @return GetNodeJwsResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getNodeJwsV1(body: kotlin.Any?) : GetNodeJwsResponse { - val localVariableConfig = getNodeJwsV1RequestConfig(body = body) - - val localVarResponse = request( - localVariableConfig - ) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getNodeJwsV1(body: kotlin.Any? = null) : GetNodeJwsResponse { + val localVarResponse = getNodeJwsV1WithHttpInfo(body = body) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as GetNodeJwsResponse @@ -130,41 +150,60 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation getNodeJwsV1 - * - * @param body (optional) - * @return RequestConfig - */ + * Retrieves the JWT of a Cactus Node + * + * @param body (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getNodeJwsV1WithHttpInfo(body: kotlin.Any?) : ApiResponse { + val localVariableConfig = getNodeJwsV1RequestConfig(body = body) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getNodeJwsV1 + * + * @param body (optional) + * @return RequestConfig + */ fun getNodeJwsV1RequestConfig(body: kotlin.Any?) : RequestConfig { val localVariableBody = body val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/node/jws", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Get the Prometheus Metrics - * - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Get the Prometheus Metrics + * + * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPrometheusMetricsV1() : kotlin.String { - val localVariableConfig = getPrometheusMetricsV1RequestConfig() - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = getPrometheusMetricsV1WithHttpInfo() return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String @@ -182,22 +221,43 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation getPrometheusMetricsV1 - * - * @return RequestConfig - */ + * Get the Prometheus Metrics + * + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getPrometheusMetricsV1WithHttpInfo() : ApiResponse { + val localVariableConfig = getPrometheusMetricsV1RequestConfig() + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getPrometheusMetricsV1 + * + * @return RequestConfig + */ fun getPrometheusMetricsV1RequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/get-prometheus-exporter-metrics", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index b359be1e41..757080d7ed 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -10,21 +10,26 @@ import okhttp3.ResponseBody import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import okhttp3.Headers +import okhttp3.Headers.Companion.toHeaders import okhttp3.MultipartBody +import okhttp3.Call +import okhttp3.Callback +import okhttp3.Response +import okhttp3.internal.EMPTY_REQUEST import java.io.BufferedWriter import java.io.File import java.io.FileWriter +import java.io.IOException import java.net.URLConnection import java.time.LocalDate import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter -open class ApiClient(val baseUrl: String) { +open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) { companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" @@ -39,9 +44,10 @@ open class ApiClient(val baseUrl: String) { var username: String? = null var password: String? = null var accessToken: String? = null + const val baseUrlKey = "org.openapitools.client.baseUrl" @JvmStatic - val client: OkHttpClient by lazy { + val defaultClient: OkHttpClient by lazy { builder.build() } @@ -60,48 +66,50 @@ open class ApiClient(val baseUrl: String) { return contentType ?: "application/octet-stream" } - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + protected inline fun requestBody(content: T, mediaType: String?): RequestBody = when { - content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull()) - mediaType == FormDataMediaType -> { + content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) + mediaType == FormDataMediaType -> MultipartBody.Builder() .setType(MultipartBody.FORM) .apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" + (content as Map>).forEach { (name, part) -> + if (part.body is File) { + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${part.body.name}\"") + val fileMediaType = guessContentTypeFromFile(part.body).toMediaTypeOrNull() + addPart( + partHeaders.toHeaders(), + part.body.asRequestBody(fileMediaType) ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"") addPart( - partHeaders, - parameterToString(value).toRequestBody(null) + partHeaders.toHeaders(), + parameterToString(part.body).toRequestBody(null) ) } } }.build() - } mediaType == FormUrlEncMediaType -> { FormBody.Builder().apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) + (content as Map>).forEach { (name, part) -> + add(name, parameterToString(part.body)) } }.build() } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) + mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> + if (content == null) { + EMPTY_REQUEST + } else { + Serializer.moshi.adapter(T::class.java).toJson(content) + .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) + } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -112,31 +120,35 @@ open class ApiClient(val baseUrl: String) { if(body == null) { return null } + if (T::class.java == File::class.java) { + // return tempFile + // Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options + val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() + tempFile.deleteOnExit() + body.byteStream().use { inputStream -> + tempFile.outputStream().use { tempFileOutputStream -> + inputStream.copyTo(tempFileOutputStream) + } + } + return tempFile as T + } val bodyContent = body.string() if (bodyContent.isEmpty()) { return null } - if (T::class.java == File::class.java) { - // return tempfile - val f = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() - f.deleteOnExit() - val out = BufferedWriter(FileWriter(f)) - out.write(bodyContent) - out.close() - return f as T - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) + .addEncodedPathSegments(requestConfig.path.trimStart('/')) .apply { requestConfig.query.forEach { query -> query.value.forEach { queryValue -> @@ -146,7 +158,7 @@ open class ApiClient(val baseUrl: String) { }.build() // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { + if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) { requestConfig.headers[ContentType] = JsonMediaType } if (requestConfig.headers[Accept].isNullOrEmpty()) { @@ -154,16 +166,16 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { + if (headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + val contentType = if (headers[ContentType] != null) { + // TODO: support multiple contentType options here. + (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + } else { + null + } val request = when (requestConfig.method) { RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) @@ -178,6 +190,7 @@ open class ApiClient(val baseUrl: String) { }.build() val response = client.newCall(request).execute() + val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault()) // TODO: handle specific mapping types. e.g. Map> @@ -215,7 +228,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 0000000000..cf2cfaa95d --- /dev/null +++ b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt index fb2c972cf8..064b57fc6b 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +++ b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt @@ -14,4 +14,4 @@ class BigDecimalAdapter { fun fromJson(value: String): BigDecimal { return BigDecimal(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt index 4b6963110c..7df6057b45 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt +++ b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt @@ -14,4 +14,4 @@ class BigIntegerAdapter { fun fromJson(value: String): BigInteger { return BigInteger(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 0000000000..be00e38fba --- /dev/null +++ b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 7e948e1dd0..625a19002b 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -13,5 +13,6 @@ data class RequestConfig( val path: String, val headers: MutableMap = mutableMapOf(), val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, val body: T? = null ) \ No newline at end of file diff --git a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetConsortiumJwsResponse.kt b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetConsortiumJwsResponse.kt index e10a089936..b0f7ac97d8 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetConsortiumJwsResponse.kt +++ b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetConsortiumJwsResponse.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Consortium Web Service - * - * Manage a Cactus consortium through the APIs. Needs administrative privileges. - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param jws */ + data class GetConsortiumJwsResponse ( @Json(name = "jws") diff --git a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetNodeJwsResponse.kt b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetNodeJwsResponse.kt index 6bff47d655..d3d1ba5388 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetNodeJwsResponse.kt +++ b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetNodeJwsResponse.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Consortium Web Service - * - * Manage a Cactus consortium through the APIs. Needs administrative privileges. - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param jws */ + data class GetNodeJwsResponse ( @Json(name = "jws") diff --git a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSGeneral.kt b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSGeneral.kt index 1777a6152e..e32c81a50f 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSGeneral.kt +++ b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSGeneral.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Consortium Web Service - * - * Manage a Cactus consortium through the APIs. Needs administrative privileges. - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -31,6 +26,7 @@ import com.squareup.moshi.Json * @param signatures */ + data class JWSGeneral ( @Json(name = "payload") diff --git a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSRecipient.kt b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSRecipient.kt index 150ed82e7a..9b428d7dd8 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSRecipient.kt +++ b/packages/cactus-plugin-consortium-manual/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/JWSRecipient.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Consortium Web Service - * - * Manage a Cactus consortium through the APIs. Needs administrative privileges. - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -31,6 +26,7 @@ import com.squareup.moshi.Json * @param header */ + data class JWSRecipient ( @Json(name = "signature") diff --git a/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/api.ts index 468ec37963..619b0da3ef 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * @@ -32,7 +34,7 @@ export interface GetConsortiumJwsResponse { * @type {JWSGeneral} * @memberof GetConsortiumJwsResponse */ - jws: JWSGeneral; + 'jws': JWSGeneral; } /** * @@ -45,7 +47,7 @@ export interface GetNodeJwsResponse { * @type {JWSGeneral} * @memberof GetNodeJwsResponse */ - jws: JWSGeneral; + 'jws': JWSGeneral; } /** * @@ -58,13 +60,13 @@ export interface JWSGeneral { * @type {string} * @memberof JWSGeneral */ - payload: string; + 'payload': string; /** * * @type {Array} * @memberof JWSGeneral */ - signatures: Array; + 'signatures': Array; } /** * A JSON Web Signature. See: https://tools.ietf.org/html/rfc7515 for info about standard. @@ -77,19 +79,19 @@ export interface JWSRecipient { * @type {string} * @memberof JWSRecipient */ - signature: string; + 'signature': string; /** * * @type {string} * @memberof JWSRecipient */ - protected?: string; + 'protected'?: string; /** * - * @type {{ [key: string]: object; }} + * @type {{ [key: string]: any; }} * @memberof JWSRecipient */ - header?: { [key: string]: object; }; + 'header'?: { [key: string]: any; }; } /** @@ -105,7 +107,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getConsortiumJwsV1: async (body?: object, options: any = {}): Promise => { + getConsortiumJwsV1: async (body?: object, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/consortium/jws`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -122,7 +124,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) @@ -139,7 +141,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getNodeJwsV1: async (body?: object, options: any = {}): Promise => { + getNodeJwsV1: async (body?: object, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/node/jws`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -156,7 +158,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) @@ -172,7 +174,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getPrometheusMetricsV1: async (options: any = {}): Promise => { + getPrometheusMetricsV1: async (options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/get-prometheus-exporter-metrics`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -187,7 +189,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -213,7 +215,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getConsortiumJwsV1(body?: object, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getConsortiumJwsV1(body?: object, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getConsortiumJwsV1(body, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -224,7 +226,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getNodeJwsV1(body?: object, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getNodeJwsV1(body?: object, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getNodeJwsV1(body, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -234,7 +236,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getPrometheusMetricsV1(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getPrometheusMetricsV1(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getPrometheusMetricsV1(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -295,7 +297,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getConsortiumJwsV1(body?: object, options?: any) { + public getConsortiumJwsV1(body?: object, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getConsortiumJwsV1(body, options).then((request) => request(this.axios, this.basePath)); } @@ -307,7 +309,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getNodeJwsV1(body?: object, options?: any) { + public getNodeJwsV1(body?: object, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getNodeJwsV1(body, options).then((request) => request(this.axios, this.basePath)); } @@ -318,7 +320,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getPrometheusMetricsV1(options?: any) { + public getPrometheusMetricsV1(options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getPrometheusMetricsV1(options).then((request) => request(this.axios, this.basePath)); } } diff --git a/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/base.ts index 6053861d28..b7204b65c2 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/common.ts index a44fb71d29..2016aa9217 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/packages/cactus-plugin-consortium-manual/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; } diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/openapitools.json b/packages/cactus-plugin-htlc-eth-besu-erc20/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/openapitools.json +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES index ef26562de4..9a355f61d1 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -6,7 +6,7 @@ settings.gradle src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -14,6 +14,7 @@ src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -25,6 +26,7 @@ src/main/kotlin/org/openapitools/client/models/GetStatusRequest.kt src/main/kotlin/org/openapitools/client/models/InitializeRequest.kt src/main/kotlin/org/openapitools/client/models/InvokeContractV1Response.kt src/main/kotlin/org/openapitools/client/models/NewContractRequest.kt +src/main/kotlin/org/openapitools/client/models/NewContractRequestGas.kt src/main/kotlin/org/openapitools/client/models/RefundRequest.kt src/main/kotlin/org/openapitools/client/models/RunTransactionResponse.kt src/main/kotlin/org/openapitools/client/models/Web3SigningCredential.kt diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/README.md index 4f190a6d2d..72162de4b4 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -1,9 +1,18 @@ # org.openapitools.client - Kotlin client library for Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 +Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 0.0.1 +- Package version: +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + ## Requires -* Kotlin 1.4.30 -* Gradle 6.8.3 +* Kotlin 1.7.21 +* Gradle 7.5 ## Build @@ -51,6 +60,7 @@ Class | Method | HTTP request | Description - [org.openapitools.client.models.InitializeRequest](docs/InitializeRequest.md) - [org.openapitools.client.models.InvokeContractV1Response](docs/InvokeContractV1Response.md) - [org.openapitools.client.models.NewContractRequest](docs/NewContractRequest.md) + - [org.openapitools.client.models.NewContractRequestGas](docs/NewContractRequestGas.md) - [org.openapitools.client.models.RefundRequest](docs/RefundRequest.md) - [org.openapitools.client.models.RunTransactionResponse](docs/RunTransactionResponse.md) - [org.openapitools.client.models.Web3SigningCredential](docs/Web3SigningCredential.md) diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/build.gradle b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/build.gradle index 3de8b45b13..66a3c68b89 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/build.gradle +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/build.gradle @@ -2,12 +2,12 @@ group 'org.openapitools' version '1.0.0' wrapper { - gradleVersion = '6.8.3' + gradleVersion = '7.5' distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } buildscript { - ext.kotlin_version = '1.5.10' + ext.kotlin_version = '1.7.21' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -18,6 +18,7 @@ buildscript { } apply plugin: 'kotlin' +apply plugin: 'maven-publish' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -30,8 +31,8 @@ test { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "com.squareup.moshi:moshi-kotlin:1.12.0" - implementation "com.squareup.moshi:moshi-adapters:1.12.0" - implementation "com.squareup.okhttp3:okhttp:4.9.1" + implementation "com.squareup.moshi:moshi-kotlin:1.13.0" + implementation "com.squareup.moshi:moshi-adapters:1.13.0" + implementation "com.squareup.okhttp3:okhttp:4.10.0" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 523c1ba484..bbfd0078d4 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 - * - * Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -20,6 +15,10 @@ package org.openapitools.client.apis +import java.io.IOException +import okhttp3.OkHttpClient +import okhttp3.HttpUrl + import org.openapitools.client.models.GetSingleStatusRequest import org.openapitools.client.models.GetStatusRequest import org.openapitools.client.models.InitializeRequest @@ -29,43 +28,45 @@ import org.openapitools.client.models.RefundRequest import org.openapitools.client.models.RunTransactionResponse import org.openapitools.client.models.WithdrawRequest +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://localhost") + System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost") } } /** - * - * - * @param getSingleStatusRequest (optional) - * @return kotlin.Int - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * + * + * @param getSingleStatusRequest (optional) + * @return kotlin.Int + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getSingleStatusV1(getSingleStatusRequest: GetSingleStatusRequest?) : kotlin.Int { - val localVariableConfig = getSingleStatusV1RequestConfig(getSingleStatusRequest = getSingleStatusRequest) - - val localVarResponse = request( - localVariableConfig - ) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getSingleStatusV1(getSingleStatusRequest: GetSingleStatusRequest? = null) : kotlin.Int { + val localVarResponse = getSingleStatusV1WithHttpInfo(getSingleStatusRequest = getSingleStatusRequest) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.Int @@ -83,42 +84,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation getSingleStatusV1 - * - * @param getSingleStatusRequest (optional) - * @return RequestConfig - */ + * + * + * @param getSingleStatusRequest (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getSingleStatusV1WithHttpInfo(getSingleStatusRequest: GetSingleStatusRequest?) : ApiResponse { + val localVariableConfig = getSingleStatusV1RequestConfig(getSingleStatusRequest = getSingleStatusRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getSingleStatusV1 + * + * @param getSingleStatusRequest (optional) + * @return RequestConfig + */ fun getSingleStatusV1RequestConfig(getSingleStatusRequest: GetSingleStatusRequest?) : RequestConfig { val localVariableBody = getSingleStatusRequest val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-single-status", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param getStatusRequest (optional) - * @return kotlin.collections.List - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * + * + * @param getStatusRequest (optional) + * @return kotlin.collections.List + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun getStatusV1(getStatusRequest: GetStatusRequest?) : kotlin.collections.List { - val localVariableConfig = getStatusV1RequestConfig(getStatusRequest = getStatusRequest) - - val localVarResponse = request>( - localVariableConfig - ) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getStatusV1(getStatusRequest: GetStatusRequest? = null) : kotlin.collections.List { + val localVarResponse = getStatusV1WithHttpInfo(getStatusRequest = getStatusRequest) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List @@ -136,42 +156,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation getStatusV1 - * - * @param getStatusRequest (optional) - * @return RequestConfig - */ + * + * + * @param getStatusRequest (optional) + * @return ApiResponse?> + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getStatusV1WithHttpInfo(getStatusRequest: GetStatusRequest?) : ApiResponse?> { + val localVariableConfig = getStatusV1RequestConfig(getStatusRequest = getStatusRequest) + + return request>( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getStatusV1 + * + * @param getStatusRequest (optional) + * @return RequestConfig + */ fun getStatusV1RequestConfig(getStatusRequest: GetStatusRequest?) : RequestConfig { val localVariableBody = getStatusRequest val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-status", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Initialize contract - * - * @param initializeRequest (optional) - * @return RunTransactionResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Initialize contract + * + * @param initializeRequest (optional) + * @return RunTransactionResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun initializeV1(initializeRequest: InitializeRequest?) : RunTransactionResponse { - val localVariableConfig = initializeV1RequestConfig(initializeRequest = initializeRequest) - - val localVarResponse = request( - localVariableConfig - ) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun initializeV1(initializeRequest: InitializeRequest? = null) : RunTransactionResponse { + val localVarResponse = initializeV1WithHttpInfo(initializeRequest = initializeRequest) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as RunTransactionResponse @@ -189,42 +228,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation initializeV1 - * - * @param initializeRequest (optional) - * @return RequestConfig - */ + * Initialize contract + * + * @param initializeRequest (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun initializeV1WithHttpInfo(initializeRequest: InitializeRequest?) : ApiResponse { + val localVariableConfig = initializeV1RequestConfig(initializeRequest = initializeRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation initializeV1 + * + * @param initializeRequest (optional) + * @return RequestConfig + */ fun initializeV1RequestConfig(initializeRequest: InitializeRequest?) : RequestConfig { val localVariableBody = initializeRequest val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/initialize", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Create a new hashtimelock contract - * - * @param newContractRequest (optional) - * @return InvokeContractV1Response - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Create a new hashtimelock contract + * + * @param newContractRequest (optional) + * @return InvokeContractV1Response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun newContractV1(newContractRequest: NewContractRequest?) : InvokeContractV1Response { - val localVariableConfig = newContractV1RequestConfig(newContractRequest = newContractRequest) - - val localVarResponse = request( - localVariableConfig - ) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun newContractV1(newContractRequest: NewContractRequest? = null) : InvokeContractV1Response { + val localVarResponse = newContractV1WithHttpInfo(newContractRequest = newContractRequest) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as InvokeContractV1Response @@ -242,42 +300,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation newContractV1 - * - * @param newContractRequest (optional) - * @return RequestConfig - */ + * Create a new hashtimelock contract + * + * @param newContractRequest (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun newContractV1WithHttpInfo(newContractRequest: NewContractRequest?) : ApiResponse { + val localVariableConfig = newContractV1RequestConfig(newContractRequest = newContractRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation newContractV1 + * + * @param newContractRequest (optional) + * @return RequestConfig + */ fun newContractV1RequestConfig(newContractRequest: NewContractRequest?) : RequestConfig { val localVariableBody = newContractRequest val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/new-contract", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Refund a hashtimelock contract - * - * @param refundRequest (optional) - * @return InvokeContractV1Response - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Refund a hashtimelock contract + * + * @param refundRequest (optional) + * @return InvokeContractV1Response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun refundV1(refundRequest: RefundRequest?) : InvokeContractV1Response { - val localVariableConfig = refundV1RequestConfig(refundRequest = refundRequest) - - val localVarResponse = request( - localVariableConfig - ) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun refundV1(refundRequest: RefundRequest? = null) : InvokeContractV1Response { + val localVarResponse = refundV1WithHttpInfo(refundRequest = refundRequest) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as InvokeContractV1Response @@ -295,42 +372,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation refundV1 - * - * @param refundRequest (optional) - * @return RequestConfig - */ + * Refund a hashtimelock contract + * + * @param refundRequest (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun refundV1WithHttpInfo(refundRequest: RefundRequest?) : ApiResponse { + val localVariableConfig = refundV1RequestConfig(refundRequest = refundRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation refundV1 + * + * @param refundRequest (optional) + * @return RequestConfig + */ fun refundV1RequestConfig(refundRequest: RefundRequest?) : RequestConfig { val localVariableBody = refundRequest val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/refund", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Withdraw a hashtimelock contract - * - * @param withdrawRequest (optional) - * @return InvokeContractV1Response - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Withdraw a hashtimelock contract + * + * @param withdrawRequest (optional) + * @return InvokeContractV1Response + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun withdrawV1(withdrawRequest: WithdrawRequest?) : InvokeContractV1Response { - val localVariableConfig = withdrawV1RequestConfig(withdrawRequest = withdrawRequest) - - val localVarResponse = request( - localVariableConfig - ) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun withdrawV1(withdrawRequest: WithdrawRequest? = null) : InvokeContractV1Response { + val localVarResponse = withdrawV1WithHttpInfo(withdrawRequest = withdrawRequest) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as InvokeContractV1Response @@ -348,23 +444,47 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation withdrawV1 - * - * @param withdrawRequest (optional) - * @return RequestConfig - */ + * Withdraw a hashtimelock contract + * + * @param withdrawRequest (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun withdrawV1WithHttpInfo(withdrawRequest: WithdrawRequest?) : ApiResponse { + val localVariableConfig = withdrawV1RequestConfig(withdrawRequest = withdrawRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation withdrawV1 + * + * @param withdrawRequest (optional) + * @return RequestConfig + */ fun withdrawV1RequestConfig(withdrawRequest: WithdrawRequest?) : RequestConfig { val localVariableBody = withdrawRequest val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/withdraw", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index b359be1e41..757080d7ed 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -10,21 +10,26 @@ import okhttp3.ResponseBody import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import okhttp3.Headers +import okhttp3.Headers.Companion.toHeaders import okhttp3.MultipartBody +import okhttp3.Call +import okhttp3.Callback +import okhttp3.Response +import okhttp3.internal.EMPTY_REQUEST import java.io.BufferedWriter import java.io.File import java.io.FileWriter +import java.io.IOException import java.net.URLConnection import java.time.LocalDate import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter -open class ApiClient(val baseUrl: String) { +open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) { companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" @@ -39,9 +44,10 @@ open class ApiClient(val baseUrl: String) { var username: String? = null var password: String? = null var accessToken: String? = null + const val baseUrlKey = "org.openapitools.client.baseUrl" @JvmStatic - val client: OkHttpClient by lazy { + val defaultClient: OkHttpClient by lazy { builder.build() } @@ -60,48 +66,50 @@ open class ApiClient(val baseUrl: String) { return contentType ?: "application/octet-stream" } - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + protected inline fun requestBody(content: T, mediaType: String?): RequestBody = when { - content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull()) - mediaType == FormDataMediaType -> { + content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) + mediaType == FormDataMediaType -> MultipartBody.Builder() .setType(MultipartBody.FORM) .apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" + (content as Map>).forEach { (name, part) -> + if (part.body is File) { + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${part.body.name}\"") + val fileMediaType = guessContentTypeFromFile(part.body).toMediaTypeOrNull() + addPart( + partHeaders.toHeaders(), + part.body.asRequestBody(fileMediaType) ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"") addPart( - partHeaders, - parameterToString(value).toRequestBody(null) + partHeaders.toHeaders(), + parameterToString(part.body).toRequestBody(null) ) } } }.build() - } mediaType == FormUrlEncMediaType -> { FormBody.Builder().apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) + (content as Map>).forEach { (name, part) -> + add(name, parameterToString(part.body)) } }.build() } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) + mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> + if (content == null) { + EMPTY_REQUEST + } else { + Serializer.moshi.adapter(T::class.java).toJson(content) + .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) + } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -112,31 +120,35 @@ open class ApiClient(val baseUrl: String) { if(body == null) { return null } + if (T::class.java == File::class.java) { + // return tempFile + // Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options + val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() + tempFile.deleteOnExit() + body.byteStream().use { inputStream -> + tempFile.outputStream().use { tempFileOutputStream -> + inputStream.copyTo(tempFileOutputStream) + } + } + return tempFile as T + } val bodyContent = body.string() if (bodyContent.isEmpty()) { return null } - if (T::class.java == File::class.java) { - // return tempfile - val f = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() - f.deleteOnExit() - val out = BufferedWriter(FileWriter(f)) - out.write(bodyContent) - out.close() - return f as T - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) + .addEncodedPathSegments(requestConfig.path.trimStart('/')) .apply { requestConfig.query.forEach { query -> query.value.forEach { queryValue -> @@ -146,7 +158,7 @@ open class ApiClient(val baseUrl: String) { }.build() // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { + if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) { requestConfig.headers[ContentType] = JsonMediaType } if (requestConfig.headers[Accept].isNullOrEmpty()) { @@ -154,16 +166,16 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { + if (headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + val contentType = if (headers[ContentType] != null) { + // TODO: support multiple contentType options here. + (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + } else { + null + } val request = when (requestConfig.method) { RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) @@ -178,6 +190,7 @@ open class ApiClient(val baseUrl: String) { }.build() val response = client.newCall(request).execute() + val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault()) // TODO: handle specific mapping types. e.g. Map> @@ -215,7 +228,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 0000000000..cf2cfaa95d --- /dev/null +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt index fb2c972cf8..064b57fc6b 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt @@ -14,4 +14,4 @@ class BigDecimalAdapter { fun fromJson(value: String): BigDecimal { return BigDecimal(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt index 4b6963110c..7df6057b45 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt @@ -14,4 +14,4 @@ class BigIntegerAdapter { fun fromJson(value: String): BigInteger { return BigInteger(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 0000000000..be00e38fba --- /dev/null +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 7e948e1dd0..625a19002b 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -13,5 +13,6 @@ data class RequestConfig( val path: String, val headers: MutableMap = mutableMapOf(), val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, val body: T? = null ) \ No newline at end of file diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetSingleStatusRequest.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetSingleStatusRequest.kt index 0b2e816b4c..124d2ffd51 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetSingleStatusRequest.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetSingleStatusRequest.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 - * - * Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -33,6 +28,7 @@ import com.squareup.moshi.Json * @param keychainId */ + data class GetSingleStatusRequest ( @Json(name = "id") diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetStatusRequest.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetStatusRequest.kt index 0ece8361a1..490a0e67da 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetStatusRequest.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetStatusRequest.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 - * - * Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -33,6 +28,7 @@ import com.squareup.moshi.Json * @param keychainId */ + data class GetStatusRequest ( @Json(name = "ids") diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/InitializeRequest.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/InitializeRequest.kt index 0acd6f3754..a92e00b10b 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/InitializeRequest.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/InitializeRequest.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 - * - * Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -34,6 +29,7 @@ import com.squareup.moshi.Json * @param gas */ + data class InitializeRequest ( /* connectorId for the connector besu plugin */ diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/InvokeContractV1Response.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/InvokeContractV1Response.kt index 7f37e2c93d..91566772d7 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/InvokeContractV1Response.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/InvokeContractV1Response.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 - * - * Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -32,6 +27,7 @@ import com.squareup.moshi.Json * @param callOutput */ + data class InvokeContractV1Response ( @Json(name = "success") diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/NewContractRequest.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/NewContractRequest.kt index 8341e00e7b..083917f9f1 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/NewContractRequest.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/NewContractRequest.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 - * - * Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -20,7 +15,7 @@ package org.openapitools.client.models -import org.openapitools.client.models.OneOfLessThanStringCommaNumberGreaterThan +import org.openapitools.client.models.NewContractRequestGas import org.openapitools.client.models.Web3SigningCredential import com.squareup.moshi.Json @@ -43,6 +38,7 @@ import com.squareup.moshi.Json * @param gas */ + data class NewContractRequest ( /* Contract address */ @@ -93,7 +89,7 @@ data class NewContractRequest ( val keychainId: kotlin.String, @Json(name = "gas") - val gas: OneOfLessThanStringCommaNumberGreaterThan? = null + val gas: NewContractRequestGas? = null ) diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/NewContractRequestGas.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/NewContractRequestGas.kt new file mode 100644 index 0000000000..c1670c37e9 --- /dev/null +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/NewContractRequestGas.kt @@ -0,0 +1,30 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json + +/** + * + * + */ + + +data class NewContractRequestGas ( + +) + diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RefundRequest.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RefundRequest.kt index ef7242e06e..4dff58326f 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RefundRequest.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RefundRequest.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 - * - * Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -20,7 +15,7 @@ package org.openapitools.client.models -import org.openapitools.client.models.OneOfLessThanStringCommaNumberGreaterThan +import org.openapitools.client.models.NewContractRequestGas import org.openapitools.client.models.Web3SigningCredential import com.squareup.moshi.Json @@ -35,6 +30,7 @@ import com.squareup.moshi.Json * @param gas */ + data class RefundRequest ( /* Contract htlc id for refund */ @@ -53,7 +49,7 @@ data class RefundRequest ( val keychainId: kotlin.String, @Json(name = "gas") - val gas: OneOfLessThanStringCommaNumberGreaterThan? = null + val gas: NewContractRequestGas? = null ) diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RunTransactionResponse.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RunTransactionResponse.kt index fcd59f0861..daa4e5221f 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RunTransactionResponse.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RunTransactionResponse.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 - * - * Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param transactionReceipt */ + data class RunTransactionResponse ( @Json(name = "transactionReceipt") diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredential.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredential.kt index 5005a118ab..71ca15c9cd 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredential.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredential.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 - * - * Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -37,6 +32,7 @@ import com.squareup.moshi.Json * @param secret The HEX encoded private key of an eth account. */ + interface Web3SigningCredential { @Json(name = "type") diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialCactusKeychainRef.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialCactusKeychainRef.kt index 56cd2223d6..3987b37f83 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialCactusKeychainRef.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialCactusKeychainRef.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 - * - * Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -33,6 +28,7 @@ import com.squareup.moshi.Json * @param keychainId The keychain ID to use when looking up the the keychain plugin instance that will be used to retrieve the secret pointed to by the keychainEntryKey parameter. */ + data class Web3SigningCredentialCactusKeychainRef ( @Json(name = "type") diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialNone.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialNone.kt index ede046698a..053a688144 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialNone.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialNone.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 - * - * Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param type */ + data class Web3SigningCredentialNone ( @Json(name = "type") diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialPrivateKeyHex.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialPrivateKeyHex.kt index 6c363c557e..1e9c7bb2e3 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialPrivateKeyHex.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialPrivateKeyHex.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 - * - * Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -32,6 +27,7 @@ import com.squareup.moshi.Json * @param secret The HEX encoded private key of an eth account. */ + data class Web3SigningCredentialPrivateKeyHex ( @Json(name = "type") diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialType.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialType.kt index 433078e828..5665050205 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialType.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3SigningCredentialType.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 - * - * Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -56,12 +51,12 @@ enum class Web3SigningCredentialType(val value: kotlin.String) { /** * Converts the provided [data] to a [String] on success, null otherwise. */ - fun encode(data: Any?): kotlin.String? = if (data is Web3SigningCredentialType) "$data" else null + fun encode(data: kotlin.Any?): kotlin.String? = if (data is Web3SigningCredentialType) "$data" else null /** * Returns a valid [Web3SigningCredentialType] for [data], null otherwise. */ - fun decode(data: Any?): Web3SigningCredentialType? = data?.let { + fun decode(data: kotlin.Any?): Web3SigningCredentialType? = data?.let { val normalizedData = "$it".lowercase() values().firstOrNull { value -> it == value || normalizedData == "$value".lowercase() diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3TransactionReceipt.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3TransactionReceipt.kt index ef0aa80696..8440e4aaaf 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3TransactionReceipt.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/Web3TransactionReceipt.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 - * - * Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -37,6 +32,7 @@ import com.squareup.moshi.Json * @param contractAddress */ + data class Web3TransactionReceipt ( @Json(name = "status") diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/WithdrawRequest.kt b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/WithdrawRequest.kt index 5b00c87935..f7a90a077b 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/WithdrawRequest.kt +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/WithdrawRequest.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - HTLC ETH BESU ERC20 - * - * Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -20,7 +15,7 @@ package org.openapitools.client.models -import org.openapitools.client.models.OneOfLessThanStringCommaNumberGreaterThan +import org.openapitools.client.models.NewContractRequestGas import org.openapitools.client.models.Web3SigningCredential import com.squareup.moshi.Json @@ -36,6 +31,7 @@ import com.squareup.moshi.Json * @param gas */ + data class WithdrawRequest ( /* Contract locked id */ @@ -58,7 +54,7 @@ data class WithdrawRequest ( val keychainId: kotlin.String, @Json(name = "gas") - val gas: OneOfLessThanStringCommaNumberGreaterThan? = null + val gas: NewContractRequestGas? = null ) diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/api.ts index 7d801f7f76..6e9653647c 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * Defines the parameters for retrieving the single status of the HTLC swap. @@ -32,25 +34,25 @@ export interface GetSingleStatusRequest { * @type {string} * @memberof GetSingleStatusRequest */ - id: string; + 'id': string; /** * * @type {Web3SigningCredential} * @memberof GetSingleStatusRequest */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * * @type {string} * @memberof GetSingleStatusRequest */ - connectorId: string; + 'connectorId': string; /** * * @type {string} * @memberof GetSingleStatusRequest */ - keychainId: string; + 'keychainId': string; } /** * Defines the parameters for retrieving the status of the HTLC swap. @@ -63,25 +65,25 @@ export interface GetStatusRequest { * @type {Array} * @memberof GetStatusRequest */ - ids: Array; + 'ids': Array; /** * * @type {Web3SigningCredential} * @memberof GetStatusRequest */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * * @type {string} * @memberof GetStatusRequest */ - connectorId: string; + 'connectorId': string; /** * * @type {string} * @memberof GetStatusRequest */ - keychainId: string; + 'keychainId': string; } /** * @@ -94,31 +96,31 @@ export interface InitializeRequest { * @type {string} * @memberof InitializeRequest */ - connectorId: string; + 'connectorId': string; /** * keychainId for the keychain plugin * @type {string} * @memberof InitializeRequest */ - keychainId: string; + 'keychainId': string; /** * * @type {Array} * @memberof InitializeRequest */ - constructorArgs: Array; + 'constructorArgs': Array; /** * * @type {Web3SigningCredential} * @memberof InitializeRequest */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * * @type {number} * @memberof InitializeRequest */ - gas?: number; + 'gas'?: number; } /** * @@ -131,19 +133,19 @@ export interface InvokeContractV1Response { * @type {Web3TransactionReceipt} * @memberof InvokeContractV1Response */ - transactionReceipt?: Web3TransactionReceipt; + 'transactionReceipt'?: Web3TransactionReceipt; /** * * @type {any} * @memberof InvokeContractV1Response */ - callOutput?: any | null; + 'callOutput'?: any; /** * * @type {boolean} * @memberof InvokeContractV1Response */ - success: boolean; + 'success': boolean; } /** * @@ -156,80 +158,86 @@ export interface NewContractRequest { * @type {string} * @memberof NewContractRequest */ - contractAddress: string; + 'contractAddress': string; /** * Input amount to lock * @type {number} * @memberof NewContractRequest */ - inputAmount: number; + 'inputAmount': number; /** * Output amount to lock * @type {number} * @memberof NewContractRequest */ - outputAmount: number; + 'outputAmount': number; /** * Timestamp to expire the contract * @type {number} * @memberof NewContractRequest */ - expiration: number; + 'expiration': number; /** * Hashlock needed to refund the amount * @type {string} * @memberof NewContractRequest */ - hashLock: string; + 'hashLock': string; /** * The token address * @type {string} * @memberof NewContractRequest */ - tokenAddress: string; + 'tokenAddress': string; /** * The receiver address * @type {string} * @memberof NewContractRequest */ - receiver: string; + 'receiver': string; /** * The output network id * @type {string} * @memberof NewContractRequest */ - outputNetwork: string; + 'outputNetwork': string; /** * The output address to receive the tokens * @type {string} * @memberof NewContractRequest */ - outputAddress: string; + 'outputAddress': string; /** * * @type {Web3SigningCredential} * @memberof NewContractRequest */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * connectorId for the connector besu plugin * @type {string} * @memberof NewContractRequest */ - connectorId: string; + 'connectorId': string; /** * keychainId for the keychian plugin * @type {string} * @memberof NewContractRequest */ - keychainId: string; + 'keychainId': string; /** * - * @type {string | number} + * @type {NewContractRequestGas} * @memberof NewContractRequest */ - gas?: string | number; + 'gas'?: NewContractRequestGas; } +/** + * @type NewContractRequestGas + * @export + */ +export type NewContractRequestGas = number | string; + /** * * @export @@ -241,31 +249,31 @@ export interface RefundRequest { * @type {string} * @memberof RefundRequest */ - id: string; + 'id': string; /** * * @type {Web3SigningCredential} * @memberof RefundRequest */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * connectorId for the connector besu plugin * @type {string} * @memberof RefundRequest */ - connectorId: string; + 'connectorId': string; /** * keychainId for the keychain plugin * @type {string} * @memberof RefundRequest */ - keychainId: string; + 'keychainId': string; /** * - * @type {string | number} + * @type {NewContractRequestGas} * @memberof RefundRequest */ - gas?: string | number; + 'gas'?: NewContractRequestGas; } /** * @@ -278,7 +286,7 @@ export interface RunTransactionResponse { * @type {Web3TransactionReceipt} * @memberof RunTransactionResponse */ - transactionReceipt: Web3TransactionReceipt; + 'transactionReceipt': Web3TransactionReceipt; } /** * @type Web3SigningCredential @@ -297,26 +305,28 @@ export interface Web3SigningCredentialCactusKeychainRef { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialCactusKeychainRef */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; /** * The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication. * @type {string} * @memberof Web3SigningCredentialCactusKeychainRef */ - ethAccount: string; + 'ethAccount': string; /** * The key to use when looking up the the keychain entry holding the secret pointed to by the keychainEntryKey parameter. * @type {string} * @memberof Web3SigningCredentialCactusKeychainRef */ - keychainEntryKey: string; + 'keychainEntryKey': string; /** * The keychain ID to use when looking up the the keychain plugin instance that will be used to retrieve the secret pointed to by the keychainEntryKey parameter. * @type {string} * @memberof Web3SigningCredentialCactusKeychainRef */ - keychainId: string; + 'keychainId': string; } + + /** * Using this denotes that there is no signing required because the transaction is pre-signed. * @export @@ -328,8 +338,10 @@ export interface Web3SigningCredentialNone { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialNone */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; } + + /** * * @export @@ -341,32 +353,37 @@ export interface Web3SigningCredentialPrivateKeyHex { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialPrivateKeyHex */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; /** * The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication. * @type {string} * @memberof Web3SigningCredentialPrivateKeyHex */ - ethAccount: string; + 'ethAccount': string; /** * The HEX encoded private key of an eth account. * @type {string} * @memberof Web3SigningCredentialPrivateKeyHex */ - secret: string; + 'secret': string; } + + /** * * @export * @enum {string} */ -export enum Web3SigningCredentialType { - CactusKeychainRef = 'CACTUS_KEYCHAIN_REF', - GethKeychainPassword = 'GETH_KEYCHAIN_PASSWORD', - PrivateKeyHex = 'PRIVATE_KEY_HEX', - None = 'NONE' -} +export const Web3SigningCredentialType = { + CactusKeychainRef: 'CACTUS_KEYCHAIN_REF', + GethKeychainPassword: 'GETH_KEYCHAIN_PASSWORD', + PrivateKeyHex: 'PRIVATE_KEY_HEX', + None: 'NONE' +} as const; + +export type Web3SigningCredentialType = typeof Web3SigningCredentialType[keyof typeof Web3SigningCredentialType]; + /** * @@ -374,62 +391,62 @@ export enum Web3SigningCredentialType { * @interface Web3TransactionReceipt */ export interface Web3TransactionReceipt { - [key: string]: object | any; + [key: string]: any; /** * * @type {boolean} * @memberof Web3TransactionReceipt */ - status: boolean; + 'status': boolean; /** * * @type {string} * @memberof Web3TransactionReceipt */ - transactionHash: string; + 'transactionHash': string; /** * * @type {number} * @memberof Web3TransactionReceipt */ - transactionIndex: number; + 'transactionIndex': number; /** * * @type {string} * @memberof Web3TransactionReceipt */ - blockHash: string; + 'blockHash': string; /** * * @type {number} * @memberof Web3TransactionReceipt */ - blockNumber: number; + 'blockNumber': number; /** * * @type {number} * @memberof Web3TransactionReceipt */ - gasUsed: number; + 'gasUsed': number; /** * * @type {string} * @memberof Web3TransactionReceipt */ - contractAddress?: string | null; + 'contractAddress'?: string | null; /** * * @type {string} * @memberof Web3TransactionReceipt */ - from: string; + 'from': string; /** * * @type {string} * @memberof Web3TransactionReceipt */ - to: string; + 'to': string; } /** * @@ -442,37 +459,37 @@ export interface WithdrawRequest { * @type {string} * @memberof WithdrawRequest */ - id: string; + 'id': string; /** * Secret need to unlock the contract * @type {string} * @memberof WithdrawRequest */ - secret: string; + 'secret': string; /** * * @type {Web3SigningCredential} * @memberof WithdrawRequest */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * connectorId for the connector besu plugin * @type {string} * @memberof WithdrawRequest */ - connectorId: string; + 'connectorId': string; /** * keychainId for the keychain plugin * @type {string} * @memberof WithdrawRequest */ - keychainId: string; + 'keychainId': string; /** * - * @type {string | number} + * @type {NewContractRequestGas} * @memberof WithdrawRequest */ - gas?: string | number; + 'gas'?: NewContractRequestGas; } /** @@ -487,7 +504,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getSingleStatusV1: async (getSingleStatusRequest?: GetSingleStatusRequest, options: any = {}): Promise => { + getSingleStatusV1: async (getSingleStatusRequest?: GetSingleStatusRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-single-status`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -504,7 +521,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(getSingleStatusRequest, localVarRequestOptions, configuration) @@ -520,7 +537,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getStatusV1: async (getStatusRequest?: GetStatusRequest, options: any = {}): Promise => { + getStatusV1: async (getStatusRequest?: GetStatusRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-status`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -537,7 +554,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(getStatusRequest, localVarRequestOptions, configuration) @@ -554,7 +571,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - initializeV1: async (initializeRequest?: InitializeRequest, options: any = {}): Promise => { + initializeV1: async (initializeRequest?: InitializeRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/initialize`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -571,7 +588,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(initializeRequest, localVarRequestOptions, configuration) @@ -588,7 +605,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - newContractV1: async (newContractRequest?: NewContractRequest, options: any = {}): Promise => { + newContractV1: async (newContractRequest?: NewContractRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/new-contract`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -605,7 +622,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(newContractRequest, localVarRequestOptions, configuration) @@ -622,7 +639,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - refundV1: async (refundRequest?: RefundRequest, options: any = {}): Promise => { + refundV1: async (refundRequest?: RefundRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/refund`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -639,7 +656,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(refundRequest, localVarRequestOptions, configuration) @@ -656,7 +673,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - withdrawV1: async (withdrawRequest?: WithdrawRequest, options: any = {}): Promise => { + withdrawV1: async (withdrawRequest?: WithdrawRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/withdraw`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -673,7 +690,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(withdrawRequest, localVarRequestOptions, configuration) @@ -699,7 +716,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getSingleStatusV1(getSingleStatusRequest?: GetSingleStatusRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getSingleStatusV1(getSingleStatusRequest?: GetSingleStatusRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getSingleStatusV1(getSingleStatusRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -709,7 +726,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getStatusV1(getStatusRequest?: GetStatusRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + async getStatusV1(getStatusRequest?: GetStatusRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getStatusV1(getStatusRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -720,7 +737,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async initializeV1(initializeRequest?: InitializeRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async initializeV1(initializeRequest?: InitializeRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.initializeV1(initializeRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -731,7 +748,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async newContractV1(newContractRequest?: NewContractRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async newContractV1(newContractRequest?: NewContractRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.newContractV1(newContractRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -742,7 +759,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async refundV1(refundRequest?: RefundRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async refundV1(refundRequest?: RefundRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.refundV1(refundRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -753,7 +770,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async withdrawV1(withdrawRequest?: WithdrawRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async withdrawV1(withdrawRequest?: WithdrawRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.withdrawV1(withdrawRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -842,7 +859,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getSingleStatusV1(getSingleStatusRequest?: GetSingleStatusRequest, options?: any) { + public getSingleStatusV1(getSingleStatusRequest?: GetSingleStatusRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getSingleStatusV1(getSingleStatusRequest, options).then((request) => request(this.axios, this.basePath)); } @@ -853,7 +870,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getStatusV1(getStatusRequest?: GetStatusRequest, options?: any) { + public getStatusV1(getStatusRequest?: GetStatusRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getStatusV1(getStatusRequest, options).then((request) => request(this.axios, this.basePath)); } @@ -865,7 +882,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public initializeV1(initializeRequest?: InitializeRequest, options?: any) { + public initializeV1(initializeRequest?: InitializeRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).initializeV1(initializeRequest, options).then((request) => request(this.axios, this.basePath)); } @@ -877,7 +894,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public newContractV1(newContractRequest?: NewContractRequest, options?: any) { + public newContractV1(newContractRequest?: NewContractRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).newContractV1(newContractRequest, options).then((request) => request(this.axios, this.basePath)); } @@ -889,7 +906,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public refundV1(refundRequest?: RefundRequest, options?: any) { + public refundV1(refundRequest?: RefundRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).refundV1(refundRequest, options).then((request) => request(this.axios, this.basePath)); } @@ -901,7 +918,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public withdrawV1(withdrawRequest?: WithdrawRequest, options?: any) { + public withdrawV1(withdrawRequest?: WithdrawRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).withdrawV1(withdrawRequest, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/base.ts index 8e33addbf6..78b90aa55c 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/common.ts index 187494c5d1..bb183fc748 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; } diff --git a/packages/cactus-plugin-htlc-eth-besu/openapitools.json b/packages/cactus-plugin-htlc-eth-besu/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/packages/cactus-plugin-htlc-eth-besu/openapitools.json +++ b/packages/cactus-plugin-htlc-eth-besu/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/api.ts index 613aaba70f..41403a5368 100644 --- a/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * Defines the parameters for retrieving the single status of the HTLC swap. @@ -32,25 +34,25 @@ export interface GetSingleStatusRequest { * @type {string} * @memberof GetSingleStatusRequest */ - id: string; + 'id': string; /** * * @type {Web3SigningCredential} * @memberof GetSingleStatusRequest */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * * @type {string} * @memberof GetSingleStatusRequest */ - connectorId: string; + 'connectorId': string; /** * * @type {string} * @memberof GetSingleStatusRequest */ - keychainId: string; + 'keychainId': string; } /** * Defines the parameters for retrieving the status of the HTLC swap. @@ -63,25 +65,25 @@ export interface GetStatusRequest { * @type {Array} * @memberof GetStatusRequest */ - ids: Array; + 'ids': Array; /** * * @type {Web3SigningCredential} * @memberof GetStatusRequest */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * * @type {string} * @memberof GetStatusRequest */ - connectorId: string; + 'connectorId': string; /** * * @type {string} * @memberof GetStatusRequest */ - keychainId: string; + 'keychainId': string; } /** * @@ -94,31 +96,31 @@ export interface InitializeRequest { * @type {string} * @memberof InitializeRequest */ - connectorId: string; + 'connectorId': string; /** * keychainId for the keychain plugin * @type {string} * @memberof InitializeRequest */ - keychainId: string; + 'keychainId': string; /** * * @type {Array} * @memberof InitializeRequest */ - constructorArgs: Array; + 'constructorArgs': Array; /** * * @type {Web3SigningCredential} * @memberof InitializeRequest */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * * @type {number} * @memberof InitializeRequest */ - gas?: number; + 'gas'?: number; } /** * @@ -131,19 +133,19 @@ export interface InvokeContractV1Response { * @type {Web3TransactionReceipt} * @memberof InvokeContractV1Response */ - transactionReceipt?: Web3TransactionReceipt; + 'transactionReceipt'?: Web3TransactionReceipt; /** * * @type {any} * @memberof InvokeContractV1Response */ - callOutput?: any | null; + 'callOutput'?: any; /** * * @type {boolean} * @memberof InvokeContractV1Response */ - success: boolean; + 'success': boolean; } /** * @@ -156,74 +158,80 @@ export interface NewContractObj { * @type {string} * @memberof NewContractObj */ - contractAddress: string; + 'contractAddress': string; /** * * @type {number} * @memberof NewContractObj */ - inputAmount?: number; + 'inputAmount'?: number; /** * * @type {number} * @memberof NewContractObj */ - outputAmount: number; + 'outputAmount': number; /** * * @type {number} * @memberof NewContractObj */ - expiration: number; + 'expiration': number; /** * * @type {string} * @memberof NewContractObj */ - hashLock: string; + 'hashLock': string; /** * * @type {string} * @memberof NewContractObj */ - receiver?: string; + 'receiver'?: string; /** * * @type {string} * @memberof NewContractObj */ - outputNetwork: string; + 'outputNetwork': string; /** * * @type {string} * @memberof NewContractObj */ - outputAddress: string; + 'outputAddress': string; /** * connectorId for the connector besu plugin * @type {string} * @memberof NewContractObj */ - connectorId: string; + 'connectorId': string; /** * * @type {Web3SigningCredential} * @memberof NewContractObj */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * keychainId for the keychian plugin * @type {string} * @memberof NewContractObj */ - keychainId: string; + 'keychainId': string; /** * - * @type {string | number} + * @type {NewContractObjGas} * @memberof NewContractObj */ - gas?: string | number; + 'gas'?: NewContractObjGas; } +/** + * @type NewContractObjGas + * @export + */ +export type NewContractObjGas = number | string; + /** * * @export @@ -235,31 +243,31 @@ export interface RefundReq { * @type {string} * @memberof RefundReq */ - id: string; + 'id': string; /** * * @type {Web3SigningCredential} * @memberof RefundReq */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * connectorId for the connector besu plugin * @type {string} * @memberof RefundReq */ - connectorId: string; + 'connectorId': string; /** * keychainId for the keychain plugin * @type {string} * @memberof RefundReq */ - keychainId: string; + 'keychainId': string; /** * - * @type {string | number} + * @type {NewContractObjGas} * @memberof RefundReq */ - gas?: string | number; + 'gas'?: NewContractObjGas; } /** * @@ -272,7 +280,7 @@ export interface RunTransactionResponse { * @type {Web3TransactionReceipt} * @memberof RunTransactionResponse */ - transactionReceipt: Web3TransactionReceipt; + 'transactionReceipt': Web3TransactionReceipt; } /** * @type Web3SigningCredential @@ -291,26 +299,28 @@ export interface Web3SigningCredentialCactusKeychainRef { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialCactusKeychainRef */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; /** * The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication. * @type {string} * @memberof Web3SigningCredentialCactusKeychainRef */ - ethAccount: string; + 'ethAccount': string; /** * The key to use when looking up the the keychain entry holding the secret pointed to by the keychainEntryKey parameter. * @type {string} * @memberof Web3SigningCredentialCactusKeychainRef */ - keychainEntryKey: string; + 'keychainEntryKey': string; /** * The keychain ID to use when looking up the the keychain plugin instance that will be used to retrieve the secret pointed to by the keychainEntryKey parameter. * @type {string} * @memberof Web3SigningCredentialCactusKeychainRef */ - keychainId: string; + 'keychainId': string; } + + /** * Using this denotes that there is no signing required because the transaction is pre-signed. * @export @@ -322,8 +332,10 @@ export interface Web3SigningCredentialNone { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialNone */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; } + + /** * * @export @@ -335,32 +347,37 @@ export interface Web3SigningCredentialPrivateKeyHex { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialPrivateKeyHex */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; /** * The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication. * @type {string} * @memberof Web3SigningCredentialPrivateKeyHex */ - ethAccount: string; + 'ethAccount': string; /** * The HEX encoded private key of an eth account. * @type {string} * @memberof Web3SigningCredentialPrivateKeyHex */ - secret: string; + 'secret': string; } + + /** * * @export * @enum {string} */ -export enum Web3SigningCredentialType { - CactusKeychainRef = 'CACTUS_KEYCHAIN_REF', - GethKeychainPassword = 'GETH_KEYCHAIN_PASSWORD', - PrivateKeyHex = 'PRIVATE_KEY_HEX', - None = 'NONE' -} +export const Web3SigningCredentialType = { + CactusKeychainRef: 'CACTUS_KEYCHAIN_REF', + GethKeychainPassword: 'GETH_KEYCHAIN_PASSWORD', + PrivateKeyHex: 'PRIVATE_KEY_HEX', + None: 'NONE' +} as const; + +export type Web3SigningCredentialType = typeof Web3SigningCredentialType[keyof typeof Web3SigningCredentialType]; + /** * @@ -368,62 +385,62 @@ export enum Web3SigningCredentialType { * @interface Web3TransactionReceipt */ export interface Web3TransactionReceipt { - [key: string]: object | any; + [key: string]: any; /** * * @type {boolean} * @memberof Web3TransactionReceipt */ - status: boolean; + 'status': boolean; /** * * @type {string} * @memberof Web3TransactionReceipt */ - transactionHash: string; + 'transactionHash': string; /** * * @type {number} * @memberof Web3TransactionReceipt */ - transactionIndex: number; + 'transactionIndex': number; /** * * @type {string} * @memberof Web3TransactionReceipt */ - blockHash: string; + 'blockHash': string; /** * * @type {number} * @memberof Web3TransactionReceipt */ - blockNumber: number; + 'blockNumber': number; /** * * @type {number} * @memberof Web3TransactionReceipt */ - gasUsed: number; + 'gasUsed': number; /** * * @type {string} * @memberof Web3TransactionReceipt */ - contractAddress?: string | null; + 'contractAddress'?: string | null; /** * * @type {string} * @memberof Web3TransactionReceipt */ - from: string; + 'from': string; /** * * @type {string} * @memberof Web3TransactionReceipt */ - to: string; + 'to': string; } /** * @@ -436,37 +453,37 @@ export interface WithdrawReq { * @type {string} * @memberof WithdrawReq */ - id: string; + 'id': string; /** * Secret need to unlock the contract * @type {string} * @memberof WithdrawReq */ - secret: string; + 'secret': string; /** * * @type {Web3SigningCredential} * @memberof WithdrawReq */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * connectorId for the connector besu plugin * @type {string} * @memberof WithdrawReq */ - connectorId: string; + 'connectorId': string; /** * keychainId for the keychain plugin * @type {string} * @memberof WithdrawReq */ - keychainId: string; + 'keychainId': string; /** * - * @type {string | number} + * @type {NewContractObjGas} * @memberof WithdrawReq */ - gas?: string | number; + 'gas'?: NewContractObjGas; } /** @@ -481,7 +498,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getSingleStatusV1: async (getSingleStatusRequest?: GetSingleStatusRequest, options: any = {}): Promise => { + getSingleStatusV1: async (getSingleStatusRequest?: GetSingleStatusRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/get-single-status`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -498,7 +515,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(getSingleStatusRequest, localVarRequestOptions, configuration) @@ -514,7 +531,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getStatusV1: async (getStatusRequest?: GetStatusRequest, options: any = {}): Promise => { + getStatusV1: async (getStatusRequest?: GetStatusRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/get-status`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -531,7 +548,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(getStatusRequest, localVarRequestOptions, configuration) @@ -547,7 +564,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - initializeV1: async (initializeRequest?: InitializeRequest, options: any = {}): Promise => { + initializeV1: async (initializeRequest?: InitializeRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/initialize`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -564,7 +581,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(initializeRequest, localVarRequestOptions, configuration) @@ -580,7 +597,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - newContractV1: async (newContractObj?: NewContractObj, options: any = {}): Promise => { + newContractV1: async (newContractObj?: NewContractObj, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/new-contract`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -597,7 +614,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(newContractObj, localVarRequestOptions, configuration) @@ -613,7 +630,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - refundV1: async (refundReq?: RefundReq, options: any = {}): Promise => { + refundV1: async (refundReq?: RefundReq, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/refund`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -630,7 +647,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(refundReq, localVarRequestOptions, configuration) @@ -646,7 +663,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - withdrawV1: async (withdrawReq?: WithdrawReq, options: any = {}): Promise => { + withdrawV1: async (withdrawReq?: WithdrawReq, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/withdraw`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -663,7 +680,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(withdrawReq, localVarRequestOptions, configuration) @@ -689,7 +706,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getSingleStatusV1(getSingleStatusRequest?: GetSingleStatusRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getSingleStatusV1(getSingleStatusRequest?: GetSingleStatusRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getSingleStatusV1(getSingleStatusRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -699,7 +716,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getStatusV1(getStatusRequest?: GetStatusRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + async getStatusV1(getStatusRequest?: GetStatusRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.getStatusV1(getStatusRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -709,7 +726,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async initializeV1(initializeRequest?: InitializeRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async initializeV1(initializeRequest?: InitializeRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.initializeV1(initializeRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -719,7 +736,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async newContractV1(newContractObj?: NewContractObj, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async newContractV1(newContractObj?: NewContractObj, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.newContractV1(newContractObj, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -729,7 +746,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async refundV1(refundReq?: RefundReq, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async refundV1(refundReq?: RefundReq, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.refundV1(refundReq, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -739,7 +756,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async withdrawV1(withdrawReq?: WithdrawReq, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async withdrawV1(withdrawReq?: WithdrawReq, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.withdrawV1(withdrawReq, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -824,7 +841,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getSingleStatusV1(getSingleStatusRequest?: GetSingleStatusRequest, options?: any) { + public getSingleStatusV1(getSingleStatusRequest?: GetSingleStatusRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getSingleStatusV1(getSingleStatusRequest, options).then((request) => request(this.axios, this.basePath)); } @@ -835,7 +852,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getStatusV1(getStatusRequest?: GetStatusRequest, options?: any) { + public getStatusV1(getStatusRequest?: GetStatusRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getStatusV1(getStatusRequest, options).then((request) => request(this.axios, this.basePath)); } @@ -846,7 +863,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public initializeV1(initializeRequest?: InitializeRequest, options?: any) { + public initializeV1(initializeRequest?: InitializeRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).initializeV1(initializeRequest, options).then((request) => request(this.axios, this.basePath)); } @@ -857,7 +874,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public newContractV1(newContractObj?: NewContractObj, options?: any) { + public newContractV1(newContractObj?: NewContractObj, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).newContractV1(newContractObj, options).then((request) => request(this.axios, this.basePath)); } @@ -868,7 +885,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public refundV1(refundReq?: RefundReq, options?: any) { + public refundV1(refundReq?: RefundReq, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).refundV1(refundReq, options).then((request) => request(this.axios, this.basePath)); } @@ -879,7 +896,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public withdrawV1(withdrawReq?: WithdrawReq, options?: any) { + public withdrawV1(withdrawReq?: WithdrawReq, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).withdrawV1(withdrawReq, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/base.ts index 153947125e..532b7df2db 100644 --- a/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/common.ts index f97c3d9e39..6336847822 100644 --- a/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; } diff --git a/packages/cactus-plugin-keychain-aws-sm/openapitools.json b/packages/cactus-plugin-keychain-aws-sm/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/packages/cactus-plugin-keychain-aws-sm/openapitools.json +++ b/packages/cactus-plugin-keychain-aws-sm/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES index e6344b6dd3..15e43f61f3 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -6,7 +6,7 @@ settings.gradle src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -14,6 +14,7 @@ src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/README.md index 22ca388a2f..8f6055b7e4 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -1,9 +1,18 @@ # org.openapitools.client - Kotlin client library for Hyperledger Cactus - Keychain API +Contains/describes the Keychain API types/paths for Hyperledger Cactus. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 0.3.0 +- Package version: +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + ## Requires -* Kotlin 1.4.30 -* Gradle 6.8.3 +* Kotlin 1.7.21 +* Gradle 7.5 ## Build diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/build.gradle b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/build.gradle index 3de8b45b13..66a3c68b89 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/build.gradle +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/build.gradle @@ -2,12 +2,12 @@ group 'org.openapitools' version '1.0.0' wrapper { - gradleVersion = '6.8.3' + gradleVersion = '7.5' distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } buildscript { - ext.kotlin_version = '1.5.10' + ext.kotlin_version = '1.7.21' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -18,6 +18,7 @@ buildscript { } apply plugin: 'kotlin' +apply plugin: 'maven-publish' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -30,8 +31,8 @@ test { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "com.squareup.moshi:moshi-kotlin:1.12.0" - implementation "com.squareup.moshi:moshi-adapters:1.12.0" - implementation "com.squareup.okhttp3:okhttp:4.9.1" + implementation "com.squareup.moshi:moshi-kotlin:1.13.0" + implementation "com.squareup.moshi:moshi-adapters:1.13.0" + implementation "com.squareup.okhttp3:okhttp:4.10.0" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 078e4926f5..2a7fc00071 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -20,6 +15,10 @@ package org.openapitools.client.apis +import java.io.IOException +import okhttp3.OkHttpClient +import okhttp3.HttpUrl + import org.openapitools.client.models.DeleteKeychainEntryRequestV1 import org.openapitools.client.models.DeleteKeychainEntryResponseV1 import org.openapitools.client.models.GetKeychainEntryRequestV1 @@ -29,43 +28,45 @@ import org.openapitools.client.models.HasKeychainEntryResponseV1 import org.openapitools.client.models.SetKeychainEntryRequestV1 import org.openapitools.client.models.SetKeychainEntryResponseV1 +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://localhost") + System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost") } } /** - * Deletes an entry under a key on the keychain backend. - * - * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key - * @return DeleteKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Deletes an entry under a key on the keychain backend. + * + * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key + * @return DeleteKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1) : DeleteKeychainEntryResponseV1 { - val localVariableConfig = deleteKeychainEntryV1RequestConfig(deleteKeychainEntryRequestV1 = deleteKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = deleteKeychainEntryV1WithHttpInfo(deleteKeychainEntryRequestV1 = deleteKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as DeleteKeychainEntryResponseV1 @@ -83,42 +84,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation deleteKeychainEntryV1 - * - * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key - * @return RequestConfig - */ + * Deletes an entry under a key on the keychain backend. + * + * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun deleteKeychainEntryV1WithHttpInfo(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1) : ApiResponse { + val localVariableConfig = deleteKeychainEntryV1RequestConfig(deleteKeychainEntryRequestV1 = deleteKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation deleteKeychainEntryV1 + * + * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key + * @return RequestConfig + */ fun deleteKeychainEntryV1RequestConfig(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1) : RequestConfig { val localVariableBody = deleteKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/delete-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Retrieves the contents of a keychain entry from the backend. - * - * @param getKeychainEntryRequestV1 Request body to obtain a keychain entry via its key - * @return GetKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Retrieves the contents of a keychain entry from the backend. + * + * @param getKeychainEntryRequestV1 Request body to obtain a keychain entry via its key + * @return GetKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getKeychainEntryV1(getKeychainEntryRequestV1: GetKeychainEntryRequestV1) : GetKeychainEntryResponseV1 { - val localVariableConfig = getKeychainEntryV1RequestConfig(getKeychainEntryRequestV1 = getKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = getKeychainEntryV1WithHttpInfo(getKeychainEntryRequestV1 = getKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as GetKeychainEntryResponseV1 @@ -136,41 +156,60 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation getKeychainEntryV1 - * - * @param getKeychainEntryRequestV1 Request body to obtain a keychain entry via its key - * @return RequestConfig - */ + * Retrieves the contents of a keychain entry from the backend. + * + * @param getKeychainEntryRequestV1 Request body to obtain a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getKeychainEntryV1WithHttpInfo(getKeychainEntryRequestV1: GetKeychainEntryRequestV1) : ApiResponse { + val localVariableConfig = getKeychainEntryV1RequestConfig(getKeychainEntryRequestV1 = getKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getKeychainEntryV1 + * + * @param getKeychainEntryRequestV1 Request body to obtain a keychain entry via its key + * @return RequestConfig + */ fun getKeychainEntryV1RequestConfig(getKeychainEntryRequestV1: GetKeychainEntryRequestV1) : RequestConfig { val localVariableBody = getKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/get-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Get the Prometheus Metrics - * - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Get the Prometheus Metrics + * + * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPrometheusMetricsV1() : kotlin.String { - val localVariableConfig = getPrometheusMetricsV1RequestConfig() - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = getPrometheusMetricsV1WithHttpInfo() return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String @@ -188,41 +227,57 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation getPrometheusMetricsV1 - * - * @return RequestConfig - */ + * Get the Prometheus Metrics + * + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getPrometheusMetricsV1WithHttpInfo() : ApiResponse { + val localVariableConfig = getPrometheusMetricsV1RequestConfig() + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getPrometheusMetricsV1 + * + * @return RequestConfig + */ fun getPrometheusMetricsV1RequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/get-prometheus-exporter-metrics", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Checks that an entry exists under a key on the keychain backend - * - * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key - * @return HasKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Checks that an entry exists under a key on the keychain backend + * + * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key + * @return HasKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1) : HasKeychainEntryResponseV1 { - val localVariableConfig = hasKeychainEntryV1RequestConfig(hasKeychainEntryRequestV1 = hasKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = hasKeychainEntryV1WithHttpInfo(hasKeychainEntryRequestV1 = hasKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as HasKeychainEntryResponseV1 @@ -240,42 +295,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation hasKeychainEntryV1 - * - * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key - * @return RequestConfig - */ + * Checks that an entry exists under a key on the keychain backend + * + * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun hasKeychainEntryV1WithHttpInfo(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1) : ApiResponse { + val localVariableConfig = hasKeychainEntryV1RequestConfig(hasKeychainEntryRequestV1 = hasKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation hasKeychainEntryV1 + * + * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key + * @return RequestConfig + */ fun hasKeychainEntryV1RequestConfig(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1) : RequestConfig { val localVariableBody = hasKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/has-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Sets a value under a key on the keychain backend. - * - * @param setKeychainEntryRequestV1 Request body to write/update a keychain entry via its key - * @return SetKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Sets a value under a key on the keychain backend. + * + * @param setKeychainEntryRequestV1 Request body to write/update a keychain entry via its key + * @return SetKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun setKeychainEntryV1(setKeychainEntryRequestV1: SetKeychainEntryRequestV1) : SetKeychainEntryResponseV1 { - val localVariableConfig = setKeychainEntryV1RequestConfig(setKeychainEntryRequestV1 = setKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = setKeychainEntryV1WithHttpInfo(setKeychainEntryRequestV1 = setKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as SetKeychainEntryResponseV1 @@ -293,23 +367,47 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation setKeychainEntryV1 - * - * @param setKeychainEntryRequestV1 Request body to write/update a keychain entry via its key - * @return RequestConfig - */ + * Sets a value under a key on the keychain backend. + * + * @param setKeychainEntryRequestV1 Request body to write/update a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun setKeychainEntryV1WithHttpInfo(setKeychainEntryRequestV1: SetKeychainEntryRequestV1) : ApiResponse { + val localVariableConfig = setKeychainEntryV1RequestConfig(setKeychainEntryRequestV1 = setKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation setKeychainEntryV1 + * + * @param setKeychainEntryRequestV1 Request body to write/update a keychain entry via its key + * @return RequestConfig + */ fun setKeychainEntryV1RequestConfig(setKeychainEntryRequestV1: SetKeychainEntryRequestV1) : RequestConfig { val localVariableBody = setKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/set-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index b359be1e41..757080d7ed 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -10,21 +10,26 @@ import okhttp3.ResponseBody import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import okhttp3.Headers +import okhttp3.Headers.Companion.toHeaders import okhttp3.MultipartBody +import okhttp3.Call +import okhttp3.Callback +import okhttp3.Response +import okhttp3.internal.EMPTY_REQUEST import java.io.BufferedWriter import java.io.File import java.io.FileWriter +import java.io.IOException import java.net.URLConnection import java.time.LocalDate import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter -open class ApiClient(val baseUrl: String) { +open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) { companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" @@ -39,9 +44,10 @@ open class ApiClient(val baseUrl: String) { var username: String? = null var password: String? = null var accessToken: String? = null + const val baseUrlKey = "org.openapitools.client.baseUrl" @JvmStatic - val client: OkHttpClient by lazy { + val defaultClient: OkHttpClient by lazy { builder.build() } @@ -60,48 +66,50 @@ open class ApiClient(val baseUrl: String) { return contentType ?: "application/octet-stream" } - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + protected inline fun requestBody(content: T, mediaType: String?): RequestBody = when { - content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull()) - mediaType == FormDataMediaType -> { + content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) + mediaType == FormDataMediaType -> MultipartBody.Builder() .setType(MultipartBody.FORM) .apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" + (content as Map>).forEach { (name, part) -> + if (part.body is File) { + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${part.body.name}\"") + val fileMediaType = guessContentTypeFromFile(part.body).toMediaTypeOrNull() + addPart( + partHeaders.toHeaders(), + part.body.asRequestBody(fileMediaType) ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"") addPart( - partHeaders, - parameterToString(value).toRequestBody(null) + partHeaders.toHeaders(), + parameterToString(part.body).toRequestBody(null) ) } } }.build() - } mediaType == FormUrlEncMediaType -> { FormBody.Builder().apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) + (content as Map>).forEach { (name, part) -> + add(name, parameterToString(part.body)) } }.build() } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) + mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> + if (content == null) { + EMPTY_REQUEST + } else { + Serializer.moshi.adapter(T::class.java).toJson(content) + .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) + } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -112,31 +120,35 @@ open class ApiClient(val baseUrl: String) { if(body == null) { return null } + if (T::class.java == File::class.java) { + // return tempFile + // Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options + val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() + tempFile.deleteOnExit() + body.byteStream().use { inputStream -> + tempFile.outputStream().use { tempFileOutputStream -> + inputStream.copyTo(tempFileOutputStream) + } + } + return tempFile as T + } val bodyContent = body.string() if (bodyContent.isEmpty()) { return null } - if (T::class.java == File::class.java) { - // return tempfile - val f = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() - f.deleteOnExit() - val out = BufferedWriter(FileWriter(f)) - out.write(bodyContent) - out.close() - return f as T - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) + .addEncodedPathSegments(requestConfig.path.trimStart('/')) .apply { requestConfig.query.forEach { query -> query.value.forEach { queryValue -> @@ -146,7 +158,7 @@ open class ApiClient(val baseUrl: String) { }.build() // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { + if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) { requestConfig.headers[ContentType] = JsonMediaType } if (requestConfig.headers[Accept].isNullOrEmpty()) { @@ -154,16 +166,16 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { + if (headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + val contentType = if (headers[ContentType] != null) { + // TODO: support multiple contentType options here. + (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + } else { + null + } val request = when (requestConfig.method) { RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) @@ -178,6 +190,7 @@ open class ApiClient(val baseUrl: String) { }.build() val response = client.newCall(request).execute() + val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault()) // TODO: handle specific mapping types. e.g. Map> @@ -215,7 +228,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 0000000000..cf2cfaa95d --- /dev/null +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt index fb2c972cf8..064b57fc6b 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt @@ -14,4 +14,4 @@ class BigDecimalAdapter { fun fromJson(value: String): BigDecimal { return BigDecimal(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt index 4b6963110c..7df6057b45 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt @@ -14,4 +14,4 @@ class BigIntegerAdapter { fun fromJson(value: String): BigInteger { return BigInteger(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 0000000000..be00e38fba --- /dev/null +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 7e948e1dd0..625a19002b 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -13,5 +13,6 @@ data class RequestConfig( val path: String, val headers: MutableMap = mutableMapOf(), val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, val body: T? = null ) \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt index 5b4e9c380e..058005f566 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key for the entry to check the presence of on the keychain. */ + data class DeleteKeychainEntryRequestV1 ( /* The key for the entry to check the presence of on the keychain. */ diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt index 3af6fe8305..ac544c44ef 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key that was deleted from the keychain. */ + data class DeleteKeychainEntryResponseV1 ( /* The key that was deleted from the keychain. */ diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt index 960a641c44..82f324d68f 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key for the entry to get from the keychain. */ + data class GetKeychainEntryRequestV1 ( /* The key for the entry to get from the keychain. */ diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt index 182085b6c9..294cc6d743 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value associated with the requested key on the keychain. */ + data class GetKeychainEntryResponseV1 ( /* The key that was used to retrieve the value from the keychain. */ diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt index 71dee33cb6..4f7b976c95 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key to check for presence in the keychain. */ + data class HasKeychainEntryRequestV1 ( /* The key to check for presence in the keychain. */ diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt index a59f3ed94b..34f773aea5 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -31,6 +26,7 @@ import com.squareup.moshi.Json * @param isPresent The boolean true or false indicating the presence or absence of an entry under 'key'. */ + data class HasKeychainEntryResponseV1 ( /* The key that was used to check the presence of the value in the entry store. */ diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt index cee6721377..b02d8928b9 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value that will be associated with the key on the keychain. */ + data class SetKeychainEntryRequestV1 ( /* The key for the entry to set on the keychain. */ diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt index 3a6c956f38..32c97773c4 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key that was used to set the value on the keychain. */ + data class SetKeychainEntryResponseV1 ( /* The key that was used to set the value on the keychain. */ diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/api.ts index 4353d01b22..216dcc2274 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * @@ -32,7 +34,7 @@ export interface DeleteKeychainEntryRequestV1 { * @type {string} * @memberof DeleteKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -45,7 +47,7 @@ export interface DeleteKeychainEntryResponseV1 { * @type {string} * @memberof DeleteKeychainEntryResponseV1 */ - key: string; + 'key': string; } /** * @@ -58,7 +60,7 @@ export interface GetKeychainEntryRequestV1 { * @type {string} * @memberof GetKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -71,13 +73,13 @@ export interface GetKeychainEntryResponseV1 { * @type {string} * @memberof GetKeychainEntryResponseV1 */ - key: string; + 'key': string; /** * The value associated with the requested key on the keychain. * @type {string} * @memberof GetKeychainEntryResponseV1 */ - value: string; + 'value': string; } /** * @@ -90,7 +92,7 @@ export interface HasKeychainEntryRequestV1 { * @type {string} * @memberof HasKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -103,19 +105,19 @@ export interface HasKeychainEntryResponseV1 { * @type {string} * @memberof HasKeychainEntryResponseV1 */ - key: string; + 'key': string; /** * Date and time encoded as JSON when the presence check was performed by the plugin backend. * @type {string} * @memberof HasKeychainEntryResponseV1 */ - checkedAt: string; + 'checkedAt': string; /** * The boolean true or false indicating the presence or absence of an entry under \'key\'. * @type {boolean} * @memberof HasKeychainEntryResponseV1 */ - isPresent: boolean; + 'isPresent': boolean; } /** * @@ -128,13 +130,13 @@ export interface SetKeychainEntryRequestV1 { * @type {string} * @memberof SetKeychainEntryRequestV1 */ - key: string; + 'key': string; /** * The value that will be associated with the key on the keychain. * @type {string} * @memberof SetKeychainEntryRequestV1 */ - value: string; + 'value': string; } /** * @@ -147,7 +149,7 @@ export interface SetKeychainEntryResponseV1 { * @type {string} * @memberof SetKeychainEntryResponseV1 */ - key: string; + 'key': string; } /** @@ -163,7 +165,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteKeychainEntryV1: async (deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options: any = {}): Promise => { + deleteKeychainEntryV1: async (deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'deleteKeychainEntryRequestV1' is not null or undefined assertParamExists('deleteKeychainEntryV1', 'deleteKeychainEntryRequestV1', deleteKeychainEntryRequestV1) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/delete-keychain-entry`; @@ -182,7 +184,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(deleteKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -199,7 +201,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getKeychainEntryV1: async (getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options: any = {}): Promise => { + getKeychainEntryV1: async (getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'getKeychainEntryRequestV1' is not null or undefined assertParamExists('getKeychainEntryV1', 'getKeychainEntryRequestV1', getKeychainEntryRequestV1) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/get-keychain-entry`; @@ -218,7 +220,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(getKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -234,7 +236,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getPrometheusMetricsV1: async (options: any = {}): Promise => { + getPrometheusMetricsV1: async (options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/get-prometheus-exporter-metrics`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -249,7 +251,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -265,7 +267,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - hasKeychainEntryV1: async (hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options: any = {}): Promise => { + hasKeychainEntryV1: async (hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'hasKeychainEntryRequestV1' is not null or undefined assertParamExists('hasKeychainEntryV1', 'hasKeychainEntryRequestV1', hasKeychainEntryRequestV1) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/has-keychain-entry`; @@ -284,7 +286,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(hasKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -301,7 +303,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - setKeychainEntryV1: async (setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options: any = {}): Promise => { + setKeychainEntryV1: async (setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'setKeychainEntryRequestV1' is not null or undefined assertParamExists('setKeychainEntryV1', 'setKeychainEntryRequestV1', setKeychainEntryRequestV1) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/set-keychain-entry`; @@ -320,7 +322,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(setKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -347,7 +349,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.deleteKeychainEntryV1(deleteKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -358,7 +360,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getKeychainEntryV1(getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getKeychainEntryV1(getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getKeychainEntryV1(getKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -368,7 +370,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getPrometheusMetricsV1(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getPrometheusMetricsV1(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getPrometheusMetricsV1(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -379,7 +381,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.hasKeychainEntryV1(hasKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -390,7 +392,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async setKeychainEntryV1(setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async setKeychainEntryV1(setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.setKeychainEntryV1(setKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -471,7 +473,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: any) { + public deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).deleteKeychainEntryV1(deleteKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } @@ -483,7 +485,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getKeychainEntryV1(getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options?: any) { + public getKeychainEntryV1(getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getKeychainEntryV1(getKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } @@ -494,7 +496,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getPrometheusMetricsV1(options?: any) { + public getPrometheusMetricsV1(options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getPrometheusMetricsV1(options).then((request) => request(this.axios, this.basePath)); } @@ -506,7 +508,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: any) { + public hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).hasKeychainEntryV1(hasKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } @@ -518,7 +520,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public setKeychainEntryV1(setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options?: any) { + public setKeychainEntryV1(setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).setKeychainEntryV1(setKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/base.ts index 5bdd7d5a90..51fa22c30d 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/common.ts index 551dfb0d3c..e6d53f3c0f 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; } diff --git a/packages/cactus-plugin-keychain-azure-kv/openapitools.json b/packages/cactus-plugin-keychain-azure-kv/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/packages/cactus-plugin-keychain-azure-kv/openapitools.json +++ b/packages/cactus-plugin-keychain-azure-kv/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES index 94ba8f1f2c..abca8b0131 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -6,7 +6,7 @@ settings.gradle src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -14,6 +14,7 @@ src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/README.md index ed13c0bdd3..d3c3b496d9 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -1,9 +1,18 @@ # org.openapitools.client - Kotlin client library for Hyperledger Cactus - Keychain API +Contains/describes the Keychain API types/paths for Hyperledger Cactus. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 0.3.0 +- Package version: +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + ## Requires -* Kotlin 1.4.30 -* Gradle 6.8.3 +* Kotlin 1.7.21 +* Gradle 7.5 ## Build diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/build.gradle b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/build.gradle index 3de8b45b13..66a3c68b89 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/build.gradle +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/build.gradle @@ -2,12 +2,12 @@ group 'org.openapitools' version '1.0.0' wrapper { - gradleVersion = '6.8.3' + gradleVersion = '7.5' distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } buildscript { - ext.kotlin_version = '1.5.10' + ext.kotlin_version = '1.7.21' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -18,6 +18,7 @@ buildscript { } apply plugin: 'kotlin' +apply plugin: 'maven-publish' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -30,8 +31,8 @@ test { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "com.squareup.moshi:moshi-kotlin:1.12.0" - implementation "com.squareup.moshi:moshi-adapters:1.12.0" - implementation "com.squareup.okhttp3:okhttp:4.9.1" + implementation "com.squareup.moshi:moshi-kotlin:1.13.0" + implementation "com.squareup.moshi:moshi-adapters:1.13.0" + implementation "com.squareup.okhttp3:okhttp:4.10.0" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 63a9934c2d..5ae53b8f8b 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -20,6 +15,10 @@ package org.openapitools.client.apis +import java.io.IOException +import okhttp3.OkHttpClient +import okhttp3.HttpUrl + import org.openapitools.client.models.DeleteKeychainEntryRequestV1 import org.openapitools.client.models.DeleteKeychainEntryResponseV1 import org.openapitools.client.models.GetKeychainEntryRequest @@ -29,43 +28,45 @@ import org.openapitools.client.models.HasKeychainEntryResponseV1 import org.openapitools.client.models.SetKeychainEntryRequest import org.openapitools.client.models.SetKeychainEntryResponse +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://localhost") + System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost") } } /** - * Deletes a value under a key on the keychain backend. - * - * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key - * @return DeleteKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Deletes a value under a key on the keychain backend. + * + * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key + * @return DeleteKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1) : DeleteKeychainEntryResponseV1 { - val localVariableConfig = deleteKeychainEntryV1RequestConfig(deleteKeychainEntryRequestV1 = deleteKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = deleteKeychainEntryV1WithHttpInfo(deleteKeychainEntryRequestV1 = deleteKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as DeleteKeychainEntryResponseV1 @@ -83,42 +84,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation deleteKeychainEntryV1 - * - * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key - * @return RequestConfig - */ + * Deletes a value under a key on the keychain backend. + * + * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun deleteKeychainEntryV1WithHttpInfo(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1) : ApiResponse { + val localVariableConfig = deleteKeychainEntryV1RequestConfig(deleteKeychainEntryRequestV1 = deleteKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation deleteKeychainEntryV1 + * + * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key + * @return RequestConfig + */ fun deleteKeychainEntryV1RequestConfig(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1) : RequestConfig { val localVariableBody = deleteKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/delete-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Retrieves the contents of a keychain entry from the backend. - * - * @param getKeychainEntryRequest Request body to obtain a keychain entry via its key - * @return GetKeychainEntryResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Retrieves the contents of a keychain entry from the backend. + * + * @param getKeychainEntryRequest Request body to obtain a keychain entry via its key + * @return GetKeychainEntryResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getKeychainEntryV1(getKeychainEntryRequest: GetKeychainEntryRequest) : GetKeychainEntryResponse { - val localVariableConfig = getKeychainEntryV1RequestConfig(getKeychainEntryRequest = getKeychainEntryRequest) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = getKeychainEntryV1WithHttpInfo(getKeychainEntryRequest = getKeychainEntryRequest) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as GetKeychainEntryResponse @@ -136,42 +156,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation getKeychainEntryV1 - * - * @param getKeychainEntryRequest Request body to obtain a keychain entry via its key - * @return RequestConfig - */ + * Retrieves the contents of a keychain entry from the backend. + * + * @param getKeychainEntryRequest Request body to obtain a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getKeychainEntryV1WithHttpInfo(getKeychainEntryRequest: GetKeychainEntryRequest) : ApiResponse { + val localVariableConfig = getKeychainEntryV1RequestConfig(getKeychainEntryRequest = getKeychainEntryRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getKeychainEntryV1 + * + * @param getKeychainEntryRequest Request body to obtain a keychain entry via its key + * @return RequestConfig + */ fun getKeychainEntryV1RequestConfig(getKeychainEntryRequest: GetKeychainEntryRequest) : RequestConfig { val localVariableBody = getKeychainEntryRequest val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/get-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Checks that an entry exists under a key on the keychain backend - * - * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key - * @return HasKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Checks that an entry exists under a key on the keychain backend + * + * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key + * @return HasKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1) : HasKeychainEntryResponseV1 { - val localVariableConfig = hasKeychainEntryV1RequestConfig(hasKeychainEntryRequestV1 = hasKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = hasKeychainEntryV1WithHttpInfo(hasKeychainEntryRequestV1 = hasKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as HasKeychainEntryResponseV1 @@ -189,42 +228,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation hasKeychainEntryV1 - * - * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key - * @return RequestConfig - */ + * Checks that an entry exists under a key on the keychain backend + * + * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun hasKeychainEntryV1WithHttpInfo(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1) : ApiResponse { + val localVariableConfig = hasKeychainEntryV1RequestConfig(hasKeychainEntryRequestV1 = hasKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation hasKeychainEntryV1 + * + * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key + * @return RequestConfig + */ fun hasKeychainEntryV1RequestConfig(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1) : RequestConfig { val localVariableBody = hasKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/has-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Sets a value under a key on the keychain backend. - * - * @param setKeychainEntryRequest Request body to write/update a keychain entry via its key - * @return SetKeychainEntryResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Sets a value under a key on the keychain backend. + * + * @param setKeychainEntryRequest Request body to write/update a keychain entry via its key + * @return SetKeychainEntryResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun setKeychainEntryV1(setKeychainEntryRequest: SetKeychainEntryRequest) : SetKeychainEntryResponse { - val localVariableConfig = setKeychainEntryV1RequestConfig(setKeychainEntryRequest = setKeychainEntryRequest) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = setKeychainEntryV1WithHttpInfo(setKeychainEntryRequest = setKeychainEntryRequest) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as SetKeychainEntryResponse @@ -242,23 +300,47 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation setKeychainEntryV1 - * - * @param setKeychainEntryRequest Request body to write/update a keychain entry via its key - * @return RequestConfig - */ + * Sets a value under a key on the keychain backend. + * + * @param setKeychainEntryRequest Request body to write/update a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun setKeychainEntryV1WithHttpInfo(setKeychainEntryRequest: SetKeychainEntryRequest) : ApiResponse { + val localVariableConfig = setKeychainEntryV1RequestConfig(setKeychainEntryRequest = setKeychainEntryRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation setKeychainEntryV1 + * + * @param setKeychainEntryRequest Request body to write/update a keychain entry via its key + * @return RequestConfig + */ fun setKeychainEntryV1RequestConfig(setKeychainEntryRequest: SetKeychainEntryRequest) : RequestConfig { val localVariableBody = setKeychainEntryRequest val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/set-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index b359be1e41..757080d7ed 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -10,21 +10,26 @@ import okhttp3.ResponseBody import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import okhttp3.Headers +import okhttp3.Headers.Companion.toHeaders import okhttp3.MultipartBody +import okhttp3.Call +import okhttp3.Callback +import okhttp3.Response +import okhttp3.internal.EMPTY_REQUEST import java.io.BufferedWriter import java.io.File import java.io.FileWriter +import java.io.IOException import java.net.URLConnection import java.time.LocalDate import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter -open class ApiClient(val baseUrl: String) { +open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) { companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" @@ -39,9 +44,10 @@ open class ApiClient(val baseUrl: String) { var username: String? = null var password: String? = null var accessToken: String? = null + const val baseUrlKey = "org.openapitools.client.baseUrl" @JvmStatic - val client: OkHttpClient by lazy { + val defaultClient: OkHttpClient by lazy { builder.build() } @@ -60,48 +66,50 @@ open class ApiClient(val baseUrl: String) { return contentType ?: "application/octet-stream" } - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + protected inline fun requestBody(content: T, mediaType: String?): RequestBody = when { - content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull()) - mediaType == FormDataMediaType -> { + content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) + mediaType == FormDataMediaType -> MultipartBody.Builder() .setType(MultipartBody.FORM) .apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" + (content as Map>).forEach { (name, part) -> + if (part.body is File) { + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${part.body.name}\"") + val fileMediaType = guessContentTypeFromFile(part.body).toMediaTypeOrNull() + addPart( + partHeaders.toHeaders(), + part.body.asRequestBody(fileMediaType) ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"") addPart( - partHeaders, - parameterToString(value).toRequestBody(null) + partHeaders.toHeaders(), + parameterToString(part.body).toRequestBody(null) ) } } }.build() - } mediaType == FormUrlEncMediaType -> { FormBody.Builder().apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) + (content as Map>).forEach { (name, part) -> + add(name, parameterToString(part.body)) } }.build() } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) + mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> + if (content == null) { + EMPTY_REQUEST + } else { + Serializer.moshi.adapter(T::class.java).toJson(content) + .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) + } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -112,31 +120,35 @@ open class ApiClient(val baseUrl: String) { if(body == null) { return null } + if (T::class.java == File::class.java) { + // return tempFile + // Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options + val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() + tempFile.deleteOnExit() + body.byteStream().use { inputStream -> + tempFile.outputStream().use { tempFileOutputStream -> + inputStream.copyTo(tempFileOutputStream) + } + } + return tempFile as T + } val bodyContent = body.string() if (bodyContent.isEmpty()) { return null } - if (T::class.java == File::class.java) { - // return tempfile - val f = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() - f.deleteOnExit() - val out = BufferedWriter(FileWriter(f)) - out.write(bodyContent) - out.close() - return f as T - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) + .addEncodedPathSegments(requestConfig.path.trimStart('/')) .apply { requestConfig.query.forEach { query -> query.value.forEach { queryValue -> @@ -146,7 +158,7 @@ open class ApiClient(val baseUrl: String) { }.build() // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { + if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) { requestConfig.headers[ContentType] = JsonMediaType } if (requestConfig.headers[Accept].isNullOrEmpty()) { @@ -154,16 +166,16 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { + if (headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + val contentType = if (headers[ContentType] != null) { + // TODO: support multiple contentType options here. + (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + } else { + null + } val request = when (requestConfig.method) { RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) @@ -178,6 +190,7 @@ open class ApiClient(val baseUrl: String) { }.build() val response = client.newCall(request).execute() + val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault()) // TODO: handle specific mapping types. e.g. Map> @@ -215,7 +228,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 0000000000..cf2cfaa95d --- /dev/null +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt index fb2c972cf8..064b57fc6b 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt @@ -14,4 +14,4 @@ class BigDecimalAdapter { fun fromJson(value: String): BigDecimal { return BigDecimal(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt index 4b6963110c..7df6057b45 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt @@ -14,4 +14,4 @@ class BigIntegerAdapter { fun fromJson(value: String): BigInteger { return BigInteger(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 0000000000..be00e38fba --- /dev/null +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 7e948e1dd0..625a19002b 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -13,5 +13,6 @@ data class RequestConfig( val path: String, val headers: MutableMap = mutableMapOf(), val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, val body: T? = null ) \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt index 5b4e9c380e..058005f566 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key for the entry to check the presence of on the keychain. */ + data class DeleteKeychainEntryRequestV1 ( /* The key for the entry to check the presence of on the keychain. */ diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt index 3af6fe8305..ac544c44ef 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key that was deleted from the keychain. */ + data class DeleteKeychainEntryResponseV1 ( /* The key that was deleted from the keychain. */ diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequest.kt b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequest.kt index feb1e608e5..f3033d77f5 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequest.kt +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequest.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key for the entry to get from the keychain. */ + data class GetKeychainEntryRequest ( /* The key for the entry to get from the keychain. */ diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponse.kt b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponse.kt index 933a0f99d9..9bdb563426 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponse.kt +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponse.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value associated with the requested key on the keychain. */ + data class GetKeychainEntryResponse ( /* The key that was used to retrieve the value from the keychain. */ diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt index 71dee33cb6..4f7b976c95 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key to check for presence in the keychain. */ + data class HasKeychainEntryRequestV1 ( /* The key to check for presence in the keychain. */ diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt index a59f3ed94b..34f773aea5 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -31,6 +26,7 @@ import com.squareup.moshi.Json * @param isPresent The boolean true or false indicating the presence or absence of an entry under 'key'. */ + data class HasKeychainEntryResponseV1 ( /* The key that was used to check the presence of the value in the entry store. */ diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequest.kt b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequest.kt index 420d2e0bf9..7ec6af0d92 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequest.kt +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequest.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value that will be associated with the key on the keychain. */ + data class SetKeychainEntryRequest ( /* The key for the entry to set on the keychain. */ diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponse.kt b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponse.kt index d29ede67a8..14e5d43237 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponse.kt +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponse.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key that was used to set the value on the keychain. */ + data class SetKeychainEntryResponse ( /* The key that was used to set the value on the keychain. */ diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/api.ts index dc2dc08bc0..1843dd9661 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * @@ -32,7 +34,7 @@ export interface DeleteKeychainEntryRequestV1 { * @type {string} * @memberof DeleteKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -45,7 +47,7 @@ export interface DeleteKeychainEntryResponseV1 { * @type {string} * @memberof DeleteKeychainEntryResponseV1 */ - key: string; + 'key': string; } /** * @@ -58,7 +60,7 @@ export interface GetKeychainEntryRequest { * @type {string} * @memberof GetKeychainEntryRequest */ - key: string; + 'key': string; } /** * @@ -71,13 +73,13 @@ export interface GetKeychainEntryResponse { * @type {string} * @memberof GetKeychainEntryResponse */ - key: string; + 'key': string; /** * The value associated with the requested key on the keychain. * @type {string} * @memberof GetKeychainEntryResponse */ - value: string; + 'value': string; } /** * @@ -90,7 +92,7 @@ export interface HasKeychainEntryRequestV1 { * @type {string} * @memberof HasKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -103,19 +105,19 @@ export interface HasKeychainEntryResponseV1 { * @type {string} * @memberof HasKeychainEntryResponseV1 */ - key: string; + 'key': string; /** * Date and time encoded as JSON when the presence check was performed by the plugin backend. * @type {string} * @memberof HasKeychainEntryResponseV1 */ - checkedAt: string; + 'checkedAt': string; /** * The boolean true or false indicating the presence or absence of an entry under \'key\'. * @type {boolean} * @memberof HasKeychainEntryResponseV1 */ - isPresent: boolean; + 'isPresent': boolean; } /** * @@ -128,13 +130,13 @@ export interface SetKeychainEntryRequest { * @type {string} * @memberof SetKeychainEntryRequest */ - key: string; + 'key': string; /** * The value that will be associated with the key on the keychain. * @type {string} * @memberof SetKeychainEntryRequest */ - value: string; + 'value': string; } /** * @@ -147,7 +149,7 @@ export interface SetKeychainEntryResponse { * @type {string} * @memberof SetKeychainEntryResponse */ - key: string; + 'key': string; } /** @@ -163,7 +165,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteKeychainEntryV1: async (deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options: any = {}): Promise => { + deleteKeychainEntryV1: async (deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'deleteKeychainEntryRequestV1' is not null or undefined assertParamExists('deleteKeychainEntryV1', 'deleteKeychainEntryRequestV1', deleteKeychainEntryRequestV1) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/delete-keychain-entry`; @@ -182,7 +184,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(deleteKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -199,7 +201,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getKeychainEntryV1: async (getKeychainEntryRequest: GetKeychainEntryRequest, options: any = {}): Promise => { + getKeychainEntryV1: async (getKeychainEntryRequest: GetKeychainEntryRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'getKeychainEntryRequest' is not null or undefined assertParamExists('getKeychainEntryV1', 'getKeychainEntryRequest', getKeychainEntryRequest) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/get-keychain-entry`; @@ -218,7 +220,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(getKeychainEntryRequest, localVarRequestOptions, configuration) @@ -235,7 +237,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - hasKeychainEntryV1: async (hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options: any = {}): Promise => { + hasKeychainEntryV1: async (hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'hasKeychainEntryRequestV1' is not null or undefined assertParamExists('hasKeychainEntryV1', 'hasKeychainEntryRequestV1', hasKeychainEntryRequestV1) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/has-keychain-entry`; @@ -254,7 +256,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(hasKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -271,7 +273,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - setKeychainEntryV1: async (setKeychainEntryRequest: SetKeychainEntryRequest, options: any = {}): Promise => { + setKeychainEntryV1: async (setKeychainEntryRequest: SetKeychainEntryRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'setKeychainEntryRequest' is not null or undefined assertParamExists('setKeychainEntryV1', 'setKeychainEntryRequest', setKeychainEntryRequest) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/set-keychain-entry`; @@ -290,7 +292,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(setKeychainEntryRequest, localVarRequestOptions, configuration) @@ -317,7 +319,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.deleteKeychainEntryV1(deleteKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -328,7 +330,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getKeychainEntryV1(getKeychainEntryRequest: GetKeychainEntryRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getKeychainEntryV1(getKeychainEntryRequest: GetKeychainEntryRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getKeychainEntryV1(getKeychainEntryRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -339,7 +341,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.hasKeychainEntryV1(hasKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -350,7 +352,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async setKeychainEntryV1(setKeychainEntryRequest: SetKeychainEntryRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async setKeychainEntryV1(setKeychainEntryRequest: SetKeychainEntryRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.setKeychainEntryV1(setKeychainEntryRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -422,7 +424,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: any) { + public deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).deleteKeychainEntryV1(deleteKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } @@ -434,7 +436,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getKeychainEntryV1(getKeychainEntryRequest: GetKeychainEntryRequest, options?: any) { + public getKeychainEntryV1(getKeychainEntryRequest: GetKeychainEntryRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getKeychainEntryV1(getKeychainEntryRequest, options).then((request) => request(this.axios, this.basePath)); } @@ -446,7 +448,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: any) { + public hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).hasKeychainEntryV1(hasKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } @@ -458,7 +460,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public setKeychainEntryV1(setKeychainEntryRequest: SetKeychainEntryRequest, options?: any) { + public setKeychainEntryV1(setKeychainEntryRequest: SetKeychainEntryRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).setKeychainEntryV1(setKeychainEntryRequest, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/base.ts index 5bdd7d5a90..51fa22c30d 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/common.ts index 551dfb0d3c..e6d53f3c0f 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; } diff --git a/packages/cactus-plugin-keychain-google-sm/openapitools.json b/packages/cactus-plugin-keychain-google-sm/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/packages/cactus-plugin-keychain-google-sm/openapitools.json +++ b/packages/cactus-plugin-keychain-google-sm/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES index e6344b6dd3..15e43f61f3 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -6,7 +6,7 @@ settings.gradle src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -14,6 +14,7 @@ src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/README.md index ef6e8421d5..86dd4bee2e 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -1,9 +1,18 @@ # org.openapitools.client - Kotlin client library for Hyperledger Cactus - Keychain API +Contains/describes the Keychain API types/paths for Hyperledger Cactus. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 0.3.0 +- Package version: +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + ## Requires -* Kotlin 1.4.30 -* Gradle 6.8.3 +* Kotlin 1.7.21 +* Gradle 7.5 ## Build diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/build.gradle b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/build.gradle index 3de8b45b13..66a3c68b89 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/build.gradle +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/build.gradle @@ -2,12 +2,12 @@ group 'org.openapitools' version '1.0.0' wrapper { - gradleVersion = '6.8.3' + gradleVersion = '7.5' distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } buildscript { - ext.kotlin_version = '1.5.10' + ext.kotlin_version = '1.7.21' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -18,6 +18,7 @@ buildscript { } apply plugin: 'kotlin' +apply plugin: 'maven-publish' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -30,8 +31,8 @@ test { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "com.squareup.moshi:moshi-kotlin:1.12.0" - implementation "com.squareup.moshi:moshi-adapters:1.12.0" - implementation "com.squareup.okhttp3:okhttp:4.9.1" + implementation "com.squareup.moshi:moshi-kotlin:1.13.0" + implementation "com.squareup.moshi:moshi-adapters:1.13.0" + implementation "com.squareup.okhttp3:okhttp:4.10.0" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 63df046bfc..e701c73b1b 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -20,6 +15,10 @@ package org.openapitools.client.apis +import java.io.IOException +import okhttp3.OkHttpClient +import okhttp3.HttpUrl + import org.openapitools.client.models.DeleteKeychainEntryRequestV1 import org.openapitools.client.models.DeleteKeychainEntryResponseV1 import org.openapitools.client.models.GetKeychainEntryRequestV1 @@ -29,43 +28,45 @@ import org.openapitools.client.models.HasKeychainEntryResponseV1 import org.openapitools.client.models.SetKeychainEntryRequestV1 import org.openapitools.client.models.SetKeychainEntryResponseV1 +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://localhost") + System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost") } } /** - * Deletes an entry under a key on the keychain backend. - * - * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key - * @return DeleteKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Deletes an entry under a key on the keychain backend. + * + * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key + * @return DeleteKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1) : DeleteKeychainEntryResponseV1 { - val localVariableConfig = deleteKeychainEntryV1RequestConfig(deleteKeychainEntryRequestV1 = deleteKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = deleteKeychainEntryV1WithHttpInfo(deleteKeychainEntryRequestV1 = deleteKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as DeleteKeychainEntryResponseV1 @@ -83,42 +84,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation deleteKeychainEntryV1 - * - * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key - * @return RequestConfig - */ + * Deletes an entry under a key on the keychain backend. + * + * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun deleteKeychainEntryV1WithHttpInfo(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1) : ApiResponse { + val localVariableConfig = deleteKeychainEntryV1RequestConfig(deleteKeychainEntryRequestV1 = deleteKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation deleteKeychainEntryV1 + * + * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key + * @return RequestConfig + */ fun deleteKeychainEntryV1RequestConfig(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1) : RequestConfig { val localVariableBody = deleteKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/delete-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Retrieves the contents of a keychain entry from the backend. - * - * @param getKeychainEntryRequestV1 Request body to obtain a keychain entry via its key - * @return GetKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Retrieves the contents of a keychain entry from the backend. + * + * @param getKeychainEntryRequestV1 Request body to obtain a keychain entry via its key + * @return GetKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getKeychainEntryV1(getKeychainEntryRequestV1: GetKeychainEntryRequestV1) : GetKeychainEntryResponseV1 { - val localVariableConfig = getKeychainEntryV1RequestConfig(getKeychainEntryRequestV1 = getKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = getKeychainEntryV1WithHttpInfo(getKeychainEntryRequestV1 = getKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as GetKeychainEntryResponseV1 @@ -136,42 +156,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation getKeychainEntryV1 - * - * @param getKeychainEntryRequestV1 Request body to obtain a keychain entry via its key - * @return RequestConfig - */ + * Retrieves the contents of a keychain entry from the backend. + * + * @param getKeychainEntryRequestV1 Request body to obtain a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getKeychainEntryV1WithHttpInfo(getKeychainEntryRequestV1: GetKeychainEntryRequestV1) : ApiResponse { + val localVariableConfig = getKeychainEntryV1RequestConfig(getKeychainEntryRequestV1 = getKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getKeychainEntryV1 + * + * @param getKeychainEntryRequestV1 Request body to obtain a keychain entry via its key + * @return RequestConfig + */ fun getKeychainEntryV1RequestConfig(getKeychainEntryRequestV1: GetKeychainEntryRequestV1) : RequestConfig { val localVariableBody = getKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/get-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Checks that an entry exists under a key on the keychain backend. - * - * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key - * @return HasKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Checks that an entry exists under a key on the keychain backend. + * + * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key + * @return HasKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1) : HasKeychainEntryResponseV1 { - val localVariableConfig = hasKeychainEntryV1RequestConfig(hasKeychainEntryRequestV1 = hasKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = hasKeychainEntryV1WithHttpInfo(hasKeychainEntryRequestV1 = hasKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as HasKeychainEntryResponseV1 @@ -189,42 +228,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation hasKeychainEntryV1 - * - * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key - * @return RequestConfig - */ + * Checks that an entry exists under a key on the keychain backend. + * + * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun hasKeychainEntryV1WithHttpInfo(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1) : ApiResponse { + val localVariableConfig = hasKeychainEntryV1RequestConfig(hasKeychainEntryRequestV1 = hasKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation hasKeychainEntryV1 + * + * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key + * @return RequestConfig + */ fun hasKeychainEntryV1RequestConfig(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1) : RequestConfig { val localVariableBody = hasKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/has-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Sets a value under a key on the keychain backend. - * - * @param setKeychainEntryRequestV1 Request body to write/update a keychain entry via its key - * @return SetKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Sets a value under a key on the keychain backend. + * + * @param setKeychainEntryRequestV1 Request body to write/update a keychain entry via its key + * @return SetKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun setKeychainEntryV1(setKeychainEntryRequestV1: SetKeychainEntryRequestV1) : SetKeychainEntryResponseV1 { - val localVariableConfig = setKeychainEntryV1RequestConfig(setKeychainEntryRequestV1 = setKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = setKeychainEntryV1WithHttpInfo(setKeychainEntryRequestV1 = setKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as SetKeychainEntryResponseV1 @@ -242,23 +300,47 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation setKeychainEntryV1 - * - * @param setKeychainEntryRequestV1 Request body to write/update a keychain entry via its key - * @return RequestConfig - */ + * Sets a value under a key on the keychain backend. + * + * @param setKeychainEntryRequestV1 Request body to write/update a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun setKeychainEntryV1WithHttpInfo(setKeychainEntryRequestV1: SetKeychainEntryRequestV1) : ApiResponse { + val localVariableConfig = setKeychainEntryV1RequestConfig(setKeychainEntryRequestV1 = setKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation setKeychainEntryV1 + * + * @param setKeychainEntryRequestV1 Request body to write/update a keychain entry via its key + * @return RequestConfig + */ fun setKeychainEntryV1RequestConfig(setKeychainEntryRequestV1: SetKeychainEntryRequestV1) : RequestConfig { val localVariableBody = setKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/set-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index b359be1e41..757080d7ed 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -10,21 +10,26 @@ import okhttp3.ResponseBody import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import okhttp3.Headers +import okhttp3.Headers.Companion.toHeaders import okhttp3.MultipartBody +import okhttp3.Call +import okhttp3.Callback +import okhttp3.Response +import okhttp3.internal.EMPTY_REQUEST import java.io.BufferedWriter import java.io.File import java.io.FileWriter +import java.io.IOException import java.net.URLConnection import java.time.LocalDate import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter -open class ApiClient(val baseUrl: String) { +open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) { companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" @@ -39,9 +44,10 @@ open class ApiClient(val baseUrl: String) { var username: String? = null var password: String? = null var accessToken: String? = null + const val baseUrlKey = "org.openapitools.client.baseUrl" @JvmStatic - val client: OkHttpClient by lazy { + val defaultClient: OkHttpClient by lazy { builder.build() } @@ -60,48 +66,50 @@ open class ApiClient(val baseUrl: String) { return contentType ?: "application/octet-stream" } - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + protected inline fun requestBody(content: T, mediaType: String?): RequestBody = when { - content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull()) - mediaType == FormDataMediaType -> { + content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) + mediaType == FormDataMediaType -> MultipartBody.Builder() .setType(MultipartBody.FORM) .apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" + (content as Map>).forEach { (name, part) -> + if (part.body is File) { + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${part.body.name}\"") + val fileMediaType = guessContentTypeFromFile(part.body).toMediaTypeOrNull() + addPart( + partHeaders.toHeaders(), + part.body.asRequestBody(fileMediaType) ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"") addPart( - partHeaders, - parameterToString(value).toRequestBody(null) + partHeaders.toHeaders(), + parameterToString(part.body).toRequestBody(null) ) } } }.build() - } mediaType == FormUrlEncMediaType -> { FormBody.Builder().apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) + (content as Map>).forEach { (name, part) -> + add(name, parameterToString(part.body)) } }.build() } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) + mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> + if (content == null) { + EMPTY_REQUEST + } else { + Serializer.moshi.adapter(T::class.java).toJson(content) + .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) + } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -112,31 +120,35 @@ open class ApiClient(val baseUrl: String) { if(body == null) { return null } + if (T::class.java == File::class.java) { + // return tempFile + // Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options + val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() + tempFile.deleteOnExit() + body.byteStream().use { inputStream -> + tempFile.outputStream().use { tempFileOutputStream -> + inputStream.copyTo(tempFileOutputStream) + } + } + return tempFile as T + } val bodyContent = body.string() if (bodyContent.isEmpty()) { return null } - if (T::class.java == File::class.java) { - // return tempfile - val f = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() - f.deleteOnExit() - val out = BufferedWriter(FileWriter(f)) - out.write(bodyContent) - out.close() - return f as T - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) + .addEncodedPathSegments(requestConfig.path.trimStart('/')) .apply { requestConfig.query.forEach { query -> query.value.forEach { queryValue -> @@ -146,7 +158,7 @@ open class ApiClient(val baseUrl: String) { }.build() // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { + if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) { requestConfig.headers[ContentType] = JsonMediaType } if (requestConfig.headers[Accept].isNullOrEmpty()) { @@ -154,16 +166,16 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { + if (headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + val contentType = if (headers[ContentType] != null) { + // TODO: support multiple contentType options here. + (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + } else { + null + } val request = when (requestConfig.method) { RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) @@ -178,6 +190,7 @@ open class ApiClient(val baseUrl: String) { }.build() val response = client.newCall(request).execute() + val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault()) // TODO: handle specific mapping types. e.g. Map> @@ -215,7 +228,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 0000000000..cf2cfaa95d --- /dev/null +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt index fb2c972cf8..064b57fc6b 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt @@ -14,4 +14,4 @@ class BigDecimalAdapter { fun fromJson(value: String): BigDecimal { return BigDecimal(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt index 4b6963110c..7df6057b45 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt @@ -14,4 +14,4 @@ class BigIntegerAdapter { fun fromJson(value: String): BigInteger { return BigInteger(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 0000000000..be00e38fba --- /dev/null +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 7e948e1dd0..625a19002b 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -13,5 +13,6 @@ data class RequestConfig( val path: String, val headers: MutableMap = mutableMapOf(), val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, val body: T? = null ) \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt index 5b4e9c380e..058005f566 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key for the entry to check the presence of on the keychain. */ + data class DeleteKeychainEntryRequestV1 ( /* The key for the entry to check the presence of on the keychain. */ diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt index 3af6fe8305..ac544c44ef 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key that was deleted from the keychain. */ + data class DeleteKeychainEntryResponseV1 ( /* The key that was deleted from the keychain. */ diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt index 960a641c44..82f324d68f 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key for the entry to get from the keychain. */ + data class GetKeychainEntryRequestV1 ( /* The key for the entry to get from the keychain. */ diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt index 182085b6c9..294cc6d743 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value associated with the requested key on the keychain. */ + data class GetKeychainEntryResponseV1 ( /* The key that was used to retrieve the value from the keychain. */ diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt index 71dee33cb6..4f7b976c95 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key to check for presence in the keychain. */ + data class HasKeychainEntryRequestV1 ( /* The key to check for presence in the keychain. */ diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt index a59f3ed94b..34f773aea5 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -31,6 +26,7 @@ import com.squareup.moshi.Json * @param isPresent The boolean true or false indicating the presence or absence of an entry under 'key'. */ + data class HasKeychainEntryResponseV1 ( /* The key that was used to check the presence of the value in the entry store. */ diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt index cee6721377..b02d8928b9 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value that will be associated with the key on the keychain. */ + data class SetKeychainEntryRequestV1 ( /* The key for the entry to set on the keychain. */ diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt index 3a6c956f38..32c97773c4 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-google-sm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key that was used to set the value on the keychain. */ + data class SetKeychainEntryResponseV1 ( /* The key that was used to set the value on the keychain. */ diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/api.ts index 13d89b6130..31366163f5 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * @@ -32,7 +34,7 @@ export interface DeleteKeychainEntryRequestV1 { * @type {string} * @memberof DeleteKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -45,7 +47,7 @@ export interface DeleteKeychainEntryResponseV1 { * @type {string} * @memberof DeleteKeychainEntryResponseV1 */ - key: string; + 'key': string; } /** * @@ -58,7 +60,7 @@ export interface GetKeychainEntryRequestV1 { * @type {string} * @memberof GetKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -71,13 +73,13 @@ export interface GetKeychainEntryResponseV1 { * @type {string} * @memberof GetKeychainEntryResponseV1 */ - key: string; + 'key': string; /** * The value associated with the requested key on the keychain. * @type {string} * @memberof GetKeychainEntryResponseV1 */ - value: string; + 'value': string; } /** * @@ -90,7 +92,7 @@ export interface HasKeychainEntryRequestV1 { * @type {string} * @memberof HasKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -103,19 +105,19 @@ export interface HasKeychainEntryResponseV1 { * @type {string} * @memberof HasKeychainEntryResponseV1 */ - key: string; + 'key': string; /** * Date and time encoded as JSON when the presence check was performed by the plugin backend. * @type {string} * @memberof HasKeychainEntryResponseV1 */ - checkedAt: string; + 'checkedAt': string; /** * The boolean true or false indicating the presence or absence of an entry under \'key\'. * @type {boolean} * @memberof HasKeychainEntryResponseV1 */ - isPresent: boolean; + 'isPresent': boolean; } /** * @@ -128,13 +130,13 @@ export interface SetKeychainEntryRequestV1 { * @type {string} * @memberof SetKeychainEntryRequestV1 */ - key: string; + 'key': string; /** * The value that will be associated with the key on the keychain. * @type {string} * @memberof SetKeychainEntryRequestV1 */ - value: string; + 'value': string; } /** * @@ -147,7 +149,7 @@ export interface SetKeychainEntryResponseV1 { * @type {string} * @memberof SetKeychainEntryResponseV1 */ - key: string; + 'key': string; } /** @@ -163,7 +165,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteKeychainEntryV1: async (deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options: any = {}): Promise => { + deleteKeychainEntryV1: async (deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'deleteKeychainEntryRequestV1' is not null or undefined assertParamExists('deleteKeychainEntryV1', 'deleteKeychainEntryRequestV1', deleteKeychainEntryRequestV1) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/delete-keychain-entry`; @@ -182,7 +184,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(deleteKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -199,7 +201,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getKeychainEntryV1: async (getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options: any = {}): Promise => { + getKeychainEntryV1: async (getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'getKeychainEntryRequestV1' is not null or undefined assertParamExists('getKeychainEntryV1', 'getKeychainEntryRequestV1', getKeychainEntryRequestV1) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/get-keychain-entry`; @@ -218,7 +220,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(getKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -235,7 +237,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - hasKeychainEntryV1: async (hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options: any = {}): Promise => { + hasKeychainEntryV1: async (hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'hasKeychainEntryRequestV1' is not null or undefined assertParamExists('hasKeychainEntryV1', 'hasKeychainEntryRequestV1', hasKeychainEntryRequestV1) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/has-keychain-entry`; @@ -254,7 +256,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(hasKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -271,7 +273,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - setKeychainEntryV1: async (setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options: any = {}): Promise => { + setKeychainEntryV1: async (setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'setKeychainEntryRequestV1' is not null or undefined assertParamExists('setKeychainEntryV1', 'setKeychainEntryRequestV1', setKeychainEntryRequestV1) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/set-keychain-entry`; @@ -290,7 +292,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(setKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -317,7 +319,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.deleteKeychainEntryV1(deleteKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -328,7 +330,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getKeychainEntryV1(getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getKeychainEntryV1(getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getKeychainEntryV1(getKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -339,7 +341,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.hasKeychainEntryV1(hasKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -350,7 +352,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async setKeychainEntryV1(setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async setKeychainEntryV1(setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.setKeychainEntryV1(setKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -422,7 +424,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: any) { + public deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).deleteKeychainEntryV1(deleteKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } @@ -434,7 +436,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getKeychainEntryV1(getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options?: any) { + public getKeychainEntryV1(getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getKeychainEntryV1(getKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } @@ -446,7 +448,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: any) { + public hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).hasKeychainEntryV1(hasKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } @@ -458,7 +460,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public setKeychainEntryV1(setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options?: any) { + public setKeychainEntryV1(setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).setKeychainEntryV1(setKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/base.ts index 5bdd7d5a90..51fa22c30d 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/common.ts index 551dfb0d3c..e6d53f3c0f 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/packages/cactus-plugin-keychain-google-sm/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; } diff --git a/packages/cactus-plugin-keychain-memory-wasm/openapitools.json b/packages/cactus-plugin-keychain-memory-wasm/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/openapitools.json +++ b/packages/cactus-plugin-keychain-memory-wasm/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES index e6344b6dd3..15e43f61f3 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -6,7 +6,7 @@ settings.gradle src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -14,6 +14,7 @@ src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/README.md index 1b8fa73cf8..9a6d80dc51 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -1,9 +1,18 @@ # org.openapitools.client - Kotlin client library for Hyperledger Cactus Plugin - Keychain Memory WASM +Contains/describes the Hyperledger Cactus Keychain Memory WASM plugin which is designed to help with testing and development and is implemented in Rust instead of Typescript. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 1.0.0-rc.1 +- Package version: +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + ## Requires -* Kotlin 1.4.30 -* Gradle 6.8.3 +* Kotlin 1.7.21 +* Gradle 7.5 ## Build diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/build.gradle b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/build.gradle index 3de8b45b13..66a3c68b89 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/build.gradle +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/build.gradle @@ -2,12 +2,12 @@ group 'org.openapitools' version '1.0.0' wrapper { - gradleVersion = '6.8.3' + gradleVersion = '7.5' distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } buildscript { - ext.kotlin_version = '1.5.10' + ext.kotlin_version = '1.7.21' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -18,6 +18,7 @@ buildscript { } apply plugin: 'kotlin' +apply plugin: 'maven-publish' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -30,8 +31,8 @@ test { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "com.squareup.moshi:moshi-kotlin:1.12.0" - implementation "com.squareup.moshi:moshi-adapters:1.12.0" - implementation "com.squareup.okhttp3:okhttp:4.9.1" + implementation "com.squareup.moshi:moshi-kotlin:1.13.0" + implementation "com.squareup.moshi:moshi-adapters:1.13.0" + implementation "com.squareup.okhttp3:okhttp:4.10.0" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index c7777303d6..cc12d5c4bc 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Keychain Memory WASM - * - * Contains/describes the Hyperledger Cactus Keychain Memory WASM plugin which is designed to help with testing and development and is implemented in Rust instead of Typescript. - * - * The version of the OpenAPI document: 1.0.0-rc.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -20,6 +15,10 @@ package org.openapitools.client.apis +import java.io.IOException +import okhttp3.OkHttpClient +import okhttp3.HttpUrl + import org.openapitools.client.models.DeleteKeychainEntryRequestV1 import org.openapitools.client.models.DeleteKeychainEntryResponseV1 import org.openapitools.client.models.GetKeychainEntryRequestV1 @@ -29,43 +28,45 @@ import org.openapitools.client.models.HasKeychainEntryResponseV1 import org.openapitools.client.models.SetKeychainEntryRequestV1 import org.openapitools.client.models.SetKeychainEntryResponseV1 +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://localhost") + System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost") } } /** - * Deletes an entry under a key on the keychain backend. - * - * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key - * @return DeleteKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Deletes an entry under a key on the keychain backend. + * + * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key + * @return DeleteKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1) : DeleteKeychainEntryResponseV1 { - val localVariableConfig = deleteKeychainEntryV1RequestConfig(deleteKeychainEntryRequestV1 = deleteKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = deleteKeychainEntryV1WithHttpInfo(deleteKeychainEntryRequestV1 = deleteKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as DeleteKeychainEntryResponseV1 @@ -83,42 +84,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation deleteKeychainEntryV1 - * - * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key - * @return RequestConfig - */ + * Deletes an entry under a key on the keychain backend. + * + * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun deleteKeychainEntryV1WithHttpInfo(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1) : ApiResponse { + val localVariableConfig = deleteKeychainEntryV1RequestConfig(deleteKeychainEntryRequestV1 = deleteKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation deleteKeychainEntryV1 + * + * @param deleteKeychainEntryRequestV1 Request body to delete a keychain entry via its key + * @return RequestConfig + */ fun deleteKeychainEntryV1RequestConfig(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1) : RequestConfig { val localVariableBody = deleteKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/delete-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Retrieves the contents of a keychain entry from the backend. - * - * @param getKeychainEntryRequestV1 Request body to obtain a keychain entry via its key - * @return GetKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Retrieves the contents of a keychain entry from the backend. + * + * @param getKeychainEntryRequestV1 Request body to obtain a keychain entry via its key + * @return GetKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getKeychainEntryV1(getKeychainEntryRequestV1: GetKeychainEntryRequestV1) : GetKeychainEntryResponseV1 { - val localVariableConfig = getKeychainEntryV1RequestConfig(getKeychainEntryRequestV1 = getKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = getKeychainEntryV1WithHttpInfo(getKeychainEntryRequestV1 = getKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as GetKeychainEntryResponseV1 @@ -136,42 +156,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation getKeychainEntryV1 - * - * @param getKeychainEntryRequestV1 Request body to obtain a keychain entry via its key - * @return RequestConfig - */ + * Retrieves the contents of a keychain entry from the backend. + * + * @param getKeychainEntryRequestV1 Request body to obtain a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getKeychainEntryV1WithHttpInfo(getKeychainEntryRequestV1: GetKeychainEntryRequestV1) : ApiResponse { + val localVariableConfig = getKeychainEntryV1RequestConfig(getKeychainEntryRequestV1 = getKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getKeychainEntryV1 + * + * @param getKeychainEntryRequestV1 Request body to obtain a keychain entry via its key + * @return RequestConfig + */ fun getKeychainEntryV1RequestConfig(getKeychainEntryRequestV1: GetKeychainEntryRequestV1) : RequestConfig { val localVariableBody = getKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/get-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Checks that an entry exists under a key on the keychain backend - * - * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key - * @return HasKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Checks that an entry exists under a key on the keychain backend + * + * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key + * @return HasKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1) : HasKeychainEntryResponseV1 { - val localVariableConfig = hasKeychainEntryV1RequestConfig(hasKeychainEntryRequestV1 = hasKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = hasKeychainEntryV1WithHttpInfo(hasKeychainEntryRequestV1 = hasKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as HasKeychainEntryResponseV1 @@ -189,42 +228,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation hasKeychainEntryV1 - * - * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key - * @return RequestConfig - */ + * Checks that an entry exists under a key on the keychain backend + * + * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun hasKeychainEntryV1WithHttpInfo(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1) : ApiResponse { + val localVariableConfig = hasKeychainEntryV1RequestConfig(hasKeychainEntryRequestV1 = hasKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation hasKeychainEntryV1 + * + * @param hasKeychainEntryRequestV1 Request body for checking a keychain entry via its key + * @return RequestConfig + */ fun hasKeychainEntryV1RequestConfig(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1) : RequestConfig { val localVariableBody = hasKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/has-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Sets a value under a key on the keychain backend. - * - * @param setKeychainEntryRequestV1 Request body to write/update a keychain entry via its key - * @return SetKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Sets a value under a key on the keychain backend. + * + * @param setKeychainEntryRequestV1 Request body to write/update a keychain entry via its key + * @return SetKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun setKeychainEntryV1(setKeychainEntryRequestV1: SetKeychainEntryRequestV1) : SetKeychainEntryResponseV1 { - val localVariableConfig = setKeychainEntryV1RequestConfig(setKeychainEntryRequestV1 = setKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = setKeychainEntryV1WithHttpInfo(setKeychainEntryRequestV1 = setKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as SetKeychainEntryResponseV1 @@ -242,23 +300,47 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation setKeychainEntryV1 - * - * @param setKeychainEntryRequestV1 Request body to write/update a keychain entry via its key - * @return RequestConfig - */ + * Sets a value under a key on the keychain backend. + * + * @param setKeychainEntryRequestV1 Request body to write/update a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun setKeychainEntryV1WithHttpInfo(setKeychainEntryRequestV1: SetKeychainEntryRequestV1) : ApiResponse { + val localVariableConfig = setKeychainEntryV1RequestConfig(setKeychainEntryRequestV1 = setKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation setKeychainEntryV1 + * + * @param setKeychainEntryRequestV1 Request body to write/update a keychain entry via its key + * @return RequestConfig + */ fun setKeychainEntryV1RequestConfig(setKeychainEntryRequestV1: SetKeychainEntryRequestV1) : RequestConfig { val localVariableBody = setKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/set-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index b359be1e41..757080d7ed 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -10,21 +10,26 @@ import okhttp3.ResponseBody import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import okhttp3.Headers +import okhttp3.Headers.Companion.toHeaders import okhttp3.MultipartBody +import okhttp3.Call +import okhttp3.Callback +import okhttp3.Response +import okhttp3.internal.EMPTY_REQUEST import java.io.BufferedWriter import java.io.File import java.io.FileWriter +import java.io.IOException import java.net.URLConnection import java.time.LocalDate import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter -open class ApiClient(val baseUrl: String) { +open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) { companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" @@ -39,9 +44,10 @@ open class ApiClient(val baseUrl: String) { var username: String? = null var password: String? = null var accessToken: String? = null + const val baseUrlKey = "org.openapitools.client.baseUrl" @JvmStatic - val client: OkHttpClient by lazy { + val defaultClient: OkHttpClient by lazy { builder.build() } @@ -60,48 +66,50 @@ open class ApiClient(val baseUrl: String) { return contentType ?: "application/octet-stream" } - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + protected inline fun requestBody(content: T, mediaType: String?): RequestBody = when { - content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull()) - mediaType == FormDataMediaType -> { + content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) + mediaType == FormDataMediaType -> MultipartBody.Builder() .setType(MultipartBody.FORM) .apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" + (content as Map>).forEach { (name, part) -> + if (part.body is File) { + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${part.body.name}\"") + val fileMediaType = guessContentTypeFromFile(part.body).toMediaTypeOrNull() + addPart( + partHeaders.toHeaders(), + part.body.asRequestBody(fileMediaType) ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"") addPart( - partHeaders, - parameterToString(value).toRequestBody(null) + partHeaders.toHeaders(), + parameterToString(part.body).toRequestBody(null) ) } } }.build() - } mediaType == FormUrlEncMediaType -> { FormBody.Builder().apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) + (content as Map>).forEach { (name, part) -> + add(name, parameterToString(part.body)) } }.build() } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) + mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> + if (content == null) { + EMPTY_REQUEST + } else { + Serializer.moshi.adapter(T::class.java).toJson(content) + .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) + } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -112,31 +120,35 @@ open class ApiClient(val baseUrl: String) { if(body == null) { return null } + if (T::class.java == File::class.java) { + // return tempFile + // Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options + val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() + tempFile.deleteOnExit() + body.byteStream().use { inputStream -> + tempFile.outputStream().use { tempFileOutputStream -> + inputStream.copyTo(tempFileOutputStream) + } + } + return tempFile as T + } val bodyContent = body.string() if (bodyContent.isEmpty()) { return null } - if (T::class.java == File::class.java) { - // return tempfile - val f = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() - f.deleteOnExit() - val out = BufferedWriter(FileWriter(f)) - out.write(bodyContent) - out.close() - return f as T - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) + .addEncodedPathSegments(requestConfig.path.trimStart('/')) .apply { requestConfig.query.forEach { query -> query.value.forEach { queryValue -> @@ -146,7 +158,7 @@ open class ApiClient(val baseUrl: String) { }.build() // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { + if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) { requestConfig.headers[ContentType] = JsonMediaType } if (requestConfig.headers[Accept].isNullOrEmpty()) { @@ -154,16 +166,16 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { + if (headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + val contentType = if (headers[ContentType] != null) { + // TODO: support multiple contentType options here. + (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + } else { + null + } val request = when (requestConfig.method) { RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) @@ -178,6 +190,7 @@ open class ApiClient(val baseUrl: String) { }.build() val response = client.newCall(request).execute() + val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault()) // TODO: handle specific mapping types. e.g. Map> @@ -215,7 +228,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 0000000000..cf2cfaa95d --- /dev/null +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt index fb2c972cf8..064b57fc6b 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt @@ -14,4 +14,4 @@ class BigDecimalAdapter { fun fromJson(value: String): BigDecimal { return BigDecimal(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt index 4b6963110c..7df6057b45 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt @@ -14,4 +14,4 @@ class BigIntegerAdapter { fun fromJson(value: String): BigInteger { return BigInteger(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 0000000000..be00e38fba --- /dev/null +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 7e948e1dd0..625a19002b 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -13,5 +13,6 @@ data class RequestConfig( val path: String, val headers: MutableMap = mutableMapOf(), val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, val body: T? = null ) \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt index 23ef51943b..058005f566 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Keychain Memory WASM - * - * Contains/describes the Hyperledger Cactus Keychain Memory WASM plugin which is designed to help with testing and development and is implemented in Rust instead of Typescript. - * - * The version of the OpenAPI document: 1.0.0-rc.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key for the entry to check the presence of on the keychain. */ + data class DeleteKeychainEntryRequestV1 ( /* The key for the entry to check the presence of on the keychain. */ diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt index a4d1f3ba2d..ac544c44ef 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Keychain Memory WASM - * - * Contains/describes the Hyperledger Cactus Keychain Memory WASM plugin which is designed to help with testing and development and is implemented in Rust instead of Typescript. - * - * The version of the OpenAPI document: 1.0.0-rc.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key that was deleted from the keychain. */ + data class DeleteKeychainEntryResponseV1 ( /* The key that was deleted from the keychain. */ diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt index c591bdbd3b..82f324d68f 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Keychain Memory WASM - * - * Contains/describes the Hyperledger Cactus Keychain Memory WASM plugin which is designed to help with testing and development and is implemented in Rust instead of Typescript. - * - * The version of the OpenAPI document: 1.0.0-rc.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key for the entry to get from the keychain. */ + data class GetKeychainEntryRequestV1 ( /* The key for the entry to get from the keychain. */ diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt index 0161c610e7..294cc6d743 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Keychain Memory WASM - * - * Contains/describes the Hyperledger Cactus Keychain Memory WASM plugin which is designed to help with testing and development and is implemented in Rust instead of Typescript. - * - * The version of the OpenAPI document: 1.0.0-rc.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value associated with the requested key on the keychain. */ + data class GetKeychainEntryResponseV1 ( /* The key that was used to retrieve the value from the keychain. */ diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt index 39de1d07af..4f7b976c95 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Keychain Memory WASM - * - * Contains/describes the Hyperledger Cactus Keychain Memory WASM plugin which is designed to help with testing and development and is implemented in Rust instead of Typescript. - * - * The version of the OpenAPI document: 1.0.0-rc.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key to check for presence in the keychain. */ + data class HasKeychainEntryRequestV1 ( /* The key to check for presence in the keychain. */ diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt index 0c7891d71f..34f773aea5 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Keychain Memory WASM - * - * Contains/describes the Hyperledger Cactus Keychain Memory WASM plugin which is designed to help with testing and development and is implemented in Rust instead of Typescript. - * - * The version of the OpenAPI document: 1.0.0-rc.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -31,6 +26,7 @@ import com.squareup.moshi.Json * @param isPresent The boolean true or false indicating the presence or absence of an entry under 'key'. */ + data class HasKeychainEntryResponseV1 ( /* The key that was used to check the presence of the value in the entry store. */ diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt index 63cd79f14a..b02d8928b9 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Keychain Memory WASM - * - * Contains/describes the Hyperledger Cactus Keychain Memory WASM plugin which is designed to help with testing and development and is implemented in Rust instead of Typescript. - * - * The version of the OpenAPI document: 1.0.0-rc.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value that will be associated with the key on the keychain. */ + data class SetKeychainEntryRequestV1 ( /* The key for the entry to set on the keychain. */ diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt index aa3129bc09..32c97773c4 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Keychain Memory WASM - * - * Contains/describes the Hyperledger Cactus Keychain Memory WASM plugin which is designed to help with testing and development and is implemented in Rust instead of Typescript. - * - * The version of the OpenAPI document: 1.0.0-rc.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key that was used to set the value on the keychain. */ + data class SetKeychainEntryResponseV1 ( /* The key that was used to set the value on the keychain. */ diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/api.ts index 0296a9385d..d5c1ddbc9e 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * @@ -32,7 +34,7 @@ export interface DeleteKeychainEntryRequestV1 { * @type {string} * @memberof DeleteKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -45,7 +47,7 @@ export interface DeleteKeychainEntryResponseV1 { * @type {string} * @memberof DeleteKeychainEntryResponseV1 */ - key: string; + 'key': string; } /** * @@ -58,7 +60,7 @@ export interface GetKeychainEntryRequestV1 { * @type {string} * @memberof GetKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -71,13 +73,13 @@ export interface GetKeychainEntryResponseV1 { * @type {string} * @memberof GetKeychainEntryResponseV1 */ - key: string; + 'key': string; /** * The value associated with the requested key on the keychain. * @type {string} * @memberof GetKeychainEntryResponseV1 */ - value: string; + 'value': string; } /** * @@ -90,7 +92,7 @@ export interface HasKeychainEntryRequestV1 { * @type {string} * @memberof HasKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -103,19 +105,19 @@ export interface HasKeychainEntryResponseV1 { * @type {string} * @memberof HasKeychainEntryResponseV1 */ - key: string; + 'key': string; /** * Date and time encoded as JSON when the presence check was performed by the plugin backend. * @type {string} * @memberof HasKeychainEntryResponseV1 */ - checkedAt: string; + 'checkedAt': string; /** * The boolean true or false indicating the presence or absence of an entry under \'key\'. * @type {boolean} * @memberof HasKeychainEntryResponseV1 */ - isPresent: boolean; + 'isPresent': boolean; } /** * @@ -128,13 +130,13 @@ export interface SetKeychainEntryRequestV1 { * @type {string} * @memberof SetKeychainEntryRequestV1 */ - key: string; + 'key': string; /** * The value that will be associated with the key on the keychain. * @type {string} * @memberof SetKeychainEntryRequestV1 */ - value: string; + 'value': string; } /** * @@ -147,7 +149,7 @@ export interface SetKeychainEntryResponseV1 { * @type {string} * @memberof SetKeychainEntryResponseV1 */ - key: string; + 'key': string; } /** @@ -163,7 +165,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteKeychainEntryV1: async (deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options: any = {}): Promise => { + deleteKeychainEntryV1: async (deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'deleteKeychainEntryRequestV1' is not null or undefined assertParamExists('deleteKeychainEntryV1', 'deleteKeychainEntryRequestV1', deleteKeychainEntryRequestV1) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/delete-keychain-entry`; @@ -182,7 +184,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(deleteKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -199,7 +201,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getKeychainEntryV1: async (getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options: any = {}): Promise => { + getKeychainEntryV1: async (getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'getKeychainEntryRequestV1' is not null or undefined assertParamExists('getKeychainEntryV1', 'getKeychainEntryRequestV1', getKeychainEntryRequestV1) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/get-keychain-entry`; @@ -218,7 +220,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(getKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -235,7 +237,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - hasKeychainEntryV1: async (hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options: any = {}): Promise => { + hasKeychainEntryV1: async (hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'hasKeychainEntryRequestV1' is not null or undefined assertParamExists('hasKeychainEntryV1', 'hasKeychainEntryRequestV1', hasKeychainEntryRequestV1) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/has-keychain-entry`; @@ -254,7 +256,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(hasKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -271,7 +273,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - setKeychainEntryV1: async (setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options: any = {}): Promise => { + setKeychainEntryV1: async (setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'setKeychainEntryRequestV1' is not null or undefined assertParamExists('setKeychainEntryV1', 'setKeychainEntryRequestV1', setKeychainEntryRequestV1) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/set-keychain-entry`; @@ -290,7 +292,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(setKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -317,7 +319,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.deleteKeychainEntryV1(deleteKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -328,7 +330,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getKeychainEntryV1(getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getKeychainEntryV1(getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getKeychainEntryV1(getKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -339,7 +341,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.hasKeychainEntryV1(hasKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -350,7 +352,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async setKeychainEntryV1(setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async setKeychainEntryV1(setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.setKeychainEntryV1(setKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -422,7 +424,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: any) { + public deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).deleteKeychainEntryV1(deleteKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } @@ -434,7 +436,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getKeychainEntryV1(getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options?: any) { + public getKeychainEntryV1(getKeychainEntryRequestV1: GetKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getKeychainEntryV1(getKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } @@ -446,7 +448,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: any) { + public hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).hasKeychainEntryV1(hasKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } @@ -458,7 +460,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public setKeychainEntryV1(setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options?: any) { + public setKeychainEntryV1(setKeychainEntryRequestV1: SetKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).setKeychainEntryV1(setKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/base.ts index 9557610514..7d8ccf9050 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/common.ts index 7c46a86902..13c7051221 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; } diff --git a/packages/cactus-plugin-keychain-memory/openapitools.json b/packages/cactus-plugin-keychain-memory/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/packages/cactus-plugin-keychain-memory/openapitools.json +++ b/packages/cactus-plugin-keychain-memory/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES index 8417107acc..f95b7cb080 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -6,7 +6,7 @@ settings.gradle src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -14,6 +14,7 @@ src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt diff --git a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION +++ b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/README.md index 3b7c4e9ef3..348dcb7263 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -1,9 +1,18 @@ # org.openapitools.client - Kotlin client library for Hyperledger Cactus Plugin - Keychain Memory +Contains/describes the Hyperledger Cactus Keychain Memory plugin. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 0.2.0 +- Package version: +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + ## Requires -* Kotlin 1.4.30 -* Gradle 6.8.3 +* Kotlin 1.7.21 +* Gradle 7.5 ## Build diff --git a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/build.gradle b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/build.gradle index 3de8b45b13..66a3c68b89 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/build.gradle +++ b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/build.gradle @@ -2,12 +2,12 @@ group 'org.openapitools' version '1.0.0' wrapper { - gradleVersion = '6.8.3' + gradleVersion = '7.5' distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } buildscript { - ext.kotlin_version = '1.5.10' + ext.kotlin_version = '1.7.21' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -18,6 +18,7 @@ buildscript { } apply plugin: 'kotlin' +apply plugin: 'maven-publish' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -30,8 +31,8 @@ test { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "com.squareup.moshi:moshi-kotlin:1.12.0" - implementation "com.squareup.moshi:moshi-adapters:1.12.0" - implementation "com.squareup.okhttp3:okhttp:4.9.1" + implementation "com.squareup.moshi:moshi-kotlin:1.13.0" + implementation "com.squareup.moshi:moshi-adapters:1.13.0" + implementation "com.squareup.okhttp3:okhttp:4.10.0" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 83f04c3f8a..6059971c7c 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Keychain Memory - * - * Contains/describes the Hyperledger Cactus Keychain Memory plugin. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -20,43 +15,49 @@ package org.openapitools.client.apis +import java.io.IOException +import okhttp3.OkHttpClient +import okhttp3.HttpUrl + + +import com.squareup.moshi.Json import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://localhost") + System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost") } } /** - * Get the Prometheus Metrics - * - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Get the Prometheus Metrics + * + * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPrometheusMetricsV1() : kotlin.String { - val localVariableConfig = getPrometheusMetricsV1RequestConfig() - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = getPrometheusMetricsV1WithHttpInfo() return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String @@ -74,22 +75,43 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation getPrometheusMetricsV1 - * - * @return RequestConfig - */ + * Get the Prometheus Metrics + * + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getPrometheusMetricsV1WithHttpInfo() : ApiResponse { + val localVariableConfig = getPrometheusMetricsV1RequestConfig() + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getPrometheusMetricsV1 + * + * @return RequestConfig + */ fun getPrometheusMetricsV1RequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/get-prometheus-exporter-metrics", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index b359be1e41..757080d7ed 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -10,21 +10,26 @@ import okhttp3.ResponseBody import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import okhttp3.Headers +import okhttp3.Headers.Companion.toHeaders import okhttp3.MultipartBody +import okhttp3.Call +import okhttp3.Callback +import okhttp3.Response +import okhttp3.internal.EMPTY_REQUEST import java.io.BufferedWriter import java.io.File import java.io.FileWriter +import java.io.IOException import java.net.URLConnection import java.time.LocalDate import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter -open class ApiClient(val baseUrl: String) { +open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) { companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" @@ -39,9 +44,10 @@ open class ApiClient(val baseUrl: String) { var username: String? = null var password: String? = null var accessToken: String? = null + const val baseUrlKey = "org.openapitools.client.baseUrl" @JvmStatic - val client: OkHttpClient by lazy { + val defaultClient: OkHttpClient by lazy { builder.build() } @@ -60,48 +66,50 @@ open class ApiClient(val baseUrl: String) { return contentType ?: "application/octet-stream" } - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + protected inline fun requestBody(content: T, mediaType: String?): RequestBody = when { - content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull()) - mediaType == FormDataMediaType -> { + content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) + mediaType == FormDataMediaType -> MultipartBody.Builder() .setType(MultipartBody.FORM) .apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" + (content as Map>).forEach { (name, part) -> + if (part.body is File) { + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${part.body.name}\"") + val fileMediaType = guessContentTypeFromFile(part.body).toMediaTypeOrNull() + addPart( + partHeaders.toHeaders(), + part.body.asRequestBody(fileMediaType) ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"") addPart( - partHeaders, - parameterToString(value).toRequestBody(null) + partHeaders.toHeaders(), + parameterToString(part.body).toRequestBody(null) ) } } }.build() - } mediaType == FormUrlEncMediaType -> { FormBody.Builder().apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) + (content as Map>).forEach { (name, part) -> + add(name, parameterToString(part.body)) } }.build() } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) + mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> + if (content == null) { + EMPTY_REQUEST + } else { + Serializer.moshi.adapter(T::class.java).toJson(content) + .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) + } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -112,31 +120,35 @@ open class ApiClient(val baseUrl: String) { if(body == null) { return null } + if (T::class.java == File::class.java) { + // return tempFile + // Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options + val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() + tempFile.deleteOnExit() + body.byteStream().use { inputStream -> + tempFile.outputStream().use { tempFileOutputStream -> + inputStream.copyTo(tempFileOutputStream) + } + } + return tempFile as T + } val bodyContent = body.string() if (bodyContent.isEmpty()) { return null } - if (T::class.java == File::class.java) { - // return tempfile - val f = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() - f.deleteOnExit() - val out = BufferedWriter(FileWriter(f)) - out.write(bodyContent) - out.close() - return f as T - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) + .addEncodedPathSegments(requestConfig.path.trimStart('/')) .apply { requestConfig.query.forEach { query -> query.value.forEach { queryValue -> @@ -146,7 +158,7 @@ open class ApiClient(val baseUrl: String) { }.build() // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { + if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) { requestConfig.headers[ContentType] = JsonMediaType } if (requestConfig.headers[Accept].isNullOrEmpty()) { @@ -154,16 +166,16 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { + if (headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + val contentType = if (headers[ContentType] != null) { + // TODO: support multiple contentType options here. + (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + } else { + null + } val request = when (requestConfig.method) { RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) @@ -178,6 +190,7 @@ open class ApiClient(val baseUrl: String) { }.build() val response = client.newCall(request).execute() + val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault()) // TODO: handle specific mapping types. e.g. Map> @@ -215,7 +228,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 0000000000..cf2cfaa95d --- /dev/null +++ b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt index fb2c972cf8..064b57fc6b 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +++ b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt @@ -14,4 +14,4 @@ class BigDecimalAdapter { fun fromJson(value: String): BigDecimal { return BigDecimal(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt index 4b6963110c..7df6057b45 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt +++ b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt @@ -14,4 +14,4 @@ class BigIntegerAdapter { fun fromJson(value: String): BigInteger { return BigInteger(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 0000000000..be00e38fba --- /dev/null +++ b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 7e948e1dd0..625a19002b 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -13,5 +13,6 @@ data class RequestConfig( val path: String, val headers: MutableMap = mutableMapOf(), val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, val body: T? = null ) \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequest.kt b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequest.kt index 0266b16d54..f3033d77f5 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequest.kt +++ b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequest.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Keychain Memory - * - * Contains/describes the Hyperledger Cactus Keychain Memory plugin. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key for the entry to get from the keychain. */ + data class GetKeychainEntryRequest ( /* The key for the entry to get from the keychain. */ diff --git a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponse.kt b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponse.kt index fdd4d0a2e9..9bdb563426 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponse.kt +++ b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponse.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Keychain Memory - * - * Contains/describes the Hyperledger Cactus Keychain Memory plugin. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value associated with the requested key on the keychain. */ + data class GetKeychainEntryResponse ( /* The key that was used to retrieve the value from the keychain. */ diff --git a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequest.kt b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequest.kt index a5d580176c..7ec6af0d92 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequest.kt +++ b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequest.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Keychain Memory - * - * Contains/describes the Hyperledger Cactus Keychain Memory plugin. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value that will be associated with the key on the keychain. */ + data class SetKeychainEntryRequest ( /* The key for the entry to set on the keychain. */ diff --git a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponse.kt b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponse.kt index 1b2e210b1b..14e5d43237 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponse.kt +++ b/packages/cactus-plugin-keychain-memory/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponse.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Keychain Memory - * - * Contains/describes the Hyperledger Cactus Keychain Memory plugin. - * - * The version of the OpenAPI document: 0.2.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key that was used to set the value on the keychain. */ + data class SetKeychainEntryResponse ( /* The key that was used to set the value on the keychain. */ diff --git a/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/api.ts index 288fa5a030..d5c0415652 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * @@ -32,7 +34,7 @@ export interface GetKeychainEntryRequest { * @type {string} * @memberof GetKeychainEntryRequest */ - key: string; + 'key': string; } /** * @@ -45,13 +47,13 @@ export interface GetKeychainEntryResponse { * @type {string} * @memberof GetKeychainEntryResponse */ - key: string; + 'key': string; /** * The value associated with the requested key on the keychain. * @type {string} * @memberof GetKeychainEntryResponse */ - value: string; + 'value': string; } /** * @@ -64,13 +66,13 @@ export interface SetKeychainEntryRequest { * @type {string} * @memberof SetKeychainEntryRequest */ - key: string; + 'key': string; /** * The value that will be associated with the key on the keychain. * @type {string} * @memberof SetKeychainEntryRequest */ - value: string; + 'value': string; } /** * @@ -83,7 +85,7 @@ export interface SetKeychainEntryResponse { * @type {string} * @memberof SetKeychainEntryResponse */ - key: string; + 'key': string; } /** @@ -98,7 +100,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getPrometheusMetricsV1: async (options: any = {}): Promise => { + getPrometheusMetricsV1: async (options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/get-prometheus-exporter-metrics`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -113,7 +115,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -138,7 +140,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getPrometheusMetricsV1(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getPrometheusMetricsV1(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getPrometheusMetricsV1(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -178,7 +180,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getPrometheusMetricsV1(options?: any) { + public getPrometheusMetricsV1(options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getPrometheusMetricsV1(options).then((request) => request(this.axios, this.basePath)); } } diff --git a/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/base.ts index 92d96644f9..552e7a8241 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/common.ts index a668147ac9..9dd4887ce4 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/packages/cactus-plugin-keychain-memory/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; } diff --git a/packages/cactus-plugin-keychain-vault/openapitools.json b/packages/cactus-plugin-keychain-vault/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/packages/cactus-plugin-keychain-vault/openapitools.json +++ b/packages/cactus-plugin-keychain-vault/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES index 94ba8f1f2c..abca8b0131 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -6,7 +6,7 @@ settings.gradle src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -14,6 +14,7 @@ src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/README.md index 08d166b285..a449863351 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -1,9 +1,18 @@ # org.openapitools.client - Kotlin client library for Hyperledger Cactus - Keychain API +Contains/describes the Keychain API types/paths for Hyperledger Cactus. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 0.3.0 +- Package version: +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + ## Requires -* Kotlin 1.4.30 -* Gradle 6.8.3 +* Kotlin 1.7.21 +* Gradle 7.5 ## Build diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/build.gradle b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/build.gradle index 3de8b45b13..66a3c68b89 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/build.gradle +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/build.gradle @@ -2,12 +2,12 @@ group 'org.openapitools' version '1.0.0' wrapper { - gradleVersion = '6.8.3' + gradleVersion = '7.5' distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } buildscript { - ext.kotlin_version = '1.5.10' + ext.kotlin_version = '1.7.21' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -18,6 +18,7 @@ buildscript { } apply plugin: 'kotlin' +apply plugin: 'maven-publish' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -30,8 +31,8 @@ test { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "com.squareup.moshi:moshi-kotlin:1.12.0" - implementation "com.squareup.moshi:moshi-adapters:1.12.0" - implementation "com.squareup.okhttp3:okhttp:4.9.1" + implementation "com.squareup.moshi:moshi-kotlin:1.13.0" + implementation "com.squareup.moshi:moshi-adapters:1.13.0" + implementation "com.squareup.okhttp3:okhttp:4.10.0" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index 5ff7e4d9b6..8963af7ee6 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -20,6 +15,10 @@ package org.openapitools.client.apis +import java.io.IOException +import okhttp3.OkHttpClient +import okhttp3.HttpUrl + import org.openapitools.client.models.DeleteKeychainEntryRequestV1 import org.openapitools.client.models.DeleteKeychainEntryResponseV1 import org.openapitools.client.models.GetKeychainEntryRequest @@ -29,43 +28,45 @@ import org.openapitools.client.models.HasKeychainEntryResponseV1 import org.openapitools.client.models.SetKeychainEntryRequest import org.openapitools.client.models.SetKeychainEntryResponse +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://localhost") + System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost") } } /** - * Deletes an entry from the keychain stored under the provided key. - * - * @param deleteKeychainEntryRequestV1 (optional) - * @return DeleteKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Deletes an entry from the keychain stored under the provided key. + * + * @param deleteKeychainEntryRequestV1 (optional) + * @return DeleteKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1?) : DeleteKeychainEntryResponseV1 { - val localVariableConfig = deleteKeychainEntryV1RequestConfig(deleteKeychainEntryRequestV1 = deleteKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun deleteKeychainEntryV1(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1? = null) : DeleteKeychainEntryResponseV1 { + val localVarResponse = deleteKeychainEntryV1WithHttpInfo(deleteKeychainEntryRequestV1 = deleteKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as DeleteKeychainEntryResponseV1 @@ -83,42 +84,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation deleteKeychainEntryV1 - * - * @param deleteKeychainEntryRequestV1 (optional) - * @return RequestConfig - */ + * Deletes an entry from the keychain stored under the provided key. + * + * @param deleteKeychainEntryRequestV1 (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun deleteKeychainEntryV1WithHttpInfo(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1?) : ApiResponse { + val localVariableConfig = deleteKeychainEntryV1RequestConfig(deleteKeychainEntryRequestV1 = deleteKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation deleteKeychainEntryV1 + * + * @param deleteKeychainEntryRequestV1 (optional) + * @return RequestConfig + */ fun deleteKeychainEntryV1RequestConfig(deleteKeychainEntryRequestV1: DeleteKeychainEntryRequestV1?) : RequestConfig { val localVariableBody = deleteKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/delete-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Retrieves the contents of a keychain entry from the backend. - * - * @param getKeychainEntryRequest Request body to obtain a keychain entry via its key - * @return GetKeychainEntryResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Retrieves the contents of a keychain entry from the backend. + * + * @param getKeychainEntryRequest Request body to obtain a keychain entry via its key + * @return GetKeychainEntryResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getKeychainEntryV1(getKeychainEntryRequest: GetKeychainEntryRequest) : GetKeychainEntryResponse { - val localVariableConfig = getKeychainEntryV1RequestConfig(getKeychainEntryRequest = getKeychainEntryRequest) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = getKeychainEntryV1WithHttpInfo(getKeychainEntryRequest = getKeychainEntryRequest) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as GetKeychainEntryResponse @@ -136,41 +156,60 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation getKeychainEntryV1 - * - * @param getKeychainEntryRequest Request body to obtain a keychain entry via its key - * @return RequestConfig - */ + * Retrieves the contents of a keychain entry from the backend. + * + * @param getKeychainEntryRequest Request body to obtain a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getKeychainEntryV1WithHttpInfo(getKeychainEntryRequest: GetKeychainEntryRequest) : ApiResponse { + val localVariableConfig = getKeychainEntryV1RequestConfig(getKeychainEntryRequest = getKeychainEntryRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getKeychainEntryV1 + * + * @param getKeychainEntryRequest Request body to obtain a keychain entry via its key + * @return RequestConfig + */ fun getKeychainEntryV1RequestConfig(getKeychainEntryRequest: GetKeychainEntryRequest) : RequestConfig { val localVariableBody = getKeychainEntryRequest val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/get-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Get the Prometheus Metrics - * - * @return kotlin.String - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Get the Prometheus Metrics + * + * @return kotlin.String + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun getPrometheusMetricsV1() : kotlin.String { - val localVariableConfig = getPrometheusMetricsV1RequestConfig() - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = getPrometheusMetricsV1WithHttpInfo() return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String @@ -188,41 +227,57 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation getPrometheusMetricsV1 - * - * @return RequestConfig - */ + * Get the Prometheus Metrics + * + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getPrometheusMetricsV1WithHttpInfo() : ApiResponse { + val localVariableConfig = getPrometheusMetricsV1RequestConfig() + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getPrometheusMetricsV1 + * + * @return RequestConfig + */ fun getPrometheusMetricsV1RequestConfig() : RequestConfig { val localVariableBody = null val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + return RequestConfig( method = RequestMethod.GET, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/get-prometheus-exporter-metrics", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Retrieves the information regarding a key being present on the keychain or not. - * - * @param hasKeychainEntryRequestV1 (optional) - * @return HasKeychainEntryResponseV1 - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Retrieves the information regarding a key being present on the keychain or not. + * + * @param hasKeychainEntryRequestV1 (optional) + * @return HasKeychainEntryResponseV1 + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1?) : HasKeychainEntryResponseV1 { - val localVariableConfig = hasKeychainEntryV1RequestConfig(hasKeychainEntryRequestV1 = hasKeychainEntryRequestV1) - - val localVarResponse = request( - localVariableConfig - ) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun hasKeychainEntryV1(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1? = null) : HasKeychainEntryResponseV1 { + val localVarResponse = hasKeychainEntryV1WithHttpInfo(hasKeychainEntryRequestV1 = hasKeychainEntryRequestV1) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as HasKeychainEntryResponseV1 @@ -240,42 +295,61 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation hasKeychainEntryV1 - * - * @param hasKeychainEntryRequestV1 (optional) - * @return RequestConfig - */ + * Retrieves the information regarding a key being present on the keychain or not. + * + * @param hasKeychainEntryRequestV1 (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun hasKeychainEntryV1WithHttpInfo(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1?) : ApiResponse { + val localVariableConfig = hasKeychainEntryV1RequestConfig(hasKeychainEntryRequestV1 = hasKeychainEntryRequestV1) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation hasKeychainEntryV1 + * + * @param hasKeychainEntryRequestV1 (optional) + * @return RequestConfig + */ fun hasKeychainEntryV1RequestConfig(hasKeychainEntryRequestV1: HasKeychainEntryRequestV1?) : RequestConfig { val localVariableBody = hasKeychainEntryRequestV1 val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/has-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * Sets a value under a key on the keychain backend. - * - * @param setKeychainEntryRequest Request body to write/update a keychain entry via its key - * @return SetKeychainEntryResponse - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * Sets a value under a key on the keychain backend. + * + * @param setKeychainEntryRequest Request body to write/update a keychain entry via its key + * @return SetKeychainEntryResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) fun setKeychainEntryV1(setKeychainEntryRequest: SetKeychainEntryRequest) : SetKeychainEntryResponse { - val localVariableConfig = setKeychainEntryV1RequestConfig(setKeychainEntryRequest = setKeychainEntryRequest) - - val localVarResponse = request( - localVariableConfig - ) + val localVarResponse = setKeychainEntryV1WithHttpInfo(setKeychainEntryRequest = setKeychainEntryRequest) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as SetKeychainEntryResponse @@ -293,23 +367,47 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation setKeychainEntryV1 - * - * @param setKeychainEntryRequest Request body to write/update a keychain entry via its key - * @return RequestConfig - */ + * Sets a value under a key on the keychain backend. + * + * @param setKeychainEntryRequest Request body to write/update a keychain entry via its key + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun setKeychainEntryV1WithHttpInfo(setKeychainEntryRequest: SetKeychainEntryRequest) : ApiResponse { + val localVariableConfig = setKeychainEntryV1RequestConfig(setKeychainEntryRequest = setKeychainEntryRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation setKeychainEntryV1 + * + * @param setKeychainEntryRequest Request body to write/update a keychain entry via its key + * @return RequestConfig + */ fun setKeychainEntryV1RequestConfig(setKeychainEntryRequest: SetKeychainEntryRequest) : RequestConfig { val localVariableBody = setKeychainEntryRequest val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/set-keychain-entry", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index b359be1e41..757080d7ed 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -10,21 +10,26 @@ import okhttp3.ResponseBody import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import okhttp3.Headers +import okhttp3.Headers.Companion.toHeaders import okhttp3.MultipartBody +import okhttp3.Call +import okhttp3.Callback +import okhttp3.Response +import okhttp3.internal.EMPTY_REQUEST import java.io.BufferedWriter import java.io.File import java.io.FileWriter +import java.io.IOException import java.net.URLConnection import java.time.LocalDate import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter -open class ApiClient(val baseUrl: String) { +open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) { companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" @@ -39,9 +44,10 @@ open class ApiClient(val baseUrl: String) { var username: String? = null var password: String? = null var accessToken: String? = null + const val baseUrlKey = "org.openapitools.client.baseUrl" @JvmStatic - val client: OkHttpClient by lazy { + val defaultClient: OkHttpClient by lazy { builder.build() } @@ -60,48 +66,50 @@ open class ApiClient(val baseUrl: String) { return contentType ?: "application/octet-stream" } - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + protected inline fun requestBody(content: T, mediaType: String?): RequestBody = when { - content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull()) - mediaType == FormDataMediaType -> { + content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) + mediaType == FormDataMediaType -> MultipartBody.Builder() .setType(MultipartBody.FORM) .apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" + (content as Map>).forEach { (name, part) -> + if (part.body is File) { + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${part.body.name}\"") + val fileMediaType = guessContentTypeFromFile(part.body).toMediaTypeOrNull() + addPart( + partHeaders.toHeaders(), + part.body.asRequestBody(fileMediaType) ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"") addPart( - partHeaders, - parameterToString(value).toRequestBody(null) + partHeaders.toHeaders(), + parameterToString(part.body).toRequestBody(null) ) } } }.build() - } mediaType == FormUrlEncMediaType -> { FormBody.Builder().apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) + (content as Map>).forEach { (name, part) -> + add(name, parameterToString(part.body)) } }.build() } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) + mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> + if (content == null) { + EMPTY_REQUEST + } else { + Serializer.moshi.adapter(T::class.java).toJson(content) + .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) + } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -112,31 +120,35 @@ open class ApiClient(val baseUrl: String) { if(body == null) { return null } + if (T::class.java == File::class.java) { + // return tempFile + // Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options + val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() + tempFile.deleteOnExit() + body.byteStream().use { inputStream -> + tempFile.outputStream().use { tempFileOutputStream -> + inputStream.copyTo(tempFileOutputStream) + } + } + return tempFile as T + } val bodyContent = body.string() if (bodyContent.isEmpty()) { return null } - if (T::class.java == File::class.java) { - // return tempfile - val f = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() - f.deleteOnExit() - val out = BufferedWriter(FileWriter(f)) - out.write(bodyContent) - out.close() - return f as T - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) + .addEncodedPathSegments(requestConfig.path.trimStart('/')) .apply { requestConfig.query.forEach { query -> query.value.forEach { queryValue -> @@ -146,7 +158,7 @@ open class ApiClient(val baseUrl: String) { }.build() // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { + if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) { requestConfig.headers[ContentType] = JsonMediaType } if (requestConfig.headers[Accept].isNullOrEmpty()) { @@ -154,16 +166,16 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { + if (headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + val contentType = if (headers[ContentType] != null) { + // TODO: support multiple contentType options here. + (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + } else { + null + } val request = when (requestConfig.method) { RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) @@ -178,6 +190,7 @@ open class ApiClient(val baseUrl: String) { }.build() val response = client.newCall(request).execute() + val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault()) // TODO: handle specific mapping types. e.g. Map> @@ -215,7 +228,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 0000000000..cf2cfaa95d --- /dev/null +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt index fb2c972cf8..064b57fc6b 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt @@ -14,4 +14,4 @@ class BigDecimalAdapter { fun fromJson(value: String): BigDecimal { return BigDecimal(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt index 4b6963110c..7df6057b45 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt @@ -14,4 +14,4 @@ class BigIntegerAdapter { fun fromJson(value: String): BigInteger { return BigInteger(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 0000000000..be00e38fba --- /dev/null +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 7e948e1dd0..625a19002b 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -13,5 +13,6 @@ data class RequestConfig( val path: String, val headers: MutableMap = mutableMapOf(), val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, val body: T? = null ) \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt index 3146cc440c..ba98475cd6 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key of the entry to delete from the keychain. */ + data class DeleteKeychainEntryRequestV1 ( /* The key of the entry to delete from the keychain. */ diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt index 3eea63fb57..986811776c 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/DeleteKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key of the entry that was deleted from the keychain. */ + data class DeleteKeychainEntryResponseV1 ( /* The key of the entry that was deleted from the keychain. */ diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequest.kt b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequest.kt index feb1e608e5..f3033d77f5 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequest.kt +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryRequest.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key for the entry to get from the keychain. */ + data class GetKeychainEntryRequest ( /* The key for the entry to get from the keychain. */ diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponse.kt b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponse.kt index 933a0f99d9..9bdb563426 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponse.kt +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetKeychainEntryResponse.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value associated with the requested key on the keychain. */ + data class GetKeychainEntryResponse ( /* The key that was used to retrieve the value from the keychain. */ diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt index 71dee33cb6..4f7b976c95 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryRequestV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key to check for presence in the keychain. */ + data class HasKeychainEntryRequestV1 ( /* The key to check for presence in the keychain. */ diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt index 2bd2051856..97148e92af 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/HasKeychainEntryResponseV1.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -31,6 +26,7 @@ import com.squareup.moshi.Json * @param isPresent The boolean true or false indicating the presence or absence of an entry under 'key'. */ + data class HasKeychainEntryResponseV1 ( /* The key that was used to check the presence of the value in the keychain. */ diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequest.kt b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequest.kt index 420d2e0bf9..7ec6af0d92 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequest.kt +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryRequest.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param `value` The value that will be associated with the key on the keychain. */ + data class SetKeychainEntryRequest ( /* The key for the entry to set on the keychain. */ diff --git a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponse.kt b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponse.kt index d29ede67a8..14e5d43237 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponse.kt +++ b/packages/cactus-plugin-keychain-vault/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SetKeychainEntryResponse.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus - Keychain API - * - * Contains/describes the Keychain API types/paths for Hyperledger Cactus. - * - * The version of the OpenAPI document: 0.3.0 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param key The key that was used to set the value on the keychain. */ + data class SetKeychainEntryResponse ( /* The key that was used to set the value on the keychain. */ diff --git a/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/api.ts index ab09075ca3..9595e453b4 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * @@ -32,7 +34,7 @@ export interface DeleteKeychainEntryRequestV1 { * @type {string} * @memberof DeleteKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -45,7 +47,7 @@ export interface DeleteKeychainEntryResponseV1 { * @type {string} * @memberof DeleteKeychainEntryResponseV1 */ - key: string; + 'key': string; } /** * @@ -58,7 +60,7 @@ export interface GetKeychainEntryRequest { * @type {string} * @memberof GetKeychainEntryRequest */ - key: string; + 'key': string; } /** * @@ -71,13 +73,13 @@ export interface GetKeychainEntryResponse { * @type {string} * @memberof GetKeychainEntryResponse */ - key: string; + 'key': string; /** * The value associated with the requested key on the keychain. * @type {string} * @memberof GetKeychainEntryResponse */ - value: string; + 'value': string; } /** * @@ -90,7 +92,7 @@ export interface HasKeychainEntryRequestV1 { * @type {string} * @memberof HasKeychainEntryRequestV1 */ - key: string; + 'key': string; } /** * @@ -103,19 +105,19 @@ export interface HasKeychainEntryResponseV1 { * @type {string} * @memberof HasKeychainEntryResponseV1 */ - key: string; + 'key': string; /** * Date and time encoded as JSON when the presence check was performed by the plugin backend. * @type {string} * @memberof HasKeychainEntryResponseV1 */ - checkedAt: string; + 'checkedAt': string; /** * The boolean true or false indicating the presence or absence of an entry under \'key\'. * @type {boolean} * @memberof HasKeychainEntryResponseV1 */ - isPresent: boolean; + 'isPresent': boolean; } /** * @@ -128,13 +130,13 @@ export interface SetKeychainEntryRequest { * @type {string} * @memberof SetKeychainEntryRequest */ - key: string; + 'key': string; /** * The value that will be associated with the key on the keychain. * @type {string} * @memberof SetKeychainEntryRequest */ - value: string; + 'value': string; } /** * @@ -147,7 +149,7 @@ export interface SetKeychainEntryResponse { * @type {string} * @memberof SetKeychainEntryResponse */ - key: string; + 'key': string; } /** @@ -163,7 +165,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteKeychainEntryV1: async (deleteKeychainEntryRequestV1?: DeleteKeychainEntryRequestV1, options: any = {}): Promise => { + deleteKeychainEntryV1: async (deleteKeychainEntryRequestV1?: DeleteKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/delete-keychain-entry`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -180,7 +182,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(deleteKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -197,7 +199,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getKeychainEntryV1: async (getKeychainEntryRequest: GetKeychainEntryRequest, options: any = {}): Promise => { + getKeychainEntryV1: async (getKeychainEntryRequest: GetKeychainEntryRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'getKeychainEntryRequest' is not null or undefined assertParamExists('getKeychainEntryV1', 'getKeychainEntryRequest', getKeychainEntryRequest) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/get-keychain-entry`; @@ -216,7 +218,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(getKeychainEntryRequest, localVarRequestOptions, configuration) @@ -232,7 +234,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getPrometheusMetricsV1: async (options: any = {}): Promise => { + getPrometheusMetricsV1: async (options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/get-prometheus-exporter-metrics`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -247,7 +249,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -263,7 +265,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - hasKeychainEntryV1: async (hasKeychainEntryRequestV1?: HasKeychainEntryRequestV1, options: any = {}): Promise => { + hasKeychainEntryV1: async (hasKeychainEntryRequestV1?: HasKeychainEntryRequestV1, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/has-keychain-entry`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -280,7 +282,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(hasKeychainEntryRequestV1, localVarRequestOptions, configuration) @@ -297,7 +299,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - setKeychainEntryV1: async (setKeychainEntryRequest: SetKeychainEntryRequest, options: any = {}): Promise => { + setKeychainEntryV1: async (setKeychainEntryRequest: SetKeychainEntryRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'setKeychainEntryRequest' is not null or undefined assertParamExists('setKeychainEntryV1', 'setKeychainEntryRequest', setKeychainEntryRequest) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/set-keychain-entry`; @@ -316,7 +318,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(setKeychainEntryRequest, localVarRequestOptions, configuration) @@ -343,7 +345,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async deleteKeychainEntryV1(deleteKeychainEntryRequestV1?: DeleteKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async deleteKeychainEntryV1(deleteKeychainEntryRequestV1?: DeleteKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.deleteKeychainEntryV1(deleteKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -354,7 +356,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getKeychainEntryV1(getKeychainEntryRequest: GetKeychainEntryRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getKeychainEntryV1(getKeychainEntryRequest: GetKeychainEntryRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getKeychainEntryV1(getKeychainEntryRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -364,7 +366,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getPrometheusMetricsV1(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getPrometheusMetricsV1(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getPrometheusMetricsV1(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -375,7 +377,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async hasKeychainEntryV1(hasKeychainEntryRequestV1?: HasKeychainEntryRequestV1, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async hasKeychainEntryV1(hasKeychainEntryRequestV1?: HasKeychainEntryRequestV1, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.hasKeychainEntryV1(hasKeychainEntryRequestV1, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -386,7 +388,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async setKeychainEntryV1(setKeychainEntryRequest: SetKeychainEntryRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async setKeychainEntryV1(setKeychainEntryRequest: SetKeychainEntryRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.setKeychainEntryV1(setKeychainEntryRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -467,7 +469,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public deleteKeychainEntryV1(deleteKeychainEntryRequestV1?: DeleteKeychainEntryRequestV1, options?: any) { + public deleteKeychainEntryV1(deleteKeychainEntryRequestV1?: DeleteKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).deleteKeychainEntryV1(deleteKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } @@ -479,7 +481,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getKeychainEntryV1(getKeychainEntryRequest: GetKeychainEntryRequest, options?: any) { + public getKeychainEntryV1(getKeychainEntryRequest: GetKeychainEntryRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getKeychainEntryV1(getKeychainEntryRequest, options).then((request) => request(this.axios, this.basePath)); } @@ -490,7 +492,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getPrometheusMetricsV1(options?: any) { + public getPrometheusMetricsV1(options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getPrometheusMetricsV1(options).then((request) => request(this.axios, this.basePath)); } @@ -502,7 +504,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public hasKeychainEntryV1(hasKeychainEntryRequestV1?: HasKeychainEntryRequestV1, options?: any) { + public hasKeychainEntryV1(hasKeychainEntryRequestV1?: HasKeychainEntryRequestV1, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).hasKeychainEntryV1(hasKeychainEntryRequestV1, options).then((request) => request(this.axios, this.basePath)); } @@ -514,7 +516,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public setKeychainEntryV1(setKeychainEntryRequest: SetKeychainEntryRequest, options?: any) { + public setKeychainEntryV1(setKeychainEntryRequest: SetKeychainEntryRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).setKeychainEntryV1(setKeychainEntryRequest, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/base.ts index 5bdd7d5a90..51fa22c30d 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/common.ts index 551dfb0d3c..e6d53f3c0f 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/packages/cactus-plugin-keychain-vault/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; } diff --git a/packages/cactus-plugin-ledger-connector-besu/openapitools.json b/packages/cactus-plugin-ledger-connector-besu/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/packages/cactus-plugin-ledger-connector-besu/openapitools.json +++ b/packages/cactus-plugin-ledger-connector-besu/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/api.ts index 66cb9f3497..a5a63011f1 100644 --- a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * @@ -32,13 +34,13 @@ export interface BesuPrivateTransactionConfig { * @type {string} * @memberof BesuPrivateTransactionConfig */ - privateFrom: string; + 'privateFrom': string; /** * * @type {Array} * @memberof BesuPrivateTransactionConfig */ - privateFor: Array; + 'privateFor': Array; } /** * @@ -46,57 +48,63 @@ export interface BesuPrivateTransactionConfig { * @interface BesuTransactionConfig */ export interface BesuTransactionConfig { - [key: string]: object | any; + [key: string]: any; /** * * @type {string} * @memberof BesuTransactionConfig */ - rawTransaction?: string; + 'rawTransaction'?: string; /** * - * @type {string | number} + * @type {Web3BlockHeaderTimestamp} * @memberof BesuTransactionConfig */ - from?: string | number; + 'from'?: Web3BlockHeaderTimestamp; /** * - * @type {string} + * @type {BesuTransactionConfigTo} * @memberof BesuTransactionConfig */ - to?: string; + 'to'?: BesuTransactionConfigTo; /** * - * @type {string | number} + * @type {Web3BlockHeaderTimestamp} * @memberof BesuTransactionConfig */ - value?: string | number; + 'value'?: Web3BlockHeaderTimestamp; /** * - * @type {string | number} + * @type {Web3BlockHeaderTimestamp} * @memberof BesuTransactionConfig */ - gas?: string | number; + 'gas'?: Web3BlockHeaderTimestamp; /** * - * @type {string | number} + * @type {Web3BlockHeaderTimestamp} * @memberof BesuTransactionConfig */ - gasPrice?: string | number; + 'gasPrice'?: Web3BlockHeaderTimestamp; /** * * @type {number} * @memberof BesuTransactionConfig */ - nonce?: number; + 'nonce'?: number; /** * - * @type {string} + * @type {BesuTransactionConfigTo} * @memberof BesuTransactionConfig */ - data?: string; + 'data'?: BesuTransactionConfigTo; } +/** + * @type BesuTransactionConfigTo + * @export + */ +export type BesuTransactionConfigTo = string; + /** * * @export @@ -108,20 +116,22 @@ export interface ConsistencyStrategy { * @type {ReceiptType} * @memberof ConsistencyStrategy */ - receiptType: ReceiptType; + 'receiptType': ReceiptType; /** * The amount of milliseconds to wait for the receipt to arrive to the connector. Defaults to 0 which means to wait for an unlimited amount of time. Note that this wait may be interrupted still by other parts of the infrastructure such as load balancers cutting of HTTP requests after some time even if they are the type that is supposed to be kept alive. The question of re-entrance is a broader topic not in scope to discuss here, but it is important to mention it. * @type {number} * @memberof ConsistencyStrategy */ - timeoutMs?: number; + 'timeoutMs'?: number; /** * The number of blocks to wait to be confirmed in addition to the block containing the transaction in question. Note that if the receipt type is set to only wait for node transaction pool ACK and this parameter is set to anything, but zero then the API will not accept the request due to conflicting parameters. * @type {number} * @memberof ConsistencyStrategy */ - blockConfirmations: number; + 'blockConfirmations': number; } + + /** * * @export @@ -133,61 +143,61 @@ export interface DeployContractSolidityBytecodeV1Request { * @type {string} * @memberof DeployContractSolidityBytecodeV1Request */ - contractName: string; + 'contractName': string; /** * The application binary interface of the solidity contract * @type {Array} * @memberof DeployContractSolidityBytecodeV1Request */ - contractAbi: Array; + 'contractAbi': Array; /** * * @type {Array} * @memberof DeployContractSolidityBytecodeV1Request */ - constructorArgs: Array; + 'constructorArgs': Array; /** * * @type {Web3SigningCredential} * @memberof DeployContractSolidityBytecodeV1Request */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode * @type {string} * @memberof DeployContractSolidityBytecodeV1Request */ - bytecode: string; + 'bytecode': string; /** * The keychainId for retrieve the contracts json. * @type {string} * @memberof DeployContractSolidityBytecodeV1Request */ - keychainId: string; + 'keychainId': string; /** * * @type {number} * @memberof DeployContractSolidityBytecodeV1Request */ - gas?: number; + 'gas'?: number; /** * * @type {string} * @memberof DeployContractSolidityBytecodeV1Request */ - gasPrice?: string; + 'gasPrice'?: string; /** * The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing. * @type {number} * @memberof DeployContractSolidityBytecodeV1Request */ - timeoutMs?: number; + 'timeoutMs'?: number; /** * * @type {BesuPrivateTransactionConfig} * @memberof DeployContractSolidityBytecodeV1Request */ - privateTransactionConfig?: BesuPrivateTransactionConfig; + 'privateTransactionConfig'?: BesuPrivateTransactionConfig; } /** * @@ -200,7 +210,7 @@ export interface DeployContractSolidityBytecodeV1Response { * @type {Web3TransactionReceipt} * @memberof DeployContractSolidityBytecodeV1Response */ - transactionReceipt: Web3TransactionReceipt; + 'transactionReceipt': Web3TransactionReceipt; } /** * @@ -208,10 +218,13 @@ export interface DeployContractSolidityBytecodeV1Response { * @enum {string} */ -export enum EthContractInvocationType { - Send = 'SEND', - Call = 'CALL' -} +export const EthContractInvocationType = { + Send: 'SEND', + Call: 'CALL' +} as const; + +export type EthContractInvocationType = typeof EthContractInvocationType[keyof typeof EthContractInvocationType]; + /** * @@ -224,109 +237,109 @@ export interface EvmBlock { * @type {number} * @memberof EvmBlock */ - number?: number; + 'number'?: number; /** * * @type {string} * @memberof EvmBlock */ - hash?: string; + 'hash'?: string; /** * * @type {string} * @memberof EvmBlock */ - parentHash?: string; + 'parentHash'?: string; /** * * @type {string} * @memberof EvmBlock */ - nonce?: string; + 'nonce'?: string; /** * * @type {string} * @memberof EvmBlock */ - sha3Uncles?: string; + 'sha3Uncles'?: string; /** * * @type {string} * @memberof EvmBlock */ - logsBloom?: string; + 'logsBloom'?: string; /** * * @type {string} * @memberof EvmBlock */ - transactionsRoot?: string; + 'transactionsRoot'?: string; /** * * @type {string} * @memberof EvmBlock */ - stateRoot?: string; + 'stateRoot'?: string; /** * * @type {string} * @memberof EvmBlock */ - miner?: string; + 'miner'?: string; /** * * @type {number} * @memberof EvmBlock */ - difficulty?: number; + 'difficulty'?: number; /** * * @type {number} * @memberof EvmBlock */ - totalDifficulty?: number; + 'totalDifficulty'?: number; /** * * @type {string} * @memberof EvmBlock */ - extraData?: string; + 'extraData'?: string; /** * * @type {number} * @memberof EvmBlock */ - size?: number; + 'size'?: number; /** * * @type {number} * @memberof EvmBlock */ - gasLimit?: number; + 'gasLimit'?: number; /** * * @type {number} * @memberof EvmBlock */ - gasUsed?: number; + 'gasUsed'?: number; /** * * @type {any} * @memberof EvmBlock */ - timestamp?: any | null; + 'timestamp'?: any; /** * * @type {Array} * @memberof EvmBlock */ - transactions?: Array; + 'transactions'?: Array; /** * * @type {Array} * @memberof EvmBlock */ - uncles?: Array; + 'uncles'?: Array; } /** * @@ -339,49 +352,49 @@ export interface EvmLog { * @type {string} * @memberof EvmLog */ - address: string; + 'address': string; /** * * @type {string} * @memberof EvmLog */ - data: string; + 'data': string; /** * * @type {string} * @memberof EvmLog */ - blockHash: string; + 'blockHash': string; /** * * @type {string} * @memberof EvmLog */ - transactionHash: string; + 'transactionHash': string; /** * * @type {Array} * @memberof EvmLog */ - topics: Array; + 'topics': Array; /** * * @type {number} * @memberof EvmLog */ - logIndex: number; + 'logIndex': number; /** * * @type {number} * @memberof EvmLog */ - transactionIndex: number; + 'transactionIndex': number; /** * * @type {number} * @memberof EvmLog */ - blockNumber: number; + 'blockNumber': number; } /** * @@ -394,67 +407,67 @@ export interface EvmTransaction { * @type {string} * @memberof EvmTransaction */ - hash?: string; + 'hash'?: string; /** * * @type {number} * @memberof EvmTransaction */ - nonce?: number; + 'nonce'?: number; /** * * @type {any} * @memberof EvmTransaction */ - blockHash?: any | null; + 'blockHash'?: any; /** * * @type {any} * @memberof EvmTransaction */ - blockNumber?: any | null; + 'blockNumber'?: any; /** * * @type {any} * @memberof EvmTransaction */ - transactionIndex?: any | null; + 'transactionIndex'?: any; /** * * @type {string} * @memberof EvmTransaction */ - from?: string; + 'from'?: string; /** * * @type {any} * @memberof EvmTransaction */ - to?: any | null; + 'to'?: any; /** * * @type {string} * @memberof EvmTransaction */ - value?: string; + 'value'?: string; /** * * @type {string} * @memberof EvmTransaction */ - gasPrice?: string; + 'gasPrice'?: string; /** * * @type {number} * @memberof EvmTransaction */ - gas?: number; + 'gas'?: number; /** * * @type {string} * @memberof EvmTransaction */ - input?: string; + 'input'?: string; } /** * @@ -467,13 +480,13 @@ export interface GetBalanceV1Request { * @type {string} * @memberof GetBalanceV1Request */ - address: string; + 'address': string; /** * * @type {any} * @memberof GetBalanceV1Request */ - defaultBlock?: any | null; + 'defaultBlock'?: any; } /** * @@ -486,7 +499,7 @@ export interface GetBalanceV1Response { * @type {string} * @memberof GetBalanceV1Response */ - balance: string; + 'balance': string; } /** * @@ -499,13 +512,13 @@ export interface GetBesuRecordV1Request { * @type {InvokeContractV1Request} * @memberof GetBesuRecordV1Request */ - invokeCall?: InvokeContractV1Request; + 'invokeCall'?: InvokeContractV1Request; /** * * @type {string} * @memberof GetBesuRecordV1Request */ - transactionHash?: string; + 'transactionHash'?: string; } /** * @@ -518,25 +531,25 @@ export interface GetBesuRecordV1Response { * @type {string} * @memberof GetBesuRecordV1Response */ - ledgerId?: string; + 'ledgerId'?: string; /** * * @type {string} * @memberof GetBesuRecordV1Response */ - stateContract?: string; + 'stateContract'?: string; /** * * @type {any} * @memberof GetBesuRecordV1Response */ - transactionInputData?: any | null; + 'transactionInputData'?: any; /** * * @type {any} * @memberof GetBesuRecordV1Response */ - callOutput?: any | null; + 'callOutput'?: any; } /** * @@ -549,7 +562,7 @@ export interface GetBlockV1Request { * @type {any} * @memberof GetBlockV1Request */ - blockHashOrBlockNumber: any | null; + 'blockHashOrBlockNumber': any; } /** * @@ -562,7 +575,7 @@ export interface GetBlockV1Response { * @type {EvmBlock} * @memberof GetBlockV1Response */ - block: EvmBlock; + 'block': EvmBlock; } /** * @@ -575,25 +588,25 @@ export interface GetPastLogsV1Request { * @type {any} * @memberof GetPastLogsV1Request */ - toBlock?: any | null; + 'toBlock'?: any; /** * * @type {any} * @memberof GetPastLogsV1Request */ - fromBlock?: any | null; + 'fromBlock'?: any; /** * * @type {any} * @memberof GetPastLogsV1Request */ - address?: any | null; + 'address'?: any; /** * * @type {Array} * @memberof GetPastLogsV1Request */ - topics?: Array; + 'topics'?: Array; } /** * @@ -606,7 +619,7 @@ export interface GetPastLogsV1Response { * @type {Array} * @memberof GetPastLogsV1Response */ - logs: Array; + 'logs': Array; } /** * @@ -619,7 +632,7 @@ export interface GetTransactionV1Request { * @type {string} * @memberof GetTransactionV1Request */ - transactionHash: string; + 'transactionHash': string; } /** * @@ -632,7 +645,7 @@ export interface GetTransactionV1Response { * @type {EvmTransaction} * @memberof GetTransactionV1Response */ - transaction: EvmTransaction; + 'transaction': EvmTransaction; } /** * @@ -645,86 +658,88 @@ export interface InvokeContractV1Request { * @type {string} * @memberof InvokeContractV1Request */ - contractName: string; + 'contractName': string; /** * * @type {Web3SigningCredential} * @memberof InvokeContractV1Request */ - signingCredential: Web3SigningCredential; + 'signingCredential': Web3SigningCredential; /** * * @type {EthContractInvocationType} * @memberof InvokeContractV1Request */ - invocationType: EthContractInvocationType; + 'invocationType': EthContractInvocationType; /** * The name of the contract method to invoke. * @type {string} * @memberof InvokeContractV1Request */ - methodName: string; + 'methodName': string; /** * The list of arguments to pass in to the contract method being invoked. * @type {Array} * @memberof InvokeContractV1Request */ - params: Array; + 'params': Array; /** * The application binary interface of the solidity contract, optional parameter * @type {Array} * @memberof InvokeContractV1Request */ - contractAbi?: Array; + 'contractAbi'?: Array; /** * Address of the solidity contract, optional parameter * @type {string} * @memberof InvokeContractV1Request */ - contractAddress?: string; + 'contractAddress'?: string; /** * - * @type {string | number} + * @type {Web3BlockHeaderTimestamp} * @memberof InvokeContractV1Request */ - value?: string | number; + 'value'?: Web3BlockHeaderTimestamp; /** * - * @type {string | number} + * @type {Web3BlockHeaderTimestamp} * @memberof InvokeContractV1Request */ - gas?: string | number; + 'gas'?: Web3BlockHeaderTimestamp; /** * - * @type {string | number} + * @type {Web3BlockHeaderTimestamp} * @memberof InvokeContractV1Request */ - gasPrice?: string | number; + 'gasPrice'?: Web3BlockHeaderTimestamp; /** * * @type {number} * @memberof InvokeContractV1Request */ - nonce?: number; + 'nonce'?: number; /** * The amount of milliseconds to wait for a transaction receipt beforegiving up and crashing. Only has any effect if the invocation type is SEND * @type {number} * @memberof InvokeContractV1Request */ - timeoutMs?: number; + 'timeoutMs'?: number; /** * The keychainId for retrieve the contracts json. * @type {string} * @memberof InvokeContractV1Request */ - keychainId?: string; + 'keychainId'?: string; /** * * @type {BesuPrivateTransactionConfig} * @memberof InvokeContractV1Request */ - privateTransactionConfig?: BesuPrivateTransactionConfig; + 'privateTransactionConfig'?: BesuPrivateTransactionConfig; } + + /** * * @export @@ -736,19 +751,19 @@ export interface InvokeContractV1Response { * @type {Web3TransactionReceipt} * @memberof InvokeContractV1Response */ - transactionReceipt?: Web3TransactionReceipt; + 'transactionReceipt'?: Web3TransactionReceipt; /** * * @type {any} * @memberof InvokeContractV1Response */ - callOutput?: any | null; + 'callOutput'?: any; /** * * @type {boolean} * @memberof InvokeContractV1Response */ - success: boolean; + 'success': boolean; } /** * Enumerates the possible types of receipts that can be waited for by someone or something that has requested the execution of a transaction on a ledger. @@ -756,10 +771,13 @@ export interface InvokeContractV1Response { * @enum {string} */ -export enum ReceiptType { - NodeTxPoolAck = 'NODE_TX_POOL_ACK', - LedgerBlockAck = 'LEDGER_BLOCK_ACK' -} +export const ReceiptType = { + NodeTxPoolAck: 'NODE_TX_POOL_ACK', + LedgerBlockAck: 'LEDGER_BLOCK_ACK' +} as const; + +export type ReceiptType = typeof ReceiptType[keyof typeof ReceiptType]; + /** * @@ -772,25 +790,25 @@ export interface RunTransactionRequest { * @type {Web3SigningCredential} * @memberof RunTransactionRequest */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * * @type {BesuTransactionConfig} * @memberof RunTransactionRequest */ - transactionConfig: BesuTransactionConfig; + 'transactionConfig': BesuTransactionConfig; /** * * @type {ConsistencyStrategy} * @memberof RunTransactionRequest */ - consistencyStrategy: ConsistencyStrategy; + 'consistencyStrategy': ConsistencyStrategy; /** * * @type {BesuPrivateTransactionConfig} * @memberof RunTransactionRequest */ - privateTransactionConfig?: BesuPrivateTransactionConfig; + 'privateTransactionConfig'?: BesuPrivateTransactionConfig; } /** * @@ -803,7 +821,7 @@ export interface RunTransactionResponse { * @type {Web3TransactionReceipt} * @memberof RunTransactionResponse */ - transactionReceipt: Web3TransactionReceipt; + 'transactionReceipt': Web3TransactionReceipt; } /** * @@ -816,19 +834,19 @@ export interface SignTransactionRequest { * @type {string} * @memberof SignTransactionRequest */ - keychainId: string; + 'keychainId': string; /** * * @type {string} * @memberof SignTransactionRequest */ - keychainRef: string; + 'keychainRef': string; /** * The transaction hash of ledger will be used to fetch the contain. * @type {string} * @memberof SignTransactionRequest */ - transactionHash: string; + 'transactionHash': string; } /** * @@ -841,7 +859,7 @@ export interface SignTransactionResponse { * @type {string} * @memberof SignTransactionResponse */ - signature: string; + 'signature': string; } /** * @@ -854,75 +872,143 @@ export interface SolidityContractJsonArtifact { * @type {string} * @memberof SolidityContractJsonArtifact */ - contractName: string; + 'contractName': string; /** * * @type {string} * @memberof SolidityContractJsonArtifact */ - metadata?: string; + 'metadata'?: string; /** * * @type {string} * @memberof SolidityContractJsonArtifact */ - bytecode?: string; + 'bytecode'?: string; /** * * @type {string} * @memberof SolidityContractJsonArtifact */ - deployedBytecode?: string; + 'deployedBytecode'?: string; /** * * @type {string} * @memberof SolidityContractJsonArtifact */ - sourceMap?: string; + 'sourceMap'?: string; /** * * @type {string} * @memberof SolidityContractJsonArtifact */ - deployedSourceMap?: string; + 'deployedSourceMap'?: string; /** * * @type {string} * @memberof SolidityContractJsonArtifact */ - sourcePath?: string; + 'sourcePath'?: string; /** * - * @type {{ [key: string]: object; }} + * @type {SolidityContractJsonArtifactCompiler} * @memberof SolidityContractJsonArtifact */ - compiler?: { [key: string]: object; }; + 'compiler'?: SolidityContractJsonArtifactCompiler; /** * - * @type {{ [key: string]: object; }} + * @type {{ [key: string]: any; }} * @memberof SolidityContractJsonArtifact */ - functionHashes?: { [key: string]: object; }; + 'functionHashes'?: { [key: string]: any; }; /** * - * @type {object} + * @type {SolidityContractJsonArtifactGasEstimates} * @memberof SolidityContractJsonArtifact */ - gasEstimates?: object; + 'gasEstimates'?: SolidityContractJsonArtifactGasEstimates; } /** * * @export - * @enum {string} + * @interface SolidityContractJsonArtifactCompiler */ +export interface SolidityContractJsonArtifactCompiler { + [key: string]: any; -export enum WatchBlocksV1 { - Subscribe = 'org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Subscribe', - Next = 'org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Next', - Unsubscribe = 'org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Unsubscribe', - Error = 'org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Error', - Complete = 'org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Complete' + /** + * + * @type {string} + * @memberof SolidityContractJsonArtifactCompiler + */ + 'name'?: string; + /** + * + * @type {string} + * @memberof SolidityContractJsonArtifactCompiler + */ + 'version'?: string; +} +/** + * + * @export + * @interface SolidityContractJsonArtifactGasEstimates + */ +export interface SolidityContractJsonArtifactGasEstimates { + /** + * + * @type {SolidityContractJsonArtifactGasEstimatesCreation} + * @memberof SolidityContractJsonArtifactGasEstimates + */ + 'creation'?: SolidityContractJsonArtifactGasEstimatesCreation; + /** + * + * @type {{ [key: string]: any; }} + * @memberof SolidityContractJsonArtifactGasEstimates + */ + 'external'?: { [key: string]: any; }; +} +/** + * + * @export + * @interface SolidityContractJsonArtifactGasEstimatesCreation + */ +export interface SolidityContractJsonArtifactGasEstimatesCreation { + /** + * + * @type {string} + * @memberof SolidityContractJsonArtifactGasEstimatesCreation + */ + 'codeDepositCost'?: string; + /** + * + * @type {string} + * @memberof SolidityContractJsonArtifactGasEstimatesCreation + */ + 'executionCost'?: string; + /** + * + * @type {string} + * @memberof SolidityContractJsonArtifactGasEstimatesCreation + */ + 'totalCost'?: string; } +/** + * + * @export + * @enum {string} + */ + +export const WatchBlocksV1 = { + Subscribe: 'org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Subscribe', + Next: 'org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Next', + Unsubscribe: 'org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Unsubscribe', + Error: 'org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Error', + Complete: 'org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Complete' +} as const; + +export type WatchBlocksV1 = typeof WatchBlocksV1[keyof typeof WatchBlocksV1]; + /** * @@ -935,7 +1021,7 @@ export interface WatchBlocksV1Progress { * @type {Web3BlockHeader} * @memberof WatchBlocksV1Progress */ - blockHeader: Web3BlockHeader; + 'blockHeader': Web3BlockHeader; } /** * @@ -948,86 +1034,92 @@ export interface Web3BlockHeader { * @type {number} * @memberof Web3BlockHeader */ - number: number; + 'number': number; /** * * @type {string} * @memberof Web3BlockHeader */ - hash: string; + 'hash': string; /** * * @type {string} * @memberof Web3BlockHeader */ - parentHash: string; + 'parentHash': string; /** * * @type {string} * @memberof Web3BlockHeader */ - nonce: string; + 'nonce': string; /** * * @type {string} * @memberof Web3BlockHeader */ - sha3Uncles: string; + 'sha3Uncles': string; /** * * @type {string} * @memberof Web3BlockHeader */ - logsBloom: string; + 'logsBloom': string; /** * * @type {string} * @memberof Web3BlockHeader */ - transactionRoot: string; + 'transactionRoot': string; /** * * @type {string} * @memberof Web3BlockHeader */ - stateRoot: string; + 'stateRoot': string; /** * * @type {string} * @memberof Web3BlockHeader */ - receiptRoot: string; + 'receiptRoot': string; /** * * @type {string} * @memberof Web3BlockHeader */ - miner: string; + 'miner': string; /** * * @type {string} * @memberof Web3BlockHeader */ - extraData: string; + 'extraData': string; /** * * @type {number} * @memberof Web3BlockHeader */ - gasLimit: number; + 'gasLimit': number; /** * * @type {number} * @memberof Web3BlockHeader */ - gasUsed: number; + 'gasUsed': number; /** * - * @type {string | number} + * @type {Web3BlockHeaderTimestamp} * @memberof Web3BlockHeader */ - timestamp: string | number; + 'timestamp': Web3BlockHeaderTimestamp; } +/** + * @type Web3BlockHeaderTimestamp + * @export + */ +export type Web3BlockHeaderTimestamp = number | string; + /** * @type Web3SigningCredential * @export @@ -1045,26 +1137,28 @@ export interface Web3SigningCredentialCactusKeychainRef { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialCactusKeychainRef */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; /** * The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication. * @type {string} * @memberof Web3SigningCredentialCactusKeychainRef */ - ethAccount: string; + 'ethAccount': string; /** * The key to use when looking up the the keychain entry holding the secret pointed to by the keychainEntryKey parameter. * @type {string} * @memberof Web3SigningCredentialCactusKeychainRef */ - keychainEntryKey: string; + 'keychainEntryKey': string; /** * The keychain ID to use when looking up the the keychain plugin instance that will be used to retrieve the secret pointed to by the keychainEntryKey parameter. * @type {string} * @memberof Web3SigningCredentialCactusKeychainRef */ - keychainId: string; + 'keychainId': string; } + + /** * Using this denotes that there is no signing required because the transaction is pre-signed. * @export @@ -1076,8 +1170,10 @@ export interface Web3SigningCredentialNone { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialNone */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; } + + /** * * @export @@ -1089,32 +1185,37 @@ export interface Web3SigningCredentialPrivateKeyHex { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialPrivateKeyHex */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; /** * The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication. * @type {string} * @memberof Web3SigningCredentialPrivateKeyHex */ - ethAccount: string; + 'ethAccount': string; /** * The HEX encoded private key of an eth account. * @type {string} * @memberof Web3SigningCredentialPrivateKeyHex */ - secret: string; + 'secret': string; } + + /** * * @export * @enum {string} */ -export enum Web3SigningCredentialType { - CactusKeychainRef = 'CACTUS_KEYCHAIN_REF', - GethKeychainPassword = 'GETH_KEYCHAIN_PASSWORD', - PrivateKeyHex = 'PRIVATE_KEY_HEX', - None = 'NONE' -} +export const Web3SigningCredentialType = { + CactusKeychainRef: 'CACTUS_KEYCHAIN_REF', + GethKeychainPassword: 'GETH_KEYCHAIN_PASSWORD', + PrivateKeyHex: 'PRIVATE_KEY_HEX', + None: 'NONE' +} as const; + +export type Web3SigningCredentialType = typeof Web3SigningCredentialType[keyof typeof Web3SigningCredentialType]; + /** * @@ -1122,62 +1223,62 @@ export enum Web3SigningCredentialType { * @interface Web3TransactionReceipt */ export interface Web3TransactionReceipt { - [key: string]: object | any; + [key: string]: any; /** * * @type {boolean} * @memberof Web3TransactionReceipt */ - status: boolean; + 'status': boolean; /** * * @type {string} * @memberof Web3TransactionReceipt */ - transactionHash: string; + 'transactionHash': string; /** * * @type {number} * @memberof Web3TransactionReceipt */ - transactionIndex: number; + 'transactionIndex': number; /** * * @type {string} * @memberof Web3TransactionReceipt */ - blockHash: string; + 'blockHash': string; /** * * @type {number} * @memberof Web3TransactionReceipt */ - blockNumber: number; + 'blockNumber': number; /** * * @type {number} * @memberof Web3TransactionReceipt */ - gasUsed: number; + 'gasUsed': number; /** * * @type {string} * @memberof Web3TransactionReceipt */ - contractAddress?: string | null; + 'contractAddress'?: string | null; /** * * @type {string} * @memberof Web3TransactionReceipt */ - from: string; + 'from': string; /** * * @type {string} * @memberof Web3TransactionReceipt */ - to: string; + 'to': string; } /** @@ -1193,7 +1294,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deployContractSolBytecodeV1: async (deployContractSolidityBytecodeV1Request?: DeployContractSolidityBytecodeV1Request, options: any = {}): Promise => { + deployContractSolBytecodeV1: async (deployContractSolidityBytecodeV1Request?: DeployContractSolidityBytecodeV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/deploy-contract-solidity-bytecode`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1210,7 +1311,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(deployContractSolidityBytecodeV1Request, localVarRequestOptions, configuration) @@ -1227,7 +1328,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getBalanceV1: async (getBalanceV1Request?: GetBalanceV1Request, options: any = {}): Promise => { + getBalanceV1: async (getBalanceV1Request?: GetBalanceV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-balance`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1244,7 +1345,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(getBalanceV1Request, localVarRequestOptions, configuration) @@ -1261,7 +1362,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getBesuRecordV1: async (getBesuRecordV1Request?: GetBesuRecordV1Request, options: any = {}): Promise => { + getBesuRecordV1: async (getBesuRecordV1Request?: GetBesuRecordV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-besu-record`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1278,7 +1379,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(getBesuRecordV1Request, localVarRequestOptions, configuration) @@ -1295,7 +1396,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getBlockV1: async (getBlockV1Request?: GetBlockV1Request, options: any = {}): Promise => { + getBlockV1: async (getBlockV1Request?: GetBlockV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-block`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1312,7 +1413,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(getBlockV1Request, localVarRequestOptions, configuration) @@ -1329,7 +1430,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getPastLogsV1: async (getPastLogsV1Request?: GetPastLogsV1Request, options: any = {}): Promise => { + getPastLogsV1: async (getPastLogsV1Request?: GetPastLogsV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-past-logs`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1346,7 +1447,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(getPastLogsV1Request, localVarRequestOptions, configuration) @@ -1362,7 +1463,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getPrometheusMetricsV1: async (options: any = {}): Promise => { + getPrometheusMetricsV1: async (options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-prometheus-exporter-metrics`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1377,7 +1478,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -1393,7 +1494,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getTransactionV1: async (getTransactionV1Request?: GetTransactionV1Request, options: any = {}): Promise => { + getTransactionV1: async (getTransactionV1Request?: GetTransactionV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-transaction`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1410,7 +1511,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(getTransactionV1Request, localVarRequestOptions, configuration) @@ -1427,7 +1528,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - invokeContractV1: async (invokeContractV1Request?: InvokeContractV1Request, options: any = {}): Promise => { + invokeContractV1: async (invokeContractV1Request?: InvokeContractV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1444,7 +1545,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(invokeContractV1Request, localVarRequestOptions, configuration) @@ -1461,7 +1562,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - runTransactionV1: async (runTransactionRequest?: RunTransactionRequest, options: any = {}): Promise => { + runTransactionV1: async (runTransactionRequest?: RunTransactionRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/run-transaction`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1478,7 +1579,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(runTransactionRequest, localVarRequestOptions, configuration) @@ -1495,7 +1596,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - signTransactionV1: async (signTransactionRequest: SignTransactionRequest, options: any = {}): Promise => { + signTransactionV1: async (signTransactionRequest: SignTransactionRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'signTransactionRequest' is not null or undefined assertParamExists('signTransactionV1', 'signTransactionRequest', signTransactionRequest) const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/sign-transaction`; @@ -1514,7 +1615,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(signTransactionRequest, localVarRequestOptions, configuration) @@ -1541,7 +1642,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async deployContractSolBytecodeV1(deployContractSolidityBytecodeV1Request?: DeployContractSolidityBytecodeV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async deployContractSolBytecodeV1(deployContractSolidityBytecodeV1Request?: DeployContractSolidityBytecodeV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.deployContractSolBytecodeV1(deployContractSolidityBytecodeV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1552,7 +1653,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getBalanceV1(getBalanceV1Request?: GetBalanceV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getBalanceV1(getBalanceV1Request?: GetBalanceV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getBalanceV1(getBalanceV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1563,7 +1664,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getBesuRecordV1(getBesuRecordV1Request?: GetBesuRecordV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getBesuRecordV1(getBesuRecordV1Request?: GetBesuRecordV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getBesuRecordV1(getBesuRecordV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1574,7 +1675,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getBlockV1(getBlockV1Request?: GetBlockV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getBlockV1(getBlockV1Request?: GetBlockV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getBlockV1(getBlockV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1585,7 +1686,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getPastLogsV1(getPastLogsV1Request?: GetPastLogsV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getPastLogsV1(getPastLogsV1Request?: GetPastLogsV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getPastLogsV1(getPastLogsV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1595,7 +1696,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getPrometheusMetricsV1(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getPrometheusMetricsV1(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getPrometheusMetricsV1(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1606,7 +1707,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getTransactionV1(getTransactionV1Request?: GetTransactionV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getTransactionV1(getTransactionV1Request?: GetTransactionV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getTransactionV1(getTransactionV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1617,7 +1718,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async invokeContractV1(invokeContractV1Request?: InvokeContractV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async invokeContractV1(invokeContractV1Request?: InvokeContractV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.invokeContractV1(invokeContractV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1628,7 +1729,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async runTransactionV1(runTransactionRequest?: RunTransactionRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async runTransactionV1(runTransactionRequest?: RunTransactionRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.runTransactionV1(runTransactionRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1639,7 +1740,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async signTransactionV1(signTransactionRequest: SignTransactionRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async signTransactionV1(signTransactionRequest: SignTransactionRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.signTransactionV1(signTransactionRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1770,7 +1871,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public deployContractSolBytecodeV1(deployContractSolidityBytecodeV1Request?: DeployContractSolidityBytecodeV1Request, options?: any) { + public deployContractSolBytecodeV1(deployContractSolidityBytecodeV1Request?: DeployContractSolidityBytecodeV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).deployContractSolBytecodeV1(deployContractSolidityBytecodeV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -1782,7 +1883,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getBalanceV1(getBalanceV1Request?: GetBalanceV1Request, options?: any) { + public getBalanceV1(getBalanceV1Request?: GetBalanceV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getBalanceV1(getBalanceV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -1794,7 +1895,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getBesuRecordV1(getBesuRecordV1Request?: GetBesuRecordV1Request, options?: any) { + public getBesuRecordV1(getBesuRecordV1Request?: GetBesuRecordV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getBesuRecordV1(getBesuRecordV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -1806,7 +1907,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getBlockV1(getBlockV1Request?: GetBlockV1Request, options?: any) { + public getBlockV1(getBlockV1Request?: GetBlockV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getBlockV1(getBlockV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -1818,7 +1919,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getPastLogsV1(getPastLogsV1Request?: GetPastLogsV1Request, options?: any) { + public getPastLogsV1(getPastLogsV1Request?: GetPastLogsV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getPastLogsV1(getPastLogsV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -1829,7 +1930,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getPrometheusMetricsV1(options?: any) { + public getPrometheusMetricsV1(options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getPrometheusMetricsV1(options).then((request) => request(this.axios, this.basePath)); } @@ -1841,7 +1942,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getTransactionV1(getTransactionV1Request?: GetTransactionV1Request, options?: any) { + public getTransactionV1(getTransactionV1Request?: GetTransactionV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getTransactionV1(getTransactionV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -1853,7 +1954,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public invokeContractV1(invokeContractV1Request?: InvokeContractV1Request, options?: any) { + public invokeContractV1(invokeContractV1Request?: InvokeContractV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).invokeContractV1(invokeContractV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -1865,7 +1966,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public runTransactionV1(runTransactionRequest?: RunTransactionRequest, options?: any) { + public runTransactionV1(runTransactionRequest?: RunTransactionRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).runTransactionV1(runTransactionRequest, options).then((request) => request(this.axios, this.basePath)); } @@ -1877,7 +1978,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public signTransactionV1(signTransactionRequest: SignTransactionRequest, options?: any) { + public signTransactionV1(signTransactionRequest: SignTransactionRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).signTransactionV1(signTransactionRequest, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/base.ts index 334a915eb2..b9dcb25a32 100644 --- a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/common.ts index 5129b09cf2..fa9cb04339 100644 --- a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; } diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main-server/Dockerfile b/packages/cactus-plugin-ledger-connector-corda/src/main-server/Dockerfile index eee7187fd6..4e5d603ff8 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main-server/Dockerfile +++ b/packages/cactus-plugin-ledger-connector-corda/src/main-server/Dockerfile @@ -13,8 +13,8 @@ FROM openjdk:8u275-jre-slim-buster ARG APP=/usr/src/app ENV APP=/usr/src/app -RUN apt-get update -RUN apt-get install -y ca-certificates tzdata curl tini +RUN apt update +RUN apt install -y ca-certificates tzdata curl tini RUN rm -rf /var/lib/apt/lists/* ENV TZ=Etc/UTC \ diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/GetMonitorTransactionsV1ResponseTxInner.md b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/GetMonitorTransactionsV1ResponseTxInner.md new file mode 100644 index 0000000000..ac414e83d5 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/docs/GetMonitorTransactionsV1ResponseTxInner.md @@ -0,0 +1,11 @@ + +# GetMonitorTransactionsV1ResponseTxInner + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**index** | **kotlin.String** | | [optional] +**`data`** | **kotlin.String** | | [optional] + + + diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 0000000000..cf2cfaa95d --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 0000000000..be00e38fba --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetMonitorTransactionsV1ResponseTxInner.kt b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetMonitorTransactionsV1ResponseTxInner.kt new file mode 100644 index 0000000000..22400a6292 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetMonitorTransactionsV1ResponseTxInner.kt @@ -0,0 +1,38 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json + +/** + * + * + * @param index + * @param `data` + */ + + +data class GetMonitorTransactionsV1ResponseTxInner ( + + @Json(name = "index") + val index: kotlin.String? = null, + + @Json(name = "data") + val `data`: kotlin.String? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-quorum/openapitools.json b/packages/cactus-plugin-ledger-connector-quorum/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/packages/cactus-plugin-ledger-connector-quorum/openapitools.json +++ b/packages/cactus-plugin-ledger-connector-quorum/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/api.ts index 9727493827..dc86d87e12 100644 --- a/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * @@ -27,86 +29,86 @@ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } fr * @interface ContractJSON */ export interface ContractJSON { - [key: string]: object | any; + [key: string]: any; /** * * @type {string} * @memberof ContractJSON */ - contractName: string; + 'contractName': string; /** * See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode * @type {string} * @memberof ContractJSON */ - bytecode: string; + 'bytecode': string; /** * The application binary interface of the solidity contract, optional parameter * @type {Array} * @memberof ContractJSON */ - abi?: Array; + 'abi'?: Array; /** * * @type {string} * @memberof ContractJSON */ - metadata?: string; + 'metadata'?: string; /** * * @type {string} * @memberof ContractJSON */ - deployedBytecode?: string; + 'deployedBytecode'?: string; /** * * @type {string} * @memberof ContractJSON */ - sourceMap?: string; + 'sourceMap'?: string; /** * * @type {string} * @memberof ContractJSON */ - deployedSourceMap?: string; + 'deployedSourceMap'?: string; /** * * @type {string} * @memberof ContractJSON */ - sourcePath?: string; + 'sourcePath'?: string; /** * * @type {object} * @memberof ContractJSON */ - compiler?: object; + 'compiler'?: object; /** * * @type {object} * @memberof ContractJSON */ - networks?: object; + 'networks'?: object; /** * * @type {object} * @memberof ContractJSON */ - ast?: object; + 'ast'?: object; /** * * @type {object} * @memberof ContractJSON */ - functionHashes?: object; + 'functionHashes'?: object; /** * * @type {object} * @memberof ContractJSON */ - gasEstimates?: object; + 'gasEstimates'?: object; } /** * @@ -119,37 +121,37 @@ export interface DeployContractSolidityBytecodeJsonObjectV1Request { * @type {Web3SigningCredential} * @memberof DeployContractSolidityBytecodeJsonObjectV1Request */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * * @type {number} * @memberof DeployContractSolidityBytecodeJsonObjectV1Request */ - gas?: number; + 'gas'?: number; /** * * @type {string} * @memberof DeployContractSolidityBytecodeJsonObjectV1Request */ - gasPrice?: string; + 'gasPrice'?: string; /** * The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing. * @type {number} * @memberof DeployContractSolidityBytecodeJsonObjectV1Request */ - timeoutMs?: number; + 'timeoutMs'?: number; /** * * @type {ContractJSON} * @memberof DeployContractSolidityBytecodeJsonObjectV1Request */ - contractJSON: ContractJSON; + 'contractJSON': ContractJSON; /** * The list of arguments to pass in to the constructor of the contract being deployed. * @type {Array} * @memberof DeployContractSolidityBytecodeJsonObjectV1Request */ - constructorArgs?: Array; + 'constructorArgs'?: Array; } /** * @@ -162,49 +164,49 @@ export interface DeployContractSolidityBytecodeV1Request { * @type {string} * @memberof DeployContractSolidityBytecodeV1Request */ - contractName: string; + 'contractName': string; /** * * @type {Web3SigningCredential} * @memberof DeployContractSolidityBytecodeV1Request */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * The keychainId for retrieve the contracts json. * @type {string} * @memberof DeployContractSolidityBytecodeV1Request */ - keychainId: string; + 'keychainId': string; /** * * @type {number} * @memberof DeployContractSolidityBytecodeV1Request */ - gas?: number; + 'gas'?: number; /** * * @type {string} * @memberof DeployContractSolidityBytecodeV1Request */ - gasPrice?: string; + 'gasPrice'?: string; /** * The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing. * @type {number} * @memberof DeployContractSolidityBytecodeV1Request */ - timeoutMs?: number; + 'timeoutMs'?: number; /** * For use when not using keychain, pass the contract in as this variable * @type {object} * @memberof DeployContractSolidityBytecodeV1Request */ - contractJSON?: object; + 'contractJSON'?: object; /** * The list of arguments to pass in to the constructor of the contract being deployed. * @type {Array} * @memberof DeployContractSolidityBytecodeV1Request */ - constructorArgs?: Array; + 'constructorArgs'?: Array; } /** * @@ -217,7 +219,7 @@ export interface DeployContractSolidityBytecodeV1Response { * @type {Web3TransactionReceipt} * @memberof DeployContractSolidityBytecodeV1Response */ - transactionReceipt: Web3TransactionReceipt; + 'transactionReceipt': Web3TransactionReceipt; } /** * @@ -225,10 +227,13 @@ export interface DeployContractSolidityBytecodeV1Response { * @enum {string} */ -export enum EthContractInvocationType { - Send = 'SEND', - Call = 'CALL' -} +export const EthContractInvocationType = { + Send: 'SEND', + Call: 'CALL' +} as const; + +export type EthContractInvocationType = typeof EthContractInvocationType[keyof typeof EthContractInvocationType]; + /** * @@ -236,12 +241,15 @@ export enum EthContractInvocationType { * @enum {string} */ -export enum EthContractInvocationWeb3Method { - Send = 'send', - Call = 'call', - EncodeAbi = 'encodeABI', - EstimateGas = 'estimateGas' -} +export const EthContractInvocationWeb3Method = { + Send: 'send', + Call: 'call', + EncodeAbi: 'encodeABI', + EstimateGas: 'estimateGas' +} as const; + +export type EthContractInvocationWeb3Method = typeof EthContractInvocationWeb3Method[keyof typeof EthContractInvocationWeb3Method]; + /** * @@ -254,68 +262,70 @@ export interface InvokeContractJsonObjectV1Request { * @type {Web3SigningCredential} * @memberof InvokeContractJsonObjectV1Request */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * * @type {EthContractInvocationType} * @memberof InvokeContractJsonObjectV1Request */ - invocationType: EthContractInvocationType; + 'invocationType': EthContractInvocationType; /** * The name of the contract method to invoke. * @type {string} * @memberof InvokeContractJsonObjectV1Request */ - methodName: string; + 'methodName': string; /** * The list of arguments to pass in to the contract method being invoked. * @type {Array} * @memberof InvokeContractJsonObjectV1Request */ - params: Array; + 'params': Array; /** * Address of the solidity contract * @type {string} * @memberof InvokeContractJsonObjectV1Request */ - contractAddress: string; + 'contractAddress': string; /** * - * @type {string | number} + * @type {QuorumTransactionConfigFrom} * @memberof InvokeContractJsonObjectV1Request */ - value?: string | number; + 'value'?: QuorumTransactionConfigFrom; /** * - * @type {string | number} + * @type {QuorumTransactionConfigFrom} * @memberof InvokeContractJsonObjectV1Request */ - gas?: string | number; + 'gas'?: QuorumTransactionConfigFrom; /** * - * @type {string | number} + * @type {QuorumTransactionConfigFrom} * @memberof InvokeContractJsonObjectV1Request */ - gasPrice?: string | number; + 'gasPrice'?: QuorumTransactionConfigFrom; /** * * @type {number} * @memberof InvokeContractJsonObjectV1Request */ - nonce?: number; + 'nonce'?: number; /** * The amount of milliseconds to wait for a transaction receipt beforegiving up and crashing. Only has any effect if the invocation type is SEND * @type {number} * @memberof InvokeContractJsonObjectV1Request */ - timeoutMs?: number; + 'timeoutMs'?: number; /** * * @type {ContractJSON} * @memberof InvokeContractJsonObjectV1Request */ - contractJSON: ContractJSON; + 'contractJSON': ContractJSON; } + + /** * * @export @@ -327,68 +337,70 @@ export interface InvokeContractV1Request { * @type {string} * @memberof InvokeContractV1Request */ - contractName: string; + 'contractName': string; /** * * @type {Web3SigningCredential} * @memberof InvokeContractV1Request */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * * @type {EthContractInvocationType} * @memberof InvokeContractV1Request */ - invocationType: EthContractInvocationType; + 'invocationType': EthContractInvocationType; /** * The name of the contract method to invoke. * @type {string} * @memberof InvokeContractV1Request */ - methodName: string; + 'methodName': string; /** * The list of arguments to pass in to the contract method being invoked. * @type {Array} * @memberof InvokeContractV1Request */ - params: Array; + 'params': Array; /** * - * @type {string | number} + * @type {QuorumTransactionConfigFrom} * @memberof InvokeContractV1Request */ - value?: string | number; + 'value'?: QuorumTransactionConfigFrom; /** * - * @type {string | number} + * @type {QuorumTransactionConfigFrom} * @memberof InvokeContractV1Request */ - gas?: string | number; + 'gas'?: QuorumTransactionConfigFrom; /** * - * @type {string | number} + * @type {QuorumTransactionConfigFrom} * @memberof InvokeContractV1Request */ - gasPrice?: string | number; + 'gasPrice'?: QuorumTransactionConfigFrom; /** * * @type {number} * @memberof InvokeContractV1Request */ - nonce?: number; + 'nonce'?: number; /** * The amount of milliseconds to wait for a transaction receipt beforegiving up and crashing. Only has any effect if the invocation type is SEND * @type {number} * @memberof InvokeContractV1Request */ - timeoutMs?: number; + 'timeoutMs'?: number; /** * The keychainId for retrieve the contracts json. * @type {string} * @memberof InvokeContractV1Request */ - keychainId: string; + 'keychainId': string; } + + /** * * @export @@ -400,19 +412,19 @@ export interface InvokeContractV1Response { * @type {Web3TransactionReceipt} * @memberof InvokeContractV1Response */ - transactionReceipt?: Web3TransactionReceipt; + 'transactionReceipt'?: Web3TransactionReceipt; /** * * @type {any} * @memberof InvokeContractV1Response */ - callOutput?: any | null; + 'callOutput'?: any; /** * * @type {boolean} * @memberof InvokeContractV1Response */ - success: boolean; + 'success': boolean; } /** * @@ -425,38 +437,40 @@ export interface InvokeRawWeb3EthContractV1Request { * @type {Array} * @memberof InvokeRawWeb3EthContractV1Request */ - abi: Array; + 'abi': Array; /** * Deployed solidity contract address * @type {string} * @memberof InvokeRawWeb3EthContractV1Request */ - address: string; + 'address': string; /** * * @type {EthContractInvocationWeb3Method} * @memberof InvokeRawWeb3EthContractV1Request */ - invocationType: EthContractInvocationWeb3Method; + 'invocationType': EthContractInvocationWeb3Method; /** * The list of arguments for contract invocation method (send, call, etc...) * @type {object} * @memberof InvokeRawWeb3EthContractV1Request */ - invocationParams?: object; + 'invocationParams'?: object; /** * Method of deployed solidity contract to execute * @type {string} * @memberof InvokeRawWeb3EthContractV1Request */ - contractMethod: string; + 'contractMethod': string; /** * The list of arguments for deployed solidity contract method * @type {Array} * @memberof InvokeRawWeb3EthContractV1Request */ - contractMethodArgs?: Array; + 'contractMethodArgs'?: Array; } + + /** * * @export @@ -468,19 +482,19 @@ export interface InvokeRawWeb3EthContractV1Response { * @type {number} * @memberof InvokeRawWeb3EthContractV1Response */ - status: number; + 'status': number; /** * Output of contract invocation method * @type {any} * @memberof InvokeRawWeb3EthContractV1Response */ - data?: any | null; + 'data'?: any; /** * Error details * @type {string} * @memberof InvokeRawWeb3EthContractV1Response */ - errorDetail?: string; + 'errorDetail'?: string; } /** * @@ -493,13 +507,13 @@ export interface InvokeRawWeb3EthMethodV1Request { * @type {string} * @memberof InvokeRawWeb3EthMethodV1Request */ - methodName: string; + 'methodName': string; /** * The list of arguments to pass to web3.eth method specified in methodName * @type {Array} * @memberof InvokeRawWeb3EthMethodV1Request */ - params?: Array; + 'params'?: Array; } /** * @@ -512,19 +526,19 @@ export interface InvokeRawWeb3EthMethodV1Response { * @type {number} * @memberof InvokeRawWeb3EthMethodV1Response */ - status: number; + 'status': number; /** * Output of requested web3.eth method * @type {any} * @memberof InvokeRawWeb3EthMethodV1Response */ - data?: any | null; + 'data'?: any; /** * Error details * @type {string} * @memberof InvokeRawWeb3EthMethodV1Response */ - errorDetail?: string; + 'errorDetail'?: string; } /** * @@ -532,57 +546,69 @@ export interface InvokeRawWeb3EthMethodV1Response { * @interface QuorumTransactionConfig */ export interface QuorumTransactionConfig { - [key: string]: object | any; + [key: string]: any; /** * * @type {string} * @memberof QuorumTransactionConfig */ - rawTransaction?: string; + 'rawTransaction'?: string; /** * - * @type {string | number} + * @type {QuorumTransactionConfigFrom} * @memberof QuorumTransactionConfig */ - from?: string | number; + 'from'?: QuorumTransactionConfigFrom; /** * - * @type {string} + * @type {QuorumTransactionConfigTo} * @memberof QuorumTransactionConfig */ - to?: string; + 'to'?: QuorumTransactionConfigTo; /** * - * @type {string | number} + * @type {QuorumTransactionConfigFrom} * @memberof QuorumTransactionConfig */ - value?: string | number; + 'value'?: QuorumTransactionConfigFrom; /** * - * @type {string | number} + * @type {QuorumTransactionConfigFrom} * @memberof QuorumTransactionConfig */ - gas?: string | number; + 'gas'?: QuorumTransactionConfigFrom; /** * - * @type {string | number} + * @type {QuorumTransactionConfigFrom} * @memberof QuorumTransactionConfig */ - gasPrice?: string | number; + 'gasPrice'?: QuorumTransactionConfigFrom; /** * * @type {number} * @memberof QuorumTransactionConfig */ - nonce?: number; + 'nonce'?: number; /** * - * @type {string} + * @type {QuorumTransactionConfigTo} * @memberof QuorumTransactionConfig */ - data?: string; + 'data'?: QuorumTransactionConfigTo; } +/** + * @type QuorumTransactionConfigFrom + * @export + */ +export type QuorumTransactionConfigFrom = number | string; + +/** + * @type QuorumTransactionConfigTo + * @export + */ +export type QuorumTransactionConfigTo = string; + /** * * @export @@ -594,19 +620,19 @@ export interface RunTransactionRequest { * @type {Web3SigningCredential} * @memberof RunTransactionRequest */ - web3SigningCredential: Web3SigningCredential; + 'web3SigningCredential': Web3SigningCredential; /** * * @type {QuorumTransactionConfig} * @memberof RunTransactionRequest */ - transactionConfig: QuorumTransactionConfig; + 'transactionConfig': QuorumTransactionConfig; /** * The amount of milliseconds to wait for a transaction receipt with thehash of the transaction(which indicates successful execution) beforegiving up and crashing. * @type {number} * @memberof RunTransactionRequest */ - timeoutMs?: number; + 'timeoutMs'?: number; } /** * @@ -619,7 +645,7 @@ export interface RunTransactionResponse { * @type {Web3TransactionReceipt} * @memberof RunTransactionResponse */ - transactionReceipt: Web3TransactionReceipt; + 'transactionReceipt': Web3TransactionReceipt; } /** * @@ -632,75 +658,143 @@ export interface SolidityContractJsonArtifact { * @type {string} * @memberof SolidityContractJsonArtifact */ - contractName: string; + 'contractName': string; /** * * @type {string} * @memberof SolidityContractJsonArtifact */ - metadata?: string; + 'metadata'?: string; /** * * @type {string} * @memberof SolidityContractJsonArtifact */ - bytecode?: string; + 'bytecode'?: string; /** * * @type {string} * @memberof SolidityContractJsonArtifact */ - deployedBytecode?: string; + 'deployedBytecode'?: string; /** * * @type {string} * @memberof SolidityContractJsonArtifact */ - sourceMap?: string; + 'sourceMap'?: string; /** * * @type {string} * @memberof SolidityContractJsonArtifact */ - deployedSourceMap?: string; + 'deployedSourceMap'?: string; /** * * @type {string} * @memberof SolidityContractJsonArtifact */ - sourcePath?: string; + 'sourcePath'?: string; /** * - * @type {{ [key: string]: object; }} + * @type {SolidityContractJsonArtifactCompiler} * @memberof SolidityContractJsonArtifact */ - compiler?: { [key: string]: object; }; + 'compiler'?: SolidityContractJsonArtifactCompiler; /** * - * @type {{ [key: string]: object; }} + * @type {{ [key: string]: any; }} * @memberof SolidityContractJsonArtifact */ - functionHashes?: { [key: string]: object; }; + 'functionHashes'?: { [key: string]: any; }; /** * - * @type {object} + * @type {SolidityContractJsonArtifactGasEstimates} * @memberof SolidityContractJsonArtifact */ - gasEstimates?: object; + 'gasEstimates'?: SolidityContractJsonArtifactGasEstimates; } /** * * @export - * @enum {string} + * @interface SolidityContractJsonArtifactCompiler */ +export interface SolidityContractJsonArtifactCompiler { + [key: string]: any; -export enum WatchBlocksV1 { - Subscribe = 'org.hyperledger.cactus.api.async.quorum.WatchBlocksV1.Subscribe', - Next = 'org.hyperledger.cactus.api.async.quorum.WatchBlocksV1.Next', - Unsubscribe = 'org.hyperledger.cactus.api.async.quorum.WatchBlocksV1.Unsubscribe', - Error = 'org.hyperledger.cactus.api.async.quorum.WatchBlocksV1.Error', - Complete = 'org.hyperledger.cactus.api.async.quorum.WatchBlocksV1.Complete' + /** + * + * @type {string} + * @memberof SolidityContractJsonArtifactCompiler + */ + 'name'?: string; + /** + * + * @type {string} + * @memberof SolidityContractJsonArtifactCompiler + */ + 'version'?: string; } +/** + * + * @export + * @interface SolidityContractJsonArtifactGasEstimates + */ +export interface SolidityContractJsonArtifactGasEstimates { + /** + * + * @type {SolidityContractJsonArtifactGasEstimatesCreation} + * @memberof SolidityContractJsonArtifactGasEstimates + */ + 'creation'?: SolidityContractJsonArtifactGasEstimatesCreation; + /** + * + * @type {{ [key: string]: any; }} + * @memberof SolidityContractJsonArtifactGasEstimates + */ + 'external'?: { [key: string]: any; }; +} +/** + * + * @export + * @interface SolidityContractJsonArtifactGasEstimatesCreation + */ +export interface SolidityContractJsonArtifactGasEstimatesCreation { + /** + * + * @type {string} + * @memberof SolidityContractJsonArtifactGasEstimatesCreation + */ + 'codeDepositCost'?: string; + /** + * + * @type {string} + * @memberof SolidityContractJsonArtifactGasEstimatesCreation + */ + 'executionCost'?: string; + /** + * + * @type {string} + * @memberof SolidityContractJsonArtifactGasEstimatesCreation + */ + 'totalCost'?: string; +} +/** + * + * @export + * @enum {string} + */ + +export const WatchBlocksV1 = { + Subscribe: 'org.hyperledger.cactus.api.async.quorum.WatchBlocksV1.Subscribe', + Next: 'org.hyperledger.cactus.api.async.quorum.WatchBlocksV1.Next', + Unsubscribe: 'org.hyperledger.cactus.api.async.quorum.WatchBlocksV1.Unsubscribe', + Error: 'org.hyperledger.cactus.api.async.quorum.WatchBlocksV1.Error', + Complete: 'org.hyperledger.cactus.api.async.quorum.WatchBlocksV1.Complete' +} as const; + +export type WatchBlocksV1 = typeof WatchBlocksV1[keyof typeof WatchBlocksV1]; + /** * @@ -713,121 +807,121 @@ export interface WatchBlocksV1BlockData { * @type {number} * @memberof WatchBlocksV1BlockData */ - number: number; + 'number': number; /** * * @type {string} * @memberof WatchBlocksV1BlockData */ - hash: string; + 'hash': string; /** * * @type {string} * @memberof WatchBlocksV1BlockData */ - parentHash: string; + 'parentHash': string; /** * * @type {string} * @memberof WatchBlocksV1BlockData */ - nonce: string; + 'nonce': string; /** * * @type {string} * @memberof WatchBlocksV1BlockData */ - sha3Uncles: string; + 'sha3Uncles': string; /** * * @type {string} * @memberof WatchBlocksV1BlockData */ - logsBloom: string; + 'logsBloom': string; /** * * @type {string} * @memberof WatchBlocksV1BlockData */ - transactionsRoot?: string; + 'transactionsRoot'?: string; /** * * @type {string} * @memberof WatchBlocksV1BlockData */ - stateRoot: string; + 'stateRoot': string; /** * * @type {string} * @memberof WatchBlocksV1BlockData */ - receiptsRoot?: string; + 'receiptsRoot'?: string; /** * * @type {string} * @memberof WatchBlocksV1BlockData */ - difficulty?: string; + 'difficulty'?: string; /** * * @type {string} * @memberof WatchBlocksV1BlockData */ - mixHash?: string; + 'mixHash'?: string; /** * * @type {string} * @memberof WatchBlocksV1BlockData */ - miner: string; + 'miner': string; /** * * @type {string} * @memberof WatchBlocksV1BlockData */ - extraData: string; + 'extraData': string; /** * * @type {number} * @memberof WatchBlocksV1BlockData */ - gasLimit: number; + 'gasLimit': number; /** * * @type {number} * @memberof WatchBlocksV1BlockData */ - gasUsed: number; + 'gasUsed': number; /** * - * @type {string | number} + * @type {QuorumTransactionConfigFrom} * @memberof WatchBlocksV1BlockData */ - timestamp: string | number; + 'timestamp': QuorumTransactionConfigFrom; /** * * @type {number} * @memberof WatchBlocksV1BlockData */ - size: number; + 'size': number; /** * * @type {string} * @memberof WatchBlocksV1BlockData */ - totalDifficulty: string; + 'totalDifficulty': string; /** * * @type {Array} * @memberof WatchBlocksV1BlockData */ - uncles: Array; + 'uncles': Array; /** * * @type {Array} * @memberof WatchBlocksV1BlockData */ - transactions: Array; + 'transactions': Array; } /** * @@ -840,7 +934,7 @@ export interface WatchBlocksV1Options { * @type {boolean} * @memberof WatchBlocksV1Options */ - getBlockData?: boolean; + 'getBlockData'?: boolean; } /** * @@ -853,13 +947,13 @@ export interface WatchBlocksV1Progress { * @type {Web3BlockHeader} * @memberof WatchBlocksV1Progress */ - blockHeader?: Web3BlockHeader; + 'blockHeader'?: Web3BlockHeader; /** * * @type {WatchBlocksV1BlockData} * @memberof WatchBlocksV1Progress */ - blockData?: WatchBlocksV1BlockData; + 'blockData'?: WatchBlocksV1BlockData; } /** * @@ -872,97 +966,97 @@ export interface Web3BlockHeader { * @type {number} * @memberof Web3BlockHeader */ - number: number; + 'number': number; /** * * @type {string} * @memberof Web3BlockHeader */ - hash: string; + 'hash': string; /** * * @type {string} * @memberof Web3BlockHeader */ - parentHash: string; + 'parentHash': string; /** * * @type {string} * @memberof Web3BlockHeader */ - nonce: string; + 'nonce': string; /** * * @type {string} * @memberof Web3BlockHeader */ - sha3Uncles: string; + 'sha3Uncles': string; /** * * @type {string} * @memberof Web3BlockHeader */ - logsBloom: string; + 'logsBloom': string; /** * * @type {string} * @memberof Web3BlockHeader */ - transactionsRoot?: string; + 'transactionsRoot'?: string; /** * * @type {string} * @memberof Web3BlockHeader */ - stateRoot: string; + 'stateRoot': string; /** * * @type {string} * @memberof Web3BlockHeader */ - receiptsRoot?: string; + 'receiptsRoot'?: string; /** * * @type {string} * @memberof Web3BlockHeader */ - difficulty?: string; + 'difficulty'?: string; /** * * @type {string} * @memberof Web3BlockHeader */ - mixHash?: string; + 'mixHash'?: string; /** * * @type {string} * @memberof Web3BlockHeader */ - miner: string; + 'miner': string; /** * * @type {string} * @memberof Web3BlockHeader */ - extraData: string; + 'extraData': string; /** * * @type {number} * @memberof Web3BlockHeader */ - gasLimit: number; + 'gasLimit': number; /** * * @type {number} * @memberof Web3BlockHeader */ - gasUsed: number; + 'gasUsed': number; /** * - * @type {string | number} + * @type {QuorumTransactionConfigFrom} * @memberof Web3BlockHeader */ - timestamp: string | number; + 'timestamp': QuorumTransactionConfigFrom; } /** * @type Web3SigningCredential @@ -981,26 +1075,28 @@ export interface Web3SigningCredentialCactusKeychainRef { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialCactusKeychainRef */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; /** * The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication. * @type {string} * @memberof Web3SigningCredentialCactusKeychainRef */ - ethAccount: string; + 'ethAccount': string; /** * The key to use when looking up the the keychain entry holding the secret pointed to by the keychainEntryKey parameter. * @type {string} * @memberof Web3SigningCredentialCactusKeychainRef */ - keychainEntryKey: string; + 'keychainEntryKey': string; /** * The keychain ID to use when looking up the the keychain plugin instance that will be used to retrieve the secret pointed to by the keychainEntryKey parameter. * @type {string} * @memberof Web3SigningCredentialCactusKeychainRef */ - keychainId?: string; + 'keychainId'?: string; } + + /** * * @export @@ -1012,20 +1108,22 @@ export interface Web3SigningCredentialGethKeychainPassword { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialGethKeychainPassword */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; /** * The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication. * @type {string} * @memberof Web3SigningCredentialGethKeychainPassword */ - ethAccount: string; + 'ethAccount': string; /** * A geth keychain unlock password. * @type {string} * @memberof Web3SigningCredentialGethKeychainPassword */ - secret: string; + 'secret': string; } + + /** * Using this denotes that there is no signing required because the transaction is pre-signed. * @export @@ -1037,8 +1135,10 @@ export interface Web3SigningCredentialNone { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialNone */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; } + + /** * * @export @@ -1050,32 +1150,37 @@ export interface Web3SigningCredentialPrivateKeyHex { * @type {Web3SigningCredentialType} * @memberof Web3SigningCredentialPrivateKeyHex */ - type: Web3SigningCredentialType; + 'type': Web3SigningCredentialType; /** * The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication. * @type {string} * @memberof Web3SigningCredentialPrivateKeyHex */ - ethAccount: string; + 'ethAccount': string; /** * The HEX encoded private key of an eth account. * @type {string} * @memberof Web3SigningCredentialPrivateKeyHex */ - secret: string; + 'secret': string; } + + /** * * @export * @enum {string} */ -export enum Web3SigningCredentialType { - CactusKeychainRef = 'CACTUS_KEYCHAIN_REF', - GethKeychainPassword = 'GETH_KEYCHAIN_PASSWORD', - PrivateKeyHex = 'PRIVATE_KEY_HEX', - None = 'NONE' -} +export const Web3SigningCredentialType = { + CactusKeychainRef: 'CACTUS_KEYCHAIN_REF', + GethKeychainPassword: 'GETH_KEYCHAIN_PASSWORD', + PrivateKeyHex: 'PRIVATE_KEY_HEX', + None: 'NONE' +} as const; + +export type Web3SigningCredentialType = typeof Web3SigningCredentialType[keyof typeof Web3SigningCredentialType]; + /** * @@ -1088,85 +1193,85 @@ export interface Web3Transaction { * @type {string} * @memberof Web3Transaction */ - hash: string; + 'hash': string; /** * * @type {number} * @memberof Web3Transaction */ - nonce: number; + 'nonce': number; /** * * @type {string} * @memberof Web3Transaction */ - blockHash: string | null; + 'blockHash': string | null; /** * * @type {number} * @memberof Web3Transaction */ - blockNumber: number | null; + 'blockNumber': number | null; /** * * @type {number} * @memberof Web3Transaction */ - transactionIndex: number | null; + 'transactionIndex': number | null; /** * * @type {string} * @memberof Web3Transaction */ - from: string; + 'from': string; /** * * @type {string} * @memberof Web3Transaction */ - to: string | null; + 'to': string | null; /** * * @type {string} * @memberof Web3Transaction */ - value: string; + 'value': string; /** * * @type {string} * @memberof Web3Transaction */ - gasPrice: string; + 'gasPrice': string; /** * * @type {number} * @memberof Web3Transaction */ - gas: number; + 'gas': number; /** * * @type {string} * @memberof Web3Transaction */ - input: string; + 'input': string; /** * * @type {string} * @memberof Web3Transaction */ - v?: string; + 'v'?: string; /** * * @type {string} * @memberof Web3Transaction */ - r?: string; + 'r'?: string; /** * * @type {string} * @memberof Web3Transaction */ - s?: string; + 's'?: string; } /** * @@ -1174,62 +1279,62 @@ export interface Web3Transaction { * @interface Web3TransactionReceipt */ export interface Web3TransactionReceipt { - [key: string]: object | any; + [key: string]: any; /** * * @type {boolean} * @memberof Web3TransactionReceipt */ - status: boolean; + 'status': boolean; /** * * @type {string} * @memberof Web3TransactionReceipt */ - transactionHash: string; + 'transactionHash': string; /** * * @type {number} * @memberof Web3TransactionReceipt */ - transactionIndex: number; + 'transactionIndex': number; /** * * @type {string} * @memberof Web3TransactionReceipt */ - blockHash: string; + 'blockHash': string; /** * * @type {number} * @memberof Web3TransactionReceipt */ - blockNumber: number; + 'blockNumber': number; /** * * @type {number} * @memberof Web3TransactionReceipt */ - gasUsed: number; + 'gasUsed': number; /** * * @type {string} * @memberof Web3TransactionReceipt */ - contractAddress?: string | null; + 'contractAddress'?: string | null; /** * * @type {string} * @memberof Web3TransactionReceipt */ - from: string; + 'from': string; /** * * @type {string} * @memberof Web3TransactionReceipt */ - to: string; + 'to': string; } /** @@ -1245,7 +1350,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deployContractSolBytecodeJsonObjectV1: async (deployContractSolidityBytecodeJsonObjectV1Request?: DeployContractSolidityBytecodeJsonObjectV1Request, options: any = {}): Promise => { + deployContractSolBytecodeJsonObjectV1: async (deployContractSolidityBytecodeJsonObjectV1Request?: DeployContractSolidityBytecodeJsonObjectV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/deploy-contract-solidity-bytecode-json-object`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1262,7 +1367,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(deployContractSolidityBytecodeJsonObjectV1Request, localVarRequestOptions, configuration) @@ -1279,7 +1384,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deployContractSolBytecodeV1: async (deployContractSolidityBytecodeV1Request?: DeployContractSolidityBytecodeV1Request, options: any = {}): Promise => { + deployContractSolBytecodeV1: async (deployContractSolidityBytecodeV1Request?: DeployContractSolidityBytecodeV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/deploy-contract-solidity-bytecode`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1296,7 +1401,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(deployContractSolidityBytecodeV1Request, localVarRequestOptions, configuration) @@ -1312,7 +1417,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getPrometheusMetricsV1: async (options: any = {}): Promise => { + getPrometheusMetricsV1: async (options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/get-prometheus-exporter-metrics`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1327,7 +1432,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -1343,7 +1448,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - invokeContractV1: async (invokeContractV1Request?: InvokeContractV1Request, options: any = {}): Promise => { + invokeContractV1: async (invokeContractV1Request?: InvokeContractV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/invoke-contract`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1360,7 +1465,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(invokeContractV1Request, localVarRequestOptions, configuration) @@ -1377,7 +1482,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - invokeContractV1NoKeychain: async (invokeContractJsonObjectV1Request?: InvokeContractJsonObjectV1Request, options: any = {}): Promise => { + invokeContractV1NoKeychain: async (invokeContractJsonObjectV1Request?: InvokeContractJsonObjectV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/invoke-contract-json-object`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1394,7 +1499,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(invokeContractJsonObjectV1Request, localVarRequestOptions, configuration) @@ -1411,7 +1516,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - invokeRawWeb3EthContractV1: async (invokeRawWeb3EthContractV1Request?: InvokeRawWeb3EthContractV1Request, options: any = {}): Promise => { + invokeRawWeb3EthContractV1: async (invokeRawWeb3EthContractV1Request?: InvokeRawWeb3EthContractV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/invoke-raw-web3eth-contract`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1428,7 +1533,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(invokeRawWeb3EthContractV1Request, localVarRequestOptions, configuration) @@ -1445,7 +1550,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - invokeWeb3EthMethodV1: async (invokeRawWeb3EthMethodV1Request?: InvokeRawWeb3EthMethodV1Request, options: any = {}): Promise => { + invokeWeb3EthMethodV1: async (invokeRawWeb3EthMethodV1Request?: InvokeRawWeb3EthMethodV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/invoke-raw-web3eth-method`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1462,7 +1567,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(invokeRawWeb3EthMethodV1Request, localVarRequestOptions, configuration) @@ -1479,7 +1584,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - runTransactionV1: async (runTransactionRequest?: RunTransactionRequest, options: any = {}): Promise => { + runTransactionV1: async (runTransactionRequest?: RunTransactionRequest, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/run-transaction`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1496,7 +1601,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(runTransactionRequest, localVarRequestOptions, configuration) @@ -1523,7 +1628,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async deployContractSolBytecodeJsonObjectV1(deployContractSolidityBytecodeJsonObjectV1Request?: DeployContractSolidityBytecodeJsonObjectV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async deployContractSolBytecodeJsonObjectV1(deployContractSolidityBytecodeJsonObjectV1Request?: DeployContractSolidityBytecodeJsonObjectV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.deployContractSolBytecodeJsonObjectV1(deployContractSolidityBytecodeJsonObjectV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1534,7 +1639,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async deployContractSolBytecodeV1(deployContractSolidityBytecodeV1Request?: DeployContractSolidityBytecodeV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async deployContractSolBytecodeV1(deployContractSolidityBytecodeV1Request?: DeployContractSolidityBytecodeV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.deployContractSolBytecodeV1(deployContractSolidityBytecodeV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1544,7 +1649,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async getPrometheusMetricsV1(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async getPrometheusMetricsV1(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getPrometheusMetricsV1(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1555,7 +1660,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async invokeContractV1(invokeContractV1Request?: InvokeContractV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async invokeContractV1(invokeContractV1Request?: InvokeContractV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.invokeContractV1(invokeContractV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1566,7 +1671,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async invokeContractV1NoKeychain(invokeContractJsonObjectV1Request?: InvokeContractJsonObjectV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async invokeContractV1NoKeychain(invokeContractJsonObjectV1Request?: InvokeContractJsonObjectV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.invokeContractV1NoKeychain(invokeContractJsonObjectV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1577,7 +1682,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async invokeRawWeb3EthContractV1(invokeRawWeb3EthContractV1Request?: InvokeRawWeb3EthContractV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async invokeRawWeb3EthContractV1(invokeRawWeb3EthContractV1Request?: InvokeRawWeb3EthContractV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.invokeRawWeb3EthContractV1(invokeRawWeb3EthContractV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1588,7 +1693,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async invokeWeb3EthMethodV1(invokeRawWeb3EthMethodV1Request?: InvokeRawWeb3EthMethodV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async invokeWeb3EthMethodV1(invokeRawWeb3EthMethodV1Request?: InvokeRawWeb3EthMethodV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.invokeWeb3EthMethodV1(invokeRawWeb3EthMethodV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1599,7 +1704,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async runTransactionV1(runTransactionRequest?: RunTransactionRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async runTransactionV1(runTransactionRequest?: RunTransactionRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.runTransactionV1(runTransactionRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -1710,7 +1815,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public deployContractSolBytecodeJsonObjectV1(deployContractSolidityBytecodeJsonObjectV1Request?: DeployContractSolidityBytecodeJsonObjectV1Request, options?: any) { + public deployContractSolBytecodeJsonObjectV1(deployContractSolidityBytecodeJsonObjectV1Request?: DeployContractSolidityBytecodeJsonObjectV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).deployContractSolBytecodeJsonObjectV1(deployContractSolidityBytecodeJsonObjectV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -1722,7 +1827,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public deployContractSolBytecodeV1(deployContractSolidityBytecodeV1Request?: DeployContractSolidityBytecodeV1Request, options?: any) { + public deployContractSolBytecodeV1(deployContractSolidityBytecodeV1Request?: DeployContractSolidityBytecodeV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).deployContractSolBytecodeV1(deployContractSolidityBytecodeV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -1733,7 +1838,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public getPrometheusMetricsV1(options?: any) { + public getPrometheusMetricsV1(options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).getPrometheusMetricsV1(options).then((request) => request(this.axios, this.basePath)); } @@ -1745,7 +1850,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public invokeContractV1(invokeContractV1Request?: InvokeContractV1Request, options?: any) { + public invokeContractV1(invokeContractV1Request?: InvokeContractV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).invokeContractV1(invokeContractV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -1757,7 +1862,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public invokeContractV1NoKeychain(invokeContractJsonObjectV1Request?: InvokeContractJsonObjectV1Request, options?: any) { + public invokeContractV1NoKeychain(invokeContractJsonObjectV1Request?: InvokeContractJsonObjectV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).invokeContractV1NoKeychain(invokeContractJsonObjectV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -1769,7 +1874,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public invokeRawWeb3EthContractV1(invokeRawWeb3EthContractV1Request?: InvokeRawWeb3EthContractV1Request, options?: any) { + public invokeRawWeb3EthContractV1(invokeRawWeb3EthContractV1Request?: InvokeRawWeb3EthContractV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).invokeRawWeb3EthContractV1(invokeRawWeb3EthContractV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -1781,7 +1886,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public invokeWeb3EthMethodV1(invokeRawWeb3EthMethodV1Request?: InvokeRawWeb3EthMethodV1Request, options?: any) { + public invokeWeb3EthMethodV1(invokeRawWeb3EthMethodV1Request?: InvokeRawWeb3EthMethodV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).invokeWeb3EthMethodV1(invokeRawWeb3EthMethodV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -1793,7 +1898,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public runTransactionV1(runTransactionRequest?: RunTransactionRequest, options?: any) { + public runTransactionV1(runTransactionRequest?: RunTransactionRequest, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).runTransactionV1(runTransactionRequest, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/base.ts index 3a4258beb8..bccd2a204c 100644 --- a/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/common.ts index c3f7a841ef..5e3dc6aaaf 100644 --- a/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; } diff --git a/packages/cactus-plugin-ledger-connector-ubiquity/openapitools.json b/packages/cactus-plugin-ledger-connector-ubiquity/openapitools.json index 54d00804a3..03392961f6 100644 --- a/packages/cactus-plugin-ledger-connector-ubiquity/openapitools.json +++ b/packages/cactus-plugin-ledger-connector-ubiquity/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "6.0.1" + "version": "6.3.0" } } diff --git a/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 6d54bbd775..e7e42a4b58 100644 --- a/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -6.0.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/api.ts index b487c2e579..d989331275 100644 --- a/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * Gets transactions that an address was involved with, from newest to oldest. This call uses pagination. Source: https://ubiquity.docs.blockdaemon.com/swagger-ui/#/Accounts/GetTxsByAddress diff --git a/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/base.ts index 3a29f50c20..21740fdfd0 100644 --- a/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/common.ts index 319f2b5d77..7bee5cf8cf 100644 --- a/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/packages/cactus-plugin-ledger-connector-ubiquity/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance, AxiosResponse } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } diff --git a/packages/cactus-plugin-odap-hermes/openapitools.json b/packages/cactus-plugin-odap-hermes/openapitools.json index 601ac1d61f..03392961f6 100644 --- a/packages/cactus-plugin-odap-hermes/openapitools.json +++ b/packages/cactus-plugin-odap-hermes/openapitools.json @@ -2,6 +2,6 @@ "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.2.1" + "version": "6.3.0" } } diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES index d805df58e4..54b948c8a5 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -6,7 +6,7 @@ settings.gradle src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -14,6 +14,7 @@ src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/README.md index eeb1bf2134..52f3d78b15 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -1,9 +1,18 @@ # org.openapitools.client - Kotlin client library for Hyperledger Cactus Plugin - Odap Hermes +Implementation for Odap and Hermes + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 0.0.1 +- Package version: +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + ## Requires -* Kotlin 1.4.30 -* Gradle 6.8.3 +* Kotlin 1.7.21 +* Gradle 7.5 ## Build diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/build.gradle b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/build.gradle index 3de8b45b13..66a3c68b89 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/build.gradle +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/build.gradle @@ -2,12 +2,12 @@ group 'org.openapitools' version '1.0.0' wrapper { - gradleVersion = '6.8.3' + gradleVersion = '7.5' distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" } buildscript { - ext.kotlin_version = '1.5.10' + ext.kotlin_version = '1.7.21' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -18,6 +18,7 @@ buildscript { } apply plugin: 'kotlin' +apply plugin: 'maven-publish' repositories { maven { url "https://repo1.maven.org/maven2" } @@ -30,8 +31,8 @@ test { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "com.squareup.moshi:moshi-kotlin:1.12.0" - implementation "com.squareup.moshi:moshi-adapters:1.12.0" - implementation "com.squareup.okhttp3:okhttp:4.9.1" + implementation "com.squareup.moshi:moshi-kotlin:1.13.0" + implementation "com.squareup.moshi:moshi-adapters:1.13.0" + implementation "com.squareup.okhttp3:okhttp:4.10.0" testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" } diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt index b4b85797ce..aada4a542e 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -20,6 +15,10 @@ package org.openapitools.client.apis +import java.io.IOException +import okhttp3.OkHttpClient +import okhttp3.HttpUrl + import org.openapitools.client.models.ClientV1Request import org.openapitools.client.models.CommitFinalV1Request import org.openapitools.client.models.CommitFinalV1Response @@ -39,43 +38,45 @@ import org.openapitools.client.models.TransferCompleteV1Request import org.openapitools.client.models.TransferInitializationV1Request import org.openapitools.client.models.TransferInitializationV1Response +import com.squareup.moshi.Json + import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse import org.openapitools.client.infrastructure.ClientException import org.openapitools.client.infrastructure.ClientError import org.openapitools.client.infrastructure.ServerException import org.openapitools.client.infrastructure.ServerError import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig import org.openapitools.client.infrastructure.RequestConfig import org.openapitools.client.infrastructure.RequestMethod import org.openapitools.client.infrastructure.ResponseType import org.openapitools.client.infrastructure.Success import org.openapitools.client.infrastructure.toMultiValue -class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) { +class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { companion object { @JvmStatic val defaultBasePath: String by lazy { - System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://localhost") + System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost") } } /** - * - * - * @param clientV1Request (optional) - * @return kotlin.Any - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ + * + * + * @param clientV1Request (optional) + * @return kotlin.Any + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ @Suppress("UNCHECKED_CAST") - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun clientRequestV1(clientV1Request: ClientV1Request?) : kotlin.Any { - val localVariableConfig = clientRequestV1RequestConfig(clientV1Request = clientV1Request) - - val localVarResponse = request( - localVariableConfig - ) + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun clientRequestV1(clientV1Request: ClientV1Request? = null) : kotlin.Any { + val localVarResponse = clientRequestV1WithHttpInfo(clientV1Request = clientV1Request) return when (localVarResponse.responseType) { ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.Any @@ -93,41 +94,60 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation clientRequestV1 - * - * @param clientV1Request (optional) - * @return RequestConfig - */ + * + * + * @param clientV1Request (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun clientRequestV1WithHttpInfo(clientV1Request: ClientV1Request?) : ApiResponse { + val localVariableConfig = clientRequestV1RequestConfig(clientV1Request = clientV1Request) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation clientRequestV1 + * + * @param clientV1Request (optional) + * @return RequestConfig + */ fun clientRequestV1RequestConfig(clientV1Request: ClientV1Request?) : RequestConfig { val localVariableBody = clientV1Request val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/clientrequest", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param transferInitializationV1Request (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase1TransferInitiationRequestV1(transferInitializationV1Request: TransferInitializationV1Request?) : Unit { - val localVariableConfig = phase1TransferInitiationRequestV1RequestConfig(transferInitializationV1Request = transferInitializationV1Request) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param transferInitializationV1Request (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun phase1TransferInitiationRequestV1(transferInitializationV1Request: TransferInitializationV1Request? = null) : Unit { + val localVarResponse = phase1TransferInitiationRequestV1WithHttpInfo(transferInitializationV1Request = transferInitializationV1Request) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -145,41 +165,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation phase1TransferInitiationRequestV1 - * - * @param transferInitializationV1Request (optional) - * @return RequestConfig - */ + * + * + * @param transferInitializationV1Request (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun phase1TransferInitiationRequestV1WithHttpInfo(transferInitializationV1Request: TransferInitializationV1Request?) : ApiResponse { + val localVariableConfig = phase1TransferInitiationRequestV1RequestConfig(transferInitializationV1Request = transferInitializationV1Request) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation phase1TransferInitiationRequestV1 + * + * @param transferInitializationV1Request (optional) + * @return RequestConfig + */ fun phase1TransferInitiationRequestV1RequestConfig(transferInitializationV1Request: TransferInitializationV1Request?) : RequestConfig { val localVariableBody = transferInitializationV1Request val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase1/transferinitiationrequest", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param transferInitializationV1Response (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase1TransferInitiationResponseV1(transferInitializationV1Response: TransferInitializationV1Response?) : Unit { - val localVariableConfig = phase1TransferInitiationResponseV1RequestConfig(transferInitializationV1Response = transferInitializationV1Response) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param transferInitializationV1Response (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun phase1TransferInitiationResponseV1(transferInitializationV1Response: TransferInitializationV1Response? = null) : Unit { + val localVarResponse = phase1TransferInitiationResponseV1WithHttpInfo(transferInitializationV1Response = transferInitializationV1Response) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -197,41 +234,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation phase1TransferInitiationResponseV1 - * - * @param transferInitializationV1Response (optional) - * @return RequestConfig - */ + * + * + * @param transferInitializationV1Response (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun phase1TransferInitiationResponseV1WithHttpInfo(transferInitializationV1Response: TransferInitializationV1Response?) : ApiResponse { + val localVariableConfig = phase1TransferInitiationResponseV1RequestConfig(transferInitializationV1Response = transferInitializationV1Response) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation phase1TransferInitiationResponseV1 + * + * @param transferInitializationV1Response (optional) + * @return RequestConfig + */ fun phase1TransferInitiationResponseV1RequestConfig(transferInitializationV1Response: TransferInitializationV1Response?) : RequestConfig { val localVariableBody = transferInitializationV1Response val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase1/transferinitiationresponse", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param lockEvidenceV1Request (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase2LockEvidenceRequestV1(lockEvidenceV1Request: LockEvidenceV1Request?) : Unit { - val localVariableConfig = phase2LockEvidenceRequestV1RequestConfig(lockEvidenceV1Request = lockEvidenceV1Request) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param lockEvidenceV1Request (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun phase2LockEvidenceRequestV1(lockEvidenceV1Request: LockEvidenceV1Request? = null) : Unit { + val localVarResponse = phase2LockEvidenceRequestV1WithHttpInfo(lockEvidenceV1Request = lockEvidenceV1Request) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -249,41 +303,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation phase2LockEvidenceRequestV1 - * - * @param lockEvidenceV1Request (optional) - * @return RequestConfig - */ + * + * + * @param lockEvidenceV1Request (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun phase2LockEvidenceRequestV1WithHttpInfo(lockEvidenceV1Request: LockEvidenceV1Request?) : ApiResponse { + val localVariableConfig = phase2LockEvidenceRequestV1RequestConfig(lockEvidenceV1Request = lockEvidenceV1Request) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation phase2LockEvidenceRequestV1 + * + * @param lockEvidenceV1Request (optional) + * @return RequestConfig + */ fun phase2LockEvidenceRequestV1RequestConfig(lockEvidenceV1Request: LockEvidenceV1Request?) : RequestConfig { val localVariableBody = lockEvidenceV1Request val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase2/lockevidencerequest", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param lockEvidenceV1Response (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase2LockEvidenceResponseV1(lockEvidenceV1Response: LockEvidenceV1Response?) : Unit { - val localVariableConfig = phase2LockEvidenceResponseV1RequestConfig(lockEvidenceV1Response = lockEvidenceV1Response) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param lockEvidenceV1Response (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun phase2LockEvidenceResponseV1(lockEvidenceV1Response: LockEvidenceV1Response? = null) : Unit { + val localVarResponse = phase2LockEvidenceResponseV1WithHttpInfo(lockEvidenceV1Response = lockEvidenceV1Response) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -301,41 +372,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation phase2LockEvidenceResponseV1 - * - * @param lockEvidenceV1Response (optional) - * @return RequestConfig - */ + * + * + * @param lockEvidenceV1Response (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun phase2LockEvidenceResponseV1WithHttpInfo(lockEvidenceV1Response: LockEvidenceV1Response?) : ApiResponse { + val localVariableConfig = phase2LockEvidenceResponseV1RequestConfig(lockEvidenceV1Response = lockEvidenceV1Response) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation phase2LockEvidenceResponseV1 + * + * @param lockEvidenceV1Response (optional) + * @return RequestConfig + */ fun phase2LockEvidenceResponseV1RequestConfig(lockEvidenceV1Response: LockEvidenceV1Response?) : RequestConfig { val localVariableBody = lockEvidenceV1Response val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase2/lockevidenceresponse", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param transferCommenceV1Request (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase2TransferCommenceRequestV1(transferCommenceV1Request: TransferCommenceV1Request?) : Unit { - val localVariableConfig = phase2TransferCommenceRequestV1RequestConfig(transferCommenceV1Request = transferCommenceV1Request) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param transferCommenceV1Request (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun phase2TransferCommenceRequestV1(transferCommenceV1Request: TransferCommenceV1Request? = null) : Unit { + val localVarResponse = phase2TransferCommenceRequestV1WithHttpInfo(transferCommenceV1Request = transferCommenceV1Request) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -353,41 +441,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation phase2TransferCommenceRequestV1 - * - * @param transferCommenceV1Request (optional) - * @return RequestConfig - */ + * + * + * @param transferCommenceV1Request (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun phase2TransferCommenceRequestV1WithHttpInfo(transferCommenceV1Request: TransferCommenceV1Request?) : ApiResponse { + val localVariableConfig = phase2TransferCommenceRequestV1RequestConfig(transferCommenceV1Request = transferCommenceV1Request) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation phase2TransferCommenceRequestV1 + * + * @param transferCommenceV1Request (optional) + * @return RequestConfig + */ fun phase2TransferCommenceRequestV1RequestConfig(transferCommenceV1Request: TransferCommenceV1Request?) : RequestConfig { val localVariableBody = transferCommenceV1Request val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase2/transfercommencerequest", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param transferCommenceV1Response (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase2TransferCommenceResponseV1(transferCommenceV1Response: TransferCommenceV1Response?) : Unit { - val localVariableConfig = phase2TransferCommenceResponseV1RequestConfig(transferCommenceV1Response = transferCommenceV1Response) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param transferCommenceV1Response (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun phase2TransferCommenceResponseV1(transferCommenceV1Response: TransferCommenceV1Response? = null) : Unit { + val localVarResponse = phase2TransferCommenceResponseV1WithHttpInfo(transferCommenceV1Response = transferCommenceV1Response) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -405,41 +510,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation phase2TransferCommenceResponseV1 - * - * @param transferCommenceV1Response (optional) - * @return RequestConfig - */ + * + * + * @param transferCommenceV1Response (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun phase2TransferCommenceResponseV1WithHttpInfo(transferCommenceV1Response: TransferCommenceV1Response?) : ApiResponse { + val localVariableConfig = phase2TransferCommenceResponseV1RequestConfig(transferCommenceV1Response = transferCommenceV1Response) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation phase2TransferCommenceResponseV1 + * + * @param transferCommenceV1Response (optional) + * @return RequestConfig + */ fun phase2TransferCommenceResponseV1RequestConfig(transferCommenceV1Response: TransferCommenceV1Response?) : RequestConfig { val localVariableBody = transferCommenceV1Response val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase2/transfercommenceresponse", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param commitFinalV1Request (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase3CommitFinalRequestV1(commitFinalV1Request: CommitFinalV1Request?) : Unit { - val localVariableConfig = phase3CommitFinalRequestV1RequestConfig(commitFinalV1Request = commitFinalV1Request) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param commitFinalV1Request (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun phase3CommitFinalRequestV1(commitFinalV1Request: CommitFinalV1Request? = null) : Unit { + val localVarResponse = phase3CommitFinalRequestV1WithHttpInfo(commitFinalV1Request = commitFinalV1Request) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -457,41 +579,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation phase3CommitFinalRequestV1 - * - * @param commitFinalV1Request (optional) - * @return RequestConfig - */ + * + * + * @param commitFinalV1Request (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun phase3CommitFinalRequestV1WithHttpInfo(commitFinalV1Request: CommitFinalV1Request?) : ApiResponse { + val localVariableConfig = phase3CommitFinalRequestV1RequestConfig(commitFinalV1Request = commitFinalV1Request) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation phase3CommitFinalRequestV1 + * + * @param commitFinalV1Request (optional) + * @return RequestConfig + */ fun phase3CommitFinalRequestV1RequestConfig(commitFinalV1Request: CommitFinalV1Request?) : RequestConfig { val localVariableBody = commitFinalV1Request val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase3/commitfinalrequest", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param commitFinalV1Response (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase3CommitFinalResponseV1(commitFinalV1Response: CommitFinalV1Response?) : Unit { - val localVariableConfig = phase3CommitFinalResponseV1RequestConfig(commitFinalV1Response = commitFinalV1Response) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param commitFinalV1Response (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun phase3CommitFinalResponseV1(commitFinalV1Response: CommitFinalV1Response? = null) : Unit { + val localVarResponse = phase3CommitFinalResponseV1WithHttpInfo(commitFinalV1Response = commitFinalV1Response) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -509,41 +648,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation phase3CommitFinalResponseV1 - * - * @param commitFinalV1Response (optional) - * @return RequestConfig - */ + * + * + * @param commitFinalV1Response (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun phase3CommitFinalResponseV1WithHttpInfo(commitFinalV1Response: CommitFinalV1Response?) : ApiResponse { + val localVariableConfig = phase3CommitFinalResponseV1RequestConfig(commitFinalV1Response = commitFinalV1Response) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation phase3CommitFinalResponseV1 + * + * @param commitFinalV1Response (optional) + * @return RequestConfig + */ fun phase3CommitFinalResponseV1RequestConfig(commitFinalV1Response: CommitFinalV1Response?) : RequestConfig { val localVariableBody = commitFinalV1Response val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase3/commitfinalresponse", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param commitPreparationV1Request (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase3CommitPreparationRequestV1(commitPreparationV1Request: CommitPreparationV1Request?) : Unit { - val localVariableConfig = phase3CommitPreparationRequestV1RequestConfig(commitPreparationV1Request = commitPreparationV1Request) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param commitPreparationV1Request (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun phase3CommitPreparationRequestV1(commitPreparationV1Request: CommitPreparationV1Request? = null) : Unit { + val localVarResponse = phase3CommitPreparationRequestV1WithHttpInfo(commitPreparationV1Request = commitPreparationV1Request) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -561,41 +717,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation phase3CommitPreparationRequestV1 - * - * @param commitPreparationV1Request (optional) - * @return RequestConfig - */ + * + * + * @param commitPreparationV1Request (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun phase3CommitPreparationRequestV1WithHttpInfo(commitPreparationV1Request: CommitPreparationV1Request?) : ApiResponse { + val localVariableConfig = phase3CommitPreparationRequestV1RequestConfig(commitPreparationV1Request = commitPreparationV1Request) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation phase3CommitPreparationRequestV1 + * + * @param commitPreparationV1Request (optional) + * @return RequestConfig + */ fun phase3CommitPreparationRequestV1RequestConfig(commitPreparationV1Request: CommitPreparationV1Request?) : RequestConfig { val localVariableBody = commitPreparationV1Request val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase3/commitpreparationrequest", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param commitPreparationV1Response (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase3CommitPreparationResponseV1(commitPreparationV1Response: CommitPreparationV1Response?) : Unit { - val localVariableConfig = phase3CommitPreparationResponseV1RequestConfig(commitPreparationV1Response = commitPreparationV1Response) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param commitPreparationV1Response (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun phase3CommitPreparationResponseV1(commitPreparationV1Response: CommitPreparationV1Response? = null) : Unit { + val localVarResponse = phase3CommitPreparationResponseV1WithHttpInfo(commitPreparationV1Response = commitPreparationV1Response) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -613,41 +786,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation phase3CommitPreparationResponseV1 - * - * @param commitPreparationV1Response (optional) - * @return RequestConfig - */ + * + * + * @param commitPreparationV1Response (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun phase3CommitPreparationResponseV1WithHttpInfo(commitPreparationV1Response: CommitPreparationV1Response?) : ApiResponse { + val localVariableConfig = phase3CommitPreparationResponseV1RequestConfig(commitPreparationV1Response = commitPreparationV1Response) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation phase3CommitPreparationResponseV1 + * + * @param commitPreparationV1Response (optional) + * @return RequestConfig + */ fun phase3CommitPreparationResponseV1RequestConfig(commitPreparationV1Response: CommitPreparationV1Response?) : RequestConfig { val localVariableBody = commitPreparationV1Response val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase3/commitpreparationresponse", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param transferCompleteV1Request (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase3TransferCompleteRequestV1(transferCompleteV1Request: TransferCompleteV1Request?) : Unit { - val localVariableConfig = phase3TransferCompleteRequestV1RequestConfig(transferCompleteV1Request = transferCompleteV1Request) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param transferCompleteV1Request (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun phase3TransferCompleteRequestV1(transferCompleteV1Request: TransferCompleteV1Request? = null) : Unit { + val localVarResponse = phase3TransferCompleteRequestV1WithHttpInfo(transferCompleteV1Request = transferCompleteV1Request) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -665,41 +855,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation phase3TransferCompleteRequestV1 - * - * @param transferCompleteV1Request (optional) - * @return RequestConfig - */ + * + * + * @param transferCompleteV1Request (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun phase3TransferCompleteRequestV1WithHttpInfo(transferCompleteV1Request: TransferCompleteV1Request?) : ApiResponse { + val localVariableConfig = phase3TransferCompleteRequestV1RequestConfig(transferCompleteV1Request = transferCompleteV1Request) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation phase3TransferCompleteRequestV1 + * + * @param transferCompleteV1Request (optional) + * @return RequestConfig + */ fun phase3TransferCompleteRequestV1RequestConfig(transferCompleteV1Request: TransferCompleteV1Request?) : RequestConfig { val localVariableBody = transferCompleteV1Request val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.GET, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase3/transfercompleterequest", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param recoverUpdateAckV1Message (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun recoverUpdateAckV1Message(recoverUpdateAckV1Message: RecoverUpdateAckV1Message?) : Unit { - val localVariableConfig = recoverUpdateAckV1MessageRequestConfig(recoverUpdateAckV1Message = recoverUpdateAckV1Message) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param recoverUpdateAckV1Message (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun recoverUpdateAckV1Message(recoverUpdateAckV1Message: RecoverUpdateAckV1Message? = null) : Unit { + val localVarResponse = recoverUpdateAckV1MessageWithHttpInfo(recoverUpdateAckV1Message = recoverUpdateAckV1Message) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -717,41 +924,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation recoverUpdateAckV1Message - * - * @param recoverUpdateAckV1Message (optional) - * @return RequestConfig - */ + * + * + * @param recoverUpdateAckV1Message (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun recoverUpdateAckV1MessageWithHttpInfo(recoverUpdateAckV1Message: RecoverUpdateAckV1Message?) : ApiResponse { + val localVariableConfig = recoverUpdateAckV1MessageRequestConfig(recoverUpdateAckV1Message = recoverUpdateAckV1Message) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation recoverUpdateAckV1Message + * + * @param recoverUpdateAckV1Message (optional) + * @return RequestConfig + */ fun recoverUpdateAckV1MessageRequestConfig(recoverUpdateAckV1Message: RecoverUpdateAckV1Message?) : RequestConfig { val localVariableBody = recoverUpdateAckV1Message val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/recoverupdateackmessage", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param recoverUpdateV1Message (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun recoverUpdateV1Message(recoverUpdateV1Message: RecoverUpdateV1Message?) : Unit { - val localVariableConfig = recoverUpdateV1MessageRequestConfig(recoverUpdateV1Message = recoverUpdateV1Message) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param recoverUpdateV1Message (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun recoverUpdateV1Message(recoverUpdateV1Message: RecoverUpdateV1Message? = null) : Unit { + val localVarResponse = recoverUpdateV1MessageWithHttpInfo(recoverUpdateV1Message = recoverUpdateV1Message) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -769,41 +993,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation recoverUpdateV1Message - * - * @param recoverUpdateV1Message (optional) - * @return RequestConfig - */ + * + * + * @param recoverUpdateV1Message (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun recoverUpdateV1MessageWithHttpInfo(recoverUpdateV1Message: RecoverUpdateV1Message?) : ApiResponse { + val localVariableConfig = recoverUpdateV1MessageRequestConfig(recoverUpdateV1Message = recoverUpdateV1Message) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation recoverUpdateV1Message + * + * @param recoverUpdateV1Message (optional) + * @return RequestConfig + */ fun recoverUpdateV1MessageRequestConfig(recoverUpdateV1Message: RecoverUpdateV1Message?) : RequestConfig { val localVariableBody = recoverUpdateV1Message val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/recoverupdatemessage", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param recoverV1Message (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun recoverV1Message(recoverV1Message: RecoverV1Message?) : Unit { - val localVariableConfig = recoverV1MessageRequestConfig(recoverV1Message = recoverV1Message) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param recoverV1Message (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun recoverV1Message(recoverV1Message: RecoverV1Message? = null) : Unit { + val localVarResponse = recoverV1MessageWithHttpInfo(recoverV1Message = recoverV1Message) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -821,41 +1062,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation recoverV1Message - * - * @param recoverV1Message (optional) - * @return RequestConfig - */ + * + * + * @param recoverV1Message (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun recoverV1MessageWithHttpInfo(recoverV1Message: RecoverV1Message?) : ApiResponse { + val localVariableConfig = recoverV1MessageRequestConfig(recoverV1Message = recoverV1Message) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation recoverV1Message + * + * @param recoverV1Message (optional) + * @return RequestConfig + */ fun recoverV1MessageRequestConfig(recoverV1Message: RecoverV1Message?) : RequestConfig { val localVariableBody = recoverV1Message val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/recovermessage", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param recoverSuccessV1Message (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun recoverV1Success(recoverSuccessV1Message: RecoverSuccessV1Message?) : Unit { - val localVariableConfig = recoverV1SuccessRequestConfig(recoverSuccessV1Message = recoverSuccessV1Message) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param recoverSuccessV1Message (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun recoverV1Success(recoverSuccessV1Message: RecoverSuccessV1Message? = null) : Unit { + val localVarResponse = recoverV1SuccessWithHttpInfo(recoverSuccessV1Message = recoverSuccessV1Message) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -873,41 +1131,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation recoverV1Success - * - * @param recoverSuccessV1Message (optional) - * @return RequestConfig - */ + * + * + * @param recoverSuccessV1Message (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun recoverV1SuccessWithHttpInfo(recoverSuccessV1Message: RecoverSuccessV1Message?) : ApiResponse { + val localVariableConfig = recoverV1SuccessRequestConfig(recoverSuccessV1Message = recoverSuccessV1Message) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation recoverV1Success + * + * @param recoverSuccessV1Message (optional) + * @return RequestConfig + */ fun recoverV1SuccessRequestConfig(recoverSuccessV1Message: RecoverSuccessV1Message?) : RequestConfig { val localVariableBody = recoverSuccessV1Message val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/recoversuccessmessage", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param rollbackAckV1Message (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun rollbackAckV1Message(rollbackAckV1Message: RollbackAckV1Message?) : Unit { - val localVariableConfig = rollbackAckV1MessageRequestConfig(rollbackAckV1Message = rollbackAckV1Message) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param rollbackAckV1Message (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun rollbackAckV1Message(rollbackAckV1Message: RollbackAckV1Message? = null) : Unit { + val localVarResponse = rollbackAckV1MessageWithHttpInfo(rollbackAckV1Message = rollbackAckV1Message) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -925,41 +1200,58 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation rollbackAckV1Message - * - * @param rollbackAckV1Message (optional) - * @return RequestConfig - */ + * + * + * @param rollbackAckV1Message (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun rollbackAckV1MessageWithHttpInfo(rollbackAckV1Message: RollbackAckV1Message?) : ApiResponse { + val localVariableConfig = rollbackAckV1MessageRequestConfig(rollbackAckV1Message = rollbackAckV1Message) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation rollbackAckV1Message + * + * @param rollbackAckV1Message (optional) + * @return RequestConfig + */ fun rollbackAckV1MessageRequestConfig(rollbackAckV1Message: RollbackAckV1Message?) : RequestConfig { val localVariableBody = rollbackAckV1Message val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/rollbackackmessage", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } /** - * - * - * @param rollbackV1Message (optional) - * @return void - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun rollbackV1Message(rollbackV1Message: RollbackV1Message?) : Unit { - val localVariableConfig = rollbackV1MessageRequestConfig(rollbackV1Message = rollbackV1Message) - - val localVarResponse = request( - localVariableConfig - ) + * + * + * @param rollbackV1Message (optional) + * @return void + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun rollbackV1Message(rollbackV1Message: RollbackV1Message? = null) : Unit { + val localVarResponse = rollbackV1MessageWithHttpInfo(rollbackV1Message = rollbackV1Message) return when (localVarResponse.responseType) { ResponseType.Success -> Unit @@ -977,23 +1269,45 @@ class DefaultApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath } /** - * To obtain the request config of the operation rollbackV1Message - * - * @param rollbackV1Message (optional) - * @return RequestConfig - */ + * + * + * @param rollbackV1Message (optional) + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Throws(IllegalStateException::class, IOException::class) + fun rollbackV1MessageWithHttpInfo(rollbackV1Message: RollbackV1Message?) : ApiResponse { + val localVariableConfig = rollbackV1MessageRequestConfig(rollbackV1Message = rollbackV1Message) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation rollbackV1Message + * + * @param rollbackV1Message (optional) + * @return RequestConfig + */ fun rollbackV1MessageRequestConfig(rollbackV1Message: RollbackV1Message?) : RequestConfig { val localVariableBody = rollbackV1Message val localVariableQuery: MultiValueMap = mutableMapOf() val localVariableHeaders: MutableMap = mutableMapOf() - + localVariableHeaders["Content-Type"] = "application/json" + return RequestConfig( method = RequestMethod.POST, path = "/api/v1/@hyperledger/cactus-plugin-odap-hermes/rollbackmessage", query = localVariableQuery, headers = localVariableHeaders, + requiresAuthentication = false, body = localVariableBody ) } + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] } diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt index b359be1e41..757080d7ed 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -10,21 +10,26 @@ import okhttp3.ResponseBody import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.Request import okhttp3.Headers +import okhttp3.Headers.Companion.toHeaders import okhttp3.MultipartBody +import okhttp3.Call +import okhttp3.Callback +import okhttp3.Response +import okhttp3.internal.EMPTY_REQUEST import java.io.BufferedWriter import java.io.File import java.io.FileWriter +import java.io.IOException import java.net.URLConnection import java.time.LocalDate import java.time.LocalDateTime import java.time.LocalTime import java.time.OffsetDateTime import java.time.OffsetTime -import java.util.Date import java.util.Locale import com.squareup.moshi.adapter -open class ApiClient(val baseUrl: String) { +open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) { companion object { protected const val ContentType = "Content-Type" protected const val Accept = "Accept" @@ -39,9 +44,10 @@ open class ApiClient(val baseUrl: String) { var username: String? = null var password: String? = null var accessToken: String? = null + const val baseUrlKey = "org.openapitools.client.baseUrl" @JvmStatic - val client: OkHttpClient by lazy { + val defaultClient: OkHttpClient by lazy { builder.build() } @@ -60,48 +66,50 @@ open class ApiClient(val baseUrl: String) { return contentType ?: "application/octet-stream" } - protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + protected inline fun requestBody(content: T, mediaType: String?): RequestBody = when { - content is File -> content.asRequestBody(mediaType.toMediaTypeOrNull()) - mediaType == FormDataMediaType -> { + content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) + mediaType == FormDataMediaType -> MultipartBody.Builder() .setType(MultipartBody.FORM) .apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - if (value is File) { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"; filename=\"${value.name}\"" + (content as Map>).forEach { (name, part) -> + if (part.body is File) { + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${part.body.name}\"") + val fileMediaType = guessContentTypeFromFile(part.body).toMediaTypeOrNull() + addPart( + partHeaders.toHeaders(), + part.body.asRequestBody(fileMediaType) ) - val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull() - addPart(partHeaders, value.asRequestBody(fileMediaType)) } else { - val partHeaders = Headers.headersOf( - "Content-Disposition", - "form-data; name=\"$key\"" - ) + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"") addPart( - partHeaders, - parameterToString(value).toRequestBody(null) + partHeaders.toHeaders(), + parameterToString(part.body).toRequestBody(null) ) } } }.build() - } mediaType == FormUrlEncMediaType -> { FormBody.Builder().apply { - // content's type *must* be Map + // content's type *must* be Map> @Suppress("UNCHECKED_CAST") - (content as Map).forEach { (key, value) -> - add(key, parameterToString(value)) + (content as Map>).forEach { (name, part) -> + add(name, parameterToString(part.body)) } }.build() } - mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( - mediaType.toMediaTypeOrNull() - ) + mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> + if (content == null) { + EMPTY_REQUEST + } else { + Serializer.moshi.adapter(T::class.java).toJson(content) + .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) + } mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") // TODO: this should be extended with other serializers else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") @@ -112,31 +120,35 @@ open class ApiClient(val baseUrl: String) { if(body == null) { return null } + if (T::class.java == File::class.java) { + // return tempFile + // Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options + val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() + tempFile.deleteOnExit() + body.byteStream().use { inputStream -> + tempFile.outputStream().use { tempFileOutputStream -> + inputStream.copyTo(tempFileOutputStream) + } + } + return tempFile as T + } val bodyContent = body.string() if (bodyContent.isEmpty()) { return null } - if (T::class.java == File::class.java) { - // return tempfile - val f = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() - f.deleteOnExit() - val out = BufferedWriter(FileWriter(f)) - out.write(bodyContent) - out.close() - return f as T - } - return when(mediaType) { - JsonMediaType -> Serializer.moshi.adapter().fromJson(bodyContent) + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } } - protected inline fun request(requestConfig: RequestConfig): ApiInfrastructureResponse { + protected inline fun request(requestConfig: RequestConfig): ApiResponse { val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") val url = httpUrl.newBuilder() - .addPathSegments(requestConfig.path.trimStart('/')) + .addEncodedPathSegments(requestConfig.path.trimStart('/')) .apply { requestConfig.query.forEach { query -> query.value.forEach { queryValue -> @@ -146,7 +158,7 @@ open class ApiClient(val baseUrl: String) { }.build() // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.headers[ContentType].isNullOrEmpty()) { + if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) { requestConfig.headers[ContentType] = JsonMediaType } if (requestConfig.headers[Accept].isNullOrEmpty()) { @@ -154,16 +166,16 @@ open class ApiClient(val baseUrl: String) { } val headers = requestConfig.headers - if(headers[ContentType] ?: "" == "") { - throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") - } - - if(headers[Accept] ?: "" == "") { + if (headers[Accept].isNullOrEmpty()) { throw kotlin.IllegalStateException("Missing Accept header. This is required.") } - // TODO: support multiple contentType options here. - val contentType = (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + val contentType = if (headers[ContentType] != null) { + // TODO: support multiple contentType options here. + (headers[ContentType] as String).substringBefore(";").lowercase(Locale.getDefault()) + } else { + null + } val request = when (requestConfig.method) { RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) @@ -178,6 +190,7 @@ open class ApiClient(val baseUrl: String) { }.build() val response = client.newCall(request).execute() + val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.getDefault()) // TODO: handle specific mapping types. e.g. Map> @@ -215,7 +228,7 @@ open class ApiClient(val baseUrl: String) { null -> "" is Array<*> -> toMultiValue(value, "csv").toString() is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> parseDateToQueryString(value) else -> value.toString() } diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 0000000000..cf2cfaa95d --- /dev/null +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt index fb2c972cf8..064b57fc6b 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt @@ -14,4 +14,4 @@ class BigDecimalAdapter { fun fromJson(value: String): BigDecimal { return BigDecimal(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt index 4b6963110c..7df6057b45 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt @@ -14,4 +14,4 @@ class BigIntegerAdapter { fun fromJson(value: String): BigInteger { return BigInteger(value) } -} \ No newline at end of file +} diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 0000000000..be00e38fba --- /dev/null +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt index 7e948e1dd0..625a19002b 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -13,5 +13,6 @@ data class RequestConfig( val path: String, val headers: MutableMap = mutableMapOf(), val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, val body: T? = null ) \ No newline at end of file diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AssetProfile.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AssetProfile.kt index 8ac097b537..d7e338ca33 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AssetProfile.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AssetProfile.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -40,6 +35,7 @@ import com.squareup.moshi.Json * @param ledgerRequirements */ + data class AssetProfile ( @Json(name = "expirationDate") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1Request.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1Request.kt index 3a01329117..5d4a16791a 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1Request.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1Request.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -53,6 +48,7 @@ import com.squareup.moshi.Json * @param recipientLedgerAssetID */ + data class ClientV1Request ( @Json(name = "version") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1RequestClientGatewayConfiguration.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1RequestClientGatewayConfiguration.kt index 6fc40d9c20..504f22e72e 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1RequestClientGatewayConfiguration.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1RequestClientGatewayConfiguration.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -29,6 +24,7 @@ import com.squareup.moshi.Json * @param apiHost */ + data class ClientV1RequestClientGatewayConfiguration ( @Json(name = "apiHost") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Request.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Request.kt index 53d0a70a0c..47f4f961e8 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Request.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Request.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -38,6 +33,7 @@ import com.squareup.moshi.Json * @param clientTransferNumber */ + data class CommitFinalV1Request ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Response.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Response.kt index 26ea09ca97..62c4cf3366 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Response.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Response.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -38,6 +33,7 @@ import com.squareup.moshi.Json * @param serverTransferNumber */ + data class CommitFinalV1Response ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Request.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Request.kt index 3833320b18..dddb775189 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Request.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Request.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -36,6 +31,7 @@ import com.squareup.moshi.Json * @param clientTransferNumber */ + data class CommitPreparationV1Request ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Response.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Response.kt index 0f9133a85b..e7774c6a69 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Response.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Response.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -36,6 +31,7 @@ import com.squareup.moshi.Json * @param serverTransferNumber */ + data class CommitPreparationV1Response ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CredentialProfile.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CredentialProfile.kt index b0820be7d1..0c74f0373c 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CredentialProfile.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CredentialProfile.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -53,12 +48,12 @@ enum class CredentialProfile(val value: kotlin.String) { /** * Converts the provided [data] to a [String] on success, null otherwise. */ - fun encode(data: Any?): kotlin.String? = if (data is CredentialProfile) "$data" else null + fun encode(data: kotlin.Any?): kotlin.String? = if (data is CredentialProfile) "$data" else null /** * Returns a valid [CredentialProfile] for [data], null otherwise. */ - fun decode(data: Any?): CredentialProfile? = data?.let { + fun decode(data: kotlin.Any?): CredentialProfile? = data?.let { val normalizedData = "$it".lowercase() values().firstOrNull { value -> it == value || normalizedData == "$value".lowercase() diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/History.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/History.kt index 28b4c5380a..142f7c2efb 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/History.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/History.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -35,6 +30,7 @@ import com.squareup.moshi.Json * @param applicationSpecificParameters */ + data class History ( @Json(name = "Transactions") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Request.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Request.kt index 66cfe1f2d0..c357047911 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Request.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Request.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -40,6 +35,7 @@ import com.squareup.moshi.Json * @param messageHash */ + data class LockEvidenceV1Request ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Response.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Response.kt index 2cdbfc9fd0..8e8de79399 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Response.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Response.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -36,6 +31,7 @@ import com.squareup.moshi.Json * @param serverTransferNumber */ + data class LockEvidenceV1Response ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/OdapLocalLog.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/OdapLocalLog.kt index bcfcbcf140..0ffd5ca5a2 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/OdapLocalLog.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/OdapLocalLog.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -34,6 +29,7 @@ import com.squareup.moshi.Json * @param timestamp */ + data class OdapLocalLog ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/OdapMessage.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/OdapMessage.kt index 77c2815ce8..3d25bdad4e 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/OdapMessage.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/OdapMessage.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -42,6 +37,7 @@ import com.squareup.moshi.Json * @param messageSignature */ + data class OdapMessage ( @Json(name = "SequenceNumber") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/OdapMessageActionResponse.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/OdapMessageActionResponse.kt index 8673ac67cf..85525355e8 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/OdapMessageActionResponse.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/OdapMessageActionResponse.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -30,6 +25,7 @@ import com.squareup.moshi.Json * @param arguments */ + data class OdapMessageActionResponse ( @Json(name = "ResponseCode") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PayloadProfile.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PayloadProfile.kt index 2157a47d6b..dfc8127c0b 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PayloadProfile.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PayloadProfile.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -31,6 +26,7 @@ import com.squareup.moshi.Json * @param capabilities */ + data class PayloadProfile ( @Json(name = "assetProfile") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverSuccessV1Message.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverSuccessV1Message.kt index 0b59d3326d..c9283a7aa4 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverSuccessV1Message.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverSuccessV1Message.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -31,6 +26,7 @@ import com.squareup.moshi.Json * @param signature */ + data class RecoverSuccessV1Message ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateAckV1Message.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateAckV1Message.kt index 26467411ea..91033eac53 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateAckV1Message.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateAckV1Message.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -32,6 +27,7 @@ import com.squareup.moshi.Json * @param signature */ + data class RecoverUpdateAckV1Message ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateV1Message.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateV1Message.kt index b7580fa75a..a2469113a4 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateV1Message.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateV1Message.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -32,6 +27,7 @@ import com.squareup.moshi.Json * @param signature */ + data class RecoverUpdateV1Message ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverV1Message.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverV1Message.kt index 3afc534216..7a1dbfbf2c 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverV1Message.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverV1Message.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -36,6 +31,7 @@ import com.squareup.moshi.Json * @param newGatewayPubKey */ + data class RecoverV1Message ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackAckV1Message.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackAckV1Message.kt index 6d362fe868..266781868c 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackAckV1Message.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackAckV1Message.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -31,6 +26,7 @@ import com.squareup.moshi.Json * @param signature */ + data class RollbackAckV1Message ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackV1Message.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackV1Message.kt index 3119d50923..712b3f9bb7 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackV1Message.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackV1Message.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -33,6 +28,7 @@ import com.squareup.moshi.Json * @param signature */ + data class RollbackV1Message ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SessionData.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SessionData.kt index dd8a24e7ae..5beebafa1e 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SessionData.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SessionData.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -91,6 +86,7 @@ import com.squareup.moshi.Json * @param rollbackActionsPerformed */ + data class SessionData ( @Json(name = "id") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Request.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Request.kt index d0f6cb95be..9b92bb5f05 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Request.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Request.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -42,6 +37,7 @@ import com.squareup.moshi.Json * @param clientTransferNumber */ + data class TransferCommenceV1Request ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Response.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Response.kt index 948650acc1..825ab05ab7 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Response.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Response.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -37,6 +32,7 @@ import com.squareup.moshi.Json * @param messageHash */ + data class TransferCommenceV1Response ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCompleteV1Request.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCompleteV1Request.kt index 5c84fd4b3c..53144a87a7 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCompleteV1Request.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCompleteV1Request.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -37,6 +32,7 @@ import com.squareup.moshi.Json * @param clientTransferNumber */ + data class TransferCompleteV1Request ( @Json(name = "sessionID") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferInitializationV1Request.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferInitializationV1Request.kt index abf07a3b3f..b024d5ef7c 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferInitializationV1Request.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferInitializationV1Request.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -62,6 +57,7 @@ import com.squareup.moshi.Json * @param histories */ + data class TransferInitializationV1Request ( @Json(name = "messageType") diff --git a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferInitializationV1Response.kt b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferInitializationV1Response.kt index dd84cfdbe4..4f64f38fea 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferInitializationV1Response.kt +++ b/packages/cactus-plugin-odap-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferInitializationV1Response.kt @@ -1,14 +1,9 @@ /** - * Hyperledger Cactus Plugin - Odap Hermes - * - * Implementation for Odap and Hermes - * - * The version of the OpenAPI document: 0.0.1 - * * * Please note: * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * Do not edit this file manually. + * */ @file:Suppress( @@ -39,6 +34,7 @@ import com.squareup.moshi.Json * @param destination */ + data class TransferInitializationV1Response ( @Json(name = "messageType") diff --git a/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION index 804440660c..e7e42a4b58 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION +++ b/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +6.3.0 \ No newline at end of file diff --git a/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/api.ts index 897436c653..8cdd6225ae 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -13,13 +13,15 @@ */ -import { Configuration } from './configuration'; -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; // @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; /** * @@ -32,73 +34,73 @@ export interface AssetProfile { * @type {string} * @memberof AssetProfile */ - issuer?: string; + 'issuer'?: string; /** * * @type {string} * @memberof AssetProfile */ - assetCode?: string; + 'assetCode'?: string; /** * * @type {string} * @memberof AssetProfile */ - assetCodeType?: string; + 'assetCodeType'?: string; /** * * @type {string} * @memberof AssetProfile */ - issuanceDate?: string; + 'issuanceDate'?: string; /** * * @type {string} * @memberof AssetProfile */ - expirationDate: string; + 'expirationDate': string; /** * * @type {string} * @memberof AssetProfile */ - verificationEndPoint?: string; + 'verificationEndPoint'?: string; /** * * @type {string} * @memberof AssetProfile */ - digitalSignature?: string; + 'digitalSignature'?: string; /** * * @type {string} * @memberof AssetProfile */ - prospectusLink?: string; + 'prospectusLink'?: string; /** * * @type {Array} * @memberof AssetProfile */ - keyInformationLink?: Array; + 'keyInformationLink'?: Array; /** * * @type {Array} * @memberof AssetProfile */ - keyWord?: Array; + 'keyWord'?: Array; /** * * @type {Array} * @memberof AssetProfile */ - transferRestriction?: Array; + 'transferRestriction'?: Array; /** * * @type {Array} * @memberof AssetProfile */ - ledgerRequirements?: Array; + 'ledgerRequirements'?: Array; } /** * @@ -111,133 +113,133 @@ export interface ClientV1Request { * @type {string} * @memberof ClientV1Request */ - version: string; + 'version': string; /** * * @type {string} * @memberof ClientV1Request */ - loggingProfile: string; + 'loggingProfile': string; /** * * @type {string} * @memberof ClientV1Request */ - accessControlProfile: string; + 'accessControlProfile': string; /** * * @type {string} * @memberof ClientV1Request */ - assetControlProfile: string; + 'assetControlProfile': string; /** * * @type {string} * @memberof ClientV1Request */ - applicationProfile: string; + 'applicationProfile': string; /** * * @type {AssetProfile} * @memberof ClientV1Request */ - assetProfile: AssetProfile; + 'assetProfile': AssetProfile; /** * * @type {PayloadProfile} * @memberof ClientV1Request */ - payloadProfile: PayloadProfile; + 'payloadProfile': PayloadProfile; /** * * @type {string} * @memberof ClientV1Request */ - sourceGatewayDltSystem: string; + 'sourceGatewayDltSystem': string; /** * * @type {string} * @memberof ClientV1Request */ - recipientGatewayDltSystem: string; + 'recipientGatewayDltSystem': string; /** * * @type {string} * @memberof ClientV1Request */ - recipientGatewayPubkey: string; + 'recipientGatewayPubkey': string; /** * * @type {string} * @memberof ClientV1Request */ - originatorPubkey: string; + 'originatorPubkey': string; /** * * @type {string} * @memberof ClientV1Request */ - beneficiaryPubkey: string; + 'beneficiaryPubkey': string; /** * * @type {string} * @memberof ClientV1Request */ - clientIdentityPubkey: string; + 'clientIdentityPubkey': string; /** * * @type {string} * @memberof ClientV1Request */ - serverIdentityPubkey: string; + 'serverIdentityPubkey': string; /** * * @type {string} * @memberof ClientV1Request */ - clientDltSystem: string; + 'clientDltSystem': string; /** * * @type {string} * @memberof ClientV1Request */ - serverDltSystem: string; + 'serverDltSystem': string; /** * * @type {ClientV1RequestClientGatewayConfiguration} * @memberof ClientV1Request */ - clientGatewayConfiguration: ClientV1RequestClientGatewayConfiguration; + 'clientGatewayConfiguration': ClientV1RequestClientGatewayConfiguration; /** * * @type {ClientV1RequestClientGatewayConfiguration} * @memberof ClientV1Request */ - serverGatewayConfiguration: ClientV1RequestClientGatewayConfiguration; + 'serverGatewayConfiguration': ClientV1RequestClientGatewayConfiguration; /** * * @type {number} * @memberof ClientV1Request */ - maxRetries: number; + 'maxRetries': number; /** * * @type {number} * @memberof ClientV1Request */ - maxTimeout: number; + 'maxTimeout': number; /** * * @type {string} * @memberof ClientV1Request */ - sourceLedgerAssetID: string; + 'sourceLedgerAssetID': string; /** * * @type {string} * @memberof ClientV1Request */ - recipientLedgerAssetID: string; + 'recipientLedgerAssetID': string; } /** * @@ -250,7 +252,7 @@ export interface ClientV1RequestClientGatewayConfiguration { * @type {string} * @memberof ClientV1RequestClientGatewayConfiguration */ - apiHost: string; + 'apiHost': string; } /** * @@ -263,61 +265,61 @@ export interface CommitFinalV1Request { * @type {string} * @memberof CommitFinalV1Request */ - sessionID: string; + 'sessionID': string; /** * * @type {string} * @memberof CommitFinalV1Request */ - messageType: string; + 'messageType': string; /** * * @type {string} * @memberof CommitFinalV1Request */ - clientIdentityPubkey: string; + 'clientIdentityPubkey': string; /** * * @type {string} * @memberof CommitFinalV1Request */ - serverIdentityPubkey: string; + 'serverIdentityPubkey': string; /** * * @type {string} * @memberof CommitFinalV1Request */ - commitFinalClaim: string; + 'commitFinalClaim': string; /** * * @type {object} * @memberof CommitFinalV1Request */ - commitFinalClaimFormat?: object; + 'commitFinalClaimFormat'?: object; /** * * @type {string} * @memberof CommitFinalV1Request */ - hashCommitPrepareAck: string; + 'hashCommitPrepareAck': string; /** * * @type {number} * @memberof CommitFinalV1Request */ - clientTransferNumber?: number | null; + 'clientTransferNumber'?: number | null; /** * * @type {string} * @memberof CommitFinalV1Request */ - signature: string; + 'signature': string; /** * * @type {number} * @memberof CommitFinalV1Request */ - sequenceNumber: number; + 'sequenceNumber': number; } /** * @@ -330,61 +332,61 @@ export interface CommitFinalV1Response { * @type {string} * @memberof CommitFinalV1Response */ - sessionID: string; + 'sessionID': string; /** * * @type {string} * @memberof CommitFinalV1Response */ - messageType: string; + 'messageType': string; /** * * @type {string} * @memberof CommitFinalV1Response */ - clientIdentityPubkey: string; + 'clientIdentityPubkey': string; /** * * @type {string} * @memberof CommitFinalV1Response */ - serverIdentityPubkey: string; + 'serverIdentityPubkey': string; /** * * @type {string} * @memberof CommitFinalV1Response */ - commitAcknowledgementClaim: string; + 'commitAcknowledgementClaim': string; /** * * @type {object} * @memberof CommitFinalV1Response */ - commitAcknowledgementClaimFormat?: object; + 'commitAcknowledgementClaimFormat'?: object; /** * * @type {string} * @memberof CommitFinalV1Response */ - hashCommitFinal: string; + 'hashCommitFinal': string; /** * * @type {number} * @memberof CommitFinalV1Response */ - serverTransferNumber?: number; + 'serverTransferNumber'?: number; /** * * @type {string} * @memberof CommitFinalV1Response */ - signature: string; + 'signature': string; /** * * @type {number} * @memberof CommitFinalV1Response */ - sequenceNumber: number; + 'sequenceNumber': number; } /** * @@ -397,49 +399,49 @@ export interface CommitPreparationV1Request { * @type {string} * @memberof CommitPreparationV1Request */ - sessionID: string; + 'sessionID': string; /** * * @type {string} * @memberof CommitPreparationV1Request */ - messageType: string; + 'messageType': string; /** * * @type {string} * @memberof CommitPreparationV1Request */ - clientIdentityPubkey: string; + 'clientIdentityPubkey': string; /** * * @type {string} * @memberof CommitPreparationV1Request */ - serverIdentityPubkey: string; + 'serverIdentityPubkey': string; /** * * @type {string} * @memberof CommitPreparationV1Request */ - hashLockEvidenceAck: string; + 'hashLockEvidenceAck': string; /** * * @type {number} * @memberof CommitPreparationV1Request */ - clientTransferNumber?: number; + 'clientTransferNumber'?: number; /** * * @type {string} * @memberof CommitPreparationV1Request */ - signature: string; + 'signature': string; /** * * @type {number} * @memberof CommitPreparationV1Request */ - sequenceNumber: number; + 'sequenceNumber': number; } /** * @@ -452,49 +454,49 @@ export interface CommitPreparationV1Response { * @type {string} * @memberof CommitPreparationV1Response */ - sessionID: string; + 'sessionID': string; /** * * @type {string} * @memberof CommitPreparationV1Response */ - messageType: string; + 'messageType': string; /** * * @type {string} * @memberof CommitPreparationV1Response */ - clientIdentityPubkey: string; + 'clientIdentityPubkey': string; /** * * @type {string} * @memberof CommitPreparationV1Response */ - serverIdentityPubkey: string; + 'serverIdentityPubkey': string; /** * * @type {string} * @memberof CommitPreparationV1Response */ - hashCommitPrep: string; + 'hashCommitPrep': string; /** * * @type {string} * @memberof CommitPreparationV1Response */ - serverTransferNumber?: string; + 'serverTransferNumber'?: string; /** * * @type {string} * @memberof CommitPreparationV1Response */ - signature: string; + 'signature': string; /** * * @type {number} * @memberof CommitPreparationV1Response */ - sequenceNumber: number; + 'sequenceNumber': number; } /** * @@ -502,11 +504,14 @@ export interface CommitPreparationV1Response { * @enum {string} */ -export enum CredentialProfile { - Saml = 'SAML', - Oauth = 'OAUTH', - X509 = 'X509' -} +export const CredentialProfile = { + Saml: 'SAML', + Oauth: 'OAUTH', + X509: 'X509' +} as const; + +export type CredentialProfile = typeof CredentialProfile[keyof typeof CredentialProfile]; + /** * @@ -519,43 +524,43 @@ export interface History { * @type {Array} * @memberof History */ - Transactions?: Array; + 'Transactions'?: Array; /** * * @type {Array} * @memberof History */ - Actions?: Array; + 'Actions'?: Array; /** * * @type {string} * @memberof History */ - Origin?: string; + 'Origin'?: string; /** * * @type {string} * @memberof History */ - Destination?: string; + 'Destination'?: string; /** * * @type {string} * @memberof History */ - Balance?: string; + 'Balance'?: string; /** * * @type {object} * @memberof History */ - CurrentStatus?: object; + 'CurrentStatus'?: object; /** * * @type {object} * @memberof History */ - ApplicationSpecificParameters?: object; + 'ApplicationSpecificParameters'?: object; } /** * @@ -568,73 +573,73 @@ export interface LockEvidenceV1Request { * @type {string} * @memberof LockEvidenceV1Request */ - sessionID: string; + 'sessionID': string; /** * * @type {string} * @memberof LockEvidenceV1Request */ - clientIdentityPubkey: string; + 'clientIdentityPubkey': string; /** * * @type {string} * @memberof LockEvidenceV1Request */ - serverIdentityPubkey: string; + 'serverIdentityPubkey': string; /** * * @type {string} * @memberof LockEvidenceV1Request */ - lockEvidenceClaim: string; + 'lockEvidenceClaim': string; /** * * @type {object} * @memberof LockEvidenceV1Request */ - lockEvidenceFormat?: object; + 'lockEvidenceFormat'?: object; /** * * @type {string} * @memberof LockEvidenceV1Request */ - lockEvidenceExpiration: string; + 'lockEvidenceExpiration': string; /** * * @type {string} * @memberof LockEvidenceV1Request */ - hashCommenceAckRequest: string; + 'hashCommenceAckRequest': string; /** * * @type {number} * @memberof LockEvidenceV1Request */ - clientTransferNumber?: number | null; + 'clientTransferNumber'?: number | null; /** * * @type {string} * @memberof LockEvidenceV1Request */ - signature: string; + 'signature': string; /** * * @type {string} * @memberof LockEvidenceV1Request */ - messageType: string; + 'messageType': string; /** * * @type {string} * @memberof LockEvidenceV1Request */ - messageHash?: string; + 'messageHash'?: string; /** * * @type {number} * @memberof LockEvidenceV1Request */ - sequenceNumber: number; + 'sequenceNumber': number; } /** * @@ -647,49 +652,49 @@ export interface LockEvidenceV1Response { * @type {string} * @memberof LockEvidenceV1Response */ - sessionID: string; + 'sessionID': string; /** * * @type {string} * @memberof LockEvidenceV1Response */ - clientIdentityPubkey: string; + 'clientIdentityPubkey': string; /** * * @type {string} * @memberof LockEvidenceV1Response */ - serverIdentityPubkey: string; + 'serverIdentityPubkey': string; /** * * @type {string} * @memberof LockEvidenceV1Response */ - hashLockEvidenceRequest: string; + 'hashLockEvidenceRequest': string; /** * * @type {number} * @memberof LockEvidenceV1Response */ - serverTransferNumber?: number | null; + 'serverTransferNumber'?: number | null; /** * * @type {string} * @memberof LockEvidenceV1Response */ - signature: string; + 'signature': string; /** * * @type {string} * @memberof LockEvidenceV1Response */ - messageType: string; + 'messageType': string; /** * * @type {number} * @memberof LockEvidenceV1Response */ - sequenceNumber: number; + 'sequenceNumber': number; } /** * @@ -702,37 +707,37 @@ export interface OdapLocalLog { * @type {string} * @memberof OdapLocalLog */ - key?: string; + 'key'?: string; /** * * @type {string} * @memberof OdapLocalLog */ - sessionID: string; + 'sessionID': string; /** * * @type {string} * @memberof OdapLocalLog */ - data?: string; + 'data'?: string; /** * * @type {string} * @memberof OdapLocalLog */ - type: string; + 'type': string; /** * * @type {string} * @memberof OdapLocalLog */ - operation: string; + 'operation': string; /** * * @type {string} * @memberof OdapLocalLog */ - timestamp?: string; + 'timestamp'?: string; } /** * @@ -745,93 +750,89 @@ export interface OdapMessage { * @type {number} * @memberof OdapMessage */ - SequenceNumber?: number; + 'SequenceNumber'?: number; /** * * @type {string} * @memberof OdapMessage */ - Phase?: OdapMessagePhaseEnum; + 'Phase'?: OdapMessagePhaseEnum; /** * * @type {string} * @memberof OdapMessage */ - ResourceURL?: string; + 'ResourceURL'?: string; /** * * @type {string} * @memberof OdapMessage */ - DeveloperURN?: string; + 'DeveloperURN'?: string; /** * * @type {OdapMessageActionResponse} * @memberof OdapMessage */ - ActionResponse?: OdapMessageActionResponse; + 'ActionResponse'?: OdapMessageActionResponse; /** * * @type {string} * @memberof OdapMessage */ - CredentialProfile?: OdapMessageCredentialProfileEnum; + 'CredentialProfile'?: OdapMessageCredentialProfileEnum; /** * * @type {Array} * @memberof OdapMessage */ - CredentialBlock?: Array; + 'CredentialBlock'?: Array; /** * * @type {PayloadProfile} * @memberof OdapMessage */ - CredentialsProfile?: PayloadProfile; + 'CredentialsProfile'?: PayloadProfile; /** * * @type {object} * @memberof OdapMessage */ - ApplicationProfile?: object; + 'ApplicationProfile'?: object; /** * * @type {object} * @memberof OdapMessage */ - Payload?: object; + 'Payload'?: object; /** * * @type {string} * @memberof OdapMessage */ - PayloadHash?: string; + 'PayloadHash'?: string; /** * * @type {string} * @memberof OdapMessage */ - MessageSignature?: string; + 'MessageSignature'?: string; } -/** - * @export - * @enum {string} - */ -export enum OdapMessagePhaseEnum { - TransferInitialization = 'TransferInitialization', - LockEvidenceVerification = 'LockEvidenceVerification', - CommitmentEstablishment = 'CommitmentEstablishment' -} -/** - * @export - * @enum {string} - */ -export enum OdapMessageCredentialProfileEnum { - Saml = 'SAML', - OAuth = 'OAuth', - X509 = 'X509' -} +export const OdapMessagePhaseEnum = { + TransferInitialization: 'TransferInitialization', + LockEvidenceVerification: 'LockEvidenceVerification', + CommitmentEstablishment: 'CommitmentEstablishment' +} as const; + +export type OdapMessagePhaseEnum = typeof OdapMessagePhaseEnum[keyof typeof OdapMessagePhaseEnum]; +export const OdapMessageCredentialProfileEnum = { + Saml: 'SAML', + OAuth: 'OAuth', + X509: 'X509' +} as const; + +export type OdapMessageCredentialProfileEnum = typeof OdapMessageCredentialProfileEnum[keyof typeof OdapMessageCredentialProfileEnum]; /** * @@ -844,23 +845,21 @@ export interface OdapMessageActionResponse { * @type {string} * @memberof OdapMessageActionResponse */ - ResponseCode?: OdapMessageActionResponseResponseCodeEnum; + 'ResponseCode'?: OdapMessageActionResponseResponseCodeEnum; /** * * @type {Array} * @memberof OdapMessageActionResponse */ - Arguments?: Array; + 'Arguments'?: Array; } -/** - * @export - * @enum {string} - */ -export enum OdapMessageActionResponseResponseCodeEnum { - OK = '200', - RESOURCE_NOT_FOUND = '404' -} +export const OdapMessageActionResponseResponseCodeEnum = { + OK: '200', + RESOURCE_NOT_FOUND: '404' +} as const; + +export type OdapMessageActionResponseResponseCodeEnum = typeof OdapMessageActionResponseResponseCodeEnum[keyof typeof OdapMessageActionResponseResponseCodeEnum]; /** * @@ -873,13 +872,13 @@ export interface PayloadProfile { * @type {AssetProfile} * @memberof PayloadProfile */ - assetProfile: AssetProfile; + 'assetProfile': AssetProfile; /** * * @type {string} * @memberof PayloadProfile */ - capabilities?: string; + 'capabilities'?: string; } /** * @@ -892,19 +891,19 @@ export interface RecoverSuccessV1Message { * @type {string} * @memberof RecoverSuccessV1Message */ - sessionID: string; + 'sessionID': string; /** * * @type {boolean} * @memberof RecoverSuccessV1Message */ - success: boolean; + 'success': boolean; /** * * @type {string} * @memberof RecoverSuccessV1Message */ - signature: string; + 'signature': string; } /** * @@ -917,25 +916,25 @@ export interface RecoverUpdateAckV1Message { * @type {string} * @memberof RecoverUpdateAckV1Message */ - sessionID: string; + 'sessionID': string; /** * * @type {boolean} * @memberof RecoverUpdateAckV1Message */ - success: boolean; + 'success': boolean; /** * * @type {Array} * @memberof RecoverUpdateAckV1Message */ - changedEntriesHash: Array; + 'changedEntriesHash': Array; /** * * @type {string} * @memberof RecoverUpdateAckV1Message */ - signature: string; + 'signature': string; } /** * @@ -948,19 +947,19 @@ export interface RecoverUpdateV1Message { * @type {string} * @memberof RecoverUpdateV1Message */ - sessionID: string; + 'sessionID': string; /** * * @type {Array} * @memberof RecoverUpdateV1Message */ - recoveredLogs: Array; + 'recoveredLogs': Array; /** * * @type {string} * @memberof RecoverUpdateV1Message */ - signature: string; + 'signature': string; } /** * @@ -973,49 +972,49 @@ export interface RecoverV1Message { * @type {string} * @memberof RecoverV1Message */ - sessionID: string; + 'sessionID': string; /** * * @type {string} * @memberof RecoverV1Message */ - odapPhase: string; + 'odapPhase': string; /** * * @type {number} * @memberof RecoverV1Message */ - sequenceNumber: number; + 'sequenceNumber': number; /** * * @type {string} * @memberof RecoverV1Message */ - lastLogEntryTimestamp: string; + 'lastLogEntryTimestamp': string; /** * * @type {boolean} * @memberof RecoverV1Message */ - isBackup: boolean; + 'isBackup': boolean; /** * * @type {string} * @memberof RecoverV1Message */ - newBasePath: string; + 'newBasePath': string; /** * * @type {string} * @memberof RecoverV1Message */ - newGatewayPubKey?: string; + 'newGatewayPubKey'?: string; /** * * @type {string} * @memberof RecoverV1Message */ - signature: string; + 'signature': string; } /** * @@ -1028,19 +1027,19 @@ export interface RollbackAckV1Message { * @type {string} * @memberof RollbackAckV1Message */ - sessionID: string; + 'sessionID': string; /** * * @type {boolean} * @memberof RollbackAckV1Message */ - success: boolean; + 'success': boolean; /** * * @type {string} * @memberof RollbackAckV1Message */ - signature: string; + 'signature': string; } /** * @@ -1053,31 +1052,31 @@ export interface RollbackV1Message { * @type {string} * @memberof RollbackV1Message */ - sessionID: string; + 'sessionID': string; /** * * @type {boolean} * @memberof RollbackV1Message */ - success: boolean; + 'success': boolean; /** * * @type {Array} * @memberof RollbackV1Message */ - actionPerformed: Array; + 'actionPerformed': Array; /** * * @type {Array} * @memberof RollbackV1Message */ - proofs: Array; + 'proofs': Array; /** * * @type {string} * @memberof RollbackV1Message */ - signature: string; + 'signature': string; } /** * @@ -1090,379 +1089,377 @@ export interface SessionData { * @type {string} * @memberof SessionData */ - id?: string; + 'id'?: string; /** * * @type {number} * @memberof SessionData */ - step?: number; + 'step'?: number; /** * * @type {string} * @memberof SessionData */ - version?: string; + 'version'?: string; /** * * @type {number} * @memberof SessionData */ - lastSequenceNumber?: number; + 'lastSequenceNumber'?: number; /** * * @type {string} * @memberof SessionData */ - loggingProfile?: string; + 'loggingProfile'?: string; /** * * @type {string} * @memberof SessionData */ - accessControlProfile?: string; + 'accessControlProfile'?: string; /** * * @type {string} * @memberof SessionData */ - applicationProfile?: string; + 'applicationProfile'?: string; /** * * @type {PayloadProfile} * @memberof SessionData */ - payloadProfile?: PayloadProfile; + 'payloadProfile'?: PayloadProfile; /** * * @type {AssetProfile} * @memberof SessionData */ - assetProfile?: AssetProfile; + 'assetProfile'?: AssetProfile; /** * * @type {Array} * @memberof SessionData */ - allowedSourceBackupGateways?: Array; + 'allowedSourceBackupGateways'?: Array; /** * * @type {Array} * @memberof SessionData */ - allowedRecipientBackupGateways?: Array; + 'allowedRecipientBackupGateways'?: Array; /** * * @type {string} * @memberof SessionData */ - sourceBasePath?: string; + 'sourceBasePath'?: string; /** * * @type {string} * @memberof SessionData */ - recipientBasePath?: string; + 'recipientBasePath'?: string; /** * * @type {string} * @memberof SessionData */ - originatorPubkey?: string; + 'originatorPubkey'?: string; /** * * @type {string} * @memberof SessionData */ - beneficiaryPubkey?: string; + 'beneficiaryPubkey'?: string; /** * * @type {string} * @memberof SessionData */ - sourceGatewayPubkey?: string; + 'sourceGatewayPubkey'?: string; /** * * @type {string} * @memberof SessionData */ - sourceGatewayDltSystem?: string; + 'sourceGatewayDltSystem'?: string; /** * * @type {string} * @memberof SessionData */ - recipientGatewayPubkey?: string; + 'recipientGatewayPubkey'?: string; /** * * @type {string} * @memberof SessionData */ - recipientGatewayDltSystem?: string; + 'recipientGatewayDltSystem'?: string; /** * * @type {string} * @memberof SessionData */ - initializationRequestMessageHash?: string; + 'initializationRequestMessageHash'?: string; /** * * @type {string} * @memberof SessionData */ - initializationResponseMessageHash?: string; + 'initializationResponseMessageHash'?: string; /** * * @type {string} * @memberof SessionData */ - initializationRequestMessageRcvTimeStamp?: string; + 'initializationRequestMessageRcvTimeStamp'?: string; /** * * @type {string} * @memberof SessionData */ - initializationRequestMessageProcessedTimeStamp?: string; + 'initializationRequestMessageProcessedTimeStamp'?: string; /** * * @type {string} * @memberof SessionData */ - clientSignatureInitializationRequestMessage?: string; + 'clientSignatureInitializationRequestMessage'?: string; /** * * @type {string} * @memberof SessionData */ - serverSignatureInitializationResponseMessage?: string; + 'serverSignatureInitializationResponseMessage'?: string; /** * * @type {string} * @memberof SessionData */ - transferCommenceMessageRequestHash?: string; + 'transferCommenceMessageRequestHash'?: string; /** * * @type {string} * @memberof SessionData */ - transferCommenceMessageResponseHash?: string; + 'transferCommenceMessageResponseHash'?: string; /** * * @type {string} * @memberof SessionData */ - clientSignatureTransferCommenceRequestMessage?: string; + 'clientSignatureTransferCommenceRequestMessage'?: string; /** * * @type {string} * @memberof SessionData */ - serverSignatureTransferCommenceResponseMessage?: string; + 'serverSignatureTransferCommenceResponseMessage'?: string; /** * * @type {string} * @memberof SessionData */ - lockEvidenceRequestMessageHash?: string; + 'lockEvidenceRequestMessageHash'?: string; /** * * @type {string} * @memberof SessionData */ - lockEvidenceResponseMessageHash?: string; + 'lockEvidenceResponseMessageHash'?: string; /** * * @type {string} * @memberof SessionData */ - clientSignatureLockEvidenceRequestMessage?: string; + 'clientSignatureLockEvidenceRequestMessage'?: string; /** * * @type {string} * @memberof SessionData */ - serverSignatureLockEvidenceResponseMessage?: string; + 'serverSignatureLockEvidenceResponseMessage'?: string; /** * * @type {string} * @memberof SessionData */ - lockEvidenceClaim?: string; + 'lockEvidenceClaim'?: string; /** * * @type {string} * @memberof SessionData */ - commitPrepareRequestMessageHash?: string; + 'commitPrepareRequestMessageHash'?: string; /** * * @type {string} * @memberof SessionData */ - commitPrepareResponseMessageHash?: string; + 'commitPrepareResponseMessageHash'?: string; /** * * @type {string} * @memberof SessionData */ - clientSignatureCommitPreparationRequestMessage?: string; + 'clientSignatureCommitPreparationRequestMessage'?: string; /** * * @type {string} * @memberof SessionData */ - serverSignatureCommitPreparationResponseMessage?: string; + 'serverSignatureCommitPreparationResponseMessage'?: string; /** * * @type {string} * @memberof SessionData */ - commitFinalRequestMessageHash?: string; + 'commitFinalRequestMessageHash'?: string; /** * * @type {string} * @memberof SessionData */ - commitFinalResponseMessageHash?: string; + 'commitFinalResponseMessageHash'?: string; /** * * @type {string} * @memberof SessionData */ - commitFinalClaim?: string; + 'commitFinalClaim'?: string; /** * * @type {string} * @memberof SessionData */ - commitFinalClaimFormat?: string; + 'commitFinalClaimFormat'?: string; /** * * @type {string} * @memberof SessionData */ - commitAcknowledgementClaim?: string; + 'commitAcknowledgementClaim'?: string; /** * * @type {string} * @memberof SessionData */ - commitAcknowledgementClaimFormat?: string; + 'commitAcknowledgementClaimFormat'?: string; /** * * @type {string} * @memberof SessionData */ - clientSignatureCommitFinalRequestMessage?: string; + 'clientSignatureCommitFinalRequestMessage'?: string; /** * * @type {string} * @memberof SessionData */ - serverSignatureCommitFinalResponseMessage?: string; + 'serverSignatureCommitFinalResponseMessage'?: string; /** * * @type {string} * @memberof SessionData */ - transferCompleteMessageHash?: string; + 'transferCompleteMessageHash'?: string; /** * * @type {string} * @memberof SessionData */ - clientSignatureTransferCompleteMessage?: string; + 'clientSignatureTransferCompleteMessage'?: string; /** * * @type {number} * @memberof SessionData */ - maxRetries?: number; + 'maxRetries'?: number; /** * * @type {string} * @memberof SessionData */ - recipientLedgerAssetID?: string; + 'recipientLedgerAssetID'?: string; /** * * @type {string} * @memberof SessionData */ - sourceLedgerAssetID?: string; + 'sourceLedgerAssetID'?: string; /** * * @type {number} * @memberof SessionData */ - maxTimeout?: number; + 'maxTimeout'?: number; /** * * @type {string} * @memberof SessionData */ - lastLogEntryTimestamp?: string; + 'lastLogEntryTimestamp'?: string; /** * * @type {string} * @memberof SessionData */ - unlockAssetClaim?: string; + 'unlockAssetClaim'?: string; /** * * @type {string} * @memberof SessionData */ - recreateAssetClaim?: string; + 'recreateAssetClaim'?: string; /** * * @type {string} * @memberof SessionData */ - deleteAssetClaim?: string; + 'deleteAssetClaim'?: string; /** * * @type {string} * @memberof SessionData */ - lastMessageReceivedTimestamp?: string; + 'lastMessageReceivedTimestamp'?: string; /** * * @type {boolean} * @memberof SessionData */ - rollback?: boolean; + 'rollback'?: boolean; /** * * @type {string} * @memberof SessionData */ - rollbackMessageHash?: string; + 'rollbackMessageHash'?: string; /** * * @type {Array} * @memberof SessionData */ - rollbackProofs?: Array; + 'rollbackProofs'?: Array; /** * * @type {Array} * @memberof SessionData */ - rollbackActionsPerformed?: Array; + 'rollbackActionsPerformed'?: Array; } -/** - * @export - * @enum {string} - */ -export enum SessionDataRollbackActionsPerformedEnum { - Create = 'CREATE', - Delete = 'DELETE', - Lock = 'LOCK', - Unlock = 'UNLOCK' -} +export const SessionDataRollbackActionsPerformedEnum = { + Create: 'CREATE', + Delete: 'DELETE', + Lock: 'LOCK', + Unlock: 'UNLOCK' +} as const; + +export type SessionDataRollbackActionsPerformedEnum = typeof SessionDataRollbackActionsPerformedEnum[keyof typeof SessionDataRollbackActionsPerformedEnum]; /** * @@ -1475,85 +1472,85 @@ export interface TransferCommenceV1Request { * @type {string} * @memberof TransferCommenceV1Request */ - sessionID: string; + 'sessionID': string; /** * * @type {string} * @memberof TransferCommenceV1Request */ - messageType: string; + 'messageType': string; /** * * @type {string} * @memberof TransferCommenceV1Request */ - originatorPubkey: string; + 'originatorPubkey': string; /** * * @type {string} * @memberof TransferCommenceV1Request */ - beneficiaryPubkey: string; + 'beneficiaryPubkey': string; /** * * @type {string} * @memberof TransferCommenceV1Request */ - senderDltSystem: string; + 'senderDltSystem': string; /** * * @type {string} * @memberof TransferCommenceV1Request */ - recipientDltSystem: string; + 'recipientDltSystem': string; /** * * @type {string} * @memberof TransferCommenceV1Request */ - clientIdentityPubkey: string; + 'clientIdentityPubkey': string; /** * * @type {string} * @memberof TransferCommenceV1Request */ - serverIdentityPubkey: string; + 'serverIdentityPubkey': string; /** * * @type {string} * @memberof TransferCommenceV1Request */ - hashAssetProfile: string; + 'hashAssetProfile': string; /** * * @type {number} * @memberof TransferCommenceV1Request */ - assetUnit?: number; + 'assetUnit'?: number; /** * * @type {string} * @memberof TransferCommenceV1Request */ - hashPrevMessage: string; + 'hashPrevMessage': string; /** * * @type {number} * @memberof TransferCommenceV1Request */ - clientTransferNumber?: number | null; + 'clientTransferNumber'?: number | null; /** * * @type {string} * @memberof TransferCommenceV1Request */ - signature: string; + 'signature': string; /** * * @type {number} * @memberof TransferCommenceV1Request */ - sequenceNumber: number; + 'sequenceNumber': number; } /** * @@ -1566,55 +1563,55 @@ export interface TransferCommenceV1Response { * @type {string} * @memberof TransferCommenceV1Response */ - sessionID: string; + 'sessionID': string; /** * * @type {string} * @memberof TransferCommenceV1Response */ - clientIdentityPubkey: string; + 'clientIdentityPubkey': string; /** * * @type {string} * @memberof TransferCommenceV1Response */ - serverIdentityPubkey: string; + 'serverIdentityPubkey': string; /** * * @type {string} * @memberof TransferCommenceV1Response */ - hashCommenceRequest: string; + 'hashCommenceRequest': string; /** * * @type {number} * @memberof TransferCommenceV1Response */ - serverTransferNumber?: number | null; + 'serverTransferNumber'?: number | null; /** * * @type {string} * @memberof TransferCommenceV1Response */ - signature: string; + 'signature': string; /** * * @type {string} * @memberof TransferCommenceV1Response */ - messageType: string; + 'messageType': string; /** * * @type {string} * @memberof TransferCommenceV1Response */ - messageHash?: string; + 'messageHash'?: string; /** * * @type {number} * @memberof TransferCommenceV1Response */ - sequenceNumber: number; + 'sequenceNumber': number; } /** * @@ -1627,55 +1624,55 @@ export interface TransferCompleteV1Request { * @type {string} * @memberof TransferCompleteV1Request */ - sessionID: string; + 'sessionID': string; /** * * @type {string} * @memberof TransferCompleteV1Request */ - messageType: string; + 'messageType': string; /** * * @type {string} * @memberof TransferCompleteV1Request */ - clientIdentityPubkey: string; + 'clientIdentityPubkey': string; /** * * @type {string} * @memberof TransferCompleteV1Request */ - serverIdentityPubkey: string; + 'serverIdentityPubkey': string; /** * * @type {string} * @memberof TransferCompleteV1Request */ - hashCommitFinalAck: string; + 'hashCommitFinalAck': string; /** * * @type {number} * @memberof TransferCompleteV1Request */ - clientTransferNumber?: number | null; + 'clientTransferNumber'?: number | null; /** * * @type {string} * @memberof TransferCompleteV1Request */ - signature: string; + 'signature': string; /** * * @type {string} * @memberof TransferCompleteV1Request */ - hashTransferCommence: string; + 'hashTransferCommence': string; /** * * @type {number} * @memberof TransferCompleteV1Request */ - sequenceNumber: number; + 'sequenceNumber': number; } /** * @@ -1688,202 +1685,200 @@ export interface TransferInitializationV1Request { * @type {string} * @memberof TransferInitializationV1Request */ - messageType: string; + 'messageType': string; /** * * @type {string} * @memberof TransferInitializationV1Request */ - sessionID: string; + 'sessionID': string; /** * * @type {string} * @memberof TransferInitializationV1Request */ - version?: string; + 'version'?: string; /** * * @type {string} * @memberof TransferInitializationV1Request */ - developerURN?: string; + 'developerURN'?: string; /** * * @type {CredentialProfile} * @memberof TransferInitializationV1Request */ - credentialProfile?: CredentialProfile; + 'credentialProfile'?: CredentialProfile; /** * * @type {PayloadProfile} * @memberof TransferInitializationV1Request */ - payloadProfile: PayloadProfile; + 'payloadProfile': PayloadProfile; /** * * @type {string} * @memberof TransferInitializationV1Request */ - applicationProfile: string; + 'applicationProfile': string; /** * * @type {string} * @memberof TransferInitializationV1Request */ - loggingProfile: string; + 'loggingProfile': string; /** * * @type {string} * @memberof TransferInitializationV1Request */ - accessControlProfile: string; + 'accessControlProfile': string; /** * * @type {string} * @memberof TransferInitializationV1Request */ - signature: string; + 'signature': string; /** * * @type {string} * @memberof TransferInitializationV1Request */ - sourceGatewayPubkey: string; + 'sourceGatewayPubkey': string; /** * * @type {string} * @memberof TransferInitializationV1Request */ - sourceGatewayDltSystem: string; + 'sourceGatewayDltSystem': string; /** * * @type {string} * @memberof TransferInitializationV1Request */ - recipientGatewayPubkey: string; + 'recipientGatewayPubkey': string; /** * * @type {string} * @memberof TransferInitializationV1Request */ - recipientGatewayDltSystem: string; + 'recipientGatewayDltSystem': string; /** * * @type {string} * @memberof TransferInitializationV1Request */ - escrowType?: TransferInitializationV1RequestEscrowTypeEnum; + 'escrowType'?: TransferInitializationV1RequestEscrowTypeEnum; /** * * @type {string} * @memberof TransferInitializationV1Request */ - expiryTime?: string; + 'expiryTime'?: string; /** * * @type {boolean} * @memberof TransferInitializationV1Request */ - multipleClaimsAllowed?: boolean; + 'multipleClaimsAllowed'?: boolean; /** * * @type {boolean} * @memberof TransferInitializationV1Request */ - multipleCancelsAllowed?: boolean; + 'multipleCancelsAllowed'?: boolean; /** * * @type {object} * @memberof TransferInitializationV1Request */ - permissions?: object; + 'permissions'?: object; /** * * @type {string} * @memberof TransferInitializationV1Request */ - origin?: string; + 'origin'?: string; /** * * @type {string} * @memberof TransferInitializationV1Request */ - destination?: string; + 'destination'?: string; /** * * @type {object} * @memberof TransferInitializationV1Request */ - subsequentCalls?: object; + 'subsequentCalls'?: object; /** * * @type {Array} * @memberof TransferInitializationV1Request */ - histories?: Array; + 'histories'?: Array; /** * * @type {number} * @memberof TransferInitializationV1Request */ - sequenceNumber: number; + 'sequenceNumber': number; /** * * @type {string} * @memberof TransferInitializationV1Request */ - sourceBasePath: string; + 'sourceBasePath': string; /** * * @type {string} * @memberof TransferInitializationV1Request */ - recipientBasePath: string; + 'recipientBasePath': string; /** * * @type {number} * @memberof TransferInitializationV1Request */ - maxRetries: number; + 'maxRetries': number; /** * * @type {number} * @memberof TransferInitializationV1Request */ - maxTimeout: number; + 'maxTimeout': number; /** * * @type {Array} * @memberof TransferInitializationV1Request */ - backupGatewaysAllowed: Array; + 'backupGatewaysAllowed': Array; /** * * @type {string} * @memberof TransferInitializationV1Request */ - recipientLedgerAssetID: string; + 'recipientLedgerAssetID': string; /** * * @type {string} * @memberof TransferInitializationV1Request */ - sourceLedgerAssetID: string; + 'sourceLedgerAssetID': string; } -/** - * @export - * @enum {string} - */ -export enum TransferInitializationV1RequestEscrowTypeEnum { - Faucet = 'FAUCET', - Timelock = 'TIMELOCK', - Hashlock = 'HASHLOCK', - Hashtimelock = 'HASHTIMELOCK', - Multiclaimpc = 'MULTICLAIMPC', - Destroy = 'DESTROY', - Burn = 'BURN' -} +export const TransferInitializationV1RequestEscrowTypeEnum = { + Faucet: 'FAUCET', + Timelock: 'TIMELOCK', + Hashlock: 'HASHLOCK', + Hashtimelock: 'HASHTIMELOCK', + Multiclaimpc: 'MULTICLAIMPC', + Destroy: 'DESTROY', + Burn: 'BURN' +} as const; + +export type TransferInitializationV1RequestEscrowTypeEnum = typeof TransferInitializationV1RequestEscrowTypeEnum[keyof typeof TransferInitializationV1RequestEscrowTypeEnum]; /** * @@ -1896,78 +1891,76 @@ export interface TransferInitializationV1Response { * @type {string} * @memberof TransferInitializationV1Response */ - messageType: string; + 'messageType': string; /** * * @type {string} * @memberof TransferInitializationV1Response */ - sessionID: string; + 'sessionID': string; /** * * @type {number} * @memberof TransferInitializationV1Response */ - sequenceNumber: number; + 'sequenceNumber': number; /** * * @type {string} * @memberof TransferInitializationV1Response */ - odapPhase?: TransferInitializationV1ResponseOdapPhaseEnum; + 'odapPhase'?: TransferInitializationV1ResponseOdapPhaseEnum; /** * * @type {string} * @memberof TransferInitializationV1Response */ - initialRequestMessageHash: string; + 'initialRequestMessageHash': string; /** * * @type {string} * @memberof TransferInitializationV1Response */ - destination?: string; + 'destination'?: string; /** * * @type {string} * @memberof TransferInitializationV1Response */ - timeStamp: string; + 'timeStamp': string; /** * * @type {string} * @memberof TransferInitializationV1Response */ - processedTimeStamp: string; + 'processedTimeStamp': string; /** * * @type {string} * @memberof TransferInitializationV1Response */ - serverIdentityPubkey: string; + 'serverIdentityPubkey': string; /** * * @type {string} * @memberof TransferInitializationV1Response */ - signature: string; + 'signature': string; /** * * @type {Array} * @memberof TransferInitializationV1Response */ - backupGatewaysAllowed: Array; + 'backupGatewaysAllowed': Array; } -/** - * @export - * @enum {string} - */ -export enum TransferInitializationV1ResponseOdapPhaseEnum { - TransferInitialization = 'TransferInitialization', - LockEvidenceVerification = 'LockEvidenceVerification', - CommitmentEstablishment = 'CommitmentEstablishment' -} +export const TransferInitializationV1ResponseOdapPhaseEnum = { + TransferInitialization: 'TransferInitialization', + LockEvidenceVerification: 'LockEvidenceVerification', + CommitmentEstablishment: 'CommitmentEstablishment' +} as const; + +export type TransferInitializationV1ResponseOdapPhaseEnum = typeof TransferInitializationV1ResponseOdapPhaseEnum[keyof typeof TransferInitializationV1ResponseOdapPhaseEnum]; /** @@ -1982,7 +1975,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - clientRequestV1: async (clientV1Request?: ClientV1Request, options: any = {}): Promise => { + clientRequestV1: async (clientV1Request?: ClientV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/clientrequest`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -1999,7 +1992,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(clientV1Request, localVarRequestOptions, configuration) @@ -2015,7 +2008,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - phase1TransferInitiationRequestV1: async (transferInitializationV1Request?: TransferInitializationV1Request, options: any = {}): Promise => { + phase1TransferInitiationRequestV1: async (transferInitializationV1Request?: TransferInitializationV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase1/transferinitiationrequest`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2032,7 +2025,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(transferInitializationV1Request, localVarRequestOptions, configuration) @@ -2048,7 +2041,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - phase1TransferInitiationResponseV1: async (transferInitializationV1Response?: TransferInitializationV1Response, options: any = {}): Promise => { + phase1TransferInitiationResponseV1: async (transferInitializationV1Response?: TransferInitializationV1Response, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase1/transferinitiationresponse`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2065,7 +2058,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(transferInitializationV1Response, localVarRequestOptions, configuration) @@ -2081,7 +2074,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - phase2LockEvidenceRequestV1: async (lockEvidenceV1Request?: LockEvidenceV1Request, options: any = {}): Promise => { + phase2LockEvidenceRequestV1: async (lockEvidenceV1Request?: LockEvidenceV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase2/lockevidencerequest`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2098,7 +2091,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(lockEvidenceV1Request, localVarRequestOptions, configuration) @@ -2114,7 +2107,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - phase2LockEvidenceResponseV1: async (lockEvidenceV1Response?: LockEvidenceV1Response, options: any = {}): Promise => { + phase2LockEvidenceResponseV1: async (lockEvidenceV1Response?: LockEvidenceV1Response, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase2/lockevidenceresponse`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2131,7 +2124,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(lockEvidenceV1Response, localVarRequestOptions, configuration) @@ -2147,7 +2140,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - phase2TransferCommenceRequestV1: async (transferCommenceV1Request?: TransferCommenceV1Request, options: any = {}): Promise => { + phase2TransferCommenceRequestV1: async (transferCommenceV1Request?: TransferCommenceV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase2/transfercommencerequest`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2164,7 +2157,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(transferCommenceV1Request, localVarRequestOptions, configuration) @@ -2180,7 +2173,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - phase2TransferCommenceResponseV1: async (transferCommenceV1Response?: TransferCommenceV1Response, options: any = {}): Promise => { + phase2TransferCommenceResponseV1: async (transferCommenceV1Response?: TransferCommenceV1Response, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase2/transfercommenceresponse`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2197,7 +2190,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(transferCommenceV1Response, localVarRequestOptions, configuration) @@ -2213,7 +2206,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - phase3CommitFinalRequestV1: async (commitFinalV1Request?: CommitFinalV1Request, options: any = {}): Promise => { + phase3CommitFinalRequestV1: async (commitFinalV1Request?: CommitFinalV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase3/commitfinalrequest`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2230,7 +2223,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(commitFinalV1Request, localVarRequestOptions, configuration) @@ -2246,7 +2239,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - phase3CommitFinalResponseV1: async (commitFinalV1Response?: CommitFinalV1Response, options: any = {}): Promise => { + phase3CommitFinalResponseV1: async (commitFinalV1Response?: CommitFinalV1Response, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase3/commitfinalresponse`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2263,7 +2256,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(commitFinalV1Response, localVarRequestOptions, configuration) @@ -2279,7 +2272,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - phase3CommitPreparationRequestV1: async (commitPreparationV1Request?: CommitPreparationV1Request, options: any = {}): Promise => { + phase3CommitPreparationRequestV1: async (commitPreparationV1Request?: CommitPreparationV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase3/commitpreparationrequest`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2296,7 +2289,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(commitPreparationV1Request, localVarRequestOptions, configuration) @@ -2312,7 +2305,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - phase3CommitPreparationResponseV1: async (commitPreparationV1Response?: CommitPreparationV1Response, options: any = {}): Promise => { + phase3CommitPreparationResponseV1: async (commitPreparationV1Response?: CommitPreparationV1Response, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase3/commitpreparationresponse`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2329,7 +2322,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(commitPreparationV1Response, localVarRequestOptions, configuration) @@ -2345,7 +2338,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - phase3TransferCompleteRequestV1: async (transferCompleteV1Request?: TransferCompleteV1Request, options: any = {}): Promise => { + phase3TransferCompleteRequestV1: async (transferCompleteV1Request?: TransferCompleteV1Request, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/phase3/transfercompleterequest`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2362,7 +2355,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(transferCompleteV1Request, localVarRequestOptions, configuration) @@ -2378,7 +2371,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - recoverUpdateAckV1Message: async (recoverUpdateAckV1Message?: RecoverUpdateAckV1Message, options: any = {}): Promise => { + recoverUpdateAckV1Message: async (recoverUpdateAckV1Message?: RecoverUpdateAckV1Message, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/recoverupdateackmessage`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2395,7 +2388,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(recoverUpdateAckV1Message, localVarRequestOptions, configuration) @@ -2411,7 +2404,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - recoverUpdateV1Message: async (recoverUpdateV1Message?: RecoverUpdateV1Message, options: any = {}): Promise => { + recoverUpdateV1Message: async (recoverUpdateV1Message?: RecoverUpdateV1Message, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/recoverupdatemessage`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2428,7 +2421,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(recoverUpdateV1Message, localVarRequestOptions, configuration) @@ -2444,7 +2437,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - recoverV1Message: async (recoverV1Message?: RecoverV1Message, options: any = {}): Promise => { + recoverV1Message: async (recoverV1Message?: RecoverV1Message, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/recovermessage`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2461,7 +2454,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(recoverV1Message, localVarRequestOptions, configuration) @@ -2477,7 +2470,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - recoverV1Success: async (recoverSuccessV1Message?: RecoverSuccessV1Message, options: any = {}): Promise => { + recoverV1Success: async (recoverSuccessV1Message?: RecoverSuccessV1Message, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/recoversuccessmessage`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2494,7 +2487,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(recoverSuccessV1Message, localVarRequestOptions, configuration) @@ -2510,7 +2503,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - rollbackAckV1Message: async (rollbackAckV1Message?: RollbackAckV1Message, options: any = {}): Promise => { + rollbackAckV1Message: async (rollbackAckV1Message?: RollbackAckV1Message, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/rollbackackmessage`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2527,7 +2520,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(rollbackAckV1Message, localVarRequestOptions, configuration) @@ -2543,7 +2536,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {*} [options] Override http request option. * @throws {RequiredError} */ - rollbackV1Message: async (rollbackV1Message?: RollbackV1Message, options: any = {}): Promise => { + rollbackV1Message: async (rollbackV1Message?: RollbackV1Message, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/api/v1/@hyperledger/cactus-plugin-odap-hermes/rollbackmessage`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2560,7 +2553,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = serializeDataIfNeeded(rollbackV1Message, localVarRequestOptions, configuration) @@ -2586,7 +2579,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async clientRequestV1(clientV1Request?: ClientV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async clientRequestV1(clientV1Request?: ClientV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.clientRequestV1(clientV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2596,7 +2589,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async phase1TransferInitiationRequestV1(transferInitializationV1Request?: TransferInitializationV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async phase1TransferInitiationRequestV1(transferInitializationV1Request?: TransferInitializationV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.phase1TransferInitiationRequestV1(transferInitializationV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2606,7 +2599,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async phase1TransferInitiationResponseV1(transferInitializationV1Response?: TransferInitializationV1Response, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async phase1TransferInitiationResponseV1(transferInitializationV1Response?: TransferInitializationV1Response, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.phase1TransferInitiationResponseV1(transferInitializationV1Response, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2616,7 +2609,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async phase2LockEvidenceRequestV1(lockEvidenceV1Request?: LockEvidenceV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async phase2LockEvidenceRequestV1(lockEvidenceV1Request?: LockEvidenceV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.phase2LockEvidenceRequestV1(lockEvidenceV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2626,7 +2619,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async phase2LockEvidenceResponseV1(lockEvidenceV1Response?: LockEvidenceV1Response, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async phase2LockEvidenceResponseV1(lockEvidenceV1Response?: LockEvidenceV1Response, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.phase2LockEvidenceResponseV1(lockEvidenceV1Response, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2636,7 +2629,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async phase2TransferCommenceRequestV1(transferCommenceV1Request?: TransferCommenceV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async phase2TransferCommenceRequestV1(transferCommenceV1Request?: TransferCommenceV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.phase2TransferCommenceRequestV1(transferCommenceV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2646,7 +2639,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async phase2TransferCommenceResponseV1(transferCommenceV1Response?: TransferCommenceV1Response, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async phase2TransferCommenceResponseV1(transferCommenceV1Response?: TransferCommenceV1Response, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.phase2TransferCommenceResponseV1(transferCommenceV1Response, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2656,7 +2649,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async phase3CommitFinalRequestV1(commitFinalV1Request?: CommitFinalV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async phase3CommitFinalRequestV1(commitFinalV1Request?: CommitFinalV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.phase3CommitFinalRequestV1(commitFinalV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2666,7 +2659,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async phase3CommitFinalResponseV1(commitFinalV1Response?: CommitFinalV1Response, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async phase3CommitFinalResponseV1(commitFinalV1Response?: CommitFinalV1Response, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.phase3CommitFinalResponseV1(commitFinalV1Response, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2676,7 +2669,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async phase3CommitPreparationRequestV1(commitPreparationV1Request?: CommitPreparationV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async phase3CommitPreparationRequestV1(commitPreparationV1Request?: CommitPreparationV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.phase3CommitPreparationRequestV1(commitPreparationV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2686,7 +2679,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async phase3CommitPreparationResponseV1(commitPreparationV1Response?: CommitPreparationV1Response, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async phase3CommitPreparationResponseV1(commitPreparationV1Response?: CommitPreparationV1Response, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.phase3CommitPreparationResponseV1(commitPreparationV1Response, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2696,7 +2689,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async phase3TransferCompleteRequestV1(transferCompleteV1Request?: TransferCompleteV1Request, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async phase3TransferCompleteRequestV1(transferCompleteV1Request?: TransferCompleteV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.phase3TransferCompleteRequestV1(transferCompleteV1Request, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2706,7 +2699,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async recoverUpdateAckV1Message(recoverUpdateAckV1Message?: RecoverUpdateAckV1Message, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async recoverUpdateAckV1Message(recoverUpdateAckV1Message?: RecoverUpdateAckV1Message, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.recoverUpdateAckV1Message(recoverUpdateAckV1Message, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2716,7 +2709,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async recoverUpdateV1Message(recoverUpdateV1Message?: RecoverUpdateV1Message, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async recoverUpdateV1Message(recoverUpdateV1Message?: RecoverUpdateV1Message, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.recoverUpdateV1Message(recoverUpdateV1Message, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2726,7 +2719,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async recoverV1Message(recoverV1Message?: RecoverV1Message, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async recoverV1Message(recoverV1Message?: RecoverV1Message, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.recoverV1Message(recoverV1Message, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2736,7 +2729,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async recoverV1Success(recoverSuccessV1Message?: RecoverSuccessV1Message, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async recoverV1Success(recoverSuccessV1Message?: RecoverSuccessV1Message, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.recoverV1Success(recoverSuccessV1Message, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2746,7 +2739,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async rollbackAckV1Message(rollbackAckV1Message?: RollbackAckV1Message, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async rollbackAckV1Message(rollbackAckV1Message?: RollbackAckV1Message, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.rollbackAckV1Message(rollbackAckV1Message, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2756,7 +2749,7 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async rollbackV1Message(rollbackV1Message?: RollbackV1Message, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async rollbackV1Message(rollbackV1Message?: RollbackV1Message, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.rollbackV1Message(rollbackV1Message, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -2949,7 +2942,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public clientRequestV1(clientV1Request?: ClientV1Request, options?: any) { + public clientRequestV1(clientV1Request?: ClientV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).clientRequestV1(clientV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -2960,7 +2953,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public phase1TransferInitiationRequestV1(transferInitializationV1Request?: TransferInitializationV1Request, options?: any) { + public phase1TransferInitiationRequestV1(transferInitializationV1Request?: TransferInitializationV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).phase1TransferInitiationRequestV1(transferInitializationV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -2971,7 +2964,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public phase1TransferInitiationResponseV1(transferInitializationV1Response?: TransferInitializationV1Response, options?: any) { + public phase1TransferInitiationResponseV1(transferInitializationV1Response?: TransferInitializationV1Response, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).phase1TransferInitiationResponseV1(transferInitializationV1Response, options).then((request) => request(this.axios, this.basePath)); } @@ -2982,7 +2975,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public phase2LockEvidenceRequestV1(lockEvidenceV1Request?: LockEvidenceV1Request, options?: any) { + public phase2LockEvidenceRequestV1(lockEvidenceV1Request?: LockEvidenceV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).phase2LockEvidenceRequestV1(lockEvidenceV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -2993,7 +2986,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public phase2LockEvidenceResponseV1(lockEvidenceV1Response?: LockEvidenceV1Response, options?: any) { + public phase2LockEvidenceResponseV1(lockEvidenceV1Response?: LockEvidenceV1Response, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).phase2LockEvidenceResponseV1(lockEvidenceV1Response, options).then((request) => request(this.axios, this.basePath)); } @@ -3004,7 +2997,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public phase2TransferCommenceRequestV1(transferCommenceV1Request?: TransferCommenceV1Request, options?: any) { + public phase2TransferCommenceRequestV1(transferCommenceV1Request?: TransferCommenceV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).phase2TransferCommenceRequestV1(transferCommenceV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -3015,7 +3008,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public phase2TransferCommenceResponseV1(transferCommenceV1Response?: TransferCommenceV1Response, options?: any) { + public phase2TransferCommenceResponseV1(transferCommenceV1Response?: TransferCommenceV1Response, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).phase2TransferCommenceResponseV1(transferCommenceV1Response, options).then((request) => request(this.axios, this.basePath)); } @@ -3026,7 +3019,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public phase3CommitFinalRequestV1(commitFinalV1Request?: CommitFinalV1Request, options?: any) { + public phase3CommitFinalRequestV1(commitFinalV1Request?: CommitFinalV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).phase3CommitFinalRequestV1(commitFinalV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -3037,7 +3030,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public phase3CommitFinalResponseV1(commitFinalV1Response?: CommitFinalV1Response, options?: any) { + public phase3CommitFinalResponseV1(commitFinalV1Response?: CommitFinalV1Response, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).phase3CommitFinalResponseV1(commitFinalV1Response, options).then((request) => request(this.axios, this.basePath)); } @@ -3048,7 +3041,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public phase3CommitPreparationRequestV1(commitPreparationV1Request?: CommitPreparationV1Request, options?: any) { + public phase3CommitPreparationRequestV1(commitPreparationV1Request?: CommitPreparationV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).phase3CommitPreparationRequestV1(commitPreparationV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -3059,7 +3052,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public phase3CommitPreparationResponseV1(commitPreparationV1Response?: CommitPreparationV1Response, options?: any) { + public phase3CommitPreparationResponseV1(commitPreparationV1Response?: CommitPreparationV1Response, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).phase3CommitPreparationResponseV1(commitPreparationV1Response, options).then((request) => request(this.axios, this.basePath)); } @@ -3070,7 +3063,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public phase3TransferCompleteRequestV1(transferCompleteV1Request?: TransferCompleteV1Request, options?: any) { + public phase3TransferCompleteRequestV1(transferCompleteV1Request?: TransferCompleteV1Request, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).phase3TransferCompleteRequestV1(transferCompleteV1Request, options).then((request) => request(this.axios, this.basePath)); } @@ -3081,7 +3074,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public recoverUpdateAckV1Message(recoverUpdateAckV1Message?: RecoverUpdateAckV1Message, options?: any) { + public recoverUpdateAckV1Message(recoverUpdateAckV1Message?: RecoverUpdateAckV1Message, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).recoverUpdateAckV1Message(recoverUpdateAckV1Message, options).then((request) => request(this.axios, this.basePath)); } @@ -3092,7 +3085,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public recoverUpdateV1Message(recoverUpdateV1Message?: RecoverUpdateV1Message, options?: any) { + public recoverUpdateV1Message(recoverUpdateV1Message?: RecoverUpdateV1Message, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).recoverUpdateV1Message(recoverUpdateV1Message, options).then((request) => request(this.axios, this.basePath)); } @@ -3103,7 +3096,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public recoverV1Message(recoverV1Message?: RecoverV1Message, options?: any) { + public recoverV1Message(recoverV1Message?: RecoverV1Message, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).recoverV1Message(recoverV1Message, options).then((request) => request(this.axios, this.basePath)); } @@ -3114,7 +3107,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public recoverV1Success(recoverSuccessV1Message?: RecoverSuccessV1Message, options?: any) { + public recoverV1Success(recoverSuccessV1Message?: RecoverSuccessV1Message, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).recoverV1Success(recoverSuccessV1Message, options).then((request) => request(this.axios, this.basePath)); } @@ -3125,7 +3118,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public rollbackAckV1Message(rollbackAckV1Message?: RollbackAckV1Message, options?: any) { + public rollbackAckV1Message(rollbackAckV1Message?: RollbackAckV1Message, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).rollbackAckV1Message(rollbackAckV1Message, options).then((request) => request(this.axios, this.basePath)); } @@ -3136,7 +3129,7 @@ export class DefaultApi extends BaseAPI { * @throws {RequiredError} * @memberof DefaultApi */ - public rollbackV1Message(rollbackV1Message?: RollbackV1Message, options?: any) { + public rollbackV1Message(rollbackV1Message?: RollbackV1Message, options?: AxiosRequestConfig) { return DefaultApiFp(this.configuration).rollbackV1Message(rollbackV1Message, options).then((request) => request(this.axios, this.basePath)); } } diff --git a/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/base.ts index 3959c9161f..b941fd05a6 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/base.ts +++ b/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -13,10 +13,11 @@ */ -import { Configuration } from "./configuration"; +import type { Configuration } from './configuration'; // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export const COLLECTION_FORMATS = { */ export interface RequestArgs { url: string; - options: any; + options: AxiosRequestConfig; } /** @@ -64,8 +65,8 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + this.name = "RequiredError" } } diff --git a/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/common.ts index 12cb47901c..29acfe3d10 100644 --- a/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/common.ts +++ b/packages/cactus-plugin-odap-hermes/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -13,9 +13,10 @@ */ -import { Configuration } from "./configuration"; -import { RequiredError, RequestArgs } from "./base"; -import { AxiosInstance } from 'axios'; +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; /** * @@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + /** * * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { const searchParams = new URLSearchParams(url.search); - for (const object of objects) { - for (const key in object) { - if (Array.isArray(object[key])) { - searchParams.delete(key); - for (const item of object[key]) { - searchParams.append(key, item); - } - } else { - searchParams.set(key, object[key]); - } - } - } + setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); } @@ -131,8 +143,8 @@ export const toPathString = function (url: URL) { * @export */ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); + return axios.request(axiosRequestArgs); }; }