/* 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 { AccessControlListFromJSON, AccessControlListToJSON, FormChangeRequestToJSON, FormDataFromJSON, FormGroupFromJSON, FormRejectionToJSON, ListRequestToJSON, ListResponseFromJSON, } from '../models/index';
/**
 *
 */
export class FormServicesApi extends runtime.BaseAPI {
    /**
     */
    async deleteRepoV1FormDataIdRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteRepoV1FormDataId().');
        }
        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/form/data/{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 deleteRepoV1FormDataId(requestParameters, initOverrides) {
        await this.deleteRepoV1FormDataIdRaw(requestParameters, initOverrides);
    }
    /**
     */
    async getRepoV1FormGroupIdRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getRepoV1FormGroupId().');
        }
        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/form/group/{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) => FormGroupFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1FormGroupId(requestParameters, initOverrides) {
        const response = await this.getRepoV1FormGroupIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async getRepoV1FormGroupIdAclRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getRepoV1FormGroupIdAcl().');
        }
        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/form/group/{id}/acl`;
        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) => AccessControlListFromJSON(jsonValue));
    }
    /**
     */
    async getRepoV1FormGroupIdAcl(requestParameters, initOverrides) {
        const response = await this.getRepoV1FormGroupIdAclRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1FormDataRaw(requestParameters, initOverrides) {
        if (requestParameters['groupId'] == null) {
            throw new runtime.RequiredError('groupId', 'Required parameter "groupId" was null or undefined when calling postRepoV1FormData().');
        }
        if (requestParameters['formChangeRequest'] == null) {
            throw new runtime.RequiredError('formChangeRequest', 'Required parameter "formChangeRequest" was null or undefined when calling postRepoV1FormData().');
        }
        const queryParameters = {};
        if (requestParameters['groupId'] != null) {
            queryParameters['groupId'] = requestParameters['groupId'];
        }
        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/form/data`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: FormChangeRequestToJSON(requestParameters['formChangeRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => FormDataFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1FormData(requestParameters, initOverrides) {
        const response = await this.postRepoV1FormDataRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1FormDataIdSubmitRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling postRepoV1FormDataIdSubmit().');
        }
        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/form/data/{id}/submit`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => FormDataFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1FormDataIdSubmit(requestParameters, initOverrides) {
        const response = await this.postRepoV1FormDataIdSubmitRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1FormDataListRaw(requestParameters, initOverrides) {
        if (requestParameters['listRequest'] == null) {
            throw new runtime.RequiredError('listRequest', 'Required parameter "listRequest" was null or undefined when calling postRepoV1FormDataList().');
        }
        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/form/data/list`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: ListRequestToJSON(requestParameters['listRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ListResponseFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1FormDataList(requestParameters, initOverrides) {
        const response = await this.postRepoV1FormDataListRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1FormDataListReviewerRaw(requestParameters, initOverrides) {
        if (requestParameters['listRequest'] == null) {
            throw new runtime.RequiredError('listRequest', 'Required parameter "listRequest" was null or undefined when calling postRepoV1FormDataListReviewer().');
        }
        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/form/data/list/reviewer`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: ListRequestToJSON(requestParameters['listRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => ListResponseFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1FormDataListReviewer(requestParameters, initOverrides) {
        const response = await this.postRepoV1FormDataListReviewerRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async postRepoV1FormGroupRaw(requestParameters, initOverrides) {
        if (requestParameters['name'] == null) {
            throw new runtime.RequiredError('name', 'Required parameter "name" was null or undefined when calling postRepoV1FormGroup().');
        }
        const queryParameters = {};
        if (requestParameters['name'] != null) {
            queryParameters['name'] = requestParameters['name'];
        }
        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/form/group`;
        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => FormGroupFromJSON(jsonValue));
    }
    /**
     */
    async postRepoV1FormGroup(requestParameters, initOverrides) {
        const response = await this.postRepoV1FormGroupRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1FormDataIdRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling putRepoV1FormDataId().');
        }
        if (requestParameters['formChangeRequest'] == null) {
            throw new runtime.RequiredError('formChangeRequest', 'Required parameter "formChangeRequest" was null or undefined when calling putRepoV1FormDataId().');
        }
        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/form/data/{id}`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: FormChangeRequestToJSON(requestParameters['formChangeRequest']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => FormDataFromJSON(jsonValue));
    }
    /**
     */
    async putRepoV1FormDataId(requestParameters, initOverrides) {
        const response = await this.putRepoV1FormDataIdRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1FormDataIdAcceptRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling putRepoV1FormDataIdAccept().');
        }
        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/form/data/{id}/accept`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => FormDataFromJSON(jsonValue));
    }
    /**
     */
    async putRepoV1FormDataIdAccept(requestParameters, initOverrides) {
        const response = await this.putRepoV1FormDataIdAcceptRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1FormDataIdRejectRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling putRepoV1FormDataIdReject().');
        }
        if (requestParameters['formRejection'] == null) {
            throw new runtime.RequiredError('formRejection', 'Required parameter "formRejection" was null or undefined when calling putRepoV1FormDataIdReject().');
        }
        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/form/data/{id}/reject`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: FormRejectionToJSON(requestParameters['formRejection']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => FormDataFromJSON(jsonValue));
    }
    /**
     */
    async putRepoV1FormDataIdReject(requestParameters, initOverrides) {
        const response = await this.putRepoV1FormDataIdRejectRaw(requestParameters, initOverrides);
        return await response.value();
    }
    /**
     */
    async putRepoV1FormGroupIdAclRaw(requestParameters, initOverrides) {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling putRepoV1FormGroupIdAcl().');
        }
        if (requestParameters['accessControlList'] == null) {
            throw new runtime.RequiredError('accessControlList', 'Required parameter "accessControlList" was null or undefined when calling putRepoV1FormGroupIdAcl().');
        }
        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/form/group/{id}/acl`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: AccessControlListToJSON(requestParameters['accessControlList']),
        }, initOverrides);
        return new runtime.JSONApiResponse(response, (jsonValue) => AccessControlListFromJSON(jsonValue));
    }
    /**
     */
    async putRepoV1FormGroupIdAcl(requestParameters, initOverrides) {
        const response = await this.putRepoV1FormGroupIdAclRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
//# sourceMappingURL=FormServicesApi.js.map