/* tslint:disable */
/* eslint-disable */
/**
 * Synapse REST API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v1
 *
 *
 * 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 { SubscriberCountFromJSON, SubscriberPagedResultsFromJSON, SubscriptionFromJSON, SubscriptionPagedResultsFromJSON, SubscriptionRequestToJSON, TopicToJSON, } from '../models/index';
/**
 *
 */
export class SubscriptionServicesApi extends runtime.BaseAPI {
    /**
     */
    async deleteRepoV1SubscriptionAllRaw(initOverrides) {
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/subscription/all`;
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteRepoV1SubscriptionAll(initOverrides) {
        await this.deleteRepoV1SubscriptionAllRaw(initOverrides);
    }
    /**
     */
    async deleteRepoV1SubscriptionIdRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteRepoV1SubscriptionId().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/subscription/{id}`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteRepoV1SubscriptionId(requestParameters, initOverrides) {
        await this.deleteRepoV1SubscriptionIdRaw(requestParameters, initOverrides);
    }
    /**
     */
    async getRepoV1SubscriptionAllRaw(requestParameters, initOverrides) {
        if (requestParameters['limit'] == null) {
            throw new runtime.RequiredError('limit', 'Required parameter "limit" was null or undefined when calling getRepoV1SubscriptionAll().');
        }
        if (requestParameters['offset'] == null) {
            throw new runtime.RequiredError('offset', 'Required parameter "offset" was null or undefined when calling getRepoV1SubscriptionAll().');
        }
        if (requestParameters['objectType'] == null) {
            throw new runtime.RequiredError('objectType', 'Required parameter "objectType" was null or undefined when calling getRepoV1SubscriptionAll().');
        }
        const queryParameters = {};
        if (requestParameters['limit'] != null) {
            queryParameters['limit'] = requestParameters['limit'];
        }
        if (requestParameters['offset'] != null) {
            queryParameters['offset'] = requestParameters['offset'];
        }
        if (requestParameters['objectType'] != null) {
            queryParameters['objectType'] = requestParameters['objectType'];
        }
        if (requestParameters['sortBy'] != null) {
            queryParameters['sortBy'] = requestParameters['sortBy'];
        }
        if (requestParameters['sortDirection'] != null) {
            queryParameters['sortDirection'] = requestParameters['sortDirection'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/subscription/all`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => SubscriptionPagedResultsFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1SubscriptionAll(requestParameters, initOverrides) {
        const response = await this.getRepoV1SubscriptionAllRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1SubscriptionIdRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getRepoV1SubscriptionId().');
        }
        const queryParameters = {};
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/subscription/{id}`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => SubscriptionFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1SubscriptionId(requestParameters, initOverrides) {
        const response = await this.getRepoV1SubscriptionIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1SubscriptionRaw(requestParameters, initOverrides) {
        if (requestParameters['topic'] == null) {
            throw new runtime.RequiredError('topic', 'Required parameter "topic" was null or undefined when calling postRepoV1Subscription().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/subscription`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: TopicToJSON(requestParameters['topic']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => SubscriptionFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1Subscription(requestParameters, initOverrides) {
        const response = await this.postRepoV1SubscriptionRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1SubscriptionAllRaw(requestParameters, initOverrides) {
        if (requestParameters['objectType'] == null) {
            throw new runtime.RequiredError('objectType', 'Required parameter "objectType" was null or undefined when calling postRepoV1SubscriptionAll().');
        }
        const queryParameters = {};
        if (requestParameters['objectType'] != null) {
            queryParameters['objectType'] = requestParameters['objectType'];
        }
        const headerParameters = {};
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/subscription/all`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => SubscriptionFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1SubscriptionAll(requestParameters, initOverrides) {
        const response = await this.postRepoV1SubscriptionAllRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1SubscriptionListRaw(requestParameters, initOverrides) {
        if (requestParameters['subscriptionRequest'] == null) {
            throw new runtime.RequiredError('subscriptionRequest', 'Required parameter "subscriptionRequest" was null or undefined when calling postRepoV1SubscriptionList().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/subscription/list`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: SubscriptionRequestToJSON(requestParameters['subscriptionRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => SubscriptionPagedResultsFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1SubscriptionList(requestParameters, initOverrides) {
        const response = await this.postRepoV1SubscriptionListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1SubscriptionSubscribersRaw(requestParameters, initOverrides) {
        if (requestParameters['topic'] == null) {
            throw new runtime.RequiredError('topic', 'Required parameter "topic" was null or undefined when calling postRepoV1SubscriptionSubscribers().');
        }
        const queryParameters = {};
        if (requestParameters['nextPageToken'] != null) {
            queryParameters['nextPageToken'] = requestParameters['nextPageToken'];
        }
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/subscription/subscribers`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: TopicToJSON(requestParameters['topic']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => SubscriberPagedResultsFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1SubscriptionSubscribers(requestParameters, initOverrides) {
        const response = await this.postRepoV1SubscriptionSubscribersRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1SubscriptionSubscribersCountRaw(requestParameters, initOverrides) {
        if (requestParameters['topic'] == null) {
            throw new runtime.RequiredError('topic', 'Required parameter "topic" was null or undefined when calling postRepoV1SubscriptionSubscribersCount().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("bearerAuth", []);
            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        let urlPath = `/repo/v1/subscription/subscribers/count`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: TopicToJSON(requestParameters['topic']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => SubscriberCountFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1SubscriptionSubscribersCount(requestParameters, initOverrides) {
        const response = await this.postRepoV1SubscriptionSubscribersCountRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
//# sourceMappingURL=SubscriptionServicesApi.js.map