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

com.svix.kotlin.internal.apis.TransformationTemplateApi.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.GenerateIn
import com.svix.kotlin.models.GenerateOut
import com.svix.kotlin.models.HTTPValidationError
import com.svix.kotlin.models.HttpErrorOut
import com.svix.kotlin.models.HubspotOauthConfigIn
import com.svix.kotlin.models.IncomingWebhookPayloadOut
import com.svix.kotlin.models.ListResponseTemplateOut
import com.svix.kotlin.models.OAuthPayloadIn
import com.svix.kotlin.models.OAuthPayloadOut
import com.svix.kotlin.models.Ordering
import com.svix.kotlin.models.TemplateIn
import com.svix.kotlin.models.TemplateOut
import com.svix.kotlin.models.TemplatePatch
import com.svix.kotlin.models.TemplateUpdate
import com.svix.kotlin.models.TransformationSimulateIn
import com.svix.kotlin.models.TransformationSimulateOut

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 TransformationTemplateApi(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")
        }
    }

    /**
    * Update Hubspot Oauth Config
    * Create/update endpoint Hubsport OAuth configuration Specific private endpoint just for us, to avoid exposing the Hubspot secret to the client.
    * @param appId The app's ID or UID 
    * @param endpointId The ep's ID or UID 
    * @param hubspotOauthConfigIn  
    * @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 v1EndpointUpdateHubspotOauthConfig(appId: kotlin.String, endpointId: kotlin.String, hubspotOauthConfigIn: HubspotOauthConfigIn) : Unit {
        val localVariableConfig = v1EndpointUpdateHubspotOauthConfigRequestConfig(appId = appId, endpointId = endpointId, hubspotOauthConfigIn = hubspotOauthConfigIn)

        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 v1EndpointUpdateHubspotOauthConfig
    *
    * @param appId The app's ID or UID 
    * @param endpointId The ep's ID or UID 
    * @param hubspotOauthConfigIn  
    * @return RequestConfig
    */
    fun v1EndpointUpdateHubspotOauthConfigRequestConfig(appId: kotlin.String, endpointId: kotlin.String, hubspotOauthConfigIn: HubspotOauthConfigIn) : RequestConfig {
        val localVariableBody = hubspotOauthConfigIn
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()

        return RequestConfig(
            method = RequestMethod.PUT,
            path = "/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation-template/oauth/hubspot".replace("{"+"app_id"+"}", "$appId").replace("{"+"endpoint_id"+"}", "$endpointId"),
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * Create Transformation Template
    * Create a new transformation template
    * @param templateIn  
    * @param idempotencyKey The request's idempotency key (optional)
    * @return TemplateOut
    * @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 v1TransformationTemplateCreate(templateIn: TemplateIn, idempotencyKey: kotlin.String?) : TemplateOut {
        val localVariableConfig = v1TransformationTemplateCreateRequestConfig(templateIn = templateIn, idempotencyKey = idempotencyKey)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as TemplateOut
            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 v1TransformationTemplateCreate
    *
    * @param templateIn  
    * @param idempotencyKey The request's idempotency key (optional)
    * @return RequestConfig
    */
    fun v1TransformationTemplateCreateRequestConfig(templateIn: TemplateIn, idempotencyKey: kotlin.String?) : RequestConfig {
        val localVariableBody = templateIn
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        idempotencyKey?.apply { localVariableHeaders["idempotency-key"] = this.toString() }

        return RequestConfig(
            method = RequestMethod.POST,
            path = "/api/v1/transformation-template",
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * Delete Transformation Template
    * Delete a transformation template
    * @param transformationTemplateId  
    * @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 v1TransformationTemplateDelete(transformationTemplateId: kotlin.String) : Unit {
        val localVariableConfig = v1TransformationTemplateDeleteRequestConfig(transformationTemplateId = transformationTemplateId)

        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 v1TransformationTemplateDelete
    *
    * @param transformationTemplateId  
    * @return RequestConfig
    */
    fun v1TransformationTemplateDeleteRequestConfig(transformationTemplateId: kotlin.String) : RequestConfig {
        val localVariableBody = null
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()

        return RequestConfig(
            method = RequestMethod.DELETE,
            path = "/api/v1/transformation-template/{transformation_template_id}".replace("{"+"transformation_template_id"+"}", "$transformationTemplateId"),
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * Generate
    * Use OpenAI's Completion API to generate code for a transformation template
    * @param generateIn  
    * @param idempotencyKey The request's idempotency key (optional)
    * @return GenerateOut
    * @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 v1TransformationTemplateGenerate(generateIn: GenerateIn, idempotencyKey: kotlin.String?) : GenerateOut {
        val localVariableConfig = v1TransformationTemplateGenerateRequestConfig(generateIn = generateIn, idempotencyKey = idempotencyKey)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as GenerateOut
            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 v1TransformationTemplateGenerate
    *
    * @param generateIn  
    * @param idempotencyKey The request's idempotency key (optional)
    * @return RequestConfig
    */
    fun v1TransformationTemplateGenerateRequestConfig(generateIn: GenerateIn, idempotencyKey: kotlin.String?) : RequestConfig {
        val localVariableBody = generateIn
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        idempotencyKey?.apply { localVariableHeaders["idempotency-key"] = this.toString() }

        return RequestConfig(
            method = RequestMethod.POST,
            path = "/api/v1/transformation-template/generate",
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * Get Transformation Template
    * Get a transformation template
    * @param transformationTemplateId  
    * @return TemplateOut
    * @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 v1TransformationTemplateGet(transformationTemplateId: kotlin.String) : TemplateOut {
        val localVariableConfig = v1TransformationTemplateGetRequestConfig(transformationTemplateId = transformationTemplateId)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as TemplateOut
            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 v1TransformationTemplateGet
    *
    * @param transformationTemplateId  
    * @return RequestConfig
    */
    fun v1TransformationTemplateGetRequestConfig(transformationTemplateId: kotlin.String) : RequestConfig {
        val localVariableBody = null
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()

        return RequestConfig(
            method = RequestMethod.GET,
            path = "/api/v1/transformation-template/{transformation_template_id}".replace("{"+"transformation_template_id"+"}", "$transformationTemplateId"),
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * List Transformation Templates
    * List all transformation templates for an application
    * @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 ListResponseTemplateOut
    * @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 v1TransformationTemplateList(limit: kotlin.Int?, iterator: kotlin.String?, order: Ordering?) : ListResponseTemplateOut {
        val localVariableConfig = v1TransformationTemplateListRequestConfig(limit = limit, iterator = iterator, order = order)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as ListResponseTemplateOut
            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 v1TransformationTemplateList
    *
    * @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 v1TransformationTemplateListRequestConfig(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/transformation-template",
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * Authorize Discord
    * Get Discord Incoming webhook URL
    * @param oauthPayloadIn  
    * @param idempotencyKey The request's idempotency key (optional)
    * @return IncomingWebhookPayloadOut
    * @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 v1TransformationTemplateOauthDiscord(oauthPayloadIn: OAuthPayloadIn, idempotencyKey: kotlin.String?) : IncomingWebhookPayloadOut {
        val localVariableConfig = v1TransformationTemplateOauthDiscordRequestConfig(oauthPayloadIn = oauthPayloadIn, idempotencyKey = idempotencyKey)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as IncomingWebhookPayloadOut
            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 v1TransformationTemplateOauthDiscord
    *
    * @param oauthPayloadIn  
    * @param idempotencyKey The request's idempotency key (optional)
    * @return RequestConfig
    */
    fun v1TransformationTemplateOauthDiscordRequestConfig(oauthPayloadIn: OAuthPayloadIn, idempotencyKey: kotlin.String?) : RequestConfig {
        val localVariableBody = oauthPayloadIn
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        idempotencyKey?.apply { localVariableHeaders["idempotency-key"] = this.toString() }

        return RequestConfig(
            method = RequestMethod.POST,
            path = "/api/v1/transformation-template/oauth/discord",
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * Authorize Hubspot
    * Get Hubspot access token using authorization code
    * @param oauthPayloadIn  
    * @param idempotencyKey The request's idempotency key (optional)
    * @return OAuthPayloadOut
    * @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 v1TransformationTemplateOauthHubspot(oauthPayloadIn: OAuthPayloadIn, idempotencyKey: kotlin.String?) : OAuthPayloadOut {
        val localVariableConfig = v1TransformationTemplateOauthHubspotRequestConfig(oauthPayloadIn = oauthPayloadIn, idempotencyKey = idempotencyKey)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as OAuthPayloadOut
            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 v1TransformationTemplateOauthHubspot
    *
    * @param oauthPayloadIn  
    * @param idempotencyKey The request's idempotency key (optional)
    * @return RequestConfig
    */
    fun v1TransformationTemplateOauthHubspotRequestConfig(oauthPayloadIn: OAuthPayloadIn, idempotencyKey: kotlin.String?) : RequestConfig {
        val localVariableBody = oauthPayloadIn
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        idempotencyKey?.apply { localVariableHeaders["idempotency-key"] = this.toString() }

        return RequestConfig(
            method = RequestMethod.POST,
            path = "/api/v1/transformation-template/oauth/hubspot",
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * Authorize Slack
    * Get Slack Incoming webhook URL
    * @param oauthPayloadIn  
    * @param idempotencyKey The request's idempotency key (optional)
    * @return IncomingWebhookPayloadOut
    * @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 v1TransformationTemplateOauthSlack(oauthPayloadIn: OAuthPayloadIn, idempotencyKey: kotlin.String?) : IncomingWebhookPayloadOut {
        val localVariableConfig = v1TransformationTemplateOauthSlackRequestConfig(oauthPayloadIn = oauthPayloadIn, idempotencyKey = idempotencyKey)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as IncomingWebhookPayloadOut
            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 v1TransformationTemplateOauthSlack
    *
    * @param oauthPayloadIn  
    * @param idempotencyKey The request's idempotency key (optional)
    * @return RequestConfig
    */
    fun v1TransformationTemplateOauthSlackRequestConfig(oauthPayloadIn: OAuthPayloadIn, idempotencyKey: kotlin.String?) : RequestConfig {
        val localVariableBody = oauthPayloadIn
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        idempotencyKey?.apply { localVariableHeaders["idempotency-key"] = this.toString() }

        return RequestConfig(
            method = RequestMethod.POST,
            path = "/api/v1/transformation-template/oauth/slack",
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * Patch Transformation Template
    * Partially update a transformation template
    * @param transformationTemplateId  
    * @param templatePatch  
    * @return TemplateOut
    * @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 v1TransformationTemplatePatch(transformationTemplateId: kotlin.String, templatePatch: TemplatePatch) : TemplateOut {
        val localVariableConfig = v1TransformationTemplatePatchRequestConfig(transformationTemplateId = transformationTemplateId, templatePatch = templatePatch)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as TemplateOut
            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 v1TransformationTemplatePatch
    *
    * @param transformationTemplateId  
    * @param templatePatch  
    * @return RequestConfig
    */
    fun v1TransformationTemplatePatchRequestConfig(transformationTemplateId: kotlin.String, templatePatch: TemplatePatch) : RequestConfig {
        val localVariableBody = templatePatch
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()

        return RequestConfig(
            method = RequestMethod.PATCH,
            path = "/api/v1/transformation-template/{transformation_template_id}".replace("{"+"transformation_template_id"+"}", "$transformationTemplateId"),
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * Simulate
    * Simulate running the transformation on the payload and code
    * @param transformationSimulateIn  
    * @param idempotencyKey The request's idempotency key (optional)
    * @return TransformationSimulateOut
    * @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 v1TransformationTemplateSimulate(transformationSimulateIn: TransformationSimulateIn, idempotencyKey: kotlin.String?) : TransformationSimulateOut {
        val localVariableConfig = v1TransformationTemplateSimulateRequestConfig(transformationSimulateIn = transformationSimulateIn, idempotencyKey = idempotencyKey)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as TransformationSimulateOut
            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 v1TransformationTemplateSimulate
    *
    * @param transformationSimulateIn  
    * @param idempotencyKey The request's idempotency key (optional)
    * @return RequestConfig
    */
    fun v1TransformationTemplateSimulateRequestConfig(transformationSimulateIn: TransformationSimulateIn, idempotencyKey: kotlin.String?) : RequestConfig {
        val localVariableBody = transformationSimulateIn
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        idempotencyKey?.apply { localVariableHeaders["idempotency-key"] = this.toString() }

        return RequestConfig(
            method = RequestMethod.POST,
            path = "/api/v1/transformation-template/simulate",
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

    /**
    * Update Transformation Template
    * Update a transformation template
    * @param transformationTemplateId  
    * @param templateUpdate  
    * @return TemplateOut
    * @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 v1TransformationTemplateUpdate(transformationTemplateId: kotlin.String, templateUpdate: TemplateUpdate) : TemplateOut {
        val localVariableConfig = v1TransformationTemplateUpdateRequestConfig(transformationTemplateId = transformationTemplateId, templateUpdate = templateUpdate)

        val localVarResponse = request(
            localVariableConfig
        )

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as TemplateOut
            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 v1TransformationTemplateUpdate
    *
    * @param transformationTemplateId  
    * @param templateUpdate  
    * @return RequestConfig
    */
    fun v1TransformationTemplateUpdateRequestConfig(transformationTemplateId: kotlin.String, templateUpdate: TemplateUpdate) : RequestConfig {
        val localVariableBody = templateUpdate
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()

        return RequestConfig(
            method = RequestMethod.PUT,
            path = "/api/v1/transformation-template/{transformation_template_id}".replace("{"+"transformation_template_id"+"}", "$transformationTemplateId"),
            query = localVariableQuery,
            headers = localVariableHeaders,
            body = localVariableBody
        )
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy