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

ru.testit.kotlin.client.apis.TestResultsApi.kt Maven / Gradle / Ivy

There is a newer version: 0.2.0
Show newest version
/**
 *
 * 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 ru.testit.kotlin.client.apis

import java.io.IOException
import okhttp3.OkHttpClient
import okhttp3.HttpUrl

import ru.testit.kotlin.client.models.AttachmentModel
import ru.testit.kotlin.client.models.ImageResizeType
import ru.testit.kotlin.client.models.ProblemDetails
import ru.testit.kotlin.client.models.TestResultModel
import ru.testit.kotlin.client.models.TestResultShortGetModel
import ru.testit.kotlin.client.models.TestResultUpdateModel
import ru.testit.kotlin.client.models.TestResultsFilterModel
import ru.testit.kotlin.client.models.TestResultsStatisticsGetModel
import ru.testit.kotlin.client.models.ValidationProblemDetails

import com.squareup.moshi.Json

import ru.testit.kotlin.client.infrastructure.ApiClient
import ru.testit.kotlin.client.infrastructure.ApiResponse
import ru.testit.kotlin.client.infrastructure.ClientException
import ru.testit.kotlin.client.infrastructure.ClientError
import ru.testit.kotlin.client.infrastructure.ServerException
import ru.testit.kotlin.client.infrastructure.ServerError
import ru.testit.kotlin.client.infrastructure.MultiValueMap
import ru.testit.kotlin.client.infrastructure.PartConfig
import ru.testit.kotlin.client.infrastructure.RequestConfig
import ru.testit.kotlin.client.infrastructure.RequestMethod
import ru.testit.kotlin.client.infrastructure.ResponseType
import ru.testit.kotlin.client.infrastructure.Success
import ru.testit.kotlin.client.infrastructure.toMultiValue

class TestResultsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) {
    companion object {
        @JvmStatic
        val defaultBasePath: String by lazy {
            System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost")
        }
    }

    /**
     * Get test result by ID aggregated with previous results
     * 
     * @param id Test result unique ID
     * @return TestResultModel
     * @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(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
    fun apiV2TestResultsIdAggregatedGet(id: java.util.UUID) : TestResultModel {
        val localVarResponse = apiV2TestResultsIdAggregatedGetWithHttpInfo(id = id)

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as TestResultModel
            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.body}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
     * Get test result by ID aggregated with previous results
     * 
     * @param id Test result unique ID
     * @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 apiV2TestResultsIdAggregatedGetWithHttpInfo(id: java.util.UUID) : ApiResponse {
        val localVariableConfig = apiV2TestResultsIdAggregatedGetRequestConfig(id = id)

        return request(
            localVariableConfig
        )
    }

    /**
     * To obtain the request config of the operation apiV2TestResultsIdAggregatedGet
     *
     * @param id Test result unique ID
     * @return RequestConfig
     */
    fun apiV2TestResultsIdAggregatedGetRequestConfig(id: java.util.UUID) : RequestConfig {
        val localVariableBody = null
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        localVariableHeaders["Accept"] = "application/json"

        return RequestConfig(
            method = RequestMethod.GET,
            path = "/api/v2/testResults/{id}/aggregated".replace("{"+"id"+"}", encodeURIComponent(id.toString())),
            query = localVariableQuery,
            headers = localVariableHeaders,
            requiresAuthentication = true,
            body = localVariableBody
        )
    }

    /**
     * Attach file to the test result
     * 
     * @param id Test result unique ID
     * @param attachmentId Attachment unique ID
     * @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 apiV2TestResultsIdAttachmentsAttachmentIdPut(id: java.util.UUID, attachmentId: java.util.UUID) : Unit {
        val localVarResponse = apiV2TestResultsIdAttachmentsAttachmentIdPutWithHttpInfo(id = id, attachmentId = attachmentId)

        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.body}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
     * Attach file to the test result
     * 
     * @param id Test result unique ID
     * @param attachmentId Attachment unique ID
     * @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 apiV2TestResultsIdAttachmentsAttachmentIdPutWithHttpInfo(id: java.util.UUID, attachmentId: java.util.UUID) : ApiResponse {
        val localVariableConfig = apiV2TestResultsIdAttachmentsAttachmentIdPutRequestConfig(id = id, attachmentId = attachmentId)

        return request(
            localVariableConfig
        )
    }

    /**
     * To obtain the request config of the operation apiV2TestResultsIdAttachmentsAttachmentIdPut
     *
     * @param id Test result unique ID
     * @param attachmentId Attachment unique ID
     * @return RequestConfig
     */
    fun apiV2TestResultsIdAttachmentsAttachmentIdPutRequestConfig(id: java.util.UUID, attachmentId: java.util.UUID) : RequestConfig {
        val localVariableBody = null
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        localVariableHeaders["Accept"] = "application/json"

        return RequestConfig(
            method = RequestMethod.PUT,
            path = "/api/v2/testResults/{id}/attachments/{attachmentId}".replace("{"+"id"+"}", encodeURIComponent(id.toString())).replace("{"+"attachmentId"+"}", encodeURIComponent(attachmentId.toString())),
            query = localVariableQuery,
            headers = localVariableHeaders,
            requiresAuthentication = true,
            body = localVariableBody
        )
    }

    /**
     * Get test result attachments meta-information
     * 
     * @param id Test result unique ID
     * @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(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
    fun apiV2TestResultsIdAttachmentsInfoGet(id: java.util.UUID) : kotlin.collections.List {
        val localVarResponse = apiV2TestResultsIdAttachmentsInfoGetWithHttpInfo(id = id)

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List
            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.body}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
     * Get test result attachments meta-information
     * 
     * @param id Test result unique ID
     * @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 apiV2TestResultsIdAttachmentsInfoGetWithHttpInfo(id: java.util.UUID) : ApiResponse?> {
        val localVariableConfig = apiV2TestResultsIdAttachmentsInfoGetRequestConfig(id = id)

        return request>(
            localVariableConfig
        )
    }

    /**
     * To obtain the request config of the operation apiV2TestResultsIdAttachmentsInfoGet
     *
     * @param id Test result unique ID
     * @return RequestConfig
     */
    fun apiV2TestResultsIdAttachmentsInfoGetRequestConfig(id: java.util.UUID) : RequestConfig {
        val localVariableBody = null
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        localVariableHeaders["Accept"] = "application/json"

        return RequestConfig(
            method = RequestMethod.GET,
            path = "/api/v2/testResults/{id}/attachments/info".replace("{"+"id"+"}", encodeURIComponent(id.toString())),
            query = localVariableQuery,
            headers = localVariableHeaders,
            requiresAuthentication = true,
            body = localVariableBody
        )
    }

    /**
     * Get test result by ID
     * 
     * @param id Test result unique ID
     * @return TestResultModel
     * @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(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
    fun apiV2TestResultsIdGet(id: java.util.UUID) : TestResultModel {
        val localVarResponse = apiV2TestResultsIdGetWithHttpInfo(id = id)

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as TestResultModel
            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.body}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
     * Get test result by ID
     * 
     * @param id Test result unique ID
     * @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 apiV2TestResultsIdGetWithHttpInfo(id: java.util.UUID) : ApiResponse {
        val localVariableConfig = apiV2TestResultsIdGetRequestConfig(id = id)

        return request(
            localVariableConfig
        )
    }

    /**
     * To obtain the request config of the operation apiV2TestResultsIdGet
     *
     * @param id Test result unique ID
     * @return RequestConfig
     */
    fun apiV2TestResultsIdGetRequestConfig(id: java.util.UUID) : RequestConfig {
        val localVariableBody = null
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        localVariableHeaders["Accept"] = "application/json"

        return RequestConfig(
            method = RequestMethod.GET,
            path = "/api/v2/testResults/{id}".replace("{"+"id"+"}", encodeURIComponent(id.toString())),
            query = localVariableQuery,
            headers = localVariableHeaders,
            requiresAuthentication = true,
            body = localVariableBody
        )
    }

    /**
     * Edit test result by ID
     * 
     * @param id Test result unique ID
     * @param testResultUpdateModel  (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 apiV2TestResultsIdPut(id: java.util.UUID, testResultUpdateModel: TestResultUpdateModel? = null) : Unit {
        val localVarResponse = apiV2TestResultsIdPutWithHttpInfo(id = id, testResultUpdateModel = testResultUpdateModel)

        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.body}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
     * Edit test result by ID
     * 
     * @param id Test result unique ID
     * @param testResultUpdateModel  (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 apiV2TestResultsIdPutWithHttpInfo(id: java.util.UUID, testResultUpdateModel: TestResultUpdateModel?) : ApiResponse {
        val localVariableConfig = apiV2TestResultsIdPutRequestConfig(id = id, testResultUpdateModel = testResultUpdateModel)

        return request(
            localVariableConfig
        )
    }

    /**
     * To obtain the request config of the operation apiV2TestResultsIdPut
     *
     * @param id Test result unique ID
     * @param testResultUpdateModel  (optional)
     * @return RequestConfig
     */
    fun apiV2TestResultsIdPutRequestConfig(id: java.util.UUID, testResultUpdateModel: TestResultUpdateModel?) : RequestConfig {
        val localVariableBody = testResultUpdateModel
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        localVariableHeaders["Content-Type"] = "application/json"
        localVariableHeaders["Accept"] = "application/json"

        return RequestConfig(
            method = RequestMethod.PUT,
            path = "/api/v2/testResults/{id}".replace("{"+"id"+"}", encodeURIComponent(id.toString())),
            query = localVariableQuery,
            headers = localVariableHeaders,
            requiresAuthentication = true,
            body = localVariableBody
        )
    }

    /**
     * Search for test results
     * 
     * @param skip Amount of items to be skipped (offset) (optional)
     * @param take Amount of items to be taken (limit) (optional)
     * @param orderBy SQL-like  ORDER BY statement (column1 ASC|DESC , column2 ASC|DESC) (optional)
     * @param searchField Property name for searching (optional)
     * @param searchValue Value for searching (optional)
     * @param testResultsFilterModel  (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(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
    fun apiV2TestResultsSearchPost(skip: kotlin.Int? = null, take: kotlin.Int? = null, orderBy: kotlin.String? = null, searchField: kotlin.String? = null, searchValue: kotlin.String? = null, testResultsFilterModel: TestResultsFilterModel? = null) : kotlin.collections.List {
        val localVarResponse = apiV2TestResultsSearchPostWithHttpInfo(skip = skip, take = take, orderBy = orderBy, searchField = searchField, searchValue = searchValue, testResultsFilterModel = testResultsFilterModel)

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List
            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.body}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
     * Search for test results
     * 
     * @param skip Amount of items to be skipped (offset) (optional)
     * @param take Amount of items to be taken (limit) (optional)
     * @param orderBy SQL-like  ORDER BY statement (column1 ASC|DESC , column2 ASC|DESC) (optional)
     * @param searchField Property name for searching (optional)
     * @param searchValue Value for searching (optional)
     * @param testResultsFilterModel  (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 apiV2TestResultsSearchPostWithHttpInfo(skip: kotlin.Int?, take: kotlin.Int?, orderBy: kotlin.String?, searchField: kotlin.String?, searchValue: kotlin.String?, testResultsFilterModel: TestResultsFilterModel?) : ApiResponse?> {
        val localVariableConfig = apiV2TestResultsSearchPostRequestConfig(skip = skip, take = take, orderBy = orderBy, searchField = searchField, searchValue = searchValue, testResultsFilterModel = testResultsFilterModel)

        return request>(
            localVariableConfig
        )
    }

    /**
     * To obtain the request config of the operation apiV2TestResultsSearchPost
     *
     * @param skip Amount of items to be skipped (offset) (optional)
     * @param take Amount of items to be taken (limit) (optional)
     * @param orderBy SQL-like  ORDER BY statement (column1 ASC|DESC , column2 ASC|DESC) (optional)
     * @param searchField Property name for searching (optional)
     * @param searchValue Value for searching (optional)
     * @param testResultsFilterModel  (optional)
     * @return RequestConfig
     */
    fun apiV2TestResultsSearchPostRequestConfig(skip: kotlin.Int?, take: kotlin.Int?, orderBy: kotlin.String?, searchField: kotlin.String?, searchValue: kotlin.String?, testResultsFilterModel: TestResultsFilterModel?) : RequestConfig {
        val localVariableBody = testResultsFilterModel
        val localVariableQuery: MultiValueMap = mutableMapOf>()
            .apply {
                if (skip != null) {
                    put("Skip", listOf(skip.toString()))
                }
                if (take != null) {
                    put("Take", listOf(take.toString()))
                }
                if (orderBy != null) {
                    put("OrderBy", listOf(orderBy.toString()))
                }
                if (searchField != null) {
                    put("SearchField", listOf(searchField.toString()))
                }
                if (searchValue != null) {
                    put("SearchValue", listOf(searchValue.toString()))
                }
            }
        val localVariableHeaders: MutableMap = mutableMapOf()
        localVariableHeaders["Content-Type"] = "application/json"
        localVariableHeaders["Accept"] = "application/json"

        return RequestConfig(
            method = RequestMethod.POST,
            path = "/api/v2/testResults/search",
            query = localVariableQuery,
            headers = localVariableHeaders,
            requiresAuthentication = true,
            body = localVariableBody
        )
    }

    /**
     * Search for test results and extract statistics
     * 
     * @param testResultsFilterModel  (optional)
     * @return TestResultsStatisticsGetModel
     * @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(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
    fun apiV2TestResultsStatisticsFilterPost(testResultsFilterModel: TestResultsFilterModel? = null) : TestResultsStatisticsGetModel {
        val localVarResponse = apiV2TestResultsStatisticsFilterPostWithHttpInfo(testResultsFilterModel = testResultsFilterModel)

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as TestResultsStatisticsGetModel
            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.body}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
     * Search for test results and extract statistics
     * 
     * @param testResultsFilterModel  (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 apiV2TestResultsStatisticsFilterPostWithHttpInfo(testResultsFilterModel: TestResultsFilterModel?) : ApiResponse {
        val localVariableConfig = apiV2TestResultsStatisticsFilterPostRequestConfig(testResultsFilterModel = testResultsFilterModel)

        return request(
            localVariableConfig
        )
    }

    /**
     * To obtain the request config of the operation apiV2TestResultsStatisticsFilterPost
     *
     * @param testResultsFilterModel  (optional)
     * @return RequestConfig
     */
    fun apiV2TestResultsStatisticsFilterPostRequestConfig(testResultsFilterModel: TestResultsFilterModel?) : RequestConfig {
        val localVariableBody = testResultsFilterModel
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        localVariableHeaders["Content-Type"] = "application/json"
        localVariableHeaders["Accept"] = "application/json"

        return RequestConfig(
            method = RequestMethod.POST,
            path = "/api/v2/testResults/statistics/filter",
            query = localVariableQuery,
            headers = localVariableHeaders,
            requiresAuthentication = true,
            body = localVariableBody
        )
    }

    /**
     * Upload and link attachment to TestResult
     *  Use case   User sets testResultId   User attaches a file   System creates attachment and links it to the test result   System returns attachment identifier
     * @param id Test result internal identifier (guid format)
     * @param file Select file (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 createAttachment(id: java.util.UUID, file: java.io.File? = null) : Unit {
        val localVarResponse = createAttachmentWithHttpInfo(id = id, file = file)

        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.body}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
     * Upload and link attachment to TestResult
     *  Use case   User sets testResultId   User attaches a file   System creates attachment and links it to the test result   System returns attachment identifier
     * @param id Test result internal identifier (guid format)
     * @param file Select file (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 createAttachmentWithHttpInfo(id: java.util.UUID, file: java.io.File?) : ApiResponse {
        val localVariableConfig = createAttachmentRequestConfig(id = id, file = file)

        return request>, Unit>(
            localVariableConfig
        )
    }

    /**
     * To obtain the request config of the operation createAttachment
     *
     * @param id Test result internal identifier (guid format)
     * @param file Select file (optional)
     * @return RequestConfig
     */
    fun createAttachmentRequestConfig(id: java.util.UUID, file: java.io.File?) : RequestConfig>> {
        val localVariableBody = mapOf(
            "file" to PartConfig(body = file, headers = mutableMapOf()),)
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data")
        localVariableHeaders["Accept"] = "application/json"

        return RequestConfig(
            method = RequestMethod.POST,
            path = "/api/v2/testResults/{id}/attachments".replace("{"+"id"+"}", encodeURIComponent(id.toString())),
            query = localVariableQuery,
            headers = localVariableHeaders,
            requiresAuthentication = true,
            body = localVariableBody
        )
    }

    /**
     * Remove attachment and unlink from TestResult
     *  Use case   User sets testResultId and attachmentId   User attaches a file   User runs method execution   System deletes attachment and unlinks it from the test result   System returns attachment identifier
     * @param id Test result internal identifier (guid format)
     * @param attachmentId Attachment internal identifier (guid format)
     * @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 deleteAttachment(id: java.util.UUID, attachmentId: java.util.UUID) : Unit {
        val localVarResponse = deleteAttachmentWithHttpInfo(id = id, attachmentId = attachmentId)

        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.body}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
     * Remove attachment and unlink from TestResult
     *  Use case   User sets testResultId and attachmentId   User attaches a file   User runs method execution   System deletes attachment and unlinks it from the test result   System returns attachment identifier
     * @param id Test result internal identifier (guid format)
     * @param attachmentId Attachment internal identifier (guid format)
     * @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 deleteAttachmentWithHttpInfo(id: java.util.UUID, attachmentId: java.util.UUID) : ApiResponse {
        val localVariableConfig = deleteAttachmentRequestConfig(id = id, attachmentId = attachmentId)

        return request(
            localVariableConfig
        )
    }

    /**
     * To obtain the request config of the operation deleteAttachment
     *
     * @param id Test result internal identifier (guid format)
     * @param attachmentId Attachment internal identifier (guid format)
     * @return RequestConfig
     */
    fun deleteAttachmentRequestConfig(id: java.util.UUID, attachmentId: java.util.UUID) : RequestConfig {
        val localVariableBody = null
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        localVariableHeaders["Accept"] = "application/json"

        return RequestConfig(
            method = RequestMethod.DELETE,
            path = "/api/v2/testResults/{id}/attachments/{attachmentId}".replace("{"+"id"+"}", encodeURIComponent(id.toString())).replace("{"+"attachmentId"+"}", encodeURIComponent(attachmentId.toString())),
            query = localVariableQuery,
            headers = localVariableHeaders,
            requiresAuthentication = true,
            body = localVariableBody
        )
    }

    /**
     * Get attachment of TestResult
     *  Use case   User sets attachmentId and testResultId   [Optional] User sets resize configuration   User runs method execution   System search attachments by the attachmentId and the testResultId                         [Optional] If resize configuration is set, System resizes the attachment according to the resize                      configuration                     [Optional] Otherwise, System does not resize the attachment   System returns attachment as a file
     * @param attachmentId Attachment internal identifier (guid format)
     * @param id Test result internal identifier (guid format)
     * @param width Width of the result image (optional)
     * @param height Height of the result image (optional)
     * @param resizeType Type of resizing to apply to the result image (optional)
     * @param backgroundColor Color of the background if the `resizeType` is `AddBackgroundStripes` (optional)
     * @param preview If image must be converted to a preview (lower quality, no animation) (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 downloadAttachment(attachmentId: java.util.UUID, id: java.util.UUID, width: kotlin.Int? = null, height: kotlin.Int? = null, resizeType: ImageResizeType? = null, backgroundColor: kotlin.String? = null, preview: kotlin.Boolean? = null) : Unit {
        val localVarResponse = downloadAttachmentWithHttpInfo(attachmentId = attachmentId, id = id, width = width, height = height, resizeType = resizeType, backgroundColor = backgroundColor, preview = preview)

        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.body}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
     * Get attachment of TestResult
     *  Use case   User sets attachmentId and testResultId   [Optional] User sets resize configuration   User runs method execution   System search attachments by the attachmentId and the testResultId                         [Optional] If resize configuration is set, System resizes the attachment according to the resize                      configuration                     [Optional] Otherwise, System does not resize the attachment   System returns attachment as a file
     * @param attachmentId Attachment internal identifier (guid format)
     * @param id Test result internal identifier (guid format)
     * @param width Width of the result image (optional)
     * @param height Height of the result image (optional)
     * @param resizeType Type of resizing to apply to the result image (optional)
     * @param backgroundColor Color of the background if the `resizeType` is `AddBackgroundStripes` (optional)
     * @param preview If image must be converted to a preview (lower quality, no animation) (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 downloadAttachmentWithHttpInfo(attachmentId: java.util.UUID, id: java.util.UUID, width: kotlin.Int?, height: kotlin.Int?, resizeType: ImageResizeType?, backgroundColor: kotlin.String?, preview: kotlin.Boolean?) : ApiResponse {
        val localVariableConfig = downloadAttachmentRequestConfig(attachmentId = attachmentId, id = id, width = width, height = height, resizeType = resizeType, backgroundColor = backgroundColor, preview = preview)

        return request(
            localVariableConfig
        )
    }

    /**
     * To obtain the request config of the operation downloadAttachment
     *
     * @param attachmentId Attachment internal identifier (guid format)
     * @param id Test result internal identifier (guid format)
     * @param width Width of the result image (optional)
     * @param height Height of the result image (optional)
     * @param resizeType Type of resizing to apply to the result image (optional)
     * @param backgroundColor Color of the background if the `resizeType` is `AddBackgroundStripes` (optional)
     * @param preview If image must be converted to a preview (lower quality, no animation) (optional)
     * @return RequestConfig
     */
    fun downloadAttachmentRequestConfig(attachmentId: java.util.UUID, id: java.util.UUID, width: kotlin.Int?, height: kotlin.Int?, resizeType: ImageResizeType?, backgroundColor: kotlin.String?, preview: kotlin.Boolean?) : RequestConfig {
        val localVariableBody = null
        val localVariableQuery: MultiValueMap = mutableMapOf>()
            .apply {
                if (width != null) {
                    put("width", listOf(width.toString()))
                }
                if (height != null) {
                    put("height", listOf(height.toString()))
                }
                if (resizeType != null) {
                    put("resizeType", listOf(resizeType.toString()))
                }
                if (backgroundColor != null) {
                    put("backgroundColor", listOf(backgroundColor.toString()))
                }
                if (preview != null) {
                    put("preview", listOf(preview.toString()))
                }
            }
        val localVariableHeaders: MutableMap = mutableMapOf()
        localVariableHeaders["Accept"] = "application/json"

        return RequestConfig(
            method = RequestMethod.GET,
            path = "/api/v2/testResults/{id}/attachments/{attachmentId}".replace("{"+"attachmentId"+"}", encodeURIComponent(attachmentId.toString())).replace("{"+"id"+"}", encodeURIComponent(id.toString())),
            query = localVariableQuery,
            headers = localVariableHeaders,
            requiresAuthentication = true,
            body = localVariableBody
        )
    }

    /**
     * Get Metadata of TestResult's attachment
     *  Use case   User sets attachmentId and testResultId   User runs method execution   System search attachment by the attachmentId and the testResultId   System returns attachment data
     * @param id Test result internal identifier (guid format)
     * @param attachmentId Attachment internal identifier (guid format)
     * @return AttachmentModel
     * @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(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
    fun getAttachment(id: java.util.UUID, attachmentId: java.util.UUID) : AttachmentModel {
        val localVarResponse = getAttachmentWithHttpInfo(id = id, attachmentId = attachmentId)

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as AttachmentModel
            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.body}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
     * Get Metadata of TestResult's attachment
     *  Use case   User sets attachmentId and testResultId   User runs method execution   System search attachment by the attachmentId and the testResultId   System returns attachment data
     * @param id Test result internal identifier (guid format)
     * @param attachmentId Attachment internal identifier (guid format)
     * @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 getAttachmentWithHttpInfo(id: java.util.UUID, attachmentId: java.util.UUID) : ApiResponse {
        val localVariableConfig = getAttachmentRequestConfig(id = id, attachmentId = attachmentId)

        return request(
            localVariableConfig
        )
    }

    /**
     * To obtain the request config of the operation getAttachment
     *
     * @param id Test result internal identifier (guid format)
     * @param attachmentId Attachment internal identifier (guid format)
     * @return RequestConfig
     */
    fun getAttachmentRequestConfig(id: java.util.UUID, attachmentId: java.util.UUID) : RequestConfig {
        val localVariableBody = null
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        localVariableHeaders["Accept"] = "application/json"

        return RequestConfig(
            method = RequestMethod.GET,
            path = "/api/v2/testResults/{id}/attachments/{attachmentId}/info".replace("{"+"id"+"}", encodeURIComponent(id.toString())).replace("{"+"attachmentId"+"}", encodeURIComponent(attachmentId.toString())),
            query = localVariableQuery,
            headers = localVariableHeaders,
            requiresAuthentication = true,
            body = localVariableBody
        )
    }

    /**
     * Get all attachments of TestResult
     *  Use case   User sets testResultId   User runs method execution   System search all attachments of the test result   System returns attachments enumeration
     * @param id Test result internal identifier (guid format)
     * @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(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
    fun getAttachments(id: java.util.UUID) : kotlin.collections.List {
        val localVarResponse = getAttachmentsWithHttpInfo(id = id)

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List
            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.body}", localVarError.statusCode, localVarResponse)
            }
        }
    }

    /**
     * Get all attachments of TestResult
     *  Use case   User sets testResultId   User runs method execution   System search all attachments of the test result   System returns attachments enumeration
     * @param id Test result internal identifier (guid format)
     * @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 getAttachmentsWithHttpInfo(id: java.util.UUID) : ApiResponse?> {
        val localVariableConfig = getAttachmentsRequestConfig(id = id)

        return request>(
            localVariableConfig
        )
    }

    /**
     * To obtain the request config of the operation getAttachments
     *
     * @param id Test result internal identifier (guid format)
     * @return RequestConfig
     */
    fun getAttachmentsRequestConfig(id: java.util.UUID) : RequestConfig {
        val localVariableBody = null
        val localVariableQuery: MultiValueMap = mutableMapOf()
        val localVariableHeaders: MutableMap = mutableMapOf()
        localVariableHeaders["Accept"] = "application/json"

        return RequestConfig(
            method = RequestMethod.GET,
            path = "/api/v2/testResults/{id}/attachments".replace("{"+"id"+"}", encodeURIComponent(id.toString())),
            query = localVariableQuery,
            headers = localVariableHeaders,
            requiresAuthentication = true,
            body = localVariableBody
        )
    }


    private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String =
        HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy