UNPKG

@simplyhomes/sos-client

Version:

Client SDK for SimplyHomes SOS API

131 lines (130 loc) 4.73 kB
import { AxiosInstance } from 'axios'; import { SDK_Properties } from './properties'; import { SDK_Units } from './units'; import { SDK_Markets } from './markets'; import { SDK_HousingAuthorities } from './housing-authorities'; import { SDK_Neighborhoods } from './neighborhoods'; import { SDK_Counties } from './counties'; import { SDK_Organizations } from './organizations'; import { SDK_Options } from './options'; import { SDK_Owners } from './owners'; import { SDK_PropertyManagers } from './property-managers'; import { SDK_Lenders } from './lenders'; type SDK_ApiConfig = { apiUrl: string; } & ({ apiKey: string; authToken?: never; organizationId?: number; } | { authToken: string; apiKey?: never; }); export type SDK_Context = { axios: AxiosInstance; }; export declare class SDK_SoS { private config; private context; constructor(config: SDK_ApiConfig); /** * The properties API provides access to the properties in the system. * This includes the ability to create, update properties. * It also includes the ability to get a list of properties, get a single property, */ get properties(): SDK_Properties; /** * The units API provides access to the units in the system. * This includes the ability to create units. * It also includes the ability to get a single unit, */ get units(): SDK_Units; /** * The markets API provides access to the markets in the system. * This includes the ability to get list, get a single market and update market. */ get markets(): SDK_Markets; /** * The owners API provides access to the owners in the system. * This includes the ability to get list, get a single owner and update owner. */ get owners(): SDK_Owners; /** * The property managers API provides access to the property managers in the system. * This includes the ability to get list, get a single property manager and update property manager. */ get propertyManagers(): SDK_PropertyManagers; /** * The housing authorities API provides access to the housing authorities in the system. * This includes the ability to get list, get a single housing authority. */ get housingAuthorities(): SDK_HousingAuthorities; /** * The neighborhoods API provides access to the neighborhoods in the system. * This includes the ability to get list, get a single neighborhood. */ get neighborhoods(): SDK_Neighborhoods; /** * The counties API provides access to the counties in the system. * This includes the ability to get list, get a single county. */ get counties(): SDK_Counties; /** * The counties API provides access to the lenders in the system. * This includes the ability to get list, get a single county. */ get lenders(): SDK_Lenders; /** * The organizations API provides access to the organizations in the system. * This includes the ability to get list, get a single and create organization. */ get organizations(): SDK_Organizations; /** * The options API provides access to the options in the system. * This includes the ability to get list options */ get options(): SDK_Options; private createContext; private updateContext; /** * Sets the API key for authentication. * * @param {string} apiKey - The API key to authenticate requests * @returns {this} The current instance for method chaining * * @example * // Set API key * client.setApiKey('your-api-key-123'); */ setApiKey(apiKey: string): this; /** * Sets the base API URL for all requests. * * @param {string} apiUrl - The base URL of the API (e.g. 'https://api.example.com/v1') * @returns {this} The current instance for method chaining * * @example * // Change API endpoint * client.setApiUrl('https://api.staging.example.com/v2'); */ setApiUrl(apiUrl: string): this; /** * Sets the organization ID in the SDK config, if supported * @param organizationId Numeric organization ID to set * @returns Current instance for method chaining */ setOrganizationId(organizationId: number): this; /** * Gets a read-only copy of the current SDK configuration. * * @returns {Readonly<SDK_ApiConfig>} Immutable copy of current configuration * * @example * // Check current config * const config = client.getCurrentConfig(); * console.log('Current API URL:', config.apiUrl); */ getCurrentConfig(): Readonly<SDK_ApiConfig>; private isApiKeyConfig; } export {};