// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; import * as BusinessPartnersAPI from './business-partners'; import * as Shared from './shared'; import { APIPromise } from '../core/api-promise'; import { PageCursorURL, PagePromise } from '../core/pagination'; import { buildHeaders } from '../internal/headers'; import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; /** * Work locations used by the company */ export class WorkLocations extends APIResource { /** * A list of work locations. * * - Requires: `API Tier 1` * - Sortable fields: `id`, `created_at`, `updated_at` */ list( query: WorkLocationListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/work-locations/', PageCursorURL, { query, ...options }); } /** * Create a new work location */ create(body: WorkLocationCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/work-locations/', { body, ...options }); } /** * Retrieve a specific work location */ retrieve(id: string, options?: RequestOptions): APIPromise { return this._client.get(path`/work-locations/${id}/`, options); } /** * Update a specific work location. */ update(id: string, body: WorkLocationUpdateParams, options?: RequestOptions): APIPromise { return this._client.patch(path`/work-locations/${id}/`, { body, ...options }); } /** * Delete a work location */ delete(id: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/work-locations/${id}/`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } } export type WorkLocationsPageCursorURL = PageCursorURL; export interface WorkLocation { /** * Identifier field */ id: string; /** * The address for the work location. */ address: Shared.Address; /** * Record creation date */ created_at: string; /** * The name of the work location. */ name: string; /** * Record update date */ updated_at: string; } /** * Meta information for the response. */ export interface WorkLocationRetrieveResponse extends BusinessPartnersAPI.Meta, WorkLocation {} export interface WorkLocationListParams { cursor?: string; order_by?: string; } export interface WorkLocationCreateParams { /** * The address for the work location. */ address: WorkLocationCreateParams.Address; /** * The name of the work location. */ name: string; } export namespace WorkLocationCreateParams { /** * The address for the work location. */ export interface Address { /** * The country component, pursuant to SCIM RFC 7643 4.1.2. */ country?: Shared.CountryCode; /** * The city or locality component. */ locality?: string; /** * The zip code or postal code component, pursuant to SCIM RFC 7643 4.1.2. */ postal_code?: string; /** * The state or region component, pursuant to SCIM RFC 7643 4.1.2. */ region?: string; /** * The full street address component, which may include house number, street name, * P.O. box, and multi-line extended street address information, pursuant to SCIM * RFC 7643 4.1.2.. */ street_address?: string; /** * The classification of the address. */ type?: 'HOME' | 'WORK' | 'OTHER'; } } export interface WorkLocationUpdateParams { /** * The address for the work location. */ address: WorkLocationUpdateParams.Address; /** * The name of the work location. */ name: string; } export namespace WorkLocationUpdateParams { /** * The address for the work location. */ export interface Address { /** * The country component, pursuant to SCIM RFC 7643 4.1.2. */ country?: Shared.CountryCode; /** * The city or locality component. */ locality?: string; /** * The zip code or postal code component, pursuant to SCIM RFC 7643 4.1.2. */ postal_code?: string; /** * The state or region component, pursuant to SCIM RFC 7643 4.1.2. */ region?: string; /** * The full street address component, which may include house number, street name, * P.O. box, and multi-line extended street address information, pursuant to SCIM * RFC 7643 4.1.2.. */ street_address?: string; /** * The classification of the address. */ type?: 'HOME' | 'WORK' | 'OTHER'; } } export declare namespace WorkLocations { export { type WorkLocation as WorkLocation, type WorkLocationRetrieveResponse as WorkLocationRetrieveResponse, type WorkLocationsPageCursorURL as WorkLocationsPageCursorURL, type WorkLocationListParams as WorkLocationListParams, type WorkLocationCreateParams as WorkLocationCreateParams, type WorkLocationUpdateParams as WorkLocationUpdateParams, }; }