/* tslint:disable */
/* eslint-disable */
/**
 * Dash API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 0.1
 * 
 *
 * 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 {
  InboxItem,
} from '../models';
import {
    InboxItemFromJSON,
    InboxItemToJSON,
} from '../models';

export interface AddInboxItemRequest {
    inboxItem: InboxItem;
}

export interface DeleteInboxItemRequest {
    item: number;
}

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

    /**
     */
    async addInboxItemRaw(requestParameters: AddInboxItemRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.inboxItem === null || requestParameters.inboxItem === undefined) {
            throw new runtime.RequiredError('inboxItem','Required parameter requestParameters.inboxItem was null or undefined when calling addInboxItem.');
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

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

        const response = await this.request({
            path: `/inbox/`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: InboxItemToJSON(requestParameters.inboxItem),
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     */
    async addInboxItem(requestParameters: AddInboxItemRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.addInboxItemRaw(requestParameters, initOverrides);
    }

    /**
     */
    async deleteInboxItemRaw(requestParameters: DeleteInboxItemRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.item === null || requestParameters.item === undefined) {
            throw new runtime.RequiredError('item','Required parameter requestParameters.item was null or undefined when calling deleteInboxItem.');
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        const response = await this.request({
            path: `/inbox/{item}`.replace(`{${"item"}}`, encodeURIComponent(String(requestParameters.item))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     */
    async deleteInboxItem(requestParameters: DeleteInboxItemRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.deleteInboxItemRaw(requestParameters, initOverrides);
    }

    /**
     */
    async getInboxItemsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<InboxItem>>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        const response = await this.request({
            path: `/inbox/`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

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

    /**
     */
    async getInboxItems(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<InboxItem>> {
        const response = await this.getInboxItemsRaw(initOverrides);
        return await response.value();
    }

}
