/* tslint:disable */
/* eslint-disable */
/**
 * Vitron API
 * API documentation for Vitron backend
 *
 * The version of the OpenAPI document: v1
 * Contact: support@yourcompany.com
 *
 * 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 {
  Courier,
} from '../models';

export interface ApiOrderV1CouriersCreateRequest {
    data: Courier;
}

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

    /**
     * Create a new courier. Only superadmins can perform this action.
     * Create Courier
     */
    async apiOrderV1CouriersCreateRaw(requestParameters: ApiOrderV1CouriersCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Courier>> {
        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiOrderV1CouriersCreate.');
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

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

        if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) {
            headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password);
        }
        const response = await this.request({
            path: `/api/order/v1/couriers/`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: requestParameters.data,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Create a new courier. Only superadmins can perform this action.
     * Create Courier
     */
    async apiOrderV1CouriersCreate(requestParameters: ApiOrderV1CouriersCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Courier> {
        const response = await this.apiOrderV1CouriersCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Retrieve all couriers. Accessible by all users.
     * List Couriers
     */
    async apiOrderV1CouriersListRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<Courier>>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) {
            headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password);
        }
        const response = await this.request({
            path: `/api/order/v1/couriers/`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Retrieve all couriers. Accessible by all users.
     * List Couriers
     */
    async apiOrderV1CouriersList(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<Courier>> {
        const response = await this.apiOrderV1CouriersListRaw(initOverrides);
        return await response.value();
    }

}
