diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 0a5921d..c5964db 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -6,8 +6,13 @@ docs/EventsGet200Response.md docs/EventsPostRequest.md docs/InventoryApi.md docs/InventoryCardsGet200Response.md +docs/Task.md +docs/TasksApi.md +docs/TasksGet200Response.md +docs/TasksIdPatchRequest.md src/main/kotlin/org/trackedout/client/apis/EventsApi.kt src/main/kotlin/org/trackedout/client/apis/InventoryApi.kt +src/main/kotlin/org/trackedout/client/apis/TasksApi.kt src/main/kotlin/org/trackedout/client/infrastructure/ApiAbstractions.kt src/main/kotlin/org/trackedout/client/infrastructure/ApiClient.kt src/main/kotlin/org/trackedout/client/infrastructure/ApiResponse.kt @@ -31,3 +36,6 @@ src/main/kotlin/org/trackedout/client/models/Event.kt src/main/kotlin/org/trackedout/client/models/EventsGet200Response.kt src/main/kotlin/org/trackedout/client/models/EventsPostRequest.kt src/main/kotlin/org/trackedout/client/models/InventoryCardsGet200Response.kt +src/main/kotlin/org/trackedout/client/models/Task.kt +src/main/kotlin/org/trackedout/client/models/TasksGet200Response.kt +src/main/kotlin/org/trackedout/client/models/TasksIdPatchRequest.kt diff --git a/docs/EventsApi.md b/docs/EventsApi.md index cda0477..03eb91e 100644 --- a/docs/EventsApi.md +++ b/docs/EventsApi.md @@ -58,9 +58,7 @@ Name | Type | Description | Notes ### Authorization - -Configure bearerAuth: - ApiClient.accessToken = "" +No authorization required ### HTTP request headers @@ -107,9 +105,7 @@ Name | Type | Description | Notes ### Authorization - -Configure bearerAuth: - ApiClient.accessToken = "" +No authorization required ### HTTP request headers diff --git a/docs/Task.md b/docs/Task.md new file mode 100644 index 0000000..a0dc5bf --- /dev/null +++ b/docs/Task.md @@ -0,0 +1,15 @@ + +# Task + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **kotlin.String** | | [optional] +**type** | **kotlin.String** | | [optional] +**arguments** | **kotlin.collections.List<kotlin.String>** | | [optional] +**targetPlayer** | **kotlin.String** | | [optional] +**server** | **kotlin.String** | | [optional] +**sourceIP** | **kotlin.String** | | [optional] + + + diff --git a/docs/TasksApi.md b/docs/TasksApi.md new file mode 100644 index 0000000..5bd00f7 --- /dev/null +++ b/docs/TasksApi.md @@ -0,0 +1,214 @@ +# TasksApi + +All URIs are relative to *http://localhost:3000/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**tasksGet**](TasksApi.md#tasksGet) | **GET** /tasks | Get all tasks +[**tasksIdGet**](TasksApi.md#tasksIdGet) | **GET** /tasks/{id} | Get a task +[**tasksIdPatch**](TasksApi.md#tasksIdPatch) | **PATCH** /tasks/{id} | Update a task +[**tasksPost**](TasksApi.md#tasksPost) | **POST** /tasks | Create a task + + + +# **tasksGet** +> TasksGet200Response tasksGet(server, type, state, sortBy, projectBy, limit, page) + +Get all tasks + +Retrieve tasks, typically filtered for a specific server for it to action. + +### Example +```kotlin +// Import classes: +//import org.trackedout.client.infrastructure.* +//import org.trackedout.client.models.* + +val apiInstance = TasksApi() +val server : kotlin.String = server_example // kotlin.String | Server name +val type : kotlin.String = type_example // kotlin.String | Task type +val state : kotlin.String = state_example // kotlin.String | Task state +val sortBy : kotlin.String = sortBy_example // kotlin.String | sort by query in the form of field:desc/asc (ex. name:asc) +val projectBy : kotlin.String = projectBy_example // kotlin.String | project by query in the form of field:hide/include (ex. name:hide) +val limit : kotlin.Int = 56 // kotlin.Int | Maximum number of tasks +val page : kotlin.Int = 56 // kotlin.Int | Page number +try { + val result : TasksGet200Response = apiInstance.tasksGet(server, type, state, sortBy, projectBy, limit, page) + println(result) +} catch (e: ClientException) { + println("4xx response calling TasksApi#tasksGet") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling TasksApi#tasksGet") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **server** | **kotlin.String**| Server name | [optional] + **type** | **kotlin.String**| Task type | [optional] + **state** | **kotlin.String**| Task state | [optional] + **sortBy** | **kotlin.String**| sort by query in the form of field:desc/asc (ex. name:asc) | [optional] + **projectBy** | **kotlin.String**| project by query in the form of field:hide/include (ex. name:hide) | [optional] + **limit** | **kotlin.Int**| Maximum number of tasks | [optional] + **page** | **kotlin.Int**| Page number | [optional] [default to 1] + +### Return type + +[**TasksGet200Response**](TasksGet200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +# **tasksIdGet** +> Task tasksIdGet(id) + +Get a task + +Get a task by ID + +### Example +```kotlin +// Import classes: +//import org.trackedout.client.infrastructure.* +//import org.trackedout.client.models.* + +val apiInstance = TasksApi() +val id : kotlin.String = id_example // kotlin.String | Task ID +try { + val result : Task = apiInstance.tasksIdGet(id) + println(result) +} catch (e: ClientException) { + println("4xx response calling TasksApi#tasksIdGet") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling TasksApi#tasksIdGet") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **kotlin.String**| Task ID | + +### Return type + +[**Task**](Task.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +# **tasksIdPatch** +> Task tasksIdPatch(id, tasksIdPatchRequest) + +Update a task + +Update a task's state to one of [ \"SCHEDULED\", \"IN_PROGRESS\", \"SUCCEEDED\", \"FAILED\" ] + +### Example +```kotlin +// Import classes: +//import org.trackedout.client.infrastructure.* +//import org.trackedout.client.models.* + +val apiInstance = TasksApi() +val id : kotlin.String = id_example // kotlin.String | Task id +val tasksIdPatchRequest : TasksIdPatchRequest = // TasksIdPatchRequest | +try { + val result : Task = apiInstance.tasksIdPatch(id, tasksIdPatchRequest) + println(result) +} catch (e: ClientException) { + println("4xx response calling TasksApi#tasksIdPatch") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling TasksApi#tasksIdPatch") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **kotlin.String**| Task id | + **tasksIdPatchRequest** | [**TasksIdPatchRequest**](TasksIdPatchRequest.md)| | + +### Return type + +[**Task**](Task.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +# **tasksPost** +> Task tasksPost(task) + +Create a task + +Schedule a remote task for one of the Decked Out 2 instances. + +### Example +```kotlin +// Import classes: +//import org.trackedout.client.infrastructure.* +//import org.trackedout.client.models.* + +val apiInstance = TasksApi() +val task : Task = // Task | +try { + val result : Task = apiInstance.tasksPost(task) + println(result) +} catch (e: ClientException) { + println("4xx response calling TasksApi#tasksPost") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling TasksApi#tasksPost") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **task** | [**Task**](Task.md)| | + +### Return type + +[**Task**](Task.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + diff --git a/docs/TasksGet200Response.md b/docs/TasksGet200Response.md new file mode 100644 index 0000000..45ec561 --- /dev/null +++ b/docs/TasksGet200Response.md @@ -0,0 +1,14 @@ + +# TasksGet200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**results** | [**kotlin.collections.List<Task>**](Task.md) | | [optional] +**page** | **kotlin.Int** | | [optional] +**limit** | **kotlin.Int** | | [optional] +**totalPages** | **kotlin.Int** | | [optional] +**totalResults** | **kotlin.Int** | | [optional] + + + diff --git a/docs/TasksIdPatchRequest.md b/docs/TasksIdPatchRequest.md new file mode 100644 index 0000000..1960070 --- /dev/null +++ b/docs/TasksIdPatchRequest.md @@ -0,0 +1,10 @@ + +# TasksIdPatchRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**state** | **kotlin.String** | | [optional] + + + diff --git a/src/main/kotlin/org/trackedout/client/apis/EventsApi.kt b/src/main/kotlin/org/trackedout/client/apis/EventsApi.kt index 976e3a9..4b25617 100644 --- a/src/main/kotlin/org/trackedout/client/apis/EventsApi.kt +++ b/src/main/kotlin/org/trackedout/client/apis/EventsApi.kt @@ -149,7 +149,7 @@ class EventsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient path = "/events", query = localVariableQuery, headers = localVariableHeaders, - requiresAuthentication = true, + requiresAuthentication = false, body = localVariableBody ) } @@ -221,7 +221,7 @@ class EventsApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient path = "/events", query = localVariableQuery, headers = localVariableHeaders, - requiresAuthentication = true, + requiresAuthentication = false, body = localVariableBody ) } diff --git a/src/main/kotlin/org/trackedout/client/apis/TasksApi.kt b/src/main/kotlin/org/trackedout/client/apis/TasksApi.kt new file mode 100644 index 0000000..f3ab888 --- /dev/null +++ b/src/main/kotlin/org/trackedout/client/apis/TasksApi.kt @@ -0,0 +1,384 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.trackedout.client.apis + +import java.io.IOException +import okhttp3.OkHttpClient +import okhttp3.HttpUrl + +import org.trackedout.client.models.Error +import org.trackedout.client.models.Task +import org.trackedout.client.models.TasksGet200Response +import org.trackedout.client.models.TasksIdPatchRequest + +import com.squareup.moshi.Json + +import org.trackedout.client.infrastructure.ApiClient +import org.trackedout.client.infrastructure.ApiResponse +import org.trackedout.client.infrastructure.ClientException +import org.trackedout.client.infrastructure.ClientError +import org.trackedout.client.infrastructure.ServerException +import org.trackedout.client.infrastructure.ServerError +import org.trackedout.client.infrastructure.MultiValueMap +import org.trackedout.client.infrastructure.PartConfig +import org.trackedout.client.infrastructure.RequestConfig +import org.trackedout.client.infrastructure.RequestMethod +import org.trackedout.client.infrastructure.ResponseType +import org.trackedout.client.infrastructure.Success +import org.trackedout.client.infrastructure.toMultiValue + +class TasksApi(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:3000/v1") + } + } + + /** + * Get all tasks + * Retrieve tasks, typically filtered for a specific server for it to action. + * @param server Server name (optional) + * @param type Task type (optional) + * @param state Task state (optional) + * @param sortBy sort by query in the form of field:desc/asc (ex. name:asc) (optional) + * @param projectBy project by query in the form of field:hide/include (ex. name:hide) (optional) + * @param limit Maximum number of tasks (optional) + * @param page Page number (optional, default to 1) + * @return TasksGet200Response + * @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 tasksGet(server: kotlin.String? = null, type: kotlin.String? = null, state: kotlin.String? = null, sortBy: kotlin.String? = null, projectBy: kotlin.String? = null, limit: kotlin.Int? = null, page: kotlin.Int? = 1) : TasksGet200Response { + val localVarResponse = tasksGetWithHttpInfo(server = server, type = type, state = state, sortBy = sortBy, projectBy = projectBy, limit = limit, page = page) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as TasksGet200Response + 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 tasks + * Retrieve tasks, typically filtered for a specific server for it to action. + * @param server Server name (optional) + * @param type Task type (optional) + * @param state Task state (optional) + * @param sortBy sort by query in the form of field:desc/asc (ex. name:asc) (optional) + * @param projectBy project by query in the form of field:hide/include (ex. name:hide) (optional) + * @param limit Maximum number of tasks (optional) + * @param page Page number (optional, default to 1) + * @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 tasksGetWithHttpInfo(server: kotlin.String?, type: kotlin.String?, state: kotlin.String?, sortBy: kotlin.String?, projectBy: kotlin.String?, limit: kotlin.Int?, page: kotlin.Int?) : ApiResponse { + val localVariableConfig = tasksGetRequestConfig(server = server, type = type, state = state, sortBy = sortBy, projectBy = projectBy, limit = limit, page = page) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation tasksGet + * + * @param server Server name (optional) + * @param type Task type (optional) + * @param state Task state (optional) + * @param sortBy sort by query in the form of field:desc/asc (ex. name:asc) (optional) + * @param projectBy project by query in the form of field:hide/include (ex. name:hide) (optional) + * @param limit Maximum number of tasks (optional) + * @param page Page number (optional, default to 1) + * @return RequestConfig + */ + fun tasksGetRequestConfig(server: kotlin.String?, type: kotlin.String?, state: kotlin.String?, sortBy: kotlin.String?, projectBy: kotlin.String?, limit: kotlin.Int?, page: kotlin.Int?) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf>() + .apply { + if (server != null) { + put("server", listOf(server.toString())) + } + if (type != null) { + put("type", listOf(type.toString())) + } + if (state != null) { + put("state", listOf(state.toString())) + } + if (sortBy != null) { + put("sortBy", listOf(sortBy.toString())) + } + if (projectBy != null) { + put("projectBy", listOf(projectBy.toString())) + } + if (limit != null) { + put("limit", listOf(limit.toString())) + } + if (page != null) { + put("page", listOf(page.toString())) + } + } + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/tasks", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + /** + * Get a task + * Get a task by ID + * @param id Task ID + * @return Task + * @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 tasksIdGet(id: kotlin.String) : Task { + val localVarResponse = tasksIdGetWithHttpInfo(id = id) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as Task + 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 a task + * Get a task by ID + * @param id Task 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 tasksIdGetWithHttpInfo(id: kotlin.String) : ApiResponse { + val localVariableConfig = tasksIdGetRequestConfig(id = id) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation tasksIdGet + * + * @param id Task ID + * @return RequestConfig + */ + fun tasksIdGetRequestConfig(id: kotlin.String) : RequestConfig { + val localVariableBody = null + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/tasks/{id}".replace("{"+"id"+"}", encodeURIComponent(id.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + /** + * Update a task + * Update a task's state to one of [ \"SCHEDULED\", \"IN_PROGRESS\", \"SUCCEEDED\", \"FAILED\" ] + * @param id Task id + * @param tasksIdPatchRequest + * @return Task + * @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 tasksIdPatch(id: kotlin.String, tasksIdPatchRequest: TasksIdPatchRequest) : Task { + val localVarResponse = tasksIdPatchWithHttpInfo(id = id, tasksIdPatchRequest = tasksIdPatchRequest) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as Task + 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) + } + } + } + + /** + * Update a task + * Update a task's state to one of [ \"SCHEDULED\", \"IN_PROGRESS\", \"SUCCEEDED\", \"FAILED\" ] + * @param id Task id + * @param tasksIdPatchRequest + * @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 tasksIdPatchWithHttpInfo(id: kotlin.String, tasksIdPatchRequest: TasksIdPatchRequest) : ApiResponse { + val localVariableConfig = tasksIdPatchRequestConfig(id = id, tasksIdPatchRequest = tasksIdPatchRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation tasksIdPatch + * + * @param id Task id + * @param tasksIdPatchRequest + * @return RequestConfig + */ + fun tasksIdPatchRequestConfig(id: kotlin.String, tasksIdPatchRequest: TasksIdPatchRequest) : RequestConfig { + val localVariableBody = tasksIdPatchRequest + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.PATCH, + path = "/tasks/{id}".replace("{"+"id"+"}", encodeURIComponent(id.toString())), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + /** + * Create a task + * Schedule a remote task for one of the Decked Out 2 instances. + * @param task + * @return Task + * @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 tasksPost(task: Task) : Task { + val localVarResponse = tasksPostWithHttpInfo(task = task) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as Task + 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) + } + } + } + + /** + * Create a task + * Schedule a remote task for one of the Decked Out 2 instances. + * @param task + * @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 tasksPostWithHttpInfo(task: Task) : ApiResponse { + val localVariableConfig = tasksPostRequestConfig(task = task) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation tasksPost + * + * @param task + * @return RequestConfig + */ + fun tasksPostRequestConfig(task: Task) : RequestConfig { + val localVariableBody = task + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/tasks", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] +} diff --git a/src/main/kotlin/org/trackedout/client/models/Task.kt b/src/main/kotlin/org/trackedout/client/models/Task.kt new file mode 100644 index 0000000..dc841c4 --- /dev/null +++ b/src/main/kotlin/org/trackedout/client/models/Task.kt @@ -0,0 +1,55 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.trackedout.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param id + * @param type + * @param arguments + * @param targetPlayer + * @param server + * @param sourceIP + */ + + +data class Task ( + + @Json(name = "id") + val id: kotlin.String? = null, + + @Json(name = "type") + val type: kotlin.String? = null, + + @Json(name = "arguments") + val arguments: kotlin.collections.List? = null, + + @Json(name = "targetPlayer") + val targetPlayer: kotlin.String? = null, + + @Json(name = "server") + val server: kotlin.String? = null, + + @Json(name = "sourceIP") + val sourceIP: kotlin.String? = null + +) + diff --git a/src/main/kotlin/org/trackedout/client/models/TasksGet200Response.kt b/src/main/kotlin/org/trackedout/client/models/TasksGet200Response.kt new file mode 100644 index 0000000..1bb430d --- /dev/null +++ b/src/main/kotlin/org/trackedout/client/models/TasksGet200Response.kt @@ -0,0 +1,52 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.trackedout.client.models + +import org.trackedout.client.models.Task + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param results + * @param page + * @param limit + * @param totalPages + * @param totalResults + */ + + +data class TasksGet200Response ( + + @Json(name = "results") + val results: kotlin.collections.List? = null, + + @Json(name = "page") + val page: kotlin.Int? = null, + + @Json(name = "limit") + val limit: kotlin.Int? = null, + + @Json(name = "totalPages") + val totalPages: kotlin.Int? = null, + + @Json(name = "totalResults") + val totalResults: kotlin.Int? = null + +) + diff --git a/src/main/kotlin/org/trackedout/client/models/TasksIdPatchRequest.kt b/src/main/kotlin/org/trackedout/client/models/TasksIdPatchRequest.kt new file mode 100644 index 0000000..7011b39 --- /dev/null +++ b/src/main/kotlin/org/trackedout/client/models/TasksIdPatchRequest.kt @@ -0,0 +1,35 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.trackedout.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param state + */ + + +data class TasksIdPatchRequest ( + + @Json(name = "state") + val state: kotlin.String? = null + +) +