UNPKG

@simplyhomes/sos-sdk

Version:

TypeScript SDK for Simply Homes SoS API v4

94 lines (93 loc) 5.47 kB
/* tslint:disable */ /* eslint-disable */ /** * API v4 * Swagger documentation for API v4 * * The version of the OpenAPI document: 4.0 * * * 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 { V4WorkOrderContractorRelationsCreateRelWorkOrderContractorBodyDtoToJSON, V4WorkOrderContractorRelationsCreateRelWorkOrderContractorResponseDtoFromJSON, V4WorkOrderContractorRelationsDeleteRelWorkOrderContractorResponseDtoFromJSON, } from '../models/index'; /** * */ export class RelWorkOrderContractorsAPIV4Api extends runtime.BaseAPI { /** * Create a new relationship between a work order and a contractor * Create a new rel-work-order-contractor */ async v4WorkOrderContractorRelationsControllerCreateRelWorkOrderContractorV4Raw(requestParameters, initOverrides) { if (requestParameters['v4WorkOrderContractorRelationsCreateRelWorkOrderContractorBodyDto'] == null) { throw new runtime.RequiredError('v4WorkOrderContractorRelationsCreateRelWorkOrderContractorBodyDto', 'Required parameter "v4WorkOrderContractorRelationsCreateRelWorkOrderContractorBodyDto" was null or undefined when calling v4WorkOrderContractorRelationsControllerCreateRelWorkOrderContractorV4().'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = await this.configuration.apiKey("x-api-key"); // x-api-key authentication } if (this.configuration && this.configuration.apiKey) { headerParameters["organization-id"] = await this.configuration.apiKey("organization-id"); // organization-id authentication } let urlPath = `/v4/work-order-contractor-relations`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: V4WorkOrderContractorRelationsCreateRelWorkOrderContractorBodyDtoToJSON(requestParameters['v4WorkOrderContractorRelationsCreateRelWorkOrderContractorBodyDto']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => V4WorkOrderContractorRelationsCreateRelWorkOrderContractorResponseDtoFromJSON(jsonValue)); } /** * Create a new relationship between a work order and a contractor * Create a new rel-work-order-contractor */ async v4WorkOrderContractorRelationsControllerCreateRelWorkOrderContractorV4(requestParameters, initOverrides) { const response = await this.v4WorkOrderContractorRelationsControllerCreateRelWorkOrderContractorV4Raw(requestParameters, initOverrides); return await response.value(); } /** * Remove the relationship between a work order and a contractor * Delete a specific rel-work-order-contractor by workOrderId and contractorId */ async v4WorkOrderContractorRelationsControllerDeleteRelWorkOrderContractorV4Raw(requestParameters, initOverrides) { if (requestParameters['workOrderId'] == null) { throw new runtime.RequiredError('workOrderId', 'Required parameter "workOrderId" was null or undefined when calling v4WorkOrderContractorRelationsControllerDeleteRelWorkOrderContractorV4().'); } if (requestParameters['contractorId'] == null) { throw new runtime.RequiredError('contractorId', 'Required parameter "contractorId" was null or undefined when calling v4WorkOrderContractorRelationsControllerDeleteRelWorkOrderContractorV4().'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["x-api-key"] = await this.configuration.apiKey("x-api-key"); // x-api-key authentication } if (this.configuration && this.configuration.apiKey) { headerParameters["organization-id"] = await this.configuration.apiKey("organization-id"); // organization-id authentication } let urlPath = `/v4/work-order-contractor-relations/work-orders/{workOrderId}/contractors/{contractorId}`; urlPath = urlPath.replace(`{${"workOrderId"}}`, encodeURIComponent(String(requestParameters['workOrderId']))); urlPath = urlPath.replace(`{${"contractorId"}}`, encodeURIComponent(String(requestParameters['contractorId']))); const response = await this.request({ path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => V4WorkOrderContractorRelationsDeleteRelWorkOrderContractorResponseDtoFromJSON(jsonValue)); } /** * Remove the relationship between a work order and a contractor * Delete a specific rel-work-order-contractor by workOrderId and contractorId */ async v4WorkOrderContractorRelationsControllerDeleteRelWorkOrderContractorV4(requestParameters, initOverrides) { const response = await this.v4WorkOrderContractorRelationsControllerDeleteRelWorkOrderContractorV4Raw(requestParameters, initOverrides); return await response.value(); } }