UNPKG

@simplyhomes/sos-sdk

Version:

TypeScript SDK for Simply Homes SoS API v4

262 lines (261 loc) 28.3 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 { V4ViewsCreateViewBodyDtoToJSON, V4ViewsCreateViewResponseDtoFromJSON, V4ViewsGetViewObjectSchemaResponseDtoFromJSON, V4ViewsGetViewResponseDtoFromJSON, V4ViewsUpdateViewBodyDtoToJSON, V4ViewsUpdateViewResponseDtoFromJSON, V4ViewsValidateViewBodyDtoToJSON, V4ViewsValidateViewResponseDtoFromJSON, } from '../models/index'; /** * */ export class ViewsAPIV4Api extends runtime.BaseAPI { /** * CreateView_Docs_Route * Create view, return viewId and view data like filters, sorts, columns */ async v4ViewsControllerCreateViewV4Raw(requestParameters, initOverrides) { if (requestParameters['objectName'] == null) { throw new runtime.RequiredError('objectName', 'Required parameter "objectName" was null or undefined when calling v4ViewsControllerCreateViewV4().'); } if (requestParameters['v4ViewsCreateViewBodyDto'] == null) { throw new runtime.RequiredError('v4ViewsCreateViewBodyDto', 'Required parameter "v4ViewsCreateViewBodyDto" was null or undefined when calling v4ViewsControllerCreateViewV4().'); } 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 } let urlPath = `/v4/views/{objectName}`; urlPath = urlPath.replace(`{${"objectName"}}`, encodeURIComponent(String(requestParameters['objectName']))); const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: V4ViewsCreateViewBodyDtoToJSON(requestParameters['v4ViewsCreateViewBodyDto']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => V4ViewsCreateViewResponseDtoFromJSON(jsonValue)); } /** * CreateView_Docs_Route * Create view, return viewId and view data like filters, sorts, columns */ async v4ViewsControllerCreateViewV4(requestParameters, initOverrides) { const response = await this.v4ViewsControllerCreateViewV4Raw(requestParameters, initOverrides); return await response.value(); } /** * # GET /v4/views/{objectName}/schema ## Overview Retrieves the schema information for creating views on a specific object type. This endpoint returns metadata about all available columns and relations including their names and data types, which can be used to configure filters, sorts, and column selections when creating or updating views. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Request Parameters ### Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `objectName` | string | Yes | The object type to get schema information for (e.g., \"properties\", \"units\") | ### Object Types Available object types: - **properties**: Property entity columns - **units**: Unit entity columns ## Response Structure The response contains schema metadata for the specified object type, including available columns with their data types and available relations. ## Use Cases This endpoint is ideal for: - Building dynamic view configuration interfaces - Validating column and relation selections before creating views - Discovering available fields and relationships for filtering and sorting - Creating form controls for view builders - Understanding entity schema and relationships for API integrations ## Column Types Returned column types include: - **string**: Text-based columns - **number**: Numeric columns - **boolean**: True/false columns - **date**: Date/timestamp columns - **object**: Complex object columns - **array**: Array-type columns - **unknown**: Columns with undetermined types * Get view object schema */ async v4ViewsControllerGetViewObjectSchemaV4Raw(requestParameters, initOverrides) { if (requestParameters['objectName'] == null) { throw new runtime.RequiredError('objectName', 'Required parameter "objectName" was null or undefined when calling v4ViewsControllerGetViewObjectSchemaV4().'); } 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 } let urlPath = `/v4/views/{objectName}/schema`; urlPath = urlPath.replace(`{${"objectName"}}`, encodeURIComponent(String(requestParameters['objectName']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => V4ViewsGetViewObjectSchemaResponseDtoFromJSON(jsonValue)); } /** * # GET /v4/views/{objectName}/schema ## Overview Retrieves the schema information for creating views on a specific object type. This endpoint returns metadata about all available columns and relations including their names and data types, which can be used to configure filters, sorts, and column selections when creating or updating views. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Request Parameters ### Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `objectName` | string | Yes | The object type to get schema information for (e.g., \"properties\", \"units\") | ### Object Types Available object types: - **properties**: Property entity columns - **units**: Unit entity columns ## Response Structure The response contains schema metadata for the specified object type, including available columns with their data types and available relations. ## Use Cases This endpoint is ideal for: - Building dynamic view configuration interfaces - Validating column and relation selections before creating views - Discovering available fields and relationships for filtering and sorting - Creating form controls for view builders - Understanding entity schema and relationships for API integrations ## Column Types Returned column types include: - **string**: Text-based columns - **number**: Numeric columns - **boolean**: True/false columns - **date**: Date/timestamp columns - **object**: Complex object columns - **array**: Array-type columns - **unknown**: Columns with undetermined types * Get view object schema */ async v4ViewsControllerGetViewObjectSchemaV4(requestParameters, initOverrides) { const response = await this.v4ViewsControllerGetViewObjectSchemaV4Raw(requestParameters, initOverrides); return await response.value(); } /** * # GET /v4/views/{objectName}/{viewId} ## Overview Retrieves a specific view by its ID for a given object type. This endpoint returns the complete view configuration including filters, sorts, column selections, and metadata for the specified view. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Request Parameters ### Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `objectName` | string | Yes | The object type the view is configured for (e.g., \"properties\", \"units\") | | `viewId` | number | Yes | The unique identifier of the view to retrieve | ### Object Types Available object types: - **properties**: Views configured for property entities - **units**: Views configured for unit entities ## Response Structure The response contains the complete view configuration including all filters, sorts, column selections, and metadata. ## Use Cases This endpoint is ideal for: - Loading existing view configurations for editing - Retrieving view settings for data display - Copying view configurations to create similar views - Auditing view configurations and settings - Restoring previously saved view states ## View Components The returned view includes: - **Basic Information**: View ID, name, object type, creation details - **Column Configuration**: Selected columns and their display order - **Filter Settings**: Applied filters with operations and values - **Sort Configuration**: Sort criteria and directions - **User Information**: Creator and ownership details - **Timestamps**: Creation and modification dates ## Access Control Views are user-specific and can only be accessed by their creators. The endpoint will return an error if: - The view doesn\'t exist - The requesting user doesn\'t own the view - The view object type doesn\'t match the requested object * Get a specific view by viewId */ async v4ViewsControllerGetViewV4Raw(requestParameters, initOverrides) { if (requestParameters['viewId'] == null) { throw new runtime.RequiredError('viewId', 'Required parameter "viewId" was null or undefined when calling v4ViewsControllerGetViewV4().'); } if (requestParameters['objectName'] == null) { throw new runtime.RequiredError('objectName', 'Required parameter "objectName" was null or undefined when calling v4ViewsControllerGetViewV4().'); } 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 } let urlPath = `/v4/views/{objectName}/{viewId}`; urlPath = urlPath.replace(`{${"viewId"}}`, encodeURIComponent(String(requestParameters['viewId']))); urlPath = urlPath.replace(`{${"objectName"}}`, encodeURIComponent(String(requestParameters['objectName']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => V4ViewsGetViewResponseDtoFromJSON(jsonValue)); } /** * # GET /v4/views/{objectName}/{viewId} ## Overview Retrieves a specific view by its ID for a given object type. This endpoint returns the complete view configuration including filters, sorts, column selections, and metadata for the specified view. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Request Parameters ### Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `objectName` | string | Yes | The object type the view is configured for (e.g., \"properties\", \"units\") | | `viewId` | number | Yes | The unique identifier of the view to retrieve | ### Object Types Available object types: - **properties**: Views configured for property entities - **units**: Views configured for unit entities ## Response Structure The response contains the complete view configuration including all filters, sorts, column selections, and metadata. ## Use Cases This endpoint is ideal for: - Loading existing view configurations for editing - Retrieving view settings for data display - Copying view configurations to create similar views - Auditing view configurations and settings - Restoring previously saved view states ## View Components The returned view includes: - **Basic Information**: View ID, name, object type, creation details - **Column Configuration**: Selected columns and their display order - **Filter Settings**: Applied filters with operations and values - **Sort Configuration**: Sort criteria and directions - **User Information**: Creator and ownership details - **Timestamps**: Creation and modification dates ## Access Control Views are user-specific and can only be accessed by their creators. The endpoint will return an error if: - The view doesn\'t exist - The requesting user doesn\'t own the view - The view object type doesn\'t match the requested object * Get a specific view by viewId */ async v4ViewsControllerGetViewV4(requestParameters, initOverrides) { const response = await this.v4ViewsControllerGetViewV4Raw(requestParameters, initOverrides); return await response.value(); } /** * # PUT /v4/views/{objectName}/{viewId} ## Overview Updates an existing view configuration created by the authenticated user. This endpoint allows you to modify all aspects of a view including its name, columns, filters, and sort configurations for a specific object type. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Request Parameters ### Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `objectName` | string | Yes | The object type the view is configured for (e.g., \"properties\", \"units\") | | `viewId` | number | Yes | The unique identifier of the view to update | ### Object Types Available object types: - **properties**: Views configured for property entities - **units**: Views configured for unit entities ### Request Body The request body should contain the complete view configuration that will replace the existing configuration. | Field | Type | Required | Description | |-------|------|----------|-------------| | `name` | string | No | User-defined name for the view | | `columns` | array | Yes | Array of column configurations to display | | `filters` | array | No | Array of filter configurations to apply | | `sorts` | array | No | Array of sort configurations to apply | #### Column Configuration Object | Field | Type | Required | Description | |-------|------|----------|-------------| | `columnName` | string | Yes | Name of the database column | | `order` | number | No | Display order of the column | | `type` | string | No | Data type of the column | #### Filter Configuration Object | Field | Type | Required | Description | |-------|------|----------|-------------| | `columnName` | string | Yes | Column to filter on | | `operation` | string | Yes | Filter operation (e.g., \"equals\", \"contains\", \"greater_than\") | | `value` | any | Yes | Filter value to match against | #### Sort Configuration Object | Field | Type | Required | Description | |-------|------|----------|-------------| | `columnName` | string | Yes | Column to sort by | | `direction` | string | Yes | Sort direction (\"asc\" or \"desc\") | ## Authorization - Users can only update views they created - Views are isolated per user and cannot be modified by other users - The view must exist and belong to the authenticated user ## Use Cases This endpoint is ideal for: - **Modifying View Names**: Updating descriptive names for better organization - **Adjusting Columns**: Adding, removing, or reordering displayed columns - **Refining Filters**: Updating filter criteria for better data targeting - **Changing Sort Order**: Modifying how data is sorted and presented - **View Optimization**: Fine-tuning view configurations based on usage ## Data Validation The system validates: - **View Ownership**: Ensures the user owns the view being updated - **Column Existence**: Verifies that specified columns exist in the object schema - **Filter Operations**: Validates that filter operations are supported - **Sort Directions**: Ensures sort directions are valid (\"asc\" or \"desc\") - **Data Types**: Checks that filter values match column data types ## Business Rules - **Complete Replacement**: The update replaces the entire view configuration - **User Scope**: Only the view owner can perform updates - **Object Consistency**: The object type cannot be changed via update - **Atomic Operation**: Either all changes succeed or none are applied - **Timestamp Updates**: The `updatedAt` timestamp is automatically updated * Update an existing view by viewId */ async v4ViewsControllerUpdateViewV4Raw(requestParameters, initOverrides) { if (requestParameters['objectName'] == null) { throw new runtime.RequiredError('objectName', 'Required parameter "objectName" was null or undefined when calling v4ViewsControllerUpdateViewV4().'); } if (requestParameters['viewId'] == null) { throw new runtime.RequiredError('viewId', 'Required parameter "viewId" was null or undefined when calling v4ViewsControllerUpdateViewV4().'); } if (requestParameters['v4ViewsUpdateViewBodyDto'] == null) { throw new runtime.RequiredError('v4ViewsUpdateViewBodyDto', 'Required parameter "v4ViewsUpdateViewBodyDto" was null or undefined when calling v4ViewsControllerUpdateViewV4().'); } 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 } let urlPath = `/v4/views/{objectName}/{viewId}`; urlPath = urlPath.replace(`{${"objectName"}}`, encodeURIComponent(String(requestParameters['objectName']))); urlPath = urlPath.replace(`{${"viewId"}}`, encodeURIComponent(String(requestParameters['viewId']))); const response = await this.request({ path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: V4ViewsUpdateViewBodyDtoToJSON(requestParameters['v4ViewsUpdateViewBodyDto']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => V4ViewsUpdateViewResponseDtoFromJSON(jsonValue)); } /** * # PUT /v4/views/{objectName}/{viewId} ## Overview Updates an existing view configuration created by the authenticated user. This endpoint allows you to modify all aspects of a view including its name, columns, filters, and sort configurations for a specific object type. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Request Parameters ### Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `objectName` | string | Yes | The object type the view is configured for (e.g., \"properties\", \"units\") | | `viewId` | number | Yes | The unique identifier of the view to update | ### Object Types Available object types: - **properties**: Views configured for property entities - **units**: Views configured for unit entities ### Request Body The request body should contain the complete view configuration that will replace the existing configuration. | Field | Type | Required | Description | |-------|------|----------|-------------| | `name` | string | No | User-defined name for the view | | `columns` | array | Yes | Array of column configurations to display | | `filters` | array | No | Array of filter configurations to apply | | `sorts` | array | No | Array of sort configurations to apply | #### Column Configuration Object | Field | Type | Required | Description | |-------|------|----------|-------------| | `columnName` | string | Yes | Name of the database column | | `order` | number | No | Display order of the column | | `type` | string | No | Data type of the column | #### Filter Configuration Object | Field | Type | Required | Description | |-------|------|----------|-------------| | `columnName` | string | Yes | Column to filter on | | `operation` | string | Yes | Filter operation (e.g., \"equals\", \"contains\", \"greater_than\") | | `value` | any | Yes | Filter value to match against | #### Sort Configuration Object | Field | Type | Required | Description | |-------|------|----------|-------------| | `columnName` | string | Yes | Column to sort by | | `direction` | string | Yes | Sort direction (\"asc\" or \"desc\") | ## Authorization - Users can only update views they created - Views are isolated per user and cannot be modified by other users - The view must exist and belong to the authenticated user ## Use Cases This endpoint is ideal for: - **Modifying View Names**: Updating descriptive names for better organization - **Adjusting Columns**: Adding, removing, or reordering displayed columns - **Refining Filters**: Updating filter criteria for better data targeting - **Changing Sort Order**: Modifying how data is sorted and presented - **View Optimization**: Fine-tuning view configurations based on usage ## Data Validation The system validates: - **View Ownership**: Ensures the user owns the view being updated - **Column Existence**: Verifies that specified columns exist in the object schema - **Filter Operations**: Validates that filter operations are supported - **Sort Directions**: Ensures sort directions are valid (\"asc\" or \"desc\") - **Data Types**: Checks that filter values match column data types ## Business Rules - **Complete Replacement**: The update replaces the entire view configuration - **User Scope**: Only the view owner can perform updates - **Object Consistency**: The object type cannot be changed via update - **Atomic Operation**: Either all changes succeed or none are applied - **Timestamp Updates**: The `updatedAt` timestamp is automatically updated * Update an existing view by viewId */ async v4ViewsControllerUpdateViewV4(requestParameters, initOverrides) { const response = await this.v4ViewsControllerUpdateViewV4Raw(requestParameters, initOverrides); return await response.value(); } /** */ async v4ViewsControllerValidateViewV4Raw(requestParameters, initOverrides) { if (requestParameters['objectName'] == null) { throw new runtime.RequiredError('objectName', 'Required parameter "objectName" was null or undefined when calling v4ViewsControllerValidateViewV4().'); } if (requestParameters['v4ViewsValidateViewBodyDto'] == null) { throw new runtime.RequiredError('v4ViewsValidateViewBodyDto', 'Required parameter "v4ViewsValidateViewBodyDto" was null or undefined when calling v4ViewsControllerValidateViewV4().'); } 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 } let urlPath = `/v4/views/{objectName}/validate`; urlPath = urlPath.replace(`{${"objectName"}}`, encodeURIComponent(String(requestParameters['objectName']))); const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: V4ViewsValidateViewBodyDtoToJSON(requestParameters['v4ViewsValidateViewBodyDto']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => V4ViewsValidateViewResponseDtoFromJSON(jsonValue)); } /** */ async v4ViewsControllerValidateViewV4(requestParameters, initOverrides) { const response = await this.v4ViewsControllerValidateViewV4Raw(requestParameters, initOverrides); return await response.value(); } } /** * @export * @enum {string} */ export var EntitiesEntityMapObjectNames; (function (EntitiesEntityMapObjectNames) { EntitiesEntityMapObjectNames["Property"] = "property"; EntitiesEntityMapObjectNames["Unit"] = "unit"; EntitiesEntityMapObjectNames["Source"] = "source"; EntitiesEntityMapObjectNames["Organization"] = "organization"; EntitiesEntityMapObjectNames["Contact"] = "contact"; EntitiesEntityMapObjectNames["County"] = "county"; EntitiesEntityMapObjectNames["HousingAuthority"] = "housing_authority"; EntitiesEntityMapObjectNames["Lender"] = "lender"; EntitiesEntityMapObjectNames["Neighborhood"] = "neighborhood"; EntitiesEntityMapObjectNames["Notification"] = "notification"; EntitiesEntityMapObjectNames["Owner"] = "owner"; EntitiesEntityMapObjectNames["PropertyManager"] = "property_manager"; EntitiesEntityMapObjectNames["Option"] = "option"; EntitiesEntityMapObjectNames["Thread"] = "thread"; EntitiesEntityMapObjectNames["Lead"] = "lead"; EntitiesEntityMapObjectNames["Offer"] = "offer"; EntitiesEntityMapObjectNames["User"] = "user"; EntitiesEntityMapObjectNames["Group"] = "group"; EntitiesEntityMapObjectNames["Market"] = "market"; EntitiesEntityMapObjectNames["Message"] = "message"; EntitiesEntityMapObjectNames["MessageSubscription"] = "message_subscription"; EntitiesEntityMapObjectNames["TitleCompany"] = "title_company"; EntitiesEntityMapObjectNames["View"] = "view"; EntitiesEntityMapObjectNames["FileUpload"] = "file_upload"; EntitiesEntityMapObjectNames["ImageUpload"] = "image_upload"; EntitiesEntityMapObjectNames["PaymentStandard"] = "payment_standard"; EntitiesEntityMapObjectNames["InsurancePolicy"] = "insurance_policy"; EntitiesEntityMapObjectNames["InsuranceProvider"] = "insurance_provider"; EntitiesEntityMapObjectNames["Leasing"] = "leasing"; EntitiesEntityMapObjectNames["Tenant"] = "tenant"; EntitiesEntityMapObjectNames["Inspection"] = "inspection"; EntitiesEntityMapObjectNames["UtilityAllowance"] = "utility_allowance"; EntitiesEntityMapObjectNames["Walkthrough"] = "walkthrough"; EntitiesEntityMapObjectNames["Zipcode"] = "zipcode"; EntitiesEntityMapObjectNames["MlsListing"] = "mls_listing"; EntitiesEntityMapObjectNames["Transaction"] = "transaction"; EntitiesEntityMapObjectNames["AirtableComment"] = "airtableComment"; EntitiesEntityMapObjectNames["AirtableCommentNotification"] = "airtableCommentNotification"; EntitiesEntityMapObjectNames["AirtableCommentSubscription"] = "airtableCommentSubscription"; EntitiesEntityMapObjectNames["RelationContactProperty"] = "relation_contact_property"; EntitiesEntityMapObjectNames["RelationContactSource"] = "relation_contact_source"; EntitiesEntityMapObjectNames["RelationGroupUser"] = "relation_group_user"; EntitiesEntityMapObjectNames["RelationLeadUser"] = "relation_lead_user"; EntitiesEntityMapObjectNames["RelationMarketOwner"] = "relation_market_owner"; EntitiesEntityMapObjectNames["RelationMarketTitleCompany"] = "relation_market_title_company"; EntitiesEntityMapObjectNames["RelationOfferProperty"] = "relation_offer_property"; EntitiesEntityMapObjectNames["RelationUserThread"] = "relation_user_thread"; EntitiesEntityMapObjectNames["RelationSourceProperty"] = "relation_source_property"; EntitiesEntityMapObjectNames["RelationLeadProperty"] = "relation_lead_property"; EntitiesEntityMapObjectNames["RelationInspectionUser"] = "relation_inspection_user"; EntitiesEntityMapObjectNames["RelationLeasingUser"] = "relation_leasing_user"; EntitiesEntityMapObjectNames["Renovation"] = "renovation"; EntitiesEntityMapObjectNames["RelationRenovationUser"] = "relation_renovation_user"; EntitiesEntityMapObjectNames["RentalListing"] = "rental_listing"; EntitiesEntityMapObjectNames["RelationRentalListingUser"] = "relation_rental_listing_user"; EntitiesEntityMapObjectNames["Update"] = "update"; EntitiesEntityMapObjectNames["WorkOrder"] = "work_order"; EntitiesEntityMapObjectNames["Contractor"] = "contractor"; EntitiesEntityMapObjectNames["RelationWorkOrderContractor"] = "relation_work_order_contractor"; EntitiesEntityMapObjectNames["RelationLeasingTenant"] = "relation_leasing_tenant"; })(EntitiesEntityMapObjectNames || (EntitiesEntityMapObjectNames = {}));