@simplyhomes/sos-sdk
Version:
TypeScript SDK for Simply Homes SoS API v4
268 lines (267 loc) • 35.1 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 { V4ZipcodesCreateZipcodeBodyDtoToJSON, V4ZipcodesCreateZipcodeResponseDtoFromJSON, V4ZipcodesDeleteZipcodeResponseDtoFromJSON, V4ZipcodesGetZipcodeColumnsResponseDtoFromJSON, V4ZipcodesGetZipcodeResponseDtoFromJSON, V4ZipcodesGetZipcodesInViewResponseDtoFromJSON, V4ZipcodesGetZipcodesResponseDtoFromJSON, V4ZipcodesUpdateZipcodeBodyDtoToJSON, V4ZipcodesUpdateZipcodeResponseDtoFromJSON, } from '../models/index';
/**
*
*/
export class ZipcodesAPIV4Api extends runtime.BaseAPI {
/**
* # POST /v4/zipcodes ## Overview Create a new zipcode entry in the system. This endpoint allows you to add new zipcodes with their associated properties. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Request Body The request body must contain a JSON object with the zipcode data. ### Content Type - **application/json** ### Request Structure ```json { \"zipcode\": \"12345\", \"blacklisted\": false } ``` ### Required Fields | Field | Type | Description | |-------|------|-------------| | `zipcode` | string | The unique zipcode identifier (e.g., \"12345\") | ### Optional Fields | Field | Type | Description | |-------|------|-------------| | `blacklisted` | boolean | Whether the zipcode should be blacklisted (defaults to false) | ### Read-Only Fields The following fields cannot be set during creation: - **area**: Geographic area data (set by system processes) - **center**: Geographic center point (set by system processes) ## Validation Rules - **zipcode**: Must be a valid string format - **blacklisted**: Must be a boolean value if provided - **Uniqueness**: Zipcode identifier must be unique in the system ## Use Cases This endpoint is commonly used for: - **Initial data import**: Adding zipcodes from external sources - **System expansion**: Adding new geographic coverage areas - **Data correction**: Re-creating accidentally deleted zipcodes - **Batch operations**: Part of bulk zipcode management processes ## Business Rules - New zipcodes are created with minimal data - Geographic data (area, center) is typically populated by background processes - Blacklist status can be set immediately during creation - Zipcodes are global entities not tied to specific organizations
* Create a new zipcode
*/
async v4ZipcodesControllerCreateZipcodeV4Raw(requestParameters, initOverrides) {
if (requestParameters['v4ZipcodesCreateZipcodeBodyDto'] == null) {
throw new runtime.RequiredError('v4ZipcodesCreateZipcodeBodyDto', 'Required parameter "v4ZipcodesCreateZipcodeBodyDto" was null or undefined when calling v4ZipcodesControllerCreateZipcodeV4().');
}
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/zipcodes`;
const response = await this.request({
path: urlPath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: V4ZipcodesCreateZipcodeBodyDtoToJSON(requestParameters['v4ZipcodesCreateZipcodeBodyDto']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4ZipcodesCreateZipcodeResponseDtoFromJSON(jsonValue));
}
/**
* # POST /v4/zipcodes ## Overview Create a new zipcode entry in the system. This endpoint allows you to add new zipcodes with their associated properties. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Request Body The request body must contain a JSON object with the zipcode data. ### Content Type - **application/json** ### Request Structure ```json { \"zipcode\": \"12345\", \"blacklisted\": false } ``` ### Required Fields | Field | Type | Description | |-------|------|-------------| | `zipcode` | string | The unique zipcode identifier (e.g., \"12345\") | ### Optional Fields | Field | Type | Description | |-------|------|-------------| | `blacklisted` | boolean | Whether the zipcode should be blacklisted (defaults to false) | ### Read-Only Fields The following fields cannot be set during creation: - **area**: Geographic area data (set by system processes) - **center**: Geographic center point (set by system processes) ## Validation Rules - **zipcode**: Must be a valid string format - **blacklisted**: Must be a boolean value if provided - **Uniqueness**: Zipcode identifier must be unique in the system ## Use Cases This endpoint is commonly used for: - **Initial data import**: Adding zipcodes from external sources - **System expansion**: Adding new geographic coverage areas - **Data correction**: Re-creating accidentally deleted zipcodes - **Batch operations**: Part of bulk zipcode management processes ## Business Rules - New zipcodes are created with minimal data - Geographic data (area, center) is typically populated by background processes - Blacklist status can be set immediately during creation - Zipcodes are global entities not tied to specific organizations
* Create a new zipcode
*/
async v4ZipcodesControllerCreateZipcodeV4(requestParameters, initOverrides) {
const response = await this.v4ZipcodesControllerCreateZipcodeV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* # DELETE /v4/zipcodes/{zipcodeId} ## Overview Delete a specific zipcode from the system. This operation permanently removes the zipcode entry. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `zipcodeId` | string | Yes | The unique identifier of the zipcode to delete | ## Operation Details ### Permanent Deletion - The zipcode is permanently removed from the system - This operation cannot be undone - All associated geographic data is also removed ### Impact Assessment Before deletion, consider: - **Property references**: Properties may reference this zipcode - **Business rules**: Deletion may affect validation logic - **Data integrity**: Related records may be impacted ## Use Cases This endpoint should be used cautiously for: - **Data cleanup**: Removing invalid or duplicate zipcodes - **System maintenance**: Cleaning up test or obsolete data - **Data migration**: Part of data restructuring processes - **Error correction**: Removing incorrectly created zipcodes ## Business Rules - Zipcodes are global entities not tied to organizations - Consider setting `blacklisted = true` instead of deletion for business scenarios - Deletion is immediate and permanent - No cascade deletion is performed on related entities ## Warning **Permanent Action**: This operation permanently removes the zipcode from the system. Consider using the UPDATE endpoint to set `blacklisted = true` instead of deletion for business scenarios where the zipcode should be disabled but preserved.
* Delete a specific zipcode by zipcodeId
*/
async v4ZipcodesControllerDeleteZipcodeV4Raw(requestParameters, initOverrides) {
if (requestParameters['zipcodeId'] == null) {
throw new runtime.RequiredError('zipcodeId', 'Required parameter "zipcodeId" was null or undefined when calling v4ZipcodesControllerDeleteZipcodeV4().');
}
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/zipcodes/{zipcodeId}`;
urlPath = urlPath.replace(`{${"zipcodeId"}}`, encodeURIComponent(String(requestParameters['zipcodeId'])));
const response = await this.request({
path: urlPath,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4ZipcodesDeleteZipcodeResponseDtoFromJSON(jsonValue));
}
/**
* # DELETE /v4/zipcodes/{zipcodeId} ## Overview Delete a specific zipcode from the system. This operation permanently removes the zipcode entry. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `zipcodeId` | string | Yes | The unique identifier of the zipcode to delete | ## Operation Details ### Permanent Deletion - The zipcode is permanently removed from the system - This operation cannot be undone - All associated geographic data is also removed ### Impact Assessment Before deletion, consider: - **Property references**: Properties may reference this zipcode - **Business rules**: Deletion may affect validation logic - **Data integrity**: Related records may be impacted ## Use Cases This endpoint should be used cautiously for: - **Data cleanup**: Removing invalid or duplicate zipcodes - **System maintenance**: Cleaning up test or obsolete data - **Data migration**: Part of data restructuring processes - **Error correction**: Removing incorrectly created zipcodes ## Business Rules - Zipcodes are global entities not tied to organizations - Consider setting `blacklisted = true` instead of deletion for business scenarios - Deletion is immediate and permanent - No cascade deletion is performed on related entities ## Warning **Permanent Action**: This operation permanently removes the zipcode from the system. Consider using the UPDATE endpoint to set `blacklisted = true` instead of deletion for business scenarios where the zipcode should be disabled but preserved.
* Delete a specific zipcode by zipcodeId
*/
async v4ZipcodesControllerDeleteZipcodeV4(requestParameters, initOverrides) {
const response = await this.v4ZipcodesControllerDeleteZipcodeV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* # GET /v4/zipcodes/{zipcodeId}/{columns} ## Overview Retrieve specific columns of a zipcode by its ID. This endpoint allows you to fetch only the fields you need, improving performance and reducing bandwidth usage. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `zipcodeId` | string | Yes | The unique identifier of the zipcode to retrieve | | `columns` | string | Yes | Comma-separated list of column names to retrieve | ## Available Columns | Column | Type | Description | |--------|------|-------------| | `zipcode` | string | The zipcode identifier (always included) | | `blacklisted` | boolean | Whether the zipcode is blacklisted | | `area` | geometry | Geographic area data (MultiPolygon) | | `center` | geometry | Geographic center point (Point) | ## Examples ### Get only blacklisted status ``` GET /v4/zipcodes/12345/blacklisted ``` ### Get multiple columns ``` GET /v4/zipcodes/12345/zipcode,blacklisted,center ``` ## Response Structure The response contains only the requested columns along with metadata. ### Root Object - **objects**: Array containing the single zipcode entity with requested columns - **count**: Always 1 for successful single zipcode retrieval ## Use Cases This endpoint is commonly used for: - **Performance optimization**: Fetch only needed fields - **Bandwidth optimization**: Reduce response size - **Specific data queries**: Get targeted information - **Mobile applications**: Minimize data transfer
* Get specific columns of a zipcode by zipcodeId
*/
async v4ZipcodesControllerGetZipcodeColumnsV4Raw(requestParameters, initOverrides) {
if (requestParameters['zipcodeId'] == null) {
throw new runtime.RequiredError('zipcodeId', 'Required parameter "zipcodeId" was null or undefined when calling v4ZipcodesControllerGetZipcodeColumnsV4().');
}
if (requestParameters['columns'] == null) {
throw new runtime.RequiredError('columns', 'Required parameter "columns" was null or undefined when calling v4ZipcodesControllerGetZipcodeColumnsV4().');
}
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/zipcodes/{zipcodeId}/{columns}`;
urlPath = urlPath.replace(`{${"zipcodeId"}}`, encodeURIComponent(String(requestParameters['zipcodeId'])));
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) => V4ZipcodesGetZipcodeColumnsResponseDtoFromJSON(jsonValue));
}
/**
* # GET /v4/zipcodes/{zipcodeId}/{columns} ## Overview Retrieve specific columns of a zipcode by its ID. This endpoint allows you to fetch only the fields you need, improving performance and reducing bandwidth usage. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `zipcodeId` | string | Yes | The unique identifier of the zipcode to retrieve | | `columns` | string | Yes | Comma-separated list of column names to retrieve | ## Available Columns | Column | Type | Description | |--------|------|-------------| | `zipcode` | string | The zipcode identifier (always included) | | `blacklisted` | boolean | Whether the zipcode is blacklisted | | `area` | geometry | Geographic area data (MultiPolygon) | | `center` | geometry | Geographic center point (Point) | ## Examples ### Get only blacklisted status ``` GET /v4/zipcodes/12345/blacklisted ``` ### Get multiple columns ``` GET /v4/zipcodes/12345/zipcode,blacklisted,center ``` ## Response Structure The response contains only the requested columns along with metadata. ### Root Object - **objects**: Array containing the single zipcode entity with requested columns - **count**: Always 1 for successful single zipcode retrieval ## Use Cases This endpoint is commonly used for: - **Performance optimization**: Fetch only needed fields - **Bandwidth optimization**: Reduce response size - **Specific data queries**: Get targeted information - **Mobile applications**: Minimize data transfer
* Get specific columns of a zipcode by zipcodeId
*/
async v4ZipcodesControllerGetZipcodeColumnsV4(requestParameters, initOverrides) {
const response = await this.v4ZipcodesControllerGetZipcodeColumnsV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* # GET /v4/zipcodes/{zipcodeId} ## Overview Retrieve detailed information for a specific zipcode by its ID. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `zipcodeId` | string | Yes | The unique identifier of the zipcode to retrieve | ## Query Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `viewId` | number | No | - | Apply a specific view for filtering or column selection | ## Response Structure The response contains the zipcode entity along with metadata. ### Root Object - **objects**: Array containing the single zipcode entity - **count**: Always 1 for successful single zipcode retrieval ### Zipcode Entity - **zipcode**: The zipcode identifier (e.g., \"12345\") - **blacklisted**: Boolean indicating if the zipcode is blacklisted - **area**: Geographic area data (MultiPolygon geometry, usually null) - **center**: Geographic center point (Point geometry, usually null) ## Use Cases This endpoint is commonly used for: - **Zipcode details**: Get complete information about a specific zipcode - **Blacklist status**: Check if a specific zipcode is blacklisted - **Property validation**: Verify zipcode exists before property operations - **Geographic data**: Access zipcode boundary and center point data
* Get a specific zipcode by zipcodeId
*/
async v4ZipcodesControllerGetZipcodeV4Raw(requestParameters, initOverrides) {
if (requestParameters['zipcodeId'] == null) {
throw new runtime.RequiredError('zipcodeId', 'Required parameter "zipcodeId" was null or undefined when calling v4ZipcodesControllerGetZipcodeV4().');
}
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
}
let urlPath = `/v4/zipcodes/{zipcodeId}`;
urlPath = urlPath.replace(`{${"zipcodeId"}}`, encodeURIComponent(String(requestParameters['zipcodeId'])));
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4ZipcodesGetZipcodeResponseDtoFromJSON(jsonValue));
}
/**
* # GET /v4/zipcodes/{zipcodeId} ## Overview Retrieve detailed information for a specific zipcode by its ID. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `zipcodeId` | string | Yes | The unique identifier of the zipcode to retrieve | ## Query Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `viewId` | number | No | - | Apply a specific view for filtering or column selection | ## Response Structure The response contains the zipcode entity along with metadata. ### Root Object - **objects**: Array containing the single zipcode entity - **count**: Always 1 for successful single zipcode retrieval ### Zipcode Entity - **zipcode**: The zipcode identifier (e.g., \"12345\") - **blacklisted**: Boolean indicating if the zipcode is blacklisted - **area**: Geographic area data (MultiPolygon geometry, usually null) - **center**: Geographic center point (Point geometry, usually null) ## Use Cases This endpoint is commonly used for: - **Zipcode details**: Get complete information about a specific zipcode - **Blacklist status**: Check if a specific zipcode is blacklisted - **Property validation**: Verify zipcode exists before property operations - **Geographic data**: Access zipcode boundary and center point data
* Get a specific zipcode by zipcodeId
*/
async v4ZipcodesControllerGetZipcodeV4(requestParameters, initOverrides) {
const response = await this.v4ZipcodesControllerGetZipcodeV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* # GET /v4/zipcodes/viewId/{viewId} ## Overview Retrieve zipcodes filtered by a specific view. Views provide predefined filtering, sorting, and column selection for zipcode data. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `viewId` | number | Yes | The unique identifier of the view to apply | ## Query Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `limit` | number | No | 50 | Maximum number of zipcodes to return | | `offset` | number | No | 0 | Number of zipcodes to skip for pagination | | `countOnly` | boolean | No | false | Return only the count instead of zipcode objects | ## Views Views can define: - **Filters**: Conditions to filter zipcodes (e.g., blacklisted = true) - **Sorting**: Order of results (e.g., zipcode ascending) - **Columns**: Which fields to include in response - **Aggregations**: Summary statistics and calculations ## Response Structure The response contains an array of zipcode objects filtered by the view. ### Root Object - **objects**: Array of zipcode entities matching the view criteria - **count**: Total number of zipcodes matching the view (not just current page) ### Zipcode Entity - **zipcode**: The zipcode identifier (e.g., \"12345\") - **blacklisted**: Boolean indicating if the zipcode is blacklisted - **area**: Geographic area data (MultiPolygon geometry, usually null) - **center**: Geographic center point (Point geometry, usually null) ## Use Cases This endpoint is commonly used for: - **Filtered lists**: Get zipcodes matching specific criteria - **Dashboard queries**: Pre-configured data views for dashboards - **Report generation**: Consistent data filtering for reports - **Saved searches**: Reusable query configurations - **Analytics**: Pre-defined data slices for analysis ## Examples ### Get blacklisted zipcodes Using a view that filters for `blacklisted = true` ### Get zipcodes by region Using a view that filters by geographic boundaries ### Get zipcodes with custom sorting Using a view that applies specific ordering
* Get zipcodes with a specific viewId
*/
async v4ZipcodesControllerGetZipcodesInViewV4Raw(requestParameters, initOverrides) {
if (requestParameters['viewId'] == null) {
throw new runtime.RequiredError('viewId', 'Required parameter "viewId" was null or undefined when calling v4ZipcodesControllerGetZipcodesInViewV4().');
}
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
}
let urlPath = `/v4/zipcodes/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) => V4ZipcodesGetZipcodesInViewResponseDtoFromJSON(jsonValue));
}
/**
* # GET /v4/zipcodes/viewId/{viewId} ## Overview Retrieve zipcodes filtered by a specific view. Views provide predefined filtering, sorting, and column selection for zipcode data. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `viewId` | number | Yes | The unique identifier of the view to apply | ## Query Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `limit` | number | No | 50 | Maximum number of zipcodes to return | | `offset` | number | No | 0 | Number of zipcodes to skip for pagination | | `countOnly` | boolean | No | false | Return only the count instead of zipcode objects | ## Views Views can define: - **Filters**: Conditions to filter zipcodes (e.g., blacklisted = true) - **Sorting**: Order of results (e.g., zipcode ascending) - **Columns**: Which fields to include in response - **Aggregations**: Summary statistics and calculations ## Response Structure The response contains an array of zipcode objects filtered by the view. ### Root Object - **objects**: Array of zipcode entities matching the view criteria - **count**: Total number of zipcodes matching the view (not just current page) ### Zipcode Entity - **zipcode**: The zipcode identifier (e.g., \"12345\") - **blacklisted**: Boolean indicating if the zipcode is blacklisted - **area**: Geographic area data (MultiPolygon geometry, usually null) - **center**: Geographic center point (Point geometry, usually null) ## Use Cases This endpoint is commonly used for: - **Filtered lists**: Get zipcodes matching specific criteria - **Dashboard queries**: Pre-configured data views for dashboards - **Report generation**: Consistent data filtering for reports - **Saved searches**: Reusable query configurations - **Analytics**: Pre-defined data slices for analysis ## Examples ### Get blacklisted zipcodes Using a view that filters for `blacklisted = true` ### Get zipcodes by region Using a view that filters by geographic boundaries ### Get zipcodes with custom sorting Using a view that applies specific ordering
* Get zipcodes with a specific viewId
*/
async v4ZipcodesControllerGetZipcodesInViewV4(requestParameters, initOverrides) {
const response = await this.v4ZipcodesControllerGetZipcodesInViewV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* # GET /v4/zipcodes ## Overview Retrieve a list of zipcodes with optional view filtering and pagination. Zipcodes are global entities not restricted by organization. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Query Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `viewId` | number | No | - | Filter zipcodes using a specific view | | `limit` | number | No | 50 | Maximum number of zipcodes to return | | `offset` | number | No | 0 | Number of zipcodes to skip for pagination | | `countOnly` | boolean | No | false | Return only the count instead of zipcode objects | ## Response Structure The response contains an array of zipcode objects along with pagination metadata. ### Root Object - **objects**: Array of zipcode entities - **count**: Total number of zipcodes matching the query ### Zipcode Entity - **zipcode**: The zipcode identifier (e.g., \"12345\") - **blacklisted**: Boolean indicating if the zipcode is blacklisted - **area**: Geographic area data (MultiPolygon geometry, usually null) - **center**: Geographic center point (Point geometry, usually null) ## Use Cases This endpoint is commonly used for: - **List all zipcodes**: Get complete zipcode inventory - **Paginated retrieval**: Load zipcodes in chunks for performance - **View-based filtering**: Apply custom filters using views - **Count queries**: Get total zipcode count for statistics - **Blacklist management**: Identify blacklisted zipcodes
* Get zipcodes with optional viewId
*/
async v4ZipcodesControllerGetZipcodesV4Raw(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
}
let urlPath = `/v4/zipcodes`;
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4ZipcodesGetZipcodesResponseDtoFromJSON(jsonValue));
}
/**
* # GET /v4/zipcodes ## Overview Retrieve a list of zipcodes with optional view filtering and pagination. Zipcodes are global entities not restricted by organization. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Query Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `viewId` | number | No | - | Filter zipcodes using a specific view | | `limit` | number | No | 50 | Maximum number of zipcodes to return | | `offset` | number | No | 0 | Number of zipcodes to skip for pagination | | `countOnly` | boolean | No | false | Return only the count instead of zipcode objects | ## Response Structure The response contains an array of zipcode objects along with pagination metadata. ### Root Object - **objects**: Array of zipcode entities - **count**: Total number of zipcodes matching the query ### Zipcode Entity - **zipcode**: The zipcode identifier (e.g., \"12345\") - **blacklisted**: Boolean indicating if the zipcode is blacklisted - **area**: Geographic area data (MultiPolygon geometry, usually null) - **center**: Geographic center point (Point geometry, usually null) ## Use Cases This endpoint is commonly used for: - **List all zipcodes**: Get complete zipcode inventory - **Paginated retrieval**: Load zipcodes in chunks for performance - **View-based filtering**: Apply custom filters using views - **Count queries**: Get total zipcode count for statistics - **Blacklist management**: Identify blacklisted zipcodes
* Get zipcodes with optional viewId
*/
async v4ZipcodesControllerGetZipcodesV4(requestParameters = {}, initOverrides) {
const response = await this.v4ZipcodesControllerGetZipcodesV4Raw(requestParameters, initOverrides);
return await response.value();
}
/**
* # PATCH /v4/zipcodes/{zipcodeId} ## Overview Update a specific zipcode by its ID. Commonly used to update the blacklisted status of zipcodes. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Request Parameters ### Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `zipcodeId` | string | Yes | The unique identifier of the zipcode to update | ## Request Body The request body must contain a JSON object with the zipcode fields to be updated. ### Content Type - **application/json** ### Request Structure The request body should contain the zipcode data to update: ```json { \"zipcode\": { \"blacklisted\": true } } ``` ### Updatable Fields - **blacklisted**: Boolean indicating if the zipcode is blacklisted ## Use Cases This endpoint is commonly used for: - **Blacklisting zipcodes**: Mark zipcodes as blacklisted to prevent property purchases in those areas - **Un-blacklisting zipcodes**: Remove blacklist status from previously blacklisted zipcodes
* Update a specific zipcode by zipcodeId
*/
async v4ZipcodesControllerUpdateZipcodeV4Raw(requestParameters, initOverrides) {
if (requestParameters['zipcodeId'] == null) {
throw new runtime.RequiredError('zipcodeId', 'Required parameter "zipcodeId" was null or undefined when calling v4ZipcodesControllerUpdateZipcodeV4().');
}
if (requestParameters['v4ZipcodesUpdateZipcodeBodyDto'] == null) {
throw new runtime.RequiredError('v4ZipcodesUpdateZipcodeBodyDto', 'Required parameter "v4ZipcodesUpdateZipcodeBodyDto" was null or undefined when calling v4ZipcodesControllerUpdateZipcodeV4().');
}
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/zipcodes/{zipcodeId}`;
urlPath = urlPath.replace(`{${"zipcodeId"}}`, encodeURIComponent(String(requestParameters['zipcodeId'])));
const response = await this.request({
path: urlPath,
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: V4ZipcodesUpdateZipcodeBodyDtoToJSON(requestParameters['v4ZipcodesUpdateZipcodeBodyDto']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => V4ZipcodesUpdateZipcodeResponseDtoFromJSON(jsonValue));
}
/**
* # PATCH /v4/zipcodes/{zipcodeId} ## Overview Update a specific zipcode by its ID. Commonly used to update the blacklisted status of zipcodes. ## Authentication - **Required**: Yes - **Security**: - `x-api-key` header ## Request Parameters ### Path Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `zipcodeId` | string | Yes | The unique identifier of the zipcode to update | ## Request Body The request body must contain a JSON object with the zipcode fields to be updated. ### Content Type - **application/json** ### Request Structure The request body should contain the zipcode data to update: ```json { \"zipcode\": { \"blacklisted\": true } } ``` ### Updatable Fields - **blacklisted**: Boolean indicating if the zipcode is blacklisted ## Use Cases This endpoint is commonly used for: - **Blacklisting zipcodes**: Mark zipcodes as blacklisted to prevent property purchases in those areas - **Un-blacklisting zipcodes**: Remove blacklist status from previously blacklisted zipcodes
* Update a specific zipcode by zipcodeId
*/
async v4ZipcodesControllerUpdateZipcodeV4(requestParameters, initOverrides) {
const response = await this.v4ZipcodesControllerUpdateZipcodeV4Raw(requestParameters, initOverrides);
return await response.value();
}
}