/* 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 {
  CollectionCursorPage,
  CollectionDetailWithProducts,
  SellerCollectionAddProducts,
  SellerCollectionCreate,
  SellerCollectionUpdate,
} from '../models';

export interface ApiCollectionV1SellerCollectionsCreateRequest {
    data: SellerCollectionCreate;
}

export interface ApiCollectionV1SellerCollectionsDeleteRequest {
    id: string;
}

export interface ApiCollectionV1SellerCollectionsListRequest {
    cursor?: string;
    pageSize?: number;
}

export interface ApiCollectionV1SellerCollectionsPartialUpdateRequest {
    id: string;
    data: SellerCollectionUpdate;
}

export interface ApiCollectionV1SellerCollectionsProductsCreateRequest {
    id: string;
    data: SellerCollectionAddProducts;
}

export interface ApiCollectionV1SellerCollectionsProductsDeleteRequest {
    id: string;
    productId: string;
}

export interface ApiCollectionV1SellerCollectionsReadRequest {
    id: string;
    cursor?: string;
    pageSize?: number;
}

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

    /**
     * Create a collection for the authenticated seller. Returns the created resource.
     * Create a new seller collection
     */
    async apiCollectionV1SellerCollectionsCreateRaw(requestParameters: ApiCollectionV1SellerCollectionsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SellerCollectionCreate>> {
        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiCollectionV1SellerCollectionsCreate.');
        }

        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/collection/v1/seller/collections/`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: requestParameters.data,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Create a collection for the authenticated seller. Returns the created resource.
     * Create a new seller collection
     */
    async apiCollectionV1SellerCollectionsCreate(requestParameters: ApiCollectionV1SellerCollectionsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SellerCollectionCreate> {
        const response = await this.apiCollectionV1SellerCollectionsCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Delete a seller collection
     */
    async apiCollectionV1SellerCollectionsDeleteRaw(requestParameters: ApiCollectionV1SellerCollectionsDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiCollectionV1SellerCollectionsDelete.');
        }

        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/collection/v1/seller/collections/{id}/`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Delete a seller collection
     */
    async apiCollectionV1SellerCollectionsDelete(requestParameters: ApiCollectionV1SellerCollectionsDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.apiCollectionV1SellerCollectionsDeleteRaw(requestParameters, initOverrides);
    }

    /**
     * Lists collections created by the authenticated seller, ordered by newest first.  - Use `cursor` param from `next`/`previous` to paginate. - Optionally set `pageSize`.
     * List seller\'s collections (cursor pagination)
     */
    async apiCollectionV1SellerCollectionsListRaw(requestParameters: ApiCollectionV1SellerCollectionsListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CollectionCursorPage>> {
        const queryParameters: any = {};

        if (requestParameters.cursor !== undefined) {
            queryParameters['cursor'] = requestParameters.cursor;
        }

        if (requestParameters.pageSize !== undefined) {
            queryParameters['pageSize'] = requestParameters.pageSize;
        }

        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/collection/v1/seller/collections/`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Lists collections created by the authenticated seller, ordered by newest first.  - Use `cursor` param from `next`/`previous` to paginate. - Optionally set `pageSize`.
     * List seller\'s collections (cursor pagination)
     */
    async apiCollectionV1SellerCollectionsList(requestParameters: ApiCollectionV1SellerCollectionsListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CollectionCursorPage> {
        const response = await this.apiCollectionV1SellerCollectionsListRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Update a seller collection
     */
    async apiCollectionV1SellerCollectionsPartialUpdateRaw(requestParameters: ApiCollectionV1SellerCollectionsPartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SellerCollectionUpdate>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiCollectionV1SellerCollectionsPartialUpdate.');
        }

        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiCollectionV1SellerCollectionsPartialUpdate.');
        }

        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/collection/v1/seller/collections/{id}/`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
            method: 'PATCH',
            headers: headerParameters,
            query: queryParameters,
            body: requestParameters.data,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Update a seller collection
     */
    async apiCollectionV1SellerCollectionsPartialUpdate(requestParameters: ApiCollectionV1SellerCollectionsPartialUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SellerCollectionUpdate> {
        const response = await this.apiCollectionV1SellerCollectionsPartialUpdateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * All products must belong to the authenticated seller. Duplicates are skipped.
     * Add product(s) to a seller collection
     */
    async apiCollectionV1SellerCollectionsProductsCreateRaw(requestParameters: ApiCollectionV1SellerCollectionsProductsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SellerCollectionAddProducts>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiCollectionV1SellerCollectionsProductsCreate.');
        }

        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiCollectionV1SellerCollectionsProductsCreate.');
        }

        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/collection/v1/seller/collections/{id}/products/`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: requestParameters.data,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * All products must belong to the authenticated seller. Duplicates are skipped.
     * Add product(s) to a seller collection
     */
    async apiCollectionV1SellerCollectionsProductsCreate(requestParameters: ApiCollectionV1SellerCollectionsProductsCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SellerCollectionAddProducts> {
        const response = await this.apiCollectionV1SellerCollectionsProductsCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Remove a product from a seller collection
     */
    async apiCollectionV1SellerCollectionsProductsDeleteRaw(requestParameters: ApiCollectionV1SellerCollectionsProductsDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiCollectionV1SellerCollectionsProductsDelete.');
        }

        if (requestParameters.productId === null || requestParameters.productId === undefined) {
            throw new runtime.RequiredError('productId','Required parameter requestParameters.productId was null or undefined when calling apiCollectionV1SellerCollectionsProductsDelete.');
        }

        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/collection/v1/seller/collections/{id}/products/{product_id}/`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"product_id"}}`, encodeURIComponent(String(requestParameters.productId))),
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     * Remove a product from a seller collection
     */
    async apiCollectionV1SellerCollectionsProductsDelete(requestParameters: ApiCollectionV1SellerCollectionsProductsDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.apiCollectionV1SellerCollectionsProductsDeleteRaw(requestParameters, initOverrides);
    }

    /**
     * Returns the collection owned by the authenticated seller, plus a cursor-paginated list of products.  Use `cursor` and `pageSize` to paginate products.
     * Get a seller collection (with cursor-paginated products)
     */
    async apiCollectionV1SellerCollectionsReadRaw(requestParameters: ApiCollectionV1SellerCollectionsReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CollectionDetailWithProducts>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiCollectionV1SellerCollectionsRead.');
        }

        const queryParameters: any = {};

        if (requestParameters.cursor !== undefined) {
            queryParameters['cursor'] = requestParameters.cursor;
        }

        if (requestParameters.pageSize !== undefined) {
            queryParameters['pageSize'] = requestParameters.pageSize;
        }

        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/collection/v1/seller/collections/{id}/`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Returns the collection owned by the authenticated seller, plus a cursor-paginated list of products.  Use `cursor` and `pageSize` to paginate products.
     * Get a seller collection (with cursor-paginated products)
     */
    async apiCollectionV1SellerCollectionsRead(requestParameters: ApiCollectionV1SellerCollectionsReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CollectionDetailWithProducts> {
        const response = await this.apiCollectionV1SellerCollectionsReadRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
