/* 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 { AccountSetupInfoToJSON, AliasCheckRequestToJSON, AliasCheckResponseFromJSON, EmailValidationSignedTokenToJSON, LoginResponseFromJSON, NewUserToJSON, NotificationEmailFromJSON, PrincipalAliasRequestToJSON, PrincipalAliasResponseFromJSON, UsernameToJSON, } from '../models/index';
/**
 *
 */
export class PrincipalServicesApi extends runtime.BaseAPI {
    /**
     */
    async deleteRepoV1EmailRaw(requestParameters, initOverrides) {
        if (requestParameters['email'] == null) {
            throw new runtime.RequiredError('email', 'Required parameter "email" was null or undefined when calling deleteRepoV1Email().');
        }
        const queryParameters = {};
        if (requestParameters['email'] != null) {
            queryParameters['email'] = requestParameters['email'];
        }
        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/email`;
        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async deleteRepoV1Email(requestParameters, initOverrides) {
        await this.deleteRepoV1EmailRaw(requestParameters, initOverrides);
    }
    /**
     */
    async getRepoV1NotificationEmailRaw(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/notificationEmail`;
        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => NotificationEmailFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1NotificationEmail(initOverrides) {
        const response = await this.getRepoV1NotificationEmailRaw(initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1Account2Raw(requestParameters, initOverrides) {
        if (requestParameters['accountSetupInfo'] == null) {
            throw new runtime.RequiredError('accountSetupInfo', 'Required parameter "accountSetupInfo" was null or undefined when calling postRepoV1Account2().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        let urlPath = `/repo/v1/account2`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: AccountSetupInfoToJSON(requestParameters['accountSetupInfo']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => LoginResponseFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1Account2(requestParameters, initOverrides) {
        const response = await this.postRepoV1Account2Raw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1AccountEmailValidationRaw(requestParameters, initOverrides) {
        if (requestParameters['portalEndpoint'] == null) {
            throw new runtime.RequiredError('portalEndpoint', 'Required parameter "portalEndpoint" was null or undefined when calling postRepoV1AccountEmailValidation().');
        }
        if (requestParameters['newUser'] == null) {
            throw new runtime.RequiredError('newUser', 'Required parameter "newUser" was null or undefined when calling postRepoV1AccountEmailValidation().');
        }
        const queryParameters = {};
        if (requestParameters['portalEndpoint'] != null) {
            queryParameters['portalEndpoint'] = requestParameters['portalEndpoint'];
        }
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        let urlPath = `/repo/v1/account/emailValidation`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: NewUserToJSON(requestParameters['newUser']),
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async postRepoV1AccountEmailValidation(requestParameters, initOverrides) {
        await this.postRepoV1AccountEmailValidationRaw(requestParameters, initOverrides);
    }
    /**
     */
    async postRepoV1AccountIdEmailValidationRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling postRepoV1AccountIdEmailValidation().');
        }
        if (requestParameters['portalEndpoint'] == null) {
            throw new runtime.RequiredError('portalEndpoint', 'Required parameter "portalEndpoint" was null or undefined when calling postRepoV1AccountIdEmailValidation().');
        }
        if (requestParameters['username'] == null) {
            throw new runtime.RequiredError('username', 'Required parameter "username" was null or undefined when calling postRepoV1AccountIdEmailValidation().');
        }
        const queryParameters = {};
        if (requestParameters['portalEndpoint'] != null) {
            queryParameters['portalEndpoint'] = requestParameters['portalEndpoint'];
        }
        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/account/{id}/emailValidation`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: UsernameToJSON(requestParameters['username']),
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async postRepoV1AccountIdEmailValidation(requestParameters, initOverrides) {
        await this.postRepoV1AccountIdEmailValidationRaw(requestParameters, initOverrides);
    }
    /**
     */
    async postRepoV1EmailRaw(requestParameters, initOverrides) {
        if (requestParameters['emailValidationSignedToken'] == null) {
            throw new runtime.RequiredError('emailValidationSignedToken', 'Required parameter "emailValidationSignedToken" was null or undefined when calling postRepoV1Email().');
        }
        const queryParameters = {};
        if (requestParameters['setAsNotificationEmail'] != null) {
            queryParameters['setAsNotificationEmail'] = requestParameters['setAsNotificationEmail'];
        }
        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/email`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: EmailValidationSignedTokenToJSON(requestParameters['emailValidationSignedToken']),
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async postRepoV1Email(requestParameters, initOverrides) {
        await this.postRepoV1EmailRaw(requestParameters, initOverrides);
    }
    /**
     */
    async postRepoV1PrincipalAliasRaw(requestParameters, initOverrides) {
        if (requestParameters['principalAliasRequest'] == null) {
            throw new runtime.RequiredError('principalAliasRequest', 'Required parameter "principalAliasRequest" was null or undefined when calling postRepoV1PrincipalAlias().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        let urlPath = `/repo/v1/principal/alias`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: PrincipalAliasRequestToJSON(requestParameters['principalAliasRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => PrincipalAliasResponseFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1PrincipalAlias(requestParameters, initOverrides) {
        const response = await this.postRepoV1PrincipalAliasRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1PrincipalAvailableRaw(requestParameters, initOverrides) {
        if (requestParameters['aliasCheckRequest'] == null) {
            throw new runtime.RequiredError('aliasCheckRequest', 'Required parameter "aliasCheckRequest" was null or undefined when calling postRepoV1PrincipalAvailable().');
        }
        const queryParameters = {};
        const headerParameters = {};
        headerParameters['Content-Type'] = 'application/json';
        let urlPath = `/repo/v1/principal/available`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: AliasCheckRequestToJSON(requestParameters['aliasCheckRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AliasCheckResponseFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1PrincipalAvailable(requestParameters, initOverrides) {
        const response = await this.postRepoV1PrincipalAvailableRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1NotificationEmailRaw(requestParameters, initOverrides) {
        if (requestParameters['username'] == null) {
            throw new runtime.RequiredError('username', 'Required parameter "username" was null or undefined when calling putRepoV1NotificationEmail().');
        }
        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/notificationEmail`;
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: UsernameToJSON(requestParameters['username']),
        }, initOverrides);
        return new runtime.VoidApiResponse(response);
    }
    /**
     */
    async putRepoV1NotificationEmail(requestParameters, initOverrides) {
        await this.putRepoV1NotificationEmailRaw(requestParameters, initOverrides);
    }
}
//# sourceMappingURL=PrincipalServicesApi.js.map