/* tslint:disable */
/* eslint-disable */
/**
 * elkar-app
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 0.1.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


import * as runtime from '../runtime';
import type {
  PaginatedOutputTaskResponse,
  RetrieveTasksInput,
  TaskResponse,
} from '../models/index';
import {
    PaginatedOutputTaskResponseFromJSON,
    PaginatedOutputTaskResponseToJSON,
    RetrieveTasksInputFromJSON,
    RetrieveTasksInputToJSON,
    TaskResponseFromJSON,
    TaskResponseToJSON,
} from '../models/index';

export interface EpGetTaskRequest {
    taskId: string;
}

export interface EpRetrieveTasksRequest {
    retrieveTasksInput: RetrieveTasksInput;
}

/**
 * 
 */
export class TaskApi extends runtime.BaseAPI {

    /**
     * Get task
     */
    async epGetTaskRaw(requestParameters: EpGetTaskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TaskResponse>> {
        if (requestParameters['taskId'] == null) {
            throw new runtime.RequiredError(
                'taskId',
                'Required parameter "taskId" was null or undefined when calling epGetTask().'
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        const response = await this.request({
            path: `/tasks/{task_id}`.replace(`{${"task_id"}}`, encodeURIComponent(String(requestParameters['taskId']))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => TaskResponseFromJSON(jsonValue));
    }

    /**
     * Get task
     */
    async epGetTask(requestParameters: EpGetTaskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TaskResponse> {
        const response = await this.epGetTaskRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Retrieve tasks
     */
    async epRetrieveTasksRaw(requestParameters: EpRetrieveTasksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedOutputTaskResponse>> {
        if (requestParameters['retrieveTasksInput'] == null) {
            throw new runtime.RequiredError(
                'retrieveTasksInput',
                'Required parameter "retrieveTasksInput" was null or undefined when calling epRetrieveTasks().'
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        const response = await this.request({
            path: `/tasks/list`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: RetrieveTasksInputToJSON(requestParameters['retrieveTasksInput']),
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedOutputTaskResponseFromJSON(jsonValue));
    }

    /**
     * Retrieve tasks
     */
    async epRetrieveTasks(requestParameters: EpRetrieveTasksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedOutputTaskResponse> {
        const response = await this.epRetrieveTasksRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
