All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.svix.kotlin.internal.apis.IntegrationApi.kt Maven / Gradle / Ivy

/**
* Svix API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.1.1
* 
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.svix.kotlin.internal.apis

import com.svix.kotlin.models.HTTPValidationError
import com.svix.kotlin.models.HttpErrorOut
import com.svix.kotlin.models.IntegrationIn
import com.svix.kotlin.models.IntegrationKeyOut
import com.svix.kotlin.models.IntegrationOut
import com.svix.kotlin.models.IntegrationUpdate
import com.svix.kotlin.models.ListResponseIntegrationOut
import com.svix.kotlin.models.Ordering

import com.svix.kotlin.internal.infrastructure.ApiClient
import com.svix.kotlin.internal.infrastructure.ClientException
import com.svix.kotlin.internal.infrastructure.ClientError
import com.svix.kotlin.internal.infrastructure.ServerException
import com.svix.kotlin.internal.infrastructure.ServerError
import com.svix.kotlin.internal.infrastructure.MultiValueMap
import com.svix.kotlin.internal.infrastructure.RequestConfig
import com.svix.kotlin.internal.infrastructure.RequestMethod
import com.svix.kotlin.internal.infrastructure.ResponseType
import com.svix.kotlin.internal.infrastructure.Success
import com.svix.kotlin.internal.infrastructure.toMultiValue

class IntegrationApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
    companion object {
        @JvmStatic
        val defaultBasePath: String by lazy {
            System.getProperties().getProperty("com.svix.kotlin.internal.baseUrl", "https://api.eu.svix.com")
        }
    }

    /**
    * Create Integration
    * Create an integration.
    * @param appId The app's ID or UID 
    * @param integrationIn  
    * @param idempotencyKey The request's idempotency key (optional)
    * @return IntegrationOut
    * @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)
    suspend fun v1IntegrationCreate(appId: kotlin.String, integrationIn: IntegrationIn, idempotencyKey: kotlin.String?) : IntegrationOut {
        val localVariableConfig = v1IntegrationCreateRequestConfig(appId = appId, integrationIn = integrationIn, idempotencyKey = idempotencyKey)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as IntegrationOut
            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
            ResponseType.ClientError -> {
                val localVarError = localVarResponse as ClientError<*>
                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
            }
            ResponseType.ServerError -> {
                val localVarError = localVarResponse as ServerError<*>
                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
    * To obtain the request config of the operation v1IntegrationCreate
    *
    * @param appId The app's ID or UID 
    * @param integrationIn  
    * @param idempotencyKey The request's idempotency key (optional)
    * @return RequestConfig
    */
    fun v1IntegrationCreateRequestConfig(appId: kotlin.String, integrationIn: IntegrationIn, idempotencyKey: kotlin.String?) : RequestConfig {
        val localVariableBody = integrationIn
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        idempotencyKey?.apply { localVariableHeaders["idempotency-key"] = this.toString() }

        return RequestConfig(
            method = RequestMethod.POST,
            path = "/api/v1/app/{app_id}/integration".replace("{"+"app_id"+"}", "$appId"),
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * Delete Integration
    * Delete an integration.
    * @param appId The app's ID or UID 
    * @param integId The integ's ID 
    * @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)
    suspend fun v1IntegrationDelete(appId: kotlin.String, integId: kotlin.String) : Unit {
        val localVariableConfig = v1IntegrationDeleteRequestConfig(appId = appId, integId = integId)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> Unit
            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
            ResponseType.ClientError -> {
                val localVarError = localVarResponse as ClientError<*>
                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
            }
            ResponseType.ServerError -> {
                val localVarError = localVarResponse as ServerError<*>
                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
    * To obtain the request config of the operation v1IntegrationDelete
    *
    * @param appId The app's ID or UID 
    * @param integId The integ's ID 
    * @return RequestConfig
    */
    fun v1IntegrationDeleteRequestConfig(appId: kotlin.String, integId: kotlin.String) : RequestConfig {
        val localVariableBody = null
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()

        return RequestConfig(
            method = RequestMethod.DELETE,
            path = "/api/v1/app/{app_id}/integration/{integ_id}".replace("{"+"app_id"+"}", "$appId").replace("{"+"integ_id"+"}", "$integId"),
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * Get Integration
    * Get an integration.
    * @param appId The app's ID or UID 
    * @param integId The integ's ID 
    * @return IntegrationOut
    * @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)
    suspend fun v1IntegrationGet(appId: kotlin.String, integId: kotlin.String) : IntegrationOut {
        val localVariableConfig = v1IntegrationGetRequestConfig(appId = appId, integId = integId)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as IntegrationOut
            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
            ResponseType.ClientError -> {
                val localVarError = localVarResponse as ClientError<*>
                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
            }
            ResponseType.ServerError -> {
                val localVarError = localVarResponse as ServerError<*>
                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
    * To obtain the request config of the operation v1IntegrationGet
    *
    * @param appId The app's ID or UID 
    * @param integId The integ's ID 
    * @return RequestConfig
    */
    fun v1IntegrationGetRequestConfig(appId: kotlin.String, integId: kotlin.String) : RequestConfig {
        val localVariableBody = null
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()

        return RequestConfig(
            method = RequestMethod.GET,
            path = "/api/v1/app/{app_id}/integration/{integ_id}".replace("{"+"app_id"+"}", "$appId").replace("{"+"integ_id"+"}", "$integId"),
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * Get Integration Key
    * Get an integration's key.
    * @param appId The app's ID or UID 
    * @param integId The integ's ID 
    * @return IntegrationKeyOut
    * @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)
    @Deprecated(message = "This operation is deprecated.")
    suspend fun v1IntegrationGetKey(appId: kotlin.String, integId: kotlin.String) : IntegrationKeyOut {
        @Suppress("DEPRECATION")
        val localVariableConfig = v1IntegrationGetKeyRequestConfig(appId = appId, integId = integId)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as IntegrationKeyOut
            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
            ResponseType.ClientError -> {
                val localVarError = localVarResponse as ClientError<*>
                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
            }
            ResponseType.ServerError -> {
                val localVarError = localVarResponse as ServerError<*>
                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
    * To obtain the request config of the operation v1IntegrationGetKey
    *
    * @param appId The app's ID or UID 
    * @param integId The integ's ID 
    * @return RequestConfig
    */
    @Deprecated(message = "This operation is deprecated.")
    fun v1IntegrationGetKeyRequestConfig(appId: kotlin.String, integId: kotlin.String) : RequestConfig {
        val localVariableBody = null
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()

        return RequestConfig(
            method = RequestMethod.GET,
            path = "/api/v1/app/{app_id}/integration/{integ_id}/key".replace("{"+"app_id"+"}", "$appId").replace("{"+"integ_id"+"}", "$integId"),
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * List Integrations
    * List the application's integrations.
    * @param appId The app's ID or UID 
    * @param limit Limit the number of returned items (optional)
    * @param iterator The iterator returned from a prior invocation (optional)
    * @param order The sorting order of the returned items (optional)
    * @return ListResponseIntegrationOut
    * @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)
    suspend fun v1IntegrationList(appId: kotlin.String, limit: kotlin.Int?, iterator: kotlin.String?, order: Ordering?) : ListResponseIntegrationOut {
        val localVariableConfig = v1IntegrationListRequestConfig(appId = appId, limit = limit, iterator = iterator, order = order)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as ListResponseIntegrationOut
            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
            ResponseType.ClientError -> {
                val localVarError = localVarResponse as ClientError<*>
                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
            }
            ResponseType.ServerError -> {
                val localVarError = localVarResponse as ServerError<*>
                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
    * To obtain the request config of the operation v1IntegrationList
    *
    * @param appId The app's ID or UID 
    * @param limit Limit the number of returned items (optional)
    * @param iterator The iterator returned from a prior invocation (optional)
    * @param order The sorting order of the returned items (optional)
    * @return RequestConfig
    */
    fun v1IntegrationListRequestConfig(appId: kotlin.String, limit: kotlin.Int?, iterator: kotlin.String?, order: Ordering?) : RequestConfig {
        val localVariableBody = null
        val localVariableQuery: MultiValueMap = mutableMapOf>()
            .apply {
                if (limit != null) {
                    put("limit", listOf(limit.toString()))
                }
                if (iterator != null) {
                    put("iterator", listOf(iterator.toString()))
                }
                if (order != null) {
                    put("order", listOf(order.toString()))
                }
            }
        val localVariableHeaders: MutableMap = mutableMapOf()

        return RequestConfig(
            method = RequestMethod.GET,
            path = "/api/v1/app/{app_id}/integration".replace("{"+"app_id"+"}", "$appId"),
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * Rotate Integration Key
    * Rotate the integration's key. The previous key will be immediately revoked.
    * @param appId The app's ID or UID 
    * @param integId The integ's ID 
    * @param idempotencyKey The request's idempotency key (optional)
    * @return IntegrationKeyOut
    * @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)
    suspend fun v1IntegrationRotateKey(appId: kotlin.String, integId: kotlin.String, idempotencyKey: kotlin.String?) : IntegrationKeyOut {
        val localVariableConfig = v1IntegrationRotateKeyRequestConfig(appId = appId, integId = integId, idempotencyKey = idempotencyKey)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as IntegrationKeyOut
            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
            ResponseType.ClientError -> {
                val localVarError = localVarResponse as ClientError<*>
                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
            }
            ResponseType.ServerError -> {
                val localVarError = localVarResponse as ServerError<*>
                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
    * To obtain the request config of the operation v1IntegrationRotateKey
    *
    * @param appId The app's ID or UID 
    * @param integId The integ's ID 
    * @param idempotencyKey The request's idempotency key (optional)
    * @return RequestConfig
    */
    fun v1IntegrationRotateKeyRequestConfig(appId: kotlin.String, integId: kotlin.String, idempotencyKey: kotlin.String?) : RequestConfig {
        val localVariableBody = null
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        idempotencyKey?.apply { localVariableHeaders["idempotency-key"] = this.toString() }

        return RequestConfig(
            method = RequestMethod.POST,
            path = "/api/v1/app/{app_id}/integration/{integ_id}/key/rotate".replace("{"+"app_id"+"}", "$appId").replace("{"+"integ_id"+"}", "$integId"),
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * Update Integration
    * Update an integration.
    * @param appId The app's ID or UID 
    * @param integId The integ's ID 
    * @param integrationUpdate  
    * @return IntegrationOut
    * @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)
    suspend fun v1IntegrationUpdate(appId: kotlin.String, integId: kotlin.String, integrationUpdate: IntegrationUpdate) : IntegrationOut {
        val localVariableConfig = v1IntegrationUpdateRequestConfig(appId = appId, integId = integId, integrationUpdate = integrationUpdate)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as IntegrationOut
            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
            ResponseType.ClientError -> {
                val localVarError = localVarResponse as ClientError<*>
                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
            }
            ResponseType.ServerError -> {
                val localVarError = localVarResponse as ServerError<*>
                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
    * To obtain the request config of the operation v1IntegrationUpdate
    *
    * @param appId The app's ID or UID 
    * @param integId The integ's ID 
    * @param integrationUpdate  
    * @return RequestConfig
    */
    fun v1IntegrationUpdateRequestConfig(appId: kotlin.String, integId: kotlin.String, integrationUpdate: IntegrationUpdate) : RequestConfig {
        val localVariableBody = integrationUpdate
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()

        return RequestConfig(
            method = RequestMethod.PUT,
            path = "/api/v1/app/{app_id}/integration/{integ_id}".replace("{"+"app_id"+"}", "$appId").replace("{"+"integ_id"+"}", "$integId"),
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy