UNPKG

fsm-sdk

Version:

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

71 lines (70 loc) 3.49 kB
import { ClientConfig } from '../client-config.model'; import { HttpService } from '../http/http-service'; import { OAuthService } from '../oauth/oauth.service'; import { Activity, ServiceCall } from './service-management.model'; /** * Service for performing composite tree operations on service calls. * Provides methods to retrieve and manipulate service calls with their nested activity structures. */ export declare class CompositeTreeAPI { private _config; private _http; private _auth; constructor(_config: Readonly<ClientConfig>, _http: Readonly<HttpService>, _auth: Readonly<OAuthService>); /** * Constructs the API URL for composite tree service call operations. * * @param {string} path - 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; /** * Retrieves a service call with its complete tree structure including nested activities. * * @param {string} id - Service call ID (also supports code=$ or externalId=$ format). * @param {object} params - Optional query parameters. * @param {string} params.fieldsMode - Fields mode: 'INCLUDE', 'EXCLUDE', or 'ADD'. * @param {string[]} params.fields - Fields to include/exclude/add in the response. * @returns {Promise<ServiceCall>} A promise resolving to the service call with nested structure. */ getServiceCall(id: string, // also support code=$ or externalId=$ params?: Partial<{ fieldsMode: 'INCLUDE' | 'EXCLUDE' | 'ADD'; fields: string[]; }>): Promise<ServiceCall>; /** * Creates a new service call with its tree structure. * * @param {Partial<ServiceCall>} data - Service call data to create. * @param {object} params - Optional query parameters. * @param {boolean} params.autoCreateActivity - Whether to automatically create an activity for the service call. * @returns {Promise<ServiceCall>} A promise resolving to the created service call. */ postServiceCall(data: Partial<ServiceCall>, params?: Partial<{ autoCreateActivity: boolean; }>): Promise<ServiceCall>; /** * Updates an existing service call with its tree structure. * * @param {Partial<ServiceCall>} data - Service call data with updates. Must include the id property. * @returns {Promise<ServiceCall>} A promise resolving to the updated service call. */ patchServiceCall(data: Partial<ServiceCall>): Promise<ServiceCall>; /** * Retrieves a specific activity within a service call's tree structure. * * @param {string} serviceCallId - Service call ID (also supports code=$ or externalId=$ format). * @param {string} activityId - Activity ID (also supports code=$ or externalId=$ format). * @param {object} params - Optional query parameters. * @param {string} params.fieldsMode - Fields mode: 'INCLUDE', 'EXCLUDE', or 'ADD'. * @param {string[]} params.fields - Fields to include/exclude/add in the response. * @returns {Promise<Activity>} A promise resolving to the activity. */ getServiceCallActivity(serviceCallId: string, // also support code=$ or externalId=$ activityId: string, // also support code=$ or externalId=$ params?: Partial<{ fieldsMode: 'INCLUDE' | 'EXCLUDE' | 'ADD'; fields: string[]; }>): Promise<Activity>; }