@simplyhomes/sos-sdk
Version:
TypeScript SDK for Simply Homes SoS API v4
289 lines (288 loc) • 19.7 kB
JavaScript
/* 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 { V4LeasingsCreateLeasingBodyDtoToJSON, V4LeasingsCreateLeasingResponseDtoFromJSON, V4LeasingsDeleteLeasingResponseDtoFromJSON, V4LeasingsGetLeasingColumnsResponseDtoFromJSON, V4LeasingsGetLeasingResponseDtoFromJSON, V4LeasingsGetLeasingsInViewResponseDtoFromJSON, V4LeasingsGetLeasingsResponseDtoFromJSON, V4LeasingsUpdateLeasingBodyDtoToJSON, V4LeasingsUpdateLeasingResponseDtoFromJSON, } from '../models/index';
/**
*
*/
export class LeasingsAPIV4Api extends runtime.BaseAPI {
/**
* Create a new leasing record in the system
* Create a new leasing
*/
async v4LeasingsControllerCreateLeasingV4Raw(requestParameters, initOverrides) {
if (requestParameters['v4LeasingsCreateLeasingBodyDto'] == null) {
throw new runtime.RequiredError('v4LeasingsCreateLeasingBodyDto', 'Required parameter "v4LeasingsCreateLeasingBodyDto" was null or undefined when calling v4LeasingsControllerCreateLeasingV4().');
}
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/leasings`;
const response = await this.request({
path: urlPath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: V4LeasingsCreateLeasingBodyDtoToJSON(requestParameters['v4LeasingsCreateLeasingBodyDto']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4LeasingsCreateLeasingResponseDtoFromJSON(jsonValue));
}
/**
* Create a new leasing record in the system
* Create a new leasing
*/
async v4LeasingsControllerCreateLeasingV4(requestParameters, initOverrides) {
const response = await this.v4LeasingsControllerCreateLeasingV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* Remove a leasing record from the system
* Delete a specific leasing by leasingId
*/
async v4LeasingsControllerDeleteLeasingV4Raw(requestParameters, initOverrides) {
if (requestParameters['leasingId'] == null) {
throw new runtime.RequiredError('leasingId', 'Required parameter "leasingId" was null or undefined when calling v4LeasingsControllerDeleteLeasingV4().');
}
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/leasings/{leasingId}`;
urlPath = urlPath.replace(`{${"leasingId"}}`, encodeURIComponent(String(requestParameters['leasingId'])));
const response = await this.request({
path: urlPath,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4LeasingsDeleteLeasingResponseDtoFromJSON(jsonValue));
}
/**
* Remove a leasing record from the system
* Delete a specific leasing by leasingId
*/
async v4LeasingsControllerDeleteLeasingV4(requestParameters, initOverrides) {
const response = await this.v4LeasingsControllerDeleteLeasingV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* Retrieve only specified columns of a leasing for optimized data transfer
* Get specific columns of a leasing by leasingId
*/
async v4LeasingsControllerGetLeasingColumnsV4Raw(requestParameters, initOverrides) {
if (requestParameters['leasingId'] == null) {
throw new runtime.RequiredError('leasingId', 'Required parameter "leasingId" was null or undefined when calling v4LeasingsControllerGetLeasingColumnsV4().');
}
if (requestParameters['columns'] == null) {
throw new runtime.RequiredError('columns', 'Required parameter "columns" was null or undefined when calling v4LeasingsControllerGetLeasingColumnsV4().');
}
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/leasings/{leasingId}/{columns}`;
urlPath = urlPath.replace(`{${"leasingId"}}`, encodeURIComponent(String(requestParameters['leasingId'])));
urlPath = urlPath.replace(`{${"columns"}}`, encodeURIComponent(String(requestParameters['columns'])));
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4LeasingsGetLeasingColumnsResponseDtoFromJSON(jsonValue));
}
/**
* Retrieve only specified columns of a leasing for optimized data transfer
* Get specific columns of a leasing by leasingId
*/
async v4LeasingsControllerGetLeasingColumnsV4(requestParameters, initOverrides) {
const response = await this.v4LeasingsControllerGetLeasingColumnsV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* Retrieve detailed information about a specific leasing
* Get a specific leasing by leasingId
*/
async v4LeasingsControllerGetLeasingV4Raw(requestParameters, initOverrides) {
if (requestParameters['leasingId'] == null) {
throw new runtime.RequiredError('leasingId', 'Required parameter "leasingId" was null or undefined when calling v4LeasingsControllerGetLeasingV4().');
}
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/leasings/{leasingId}`;
urlPath = urlPath.replace(`{${"leasingId"}}`, encodeURIComponent(String(requestParameters['leasingId'])));
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4LeasingsGetLeasingResponseDtoFromJSON(jsonValue));
}
/**
* Retrieve detailed information about a specific leasing
* Get a specific leasing by leasingId
*/
async v4LeasingsControllerGetLeasingV4(requestParameters, initOverrides) {
const response = await this.v4LeasingsControllerGetLeasingV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* Retrieve leasings filtered by a specific view configuration
* Get leasings with a specific viewId
*/
async v4LeasingsControllerGetLeasingsInViewV4Raw(requestParameters, initOverrides) {
if (requestParameters['viewId'] == null) {
throw new runtime.RequiredError('viewId', 'Required parameter "viewId" was null or undefined when calling v4LeasingsControllerGetLeasingsInViewV4().');
}
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/leasings/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) => V4LeasingsGetLeasingsInViewResponseDtoFromJSON(jsonValue));
}
/**
* Retrieve leasings filtered by a specific view configuration
* Get leasings with a specific viewId
*/
async v4LeasingsControllerGetLeasingsInViewV4(requestParameters, initOverrides) {
const response = await this.v4LeasingsControllerGetLeasingsInViewV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* # GET /v4/leasings ## Overview Retrieves a list of leasings with optional filtering, sorting, and pagination capabilities. This endpoint allows you to query leasings using view configurations or direct parameters to get customized leasing datasets. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header - `organization-id` header ## Request Parameters ### Query Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `viewId` | number | No | Optional view ID to apply filters, sorts, and column selections | | `limit` | number | No | Maximum number of leasings to return (default: 10, max: 100) | | `offset` | number | No | Number of leasings to skip for pagination (default: 0) | ### View Integration When a `viewId` is provided: - **Filters**: View filters are automatically applied to the query - **Sorts**: View sort configurations determine result ordering - **Columns**: View column selections determine returned fields - **Validation**: View must exist and belong to the authenticated user ### Pagination The endpoint supports offset-based pagination: - **Default Limit**: 10 leasings per request - **Maximum Limit**: 100 leasings per request - **Offset Calculation**: Use `offset = page * limit` for page-based pagination ## Response Structure The response contains an array of leasing objects with pagination metadata. ## Use Cases This endpoint is ideal for: - Building leasing listing interfaces - Implementing leasing search and filtering - Creating leasing dashboards and analytics - Generating leasing reports and exports - Managing rental agreements and tenant relationships - Tracking lease terms and rental income ## Performance Considerations - **Pagination**: Use appropriate limit values to balance performance and data needs - **View Optimization**: Well-designed views with targeted filters improve response times - **Column Selection**: Limit returned columns through views for better performance - **Caching**: Consider implementing client-side caching for frequently accessed data ## Integration Patterns **Standard Listing:** - No viewId: Returns all organization leasings with default columns - Basic pagination: Use limit/offset for page navigation **Filtered Views:** - With viewId: Returns leasings matching view criteria - Consistent Results: Same view always returns same filtered dataset - User Personalization: Each user can have custom views for different purposes
* Get leasings with optional viewId
*/
async v4LeasingsControllerGetLeasingsV4Raw(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/leasings`;
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4LeasingsGetLeasingsResponseDtoFromJSON(jsonValue));
}
/**
* # GET /v4/leasings ## Overview Retrieves a list of leasings with optional filtering, sorting, and pagination capabilities. This endpoint allows you to query leasings using view configurations or direct parameters to get customized leasing datasets. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header - `organization-id` header ## Request Parameters ### Query Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `viewId` | number | No | Optional view ID to apply filters, sorts, and column selections | | `limit` | number | No | Maximum number of leasings to return (default: 10, max: 100) | | `offset` | number | No | Number of leasings to skip for pagination (default: 0) | ### View Integration When a `viewId` is provided: - **Filters**: View filters are automatically applied to the query - **Sorts**: View sort configurations determine result ordering - **Columns**: View column selections determine returned fields - **Validation**: View must exist and belong to the authenticated user ### Pagination The endpoint supports offset-based pagination: - **Default Limit**: 10 leasings per request - **Maximum Limit**: 100 leasings per request - **Offset Calculation**: Use `offset = page * limit` for page-based pagination ## Response Structure The response contains an array of leasing objects with pagination metadata. ## Use Cases This endpoint is ideal for: - Building leasing listing interfaces - Implementing leasing search and filtering - Creating leasing dashboards and analytics - Generating leasing reports and exports - Managing rental agreements and tenant relationships - Tracking lease terms and rental income ## Performance Considerations - **Pagination**: Use appropriate limit values to balance performance and data needs - **View Optimization**: Well-designed views with targeted filters improve response times - **Column Selection**: Limit returned columns through views for better performance - **Caching**: Consider implementing client-side caching for frequently accessed data ## Integration Patterns **Standard Listing:** - No viewId: Returns all organization leasings with default columns - Basic pagination: Use limit/offset for page navigation **Filtered Views:** - With viewId: Returns leasings matching view criteria - Consistent Results: Same view always returns same filtered dataset - User Personalization: Each user can have custom views for different purposes
* Get leasings with optional viewId
*/
async v4LeasingsControllerGetLeasingsV4(requestParameters = {}, initOverrides) {
const response = await this.v4LeasingsControllerGetLeasingsV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* Update an existing leasing record with new data
* Update a specific leasing by leasingId
*/
async v4LeasingsControllerUpdateLeasingV4Raw(requestParameters, initOverrides) {
if (requestParameters['leasingId'] == null) {
throw new runtime.RequiredError('leasingId', 'Required parameter "leasingId" was null or undefined when calling v4LeasingsControllerUpdateLeasingV4().');
}
if (requestParameters['v4LeasingsUpdateLeasingBodyDto'] == null) {
throw new runtime.RequiredError('v4LeasingsUpdateLeasingBodyDto', 'Required parameter "v4LeasingsUpdateLeasingBodyDto" was null or undefined when calling v4LeasingsControllerUpdateLeasingV4().');
}
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/leasings/{leasingId}`;
urlPath = urlPath.replace(`{${"leasingId"}}`, encodeURIComponent(String(requestParameters['leasingId'])));
const response = await this.request({
path: urlPath,
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: V4LeasingsUpdateLeasingBodyDtoToJSON(requestParameters['v4LeasingsUpdateLeasingBodyDto']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4LeasingsUpdateLeasingResponseDtoFromJSON(jsonValue));
}
/**
* Update an existing leasing record with new data
* Update a specific leasing by leasingId
*/
async v4LeasingsControllerUpdateLeasingV4(requestParameters, initOverrides) {
const response = await this.v4LeasingsControllerUpdateLeasingV4Raw(requestParameters, initOverrides);
return await response.value();
}
}