// 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 WorkersAPI from './workers'; import { APIPromise } from '../core/api-promise'; import { PageCursorURL, PagePromise } from '../core/pagination'; import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; /** * Device orders (new device shipments, retrievals, etc.) for company workers */ export class DeviceOrders extends APIResource { /** * A list of device orders. * * - Requires: `API Tier 2` * - Filterable fields: `worker_id`, `status` * - Expandable fields: `worker` * - Sortable fields: `id`, `created_at`, `updated_at` */ list( query: DeviceOrderListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/device-orders/', PageCursorURL, { query, ...options, }); } /** * Retrieve a specific device order */ retrieve( id: string, query: DeviceOrderRetrieveParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get(path`/device-orders/${id}/`, { query, ...options }); } } export type DeviceOrderListResponsesPageCursorURL = PageCursorURL; export interface DeviceOrderListResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Record update date */ updated_at: string; /** * True when a cancellation has been requested but not yet completed. */ cancel_requested?: boolean; /** * When the order reached a terminal state (COMPLETED, FAILED, or CANCELED). */ completed_at?: string; /** * The type of hardware order, as reported by the underlying inventory order (for * example: New Device Order, Warehouse Return, Warehouse Order, Add Existing * Device, Assign Device, Empty Order, or Sell Device). */ order_type?: string; /** * The ID of the role that requested the order (often an IT admin). Null if * system-created. */ requested_by_id?: string; /** * The order lifecycle state (InventoryFlowState): CREATED, RUNNING, COMPLETED, * FAILED, CANCELING, CANCELED. */ status?: string; /** * The warehouse / vendor provider servicing the order (e.g. CDW, INGRAMMICRO, * TD_SYNNEX, GROWRK). */ warehouse_provider?: string; /** * The worker the order is for. * * Expandable field */ worker?: WorkersAPI.Worker; /** * The ID of the worker the order is for (the recipient). Null if unassigned. */ worker_id?: string; } /** * Meta information for the response. */ export interface DeviceOrderRetrieveResponse extends BusinessPartnersAPI.Meta { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Record update date */ updated_at: string; /** * True when a cancellation has been requested but not yet completed. */ cancel_requested?: boolean; /** * When the order reached a terminal state (COMPLETED, FAILED, or CANCELED). */ completed_at?: string; /** * The type of hardware order, as reported by the underlying inventory order (for * example: New Device Order, Warehouse Return, Warehouse Order, Add Existing * Device, Assign Device, Empty Order, or Sell Device). */ order_type?: string; /** * The ID of the role that requested the order (often an IT admin). Null if * system-created. */ requested_by_id?: string; /** * The order lifecycle state (InventoryFlowState): CREATED, RUNNING, COMPLETED, * FAILED, CANCELING, CANCELED. */ status?: string; /** * The warehouse / vendor provider servicing the order (e.g. CDW, INGRAMMICRO, * TD_SYNNEX, GROWRK). */ warehouse_provider?: string; /** * The worker the order is for. * * Expandable field */ worker?: WorkersAPI.Worker; /** * The ID of the worker the order is for (the recipient). Null if unassigned. */ worker_id?: string; } export interface DeviceOrderListParams { cursor?: string; expand?: string; filter?: string; order_by?: string; } export interface DeviceOrderRetrieveParams { expand?: string; } export declare namespace DeviceOrders { export { type DeviceOrderListResponse as DeviceOrderListResponse, type DeviceOrderRetrieveResponse as DeviceOrderRetrieveResponse, type DeviceOrderListResponsesPageCursorURL as DeviceOrderListResponsesPageCursorURL, type DeviceOrderListParams as DeviceOrderListParams, type DeviceOrderRetrieveParams as DeviceOrderRetrieveParams, }; }