UNPKG

fsm-sdk

Version:

Node.JS sdk to interface with SAP Field Service Management APIs.

61 lines (60 loc) 2.69 kB
import { ClientConfig } from '../client-config.model'; import { HttpService } from '../http/http-service'; import { OAuthService } from '../oauth/oauth.service'; import { ServiceCall, UnifiedIdentifier } from './service-management.model'; export declare type BulkResponse<T> = { hasErrors: boolean; results: { resource: T; status: number; error?: { description: string; }; }[]; }; /** * Service for performing composite bulk operations on service calls. * Allows creating, updating, and managing multiple service calls in a single request. */ export declare class CompositeBulkAPI { private _config; private _http; private _auth; constructor(_config: Readonly<ClientConfig>, _http: Readonly<HttpService>, _auth: Readonly<OAuthService>); /** * Constructs the API URL for composite bulk service call operations. * * @param {string} path - Optional path to append to the base URL. * @returns {string} The complete API URL. * @see https://api.sap.com/api/service_management_ext/resource/Service_API_V2 */ getApiUrl(path?: string): string; /** * Creates multiple service calls in a single bulk operation. * * @param {Partial<ServiceCall>[]} data - Array of service call objects to create. * @param {object} params - Optional query parameters. * @param {boolean} params.autoCreateActivity - Whether to automatically create activities for the service calls. * @returns {Promise<BulkResponse<ServiceCall>>} A promise resolving to the bulk operation results. */ postServiceCalls(data: Partial<ServiceCall>[], params?: Partial<{ autoCreateActivity: boolean; }>): Promise<BulkResponse<ServiceCall>>; /** * Updates multiple service calls in a single bulk operation. * * @param {Partial<ServiceCall>[]} data - Array of service call objects with updates. Each must include an id. * @returns {Promise<BulkResponse<ServiceCall>>} A promise resolving to the bulk operation results. */ patchServiceCalls(data: Partial<ServiceCall>[]): Promise<BulkResponse<ServiceCall>>; /** * Marks multiple service calls as technically complete in a single bulk operation. * * @param {object} data - Request data. * @param {Partial<UnifiedIdentifier>[]} data.serviceCallIds - Array of service call identifiers to mark as technically complete. * @returns {Promise<BulkResponse<ServiceCall>>} A promise resolving to the bulk operation results. */ postServiceCallsTechnicallyComplete(data: { serviceCallIds: Partial<UnifiedIdentifier>[]; }): Promise<BulkResponse<ServiceCall>>; }