/* 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 {
  ApiInstageramV1InstagramPostsDelete200Response,
  ApiInstageramV1InstagramSyncCreate201Response,
  InstagramPostDetail,
  InstagramSyncRequest,
  PaginatedInstagramPostList,
} from '../models';

export interface ApiInstageramV1InstagramPostsDeleteRequest {
    id: string;
}

export interface ApiInstageramV1InstagramPostsListRequest {
    cursor?: string;
}

export interface ApiInstageramV1InstagramPostsReadRequest {
    id: string;
}

export interface ApiInstageramV1InstagramSyncCreateRequest {
    data: InstagramSyncRequest;
}

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

    /**
     * Delete a specific Instagram post
     */
    async apiInstageramV1InstagramPostsDeleteRaw(requestParameters: ApiInstageramV1InstagramPostsDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApiInstageramV1InstagramPostsDelete200Response>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiInstageramV1InstagramPostsDelete.');
        }

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Delete a specific Instagram post
     */
    async apiInstageramV1InstagramPostsDelete(requestParameters: ApiInstageramV1InstagramPostsDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApiInstageramV1InstagramPostsDelete200Response> {
        const response = await this.apiInstageramV1InstagramPostsDeleteRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * List Instagram posts
     */
    async apiInstageramV1InstagramPostsListRaw(requestParameters: ApiInstageramV1InstagramPostsListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PaginatedInstagramPostList>> {
        const queryParameters: any = {};

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

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * List Instagram posts
     */
    async apiInstageramV1InstagramPostsList(requestParameters: ApiInstageramV1InstagramPostsListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PaginatedInstagramPostList> {
        const response = await this.apiInstageramV1InstagramPostsListRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Get details of a specific Instagram post
     */
    async apiInstageramV1InstagramPostsReadRaw(requestParameters: ApiInstageramV1InstagramPostsReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<InstagramPostDetail>> {
        if (requestParameters.id === null || requestParameters.id === undefined) {
            throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling apiInstageramV1InstagramPostsRead.');
        }

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     * Get details of a specific Instagram post
     */
    async apiInstageramV1InstagramPostsRead(requestParameters: ApiInstageramV1InstagramPostsReadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InstagramPostDetail> {
        const response = await this.apiInstageramV1InstagramPostsReadRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     */
    async apiInstageramV1InstagramSyncCreateRaw(requestParameters: ApiInstageramV1InstagramSyncCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApiInstageramV1InstagramSyncCreate201Response>> {
        if (requestParameters.data === null || requestParameters.data === undefined) {
            throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiInstageramV1InstagramSyncCreate.');
        }

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

        return new runtime.JSONApiResponse(response);
    }

    /**
     */
    async apiInstageramV1InstagramSyncCreate(requestParameters: ApiInstageramV1InstagramSyncCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApiInstageramV1InstagramSyncCreate201Response> {
        const response = await this.apiInstageramV1InstagramSyncCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
