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

ru.testit.kotlin.client.apis.ProjectImportApi.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.ProblemDetails
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 ProjectImportApi(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")
        }
    }

    /**
     * Import project from JSON file into existing project in background job
     * 
     * @param projectId Project internal (UUID) or global (integer) identifier
     * @param file Select file (optional)
     * @return java.util.UUID
     * @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)
    @Deprecated(message = "This operation is deprecated.")
    fun backgroundImportToExistingProject(projectId: kotlin.String, file: java.io.File? = null) : java.util.UUID {
        @Suppress("DEPRECATION")
        val localVarResponse = backgroundImportToExistingProjectWithHttpInfo(projectId = projectId, file = file)

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as java.util.UUID
            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)
            }
        }
    }

    /**
     * Import project from JSON file into existing project in background job
     * 
     * @param projectId Project internal (UUID) or global (integer) identifier
     * @param file Select file (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)
    @Deprecated(message = "This operation is deprecated.")
    fun backgroundImportToExistingProjectWithHttpInfo(projectId: kotlin.String, file: java.io.File?) : ApiResponse {
        @Suppress("DEPRECATION")
        val localVariableConfig = backgroundImportToExistingProjectRequestConfig(projectId = projectId, file = file)

        return request>, java.util.UUID>(
            localVariableConfig
        )
    }

    /**
     * To obtain the request config of the operation backgroundImportToExistingProject
     *
     * @param projectId Project internal (UUID) or global (integer) identifier
     * @param file Select file (optional)
     * @return RequestConfig
     */
    @Deprecated(message = "This operation is deprecated.")
    fun backgroundImportToExistingProjectRequestConfig(projectId: kotlin.String, 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/projects/{projectId}/import/json".replace("{"+"projectId"+"}", encodeURIComponent(projectId.toString())),
            query = localVariableQuery,
            headers = localVariableHeaders,
            requiresAuthentication = true,
            body = localVariableBody
        )
    }

    /**
     * Import project from Zip file into existing project in background job
     * 
     * @param projectId Project internal (UUID) or global (integer) identifier
     * @param file Select file (optional)
     * @return java.util.UUID
     * @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)
    @Deprecated(message = "This operation is deprecated.")
    fun backgroundImportZipToExistingProject(projectId: kotlin.String, file: java.io.File? = null) : java.util.UUID {
        @Suppress("DEPRECATION")
        val localVarResponse = backgroundImportZipToExistingProjectWithHttpInfo(projectId = projectId, file = file)

        return when (localVarResponse.responseType) {
            ResponseType.Success -> (localVarResponse as Success<*>).data as java.util.UUID
            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)
            }
        }
    }

    /**
     * Import project from Zip file into existing project in background job
     * 
     * @param projectId Project internal (UUID) or global (integer) identifier
     * @param file Select file (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)
    @Deprecated(message = "This operation is deprecated.")
    fun backgroundImportZipToExistingProjectWithHttpInfo(projectId: kotlin.String, file: java.io.File?) : ApiResponse {
        @Suppress("DEPRECATION")
        val localVariableConfig = backgroundImportZipToExistingProjectRequestConfig(projectId = projectId, file = file)

        return request>, java.util.UUID>(
            localVariableConfig
        )
    }

    /**
     * To obtain the request config of the operation backgroundImportZipToExistingProject
     *
     * @param projectId Project internal (UUID) or global (integer) identifier
     * @param file Select file (optional)
     * @return RequestConfig
     */
    @Deprecated(message = "This operation is deprecated.")
    fun backgroundImportZipToExistingProjectRequestConfig(projectId: kotlin.String, 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/projects/{projectId}/import/zip".replace("{"+"projectId"+"}", encodeURIComponent(projectId.toString())),
            query = localVariableQuery,
            headers = localVariableHeaders,
            requiresAuthentication = true,
            body = localVariableBody
        )
    }

    /**
     * Import project from JSON file into existing project
     *  Use case   User attaches project as json file taken from export or export-by-testPlans method   User runs method execution   System updates project   System returns no content response
     * @param projectId Project internal (UUID) or global (integer) identifier
     * @param includeAttachments  (optional)
     * @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)
    @Deprecated(message = "This operation is deprecated.")
    fun importToExistingProject(projectId: kotlin.String, includeAttachments: kotlin.Boolean? = null, file: java.io.File? = null) : Unit {
        @Suppress("DEPRECATION")
        val localVarResponse = importToExistingProjectWithHttpInfo(projectId = projectId, includeAttachments = includeAttachments, 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)
            }
        }
    }

    /**
     * Import project from JSON file into existing project
     *  Use case   User attaches project as json file taken from export or export-by-testPlans method   User runs method execution   System updates project   System returns no content response
     * @param projectId Project internal (UUID) or global (integer) identifier
     * @param includeAttachments  (optional)
     * @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)
    @Deprecated(message = "This operation is deprecated.")
    fun importToExistingProjectWithHttpInfo(projectId: kotlin.String, includeAttachments: kotlin.Boolean?, file: java.io.File?) : ApiResponse {
        @Suppress("DEPRECATION")
        val localVariableConfig = importToExistingProjectRequestConfig(projectId = projectId, includeAttachments = includeAttachments, file = file)

        return request>, Unit>(
            localVariableConfig
        )
    }

    /**
     * To obtain the request config of the operation importToExistingProject
     *
     * @param projectId Project internal (UUID) or global (integer) identifier
     * @param includeAttachments  (optional)
     * @param file Select file (optional)
     * @return RequestConfig
     */
    @Deprecated(message = "This operation is deprecated.")
    fun importToExistingProjectRequestConfig(projectId: kotlin.String, includeAttachments: kotlin.Boolean?, file: java.io.File?) : RequestConfig>> {
        val localVariableBody = mapOf(
            "file" to PartConfig(body = file, headers = mutableMapOf()),)
        val localVariableQuery: MultiValueMap = mutableMapOf>()
            .apply {
                if (includeAttachments != null) {
                    put("includeAttachments", listOf(includeAttachments.toString()))
                }
            }
        val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data")
        localVariableHeaders["Accept"] = "application/json"

        return RequestConfig(
            method = RequestMethod.POST,
            path = "/api/v2/projects/{projectId}/import".replace("{"+"projectId"+"}", encodeURIComponent(projectId.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