UNPKG

@simplyhomes/sos-sdk

Version:

TypeScript SDK for Simply Homes SoS API v4

294 lines (293 loc) 14.5 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 { V4TenantsCreateTenantBodyDtoToJSON, V4TenantsCreateTenantResponseDtoFromJSON, V4TenantsDeleteTenantResponseDtoFromJSON, V4TenantsGetTenantResponseDtoFromJSON, V4TenantsGetTenantsInViewResponseDtoFromJSON, V4TenantsGetTenantsResponseDtoFromJSON, V4TenantsGetUniqueValuesResponseDtoFromJSON, V4TenantsUpdateTenantBodyDtoToJSON, V4TenantsUpdateTenantResponseDtoFromJSON, } from '../models/index'; /** * */ export class TenantsAPIV4Api extends runtime.BaseAPI { /** * Create a new tenant in the system * Create a new tenant */ async v4TenantsControllerCreateTenantV4Raw(requestParameters, initOverrides) { if (requestParameters['v4TenantsCreateTenantBodyDto'] == null) { throw new runtime.RequiredError('v4TenantsCreateTenantBodyDto', 'Required parameter "v4TenantsCreateTenantBodyDto" was null or undefined when calling v4TenantsControllerCreateTenantV4().'); } 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/tenants`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: V4TenantsCreateTenantBodyDtoToJSON(requestParameters['v4TenantsCreateTenantBodyDto']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => V4TenantsCreateTenantResponseDtoFromJSON(jsonValue)); } /** * Create a new tenant in the system * Create a new tenant */ async v4TenantsControllerCreateTenantV4(requestParameters, initOverrides) { const response = await this.v4TenantsControllerCreateTenantV4Raw(requestParameters, initOverrides); return await response.value(); } /** * Remove a tenant from the system * Delete a tenant */ async v4TenantsControllerDeleteTenantV4Raw(requestParameters, initOverrides) { if (requestParameters['tenantId'] == null) { throw new runtime.RequiredError('tenantId', 'Required parameter "tenantId" was null or undefined when calling v4TenantsControllerDeleteTenantV4().'); } 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/tenants/{tenantId}`; urlPath = urlPath.replace(`{${"tenantId"}}`, encodeURIComponent(String(requestParameters['tenantId']))); const response = await this.request({ path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => V4TenantsDeleteTenantResponseDtoFromJSON(jsonValue)); } /** * Remove a tenant from the system * Delete a tenant */ async v4TenantsControllerDeleteTenantV4(requestParameters, initOverrides) { const response = await this.v4TenantsControllerDeleteTenantV4Raw(requestParameters, initOverrides); return await response.value(); } /** * Retrieve a single tenant with optional view filtering * Get a single tenant by ID */ async v4TenantsControllerGetTenantV4Raw(requestParameters, initOverrides) { if (requestParameters['tenantId'] == null) { throw new runtime.RequiredError('tenantId', 'Required parameter "tenantId" was null or undefined when calling v4TenantsControllerGetTenantV4().'); } const queryParameters = {}; if (requestParameters['viewId'] != null) { queryParameters['viewId'] = requestParameters['viewId']; } 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/tenants/{tenantId}`; urlPath = urlPath.replace(`{${"tenantId"}}`, encodeURIComponent(String(requestParameters['tenantId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => V4TenantsGetTenantResponseDtoFromJSON(jsonValue)); } /** * Retrieve a single tenant with optional view filtering * Get a single tenant by ID */ async v4TenantsControllerGetTenantV4(requestParameters, initOverrides) { const response = await this.v4TenantsControllerGetTenantV4Raw(requestParameters, initOverrides); return await response.value(); } /** * Retrieve tenants filtered by a specific view configuration * Get tenants with a specific viewId */ async v4TenantsControllerGetTenantsInViewV4Raw(requestParameters, initOverrides) { if (requestParameters['viewId'] == null) { throw new runtime.RequiredError('viewId', 'Required parameter "viewId" was null or undefined when calling v4TenantsControllerGetTenantsInViewV4().'); } const queryParameters = {}; if (requestParameters['limit'] != null) { queryParameters['limit'] = requestParameters['limit']; } if (requestParameters['offset'] != null) { queryParameters['offset'] = requestParameters['offset']; } if (requestParameters['countOnly'] != null) { queryParameters['countOnly'] = requestParameters['countOnly']; } 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/tenants/viewId/{viewId}`; urlPath = urlPath.replace(`{${"viewId"}}`, encodeURIComponent(String(requestParameters['viewId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => V4TenantsGetTenantsInViewResponseDtoFromJSON(jsonValue)); } /** * Retrieve tenants filtered by a specific view configuration * Get tenants with a specific viewId */ async v4TenantsControllerGetTenantsInViewV4(requestParameters, initOverrides) { const response = await this.v4TenantsControllerGetTenantsInViewV4Raw(requestParameters, initOverrides); return await response.value(); } /** * Retrieve a list of tenants with optional view filtering * Get tenants with optional viewId */ async v4TenantsControllerGetTenantsV4Raw(requestParameters, initOverrides) { const queryParameters = {}; if (requestParameters['viewId'] != null) { queryParameters['viewId'] = requestParameters['viewId']; } if (requestParameters['limit'] != null) { queryParameters['limit'] = requestParameters['limit']; } if (requestParameters['offset'] != null) { queryParameters['offset'] = requestParameters['offset']; } if (requestParameters['countOnly'] != null) { queryParameters['countOnly'] = requestParameters['countOnly']; } 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/tenants`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => V4TenantsGetTenantsResponseDtoFromJSON(jsonValue)); } /** * Retrieve a list of tenants with optional view filtering * Get tenants with optional viewId */ async v4TenantsControllerGetTenantsV4(requestParameters = {}, initOverrides) { const response = await this.v4TenantsControllerGetTenantsV4Raw(requestParameters, initOverrides); return await response.value(); } /** * Retrieve unique values and their counts for a specific tenant column * Get unique values for a specific column */ async v4TenantsControllerGetUniqueValuesV4Raw(requestParameters, initOverrides) { if (requestParameters['column'] == null) { throw new runtime.RequiredError('column', 'Required parameter "column" was null or undefined when calling v4TenantsControllerGetUniqueValuesV4().'); } const queryParameters = {}; if (requestParameters['viewId'] != null) { queryParameters['viewId'] = requestParameters['viewId']; } if (requestParameters['offset'] != null) { queryParameters['offset'] = requestParameters['offset']; } if (requestParameters['limit'] != null) { queryParameters['limit'] = requestParameters['limit']; } 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/tenants/unique/{column}`; urlPath = urlPath.replace(`{${"column"}}`, encodeURIComponent(String(requestParameters['column']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => V4TenantsGetUniqueValuesResponseDtoFromJSON(jsonValue)); } /** * Retrieve unique values and their counts for a specific tenant column * Get unique values for a specific column */ async v4TenantsControllerGetUniqueValuesV4(requestParameters, initOverrides) { const response = await this.v4TenantsControllerGetUniqueValuesV4Raw(requestParameters, initOverrides); return await response.value(); } /** * Update tenant details * Update an existing tenant */ async v4TenantsControllerUpdateTenantV4Raw(requestParameters, initOverrides) { if (requestParameters['tenantId'] == null) { throw new runtime.RequiredError('tenantId', 'Required parameter "tenantId" was null or undefined when calling v4TenantsControllerUpdateTenantV4().'); } if (requestParameters['v4TenantsUpdateTenantBodyDto'] == null) { throw new runtime.RequiredError('v4TenantsUpdateTenantBodyDto', 'Required parameter "v4TenantsUpdateTenantBodyDto" was null or undefined when calling v4TenantsControllerUpdateTenantV4().'); } 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/tenants/{tenantId}`; urlPath = urlPath.replace(`{${"tenantId"}}`, encodeURIComponent(String(requestParameters['tenantId']))); const response = await this.request({ path: urlPath, method: 'PATCH', headers: headerParameters, query: queryParameters, body: V4TenantsUpdateTenantBodyDtoToJSON(requestParameters['v4TenantsUpdateTenantBodyDto']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => V4TenantsUpdateTenantResponseDtoFromJSON(jsonValue)); } /** * Update tenant details * Update an existing tenant */ async v4TenantsControllerUpdateTenantV4(requestParameters, initOverrides) { const response = await this.v4TenantsControllerUpdateTenantV4Raw(requestParameters, initOverrides); return await response.value(); } }