/* 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 { AuthorizationCheckHeaderToJSON, CloudmailinMessageToJSON, MessageRecipientSetToJSON, MessageStatusToJSON, MessageToUserFromJSON, MessageToUserToJSON, PaginatedResultsOfMessageBundleFromJSON, PaginatedResultsOfMessageToUserFromJSON, } from '../models/index';
/**
 *
 */
export class MessageServicesApi extends runtime.BaseAPI {
    /**
     */
    async deleteRepoV1AdminMessageMessageIdRaw(requestParameters, initOverrides) {
        if (requestParameters['messageId'] == null) {
            throw new runtime.RequiredError('messageId', 'Required parameter "messageId" was null or undefined when calling deleteRepoV1AdminMessageMessageId().');
        }
        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/admin/message/{messageId}`;
        urlPath = urlPath.replace(`{${"messageId"}}`, encodeURIComponent(String(requestParameters['messageId'])));
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteRepoV1AdminMessageMessageId(requestParameters, initOverrides) {
        await this.deleteRepoV1AdminMessageMessageIdRaw(requestParameters, initOverrides);
    }
    /**
     */
    async getRepoV1MessageInboxRaw(requestParameters, initOverrides) {
        if (requestParameters['inboxFilter'] == null) {
            throw new runtime.RequiredError('inboxFilter', 'Required parameter "inboxFilter" was null or undefined when calling getRepoV1MessageInbox().');
        }
        if (requestParameters['orderBy'] == null) {
            throw new runtime.RequiredError('orderBy', 'Required parameter "orderBy" was null or undefined when calling getRepoV1MessageInbox().');
        }
        if (requestParameters['descending'] == null) {
            throw new runtime.RequiredError('descending', 'Required parameter "descending" was null or undefined when calling getRepoV1MessageInbox().');
        }
        if (requestParameters['limit'] == null) {
            throw new runtime.RequiredError('limit', 'Required parameter "limit" was null or undefined when calling getRepoV1MessageInbox().');
        }
        if (requestParameters['offset'] == null) {
            throw new runtime.RequiredError('offset', 'Required parameter "offset" was null or undefined when calling getRepoV1MessageInbox().');
        }
        const queryParameters = {};
        if (requestParameters['inboxFilter'] != null) {
            queryParameters['inboxFilter'] = requestParameters['inboxFilter'];
        }
        if (requestParameters['orderBy'] != null) {
            queryParameters['orderBy'] = requestParameters['orderBy'];
        }
        if (requestParameters['descending'] != null) {
            queryParameters['descending'] = requestParameters['descending'];
        }
        if (requestParameters['limit'] != null) {
            queryParameters['limit'] = requestParameters['limit'];
        }
        if (requestParameters['offset'] != null) {
            queryParameters['offset'] = requestParameters['offset'];
        }
        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/message/inbox`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedResultsOfMessageBundleFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1MessageInbox(requestParameters, initOverrides) {
        const response = await this.getRepoV1MessageInboxRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1MessageMessageIdRaw(requestParameters, initOverrides) {
        if (requestParameters['messageId'] == null) {
            throw new runtime.RequiredError('messageId', 'Required parameter "messageId" was null or undefined when calling getRepoV1MessageMessageId().');
        }
        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/message/{messageId}`;
        urlPath = urlPath.replace(`{${"messageId"}}`, encodeURIComponent(String(requestParameters['messageId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => MessageToUserFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1MessageMessageId(requestParameters, initOverrides) {
        const response = await this.getRepoV1MessageMessageIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1MessageMessageIdConversationRaw(requestParameters, initOverrides) {
        if (requestParameters['messageId'] == null) {
            throw new runtime.RequiredError('messageId', 'Required parameter "messageId" was null or undefined when calling getRepoV1MessageMessageIdConversation().');
        }
        if (requestParameters['orderBy'] == null) {
            throw new runtime.RequiredError('orderBy', 'Required parameter "orderBy" was null or undefined when calling getRepoV1MessageMessageIdConversation().');
        }
        if (requestParameters['descending'] == null) {
            throw new runtime.RequiredError('descending', 'Required parameter "descending" was null or undefined when calling getRepoV1MessageMessageIdConversation().');
        }
        if (requestParameters['limit'] == null) {
            throw new runtime.RequiredError('limit', 'Required parameter "limit" was null or undefined when calling getRepoV1MessageMessageIdConversation().');
        }
        if (requestParameters['offset'] == null) {
            throw new runtime.RequiredError('offset', 'Required parameter "offset" was null or undefined when calling getRepoV1MessageMessageIdConversation().');
        }
        const queryParameters = {};
        if (requestParameters['orderBy'] != null) {
            queryParameters['orderBy'] = requestParameters['orderBy'];
        }
        if (requestParameters['descending'] != null) {
            queryParameters['descending'] = requestParameters['descending'];
        }
        if (requestParameters['limit'] != null) {
            queryParameters['limit'] = requestParameters['limit'];
        }
        if (requestParameters['offset'] != null) {
            queryParameters['offset'] = requestParameters['offset'];
        }
        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/message/{messageId}/conversation`;
        urlPath = urlPath.replace(`{${"messageId"}}`, encodeURIComponent(String(requestParameters['messageId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedResultsOfMessageToUserFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1MessageMessageIdConversation(requestParameters, initOverrides) {
        const response = await this.getRepoV1MessageMessageIdConversationRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1MessageMessageIdFileRaw(requestParameters, initOverrides) {
        if (requestParameters['messageId'] == null) {
            throw new runtime.RequiredError('messageId', 'Required parameter "messageId" was null or undefined when calling getRepoV1MessageMessageIdFile().');
        }
        const queryParameters = {};
        if (requestParameters['redirect'] != null) {
            queryParameters['redirect'] = requestParameters['redirect'];
        }
        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/message/{messageId}/file`;
        urlPath = urlPath.replace(`{${"messageId"}}`, encodeURIComponent(String(requestParameters['messageId'])));
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        if (this.isJsonMime(response.headers.get('content-type'))) {
            return new runtime.JSONApiResponse(response);
        }
        else {
            return new runtime.TextApiResponse(response);
        }
    }
    /**
     */
    async getRepoV1MessageMessageIdFile(requestParameters, initOverrides) {
        const response = await this.getRepoV1MessageMessageIdFileRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1MessageOutboxRaw(requestParameters, initOverrides) {
        if (requestParameters['orderBy'] == null) {
            throw new runtime.RequiredError('orderBy', 'Required parameter "orderBy" was null or undefined when calling getRepoV1MessageOutbox().');
        }
        if (requestParameters['descending'] == null) {
            throw new runtime.RequiredError('descending', 'Required parameter "descending" was null or undefined when calling getRepoV1MessageOutbox().');
        }
        if (requestParameters['limit'] == null) {
            throw new runtime.RequiredError('limit', 'Required parameter "limit" was null or undefined when calling getRepoV1MessageOutbox().');
        }
        if (requestParameters['offset'] == null) {
            throw new runtime.RequiredError('offset', 'Required parameter "offset" was null or undefined when calling getRepoV1MessageOutbox().');
        }
        const queryParameters = {};
        if (requestParameters['orderBy'] != null) {
            queryParameters['orderBy'] = requestParameters['orderBy'];
        }
        if (requestParameters['descending'] != null) {
            queryParameters['descending'] = requestParameters['descending'];
        }
        if (requestParameters['limit'] != null) {
            queryParameters['limit'] = requestParameters['limit'];
        }
        if (requestParameters['offset'] != null) {
            queryParameters['offset'] = requestParameters['offset'];
        }
        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/message/outbox`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedResultsOfMessageToUserFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1MessageOutbox(requestParameters, initOverrides) {
        const response = await this.getRepoV1MessageOutboxRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1CloudMailInAuthorizationRaw(requestParameters, initOverrides) {
        if (requestParameters['authorizationCheckHeader'] == null) {
            throw new runtime.RequiredError('authorizationCheckHeader', 'Required parameter "authorizationCheckHeader" was null or undefined when calling postRepoV1CloudMailInAuthorization().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        let urlPath = `/repo/v1/cloudMailInAuthorization`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: AuthorizationCheckHeaderToJSON(requestParameters['authorizationCheckHeader']),
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async postRepoV1CloudMailInAuthorization(requestParameters, initOverrides) {
        await this.postRepoV1CloudMailInAuthorizationRaw(requestParameters, initOverrides);
    }
    /**
     */
    async postRepoV1CloudMailInMessageRaw(requestParameters, initOverrides) {
        if (requestParameters['cloudmailinMessage'] == null) {
            throw new runtime.RequiredError('cloudmailinMessage', 'Required parameter "cloudmailinMessage" was null or undefined when calling postRepoV1CloudMailInMessage().');
        }
        const queryParameters = {};
        if (requestParameters['notificationUnsubscribeEndpoint'] != null) {
            queryParameters['notificationUnsubscribeEndpoint'] = requestParameters['notificationUnsubscribeEndpoint'];
        }
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        let urlPath = `/repo/v1/cloudMailInMessage`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: CloudmailinMessageToJSON(requestParameters['cloudmailinMessage']),
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async postRepoV1CloudMailInMessage(requestParameters, initOverrides) {
        await this.postRepoV1CloudMailInMessageRaw(requestParameters, initOverrides);
    }
    /**
     */
    async postRepoV1EntityIdMessageRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling postRepoV1EntityIdMessage().');
        }
        if (requestParameters['messageToUser'] == null) {
            throw new runtime.RequiredError('messageToUser', 'Required parameter "messageToUser" was null or undefined when calling postRepoV1EntityIdMessage().');
        }
        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/entity/{id}/message`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: MessageToUserToJSON(requestParameters['messageToUser']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => MessageToUserFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1EntityIdMessage(requestParameters, initOverrides) {
        const response = await this.postRepoV1EntityIdMessageRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1MessageRaw(requestParameters, initOverrides) {
        if (requestParameters['messageToUser'] == null) {
            throw new runtime.RequiredError('messageToUser', 'Required parameter "messageToUser" was null or undefined when calling postRepoV1Message().');
        }
        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/message`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: MessageToUserToJSON(requestParameters['messageToUser']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => MessageToUserFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1Message(requestParameters, initOverrides) {
        const response = await this.postRepoV1MessageRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1MessageMessageIdForwardRaw(requestParameters, initOverrides) {
        if (requestParameters['messageId'] == null) {
            throw new runtime.RequiredError('messageId', 'Required parameter "messageId" was null or undefined when calling postRepoV1MessageMessageIdForward().');
        }
        if (requestParameters['messageRecipientSet'] == null) {
            throw new runtime.RequiredError('messageRecipientSet', 'Required parameter "messageRecipientSet" was null or undefined when calling postRepoV1MessageMessageIdForward().');
        }
        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/message/{messageId}/forward`;
        urlPath = urlPath.replace(`{${"messageId"}}`, encodeURIComponent(String(requestParameters['messageId'])));
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: MessageRecipientSetToJSON(requestParameters['messageRecipientSet']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => MessageToUserFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1MessageMessageIdForward(requestParameters, initOverrides) {
        const response = await this.postRepoV1MessageMessageIdForwardRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1MessageStatusRaw(requestParameters, initOverrides) {
        if (requestParameters['messageStatus'] == null) {
            throw new runtime.RequiredError('messageStatus', 'Required parameter "messageStatus" was null or undefined when calling putRepoV1MessageStatus().');
        }
        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/message/status`;
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: MessageStatusToJSON(requestParameters['messageStatus']),
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async putRepoV1MessageStatus(requestParameters, initOverrides) {
        await this.putRepoV1MessageStatusRaw(requestParameters, initOverrides);
    }
}
//# sourceMappingURL=MessageServicesApi.js.map