@uipath/uipath-typescript 1.0.0-beta.17 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -40
- package/dist/assets/index.cjs +2090 -0
- package/dist/assets/index.d.ts +513 -0
- package/dist/assets/index.mjs +2087 -0
- package/dist/buckets/index.cjs +2364 -0
- package/dist/buckets/index.d.ts +819 -0
- package/dist/buckets/index.mjs +2361 -0
- package/dist/cases/index.cjs +3493 -0
- package/dist/cases/index.d.ts +1397 -0
- package/dist/cases/index.mjs +3487 -0
- package/dist/core/index.cjs +5267 -0
- package/dist/core/index.d.ts +406 -0
- package/dist/core/index.mjs +5241 -0
- package/dist/entities/index.cjs +2749 -0
- package/dist/entities/index.d.ts +1513 -0
- package/dist/entities/index.mjs +2743 -0
- package/dist/index.cjs +3611 -3176
- package/dist/index.d.ts +1049 -540
- package/dist/index.mjs +3611 -3176
- package/dist/index.umd.js +8492 -11899
- package/dist/maestro-processes/index.cjs +2609 -0
- package/dist/maestro-processes/index.d.ts +1127 -0
- package/dist/maestro-processes/index.mjs +2600 -0
- package/dist/processes/index.cjs +2233 -0
- package/dist/processes/index.d.ts +800 -0
- package/dist/processes/index.mjs +2230 -0
- package/dist/queues/index.cjs +2075 -0
- package/dist/queues/index.d.ts +504 -0
- package/dist/queues/index.mjs +2072 -0
- package/dist/tasks/index.cjs +2675 -0
- package/dist/tasks/index.d.ts +1122 -0
- package/dist/tasks/index.mjs +2671 -0
- package/package.json +100 -6
- package/dist/index.d.cts +0 -5376
- package/dist/index.d.mts +0 -5376
|
@@ -0,0 +1,1122 @@
|
|
|
1
|
+
import { IUiPath } from '../core/index';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Simplified universal pagination cursor
|
|
5
|
+
* Used to fetch next/previous pages
|
|
6
|
+
*/
|
|
7
|
+
interface PaginationCursor {
|
|
8
|
+
/** Opaque string containing all information needed to fetch next page */
|
|
9
|
+
value: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Discriminated union for pagination methods - ensures cursor and jumpToPage are mutually exclusive
|
|
13
|
+
*/
|
|
14
|
+
type PaginationMethodUnion = {
|
|
15
|
+
cursor?: PaginationCursor;
|
|
16
|
+
jumpToPage?: never;
|
|
17
|
+
} | {
|
|
18
|
+
cursor?: never;
|
|
19
|
+
jumpToPage?: number;
|
|
20
|
+
} | {
|
|
21
|
+
cursor?: never;
|
|
22
|
+
jumpToPage?: never;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Pagination options. Users cannot specify both cursor and jumpToPage.
|
|
26
|
+
*/
|
|
27
|
+
type PaginationOptions = {
|
|
28
|
+
/** Size of the page to fetch (items per page) */
|
|
29
|
+
pageSize?: number;
|
|
30
|
+
} & PaginationMethodUnion;
|
|
31
|
+
/**
|
|
32
|
+
* Paginated response containing items and navigation information
|
|
33
|
+
*/
|
|
34
|
+
interface PaginatedResponse<T> {
|
|
35
|
+
/** The items in the current page */
|
|
36
|
+
items: T[];
|
|
37
|
+
/** Total count of items across all pages (if available) */
|
|
38
|
+
totalCount?: number;
|
|
39
|
+
/** Whether more pages are available */
|
|
40
|
+
hasNextPage: boolean;
|
|
41
|
+
/** Cursor to fetch the next page (if available) */
|
|
42
|
+
nextCursor?: PaginationCursor;
|
|
43
|
+
/** Cursor to fetch the previous page (if available) */
|
|
44
|
+
previousCursor?: PaginationCursor;
|
|
45
|
+
/** Current page number (1-based, if available) */
|
|
46
|
+
currentPage?: number;
|
|
47
|
+
/** Total number of pages (if available) */
|
|
48
|
+
totalPages?: number;
|
|
49
|
+
/** Whether this pagination type supports jumping to arbitrary pages */
|
|
50
|
+
supportsPageJump: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Response for non-paginated calls that includes both data and total count
|
|
54
|
+
*/
|
|
55
|
+
interface NonPaginatedResponse<T> {
|
|
56
|
+
items: T[];
|
|
57
|
+
totalCount?: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Helper type for defining paginated method overloads
|
|
61
|
+
* Creates a union type of all ways pagination can be triggered
|
|
62
|
+
*/
|
|
63
|
+
type HasPaginationOptions<T> = (T & {
|
|
64
|
+
pageSize: number;
|
|
65
|
+
}) | (T & {
|
|
66
|
+
cursor: PaginationCursor;
|
|
67
|
+
}) | (T & {
|
|
68
|
+
jumpToPage: number;
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Pagination types supported by the SDK
|
|
73
|
+
*/
|
|
74
|
+
declare enum PaginationType {
|
|
75
|
+
OFFSET = "offset",
|
|
76
|
+
TOKEN = "token"
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Interface for service access methods needed by pagination helpers
|
|
80
|
+
*/
|
|
81
|
+
interface PaginationServiceAccess {
|
|
82
|
+
get<T>(path: string, options?: any): Promise<{
|
|
83
|
+
data: T;
|
|
84
|
+
}>;
|
|
85
|
+
post<T>(path: string, body?: any, options?: any): Promise<{
|
|
86
|
+
data: T;
|
|
87
|
+
}>;
|
|
88
|
+
requestWithPagination<T>(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise<PaginatedResponse<T>>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Field names for extracting data from paginated responses.
|
|
92
|
+
*/
|
|
93
|
+
interface PaginationFieldNames {
|
|
94
|
+
itemsField?: string;
|
|
95
|
+
totalCountField?: string;
|
|
96
|
+
continuationTokenField?: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Options for the requestWithPagination method in BaseService.
|
|
100
|
+
*/
|
|
101
|
+
interface RequestWithPaginationOptions extends RequestSpec {
|
|
102
|
+
pagination: PaginationFieldNames & {
|
|
103
|
+
paginationType: PaginationType;
|
|
104
|
+
paginationParams?: {
|
|
105
|
+
pageSizeParam?: string;
|
|
106
|
+
offsetParam?: string;
|
|
107
|
+
tokenParam?: string;
|
|
108
|
+
countParam?: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* HTTP methods supported by the API client
|
|
115
|
+
*/
|
|
116
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
117
|
+
/**
|
|
118
|
+
* Supported response types for API requests
|
|
119
|
+
*/
|
|
120
|
+
type ResponseType = 'json' | 'text' | 'blob' | 'arraybuffer' | 'stream';
|
|
121
|
+
/**
|
|
122
|
+
* Query parameters type with support for arrays and nested objects
|
|
123
|
+
*/
|
|
124
|
+
type QueryParams = Record<string, string | number | boolean | Array<string | number | boolean> | null | undefined>;
|
|
125
|
+
/**
|
|
126
|
+
* Standard HTTP headers type
|
|
127
|
+
*/
|
|
128
|
+
type Headers = Record<string, string>;
|
|
129
|
+
/**
|
|
130
|
+
* Options for request retries
|
|
131
|
+
*/
|
|
132
|
+
interface RetryOptions {
|
|
133
|
+
/** Maximum number of retry attempts */
|
|
134
|
+
maxRetries?: number;
|
|
135
|
+
/** Base delay between retries in milliseconds */
|
|
136
|
+
retryDelay?: number;
|
|
137
|
+
/** Whether to use exponential backoff */
|
|
138
|
+
useExponentialBackoff?: boolean;
|
|
139
|
+
/** Status codes that should trigger a retry */
|
|
140
|
+
retryableStatusCodes?: number[];
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Options for request timeouts
|
|
144
|
+
*/
|
|
145
|
+
interface TimeoutOptions {
|
|
146
|
+
/** Request timeout in milliseconds */
|
|
147
|
+
timeout?: number;
|
|
148
|
+
/** Whether to abort the request on timeout */
|
|
149
|
+
abortOnTimeout?: boolean;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Options for request body transformation
|
|
153
|
+
*/
|
|
154
|
+
interface BodyOptions {
|
|
155
|
+
/** Whether to stringify the body */
|
|
156
|
+
stringify?: boolean;
|
|
157
|
+
/** Content type override */
|
|
158
|
+
contentType?: string;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Pagination metadata for API requests
|
|
162
|
+
*/
|
|
163
|
+
interface PaginationMetadata {
|
|
164
|
+
/** Type of pagination used by the API endpoint */
|
|
165
|
+
paginationType: PaginationType;
|
|
166
|
+
/** Response field containing items array (defaults to 'value') */
|
|
167
|
+
itemsField?: string;
|
|
168
|
+
/** Response field containing total count (defaults to '@odata.count') */
|
|
169
|
+
totalCountField?: string;
|
|
170
|
+
/** Response field containing continuation token (defaults to 'continuationToken') */
|
|
171
|
+
continuationTokenField?: string;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Base interface for all API requests
|
|
175
|
+
*/
|
|
176
|
+
interface RequestSpec {
|
|
177
|
+
/** HTTP method for the request */
|
|
178
|
+
method?: HttpMethod;
|
|
179
|
+
/** URL endpoint for the request */
|
|
180
|
+
url?: string;
|
|
181
|
+
/** Query parameters to be appended to the URL */
|
|
182
|
+
params?: QueryParams;
|
|
183
|
+
/** HTTP headers to include with the request */
|
|
184
|
+
headers?: Headers;
|
|
185
|
+
/** Raw body content (takes precedence over data) */
|
|
186
|
+
body?: unknown;
|
|
187
|
+
/** Expected response type */
|
|
188
|
+
responseType?: ResponseType;
|
|
189
|
+
/** Request timeout options */
|
|
190
|
+
timeoutOptions?: TimeoutOptions;
|
|
191
|
+
/** Retry behavior options */
|
|
192
|
+
retryOptions?: RetryOptions;
|
|
193
|
+
/** Body transformation options */
|
|
194
|
+
bodyOptions?: BodyOptions;
|
|
195
|
+
/** AbortSignal for cancelling the request */
|
|
196
|
+
signal?: AbortSignal;
|
|
197
|
+
/** Pagination metadata for the request */
|
|
198
|
+
pagination?: PaginationMetadata;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
interface ApiResponse<T> {
|
|
202
|
+
data: T;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Base class for all UiPath SDK services.
|
|
206
|
+
*
|
|
207
|
+
* Provides common functionality for authentication, configuration, and API communication.
|
|
208
|
+
* All service classes extend this base to inherit dependency injection and HTTP client access.
|
|
209
|
+
*
|
|
210
|
+
* This class implements the dependency injection pattern where services receive a configured
|
|
211
|
+
* UiPath instance. The ApiClient is created internally and handles all HTTP operations
|
|
212
|
+
* including authentication token management.
|
|
213
|
+
*
|
|
214
|
+
* @remarks
|
|
215
|
+
* Service classes should extend this base and call `super(uiPath)` in their constructor.
|
|
216
|
+
* Protected HTTP methods (get, post, put, patch, delete) are available to all subclasses.
|
|
217
|
+
*
|
|
218
|
+
*/
|
|
219
|
+
declare class BaseService {
|
|
220
|
+
#private;
|
|
221
|
+
/**
|
|
222
|
+
* Creates a base service instance with dependency injection.
|
|
223
|
+
*
|
|
224
|
+
* Extracts configuration, execution context, and token manager from the UiPath instance
|
|
225
|
+
* to initialize an authenticated API client. The ApiClient handles all HTTP operations
|
|
226
|
+
* and token management internally.
|
|
227
|
+
*
|
|
228
|
+
* @param instance - UiPath SDK instance providing authentication and configuration.
|
|
229
|
+
* Services receive this via dependency injection in the modular pattern.
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```typescript
|
|
233
|
+
* // Services automatically call this via super()
|
|
234
|
+
* export class EntityService extends BaseService {
|
|
235
|
+
* constructor(instance: IUiPath) {
|
|
236
|
+
* super(instance); // Initializes the internal ApiClient
|
|
237
|
+
* }
|
|
238
|
+
* }
|
|
239
|
+
*
|
|
240
|
+
* // Usage in modular pattern
|
|
241
|
+
* import { UiPath } from '@uipath/uipath-typescript/core';
|
|
242
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
243
|
+
*
|
|
244
|
+
* const sdk = new UiPath(config);
|
|
245
|
+
* await sdk.initialize();
|
|
246
|
+
* const entities = new Entities(sdk);
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
constructor(instance: IUiPath);
|
|
250
|
+
/**
|
|
251
|
+
* Gets a valid authentication token, refreshing if necessary.
|
|
252
|
+
* Use this when you need to manually add Authorization headers (e.g., direct uploads).
|
|
253
|
+
*
|
|
254
|
+
* @returns Promise resolving to a valid access token string
|
|
255
|
+
* @throws AuthenticationError if no token is available or refresh fails
|
|
256
|
+
*/
|
|
257
|
+
protected getValidAuthToken(): Promise<string>;
|
|
258
|
+
/**
|
|
259
|
+
* Creates a service accessor for pagination helpers
|
|
260
|
+
* This allows pagination helpers to access protected methods without making them public
|
|
261
|
+
*/
|
|
262
|
+
protected createPaginationServiceAccess(): PaginationServiceAccess;
|
|
263
|
+
protected request<T>(method: string, path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
|
|
264
|
+
protected requestWithSpec<T>(spec: RequestSpec): Promise<ApiResponse<T>>;
|
|
265
|
+
protected get<T>(path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
|
|
266
|
+
protected post<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
|
|
267
|
+
protected put<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
|
|
268
|
+
protected patch<T>(path: string, data?: unknown, options?: RequestSpec): Promise<ApiResponse<T>>;
|
|
269
|
+
protected delete<T>(path: string, options?: RequestSpec): Promise<ApiResponse<T>>;
|
|
270
|
+
/**
|
|
271
|
+
* Execute a request with cursor-based pagination
|
|
272
|
+
*/
|
|
273
|
+
protected requestWithPagination<T>(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise<PaginatedResponse<T>>;
|
|
274
|
+
/**
|
|
275
|
+
* Validates and prepares pagination parameters from options
|
|
276
|
+
*/
|
|
277
|
+
private validateAndPreparePaginationParams;
|
|
278
|
+
/**
|
|
279
|
+
* Prepares request parameters for pagination based on pagination type
|
|
280
|
+
*/
|
|
281
|
+
private preparePaginationRequestParams;
|
|
282
|
+
/**
|
|
283
|
+
* Creates a paginated response from API response
|
|
284
|
+
*/
|
|
285
|
+
private createPaginatedResponseFromResponse;
|
|
286
|
+
/**
|
|
287
|
+
* Determines if there are more pages based on pagination type and metadata
|
|
288
|
+
*/
|
|
289
|
+
private determineHasMorePages;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Standardized result interface for all operation methods (pause, cancel, complete, update, upload, etc.)
|
|
294
|
+
* Success responses include data from the request context or API response
|
|
295
|
+
*/
|
|
296
|
+
interface OperationResponse<TData> {
|
|
297
|
+
/**
|
|
298
|
+
* Whether the operation was successful
|
|
299
|
+
*/
|
|
300
|
+
success: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* Response data (can contain error details in case of failure)
|
|
303
|
+
*/
|
|
304
|
+
data: TData;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Common enum for job state used across services
|
|
308
|
+
*/
|
|
309
|
+
declare enum JobState {
|
|
310
|
+
Pending = "Pending",
|
|
311
|
+
Running = "Running",
|
|
312
|
+
Stopping = "Stopping",
|
|
313
|
+
Terminating = "Terminating",
|
|
314
|
+
Faulted = "Faulted",
|
|
315
|
+
Successful = "Successful",
|
|
316
|
+
Stopped = "Stopped",
|
|
317
|
+
Suspended = "Suspended",
|
|
318
|
+
Resumed = "Resumed"
|
|
319
|
+
}
|
|
320
|
+
interface BaseOptions {
|
|
321
|
+
expand?: string;
|
|
322
|
+
select?: string;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Common request options interface used across services for querying data
|
|
326
|
+
*/
|
|
327
|
+
interface RequestOptions extends BaseOptions {
|
|
328
|
+
filter?: string;
|
|
329
|
+
orderby?: string;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
interface UserLoginInfo {
|
|
333
|
+
name: string;
|
|
334
|
+
surname: string;
|
|
335
|
+
userName: string;
|
|
336
|
+
emailAddress: string;
|
|
337
|
+
displayName: string;
|
|
338
|
+
id: number;
|
|
339
|
+
}
|
|
340
|
+
declare enum TaskType {
|
|
341
|
+
Form = "FormTask",
|
|
342
|
+
External = "ExternalTask",
|
|
343
|
+
App = "AppTask"
|
|
344
|
+
}
|
|
345
|
+
declare enum TaskPriority {
|
|
346
|
+
Low = "Low",
|
|
347
|
+
Medium = "Medium",
|
|
348
|
+
High = "High",
|
|
349
|
+
Critical = "Critical"
|
|
350
|
+
}
|
|
351
|
+
declare enum TaskStatus {
|
|
352
|
+
Unassigned = "Unassigned",
|
|
353
|
+
Pending = "Pending",
|
|
354
|
+
Completed = "Completed"
|
|
355
|
+
}
|
|
356
|
+
declare enum TaskSlaCriteria {
|
|
357
|
+
TaskCreated = "TaskCreated",
|
|
358
|
+
TaskAssigned = "TaskAssigned",
|
|
359
|
+
TaskCompleted = "TaskCompleted"
|
|
360
|
+
}
|
|
361
|
+
declare enum TaskSlaStatus {
|
|
362
|
+
OverdueLater = "OverdueLater",
|
|
363
|
+
OverdueSoon = "OverdueSoon",
|
|
364
|
+
Overdue = "Overdue",
|
|
365
|
+
CompletedInTime = "CompletedInTime"
|
|
366
|
+
}
|
|
367
|
+
declare enum TaskSourceName {
|
|
368
|
+
Agent = "Agent",
|
|
369
|
+
Workflow = "Workflow",
|
|
370
|
+
Maestro = "Maestro",
|
|
371
|
+
Default = "Default"
|
|
372
|
+
}
|
|
373
|
+
interface TaskSource {
|
|
374
|
+
sourceName: TaskSourceName;
|
|
375
|
+
sourceId: string;
|
|
376
|
+
taskSourceMetadata: Record<string, unknown>;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Task activity types
|
|
380
|
+
*/
|
|
381
|
+
declare enum TaskActivityType {
|
|
382
|
+
Created = "Created",
|
|
383
|
+
Assigned = "Assigned",
|
|
384
|
+
Reassigned = "Reassigned",
|
|
385
|
+
Unassigned = "Unassigned",
|
|
386
|
+
Saved = "Saved",
|
|
387
|
+
Forwarded = "Forwarded",
|
|
388
|
+
Completed = "Completed",
|
|
389
|
+
Commented = "Commented",
|
|
390
|
+
Deleted = "Deleted",
|
|
391
|
+
BulkSaved = "BulkSaved",
|
|
392
|
+
BulkCompleted = "BulkCompleted",
|
|
393
|
+
FirstOpened = "FirstOpened"
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Tag information for tasks
|
|
397
|
+
*/
|
|
398
|
+
interface Tag {
|
|
399
|
+
name: string;
|
|
400
|
+
displayName: string;
|
|
401
|
+
displayValue: string;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Task activity information
|
|
405
|
+
*/
|
|
406
|
+
interface TaskActivity {
|
|
407
|
+
task?: RawTaskGetResponse;
|
|
408
|
+
organizationUnitId: number;
|
|
409
|
+
taskId: number;
|
|
410
|
+
taskKey: string;
|
|
411
|
+
activityType: TaskActivityType;
|
|
412
|
+
creatorUserId: number;
|
|
413
|
+
targetUserId: number | null;
|
|
414
|
+
createdTime: string;
|
|
415
|
+
}
|
|
416
|
+
interface TaskSlaDetail {
|
|
417
|
+
expiryTime?: string;
|
|
418
|
+
startCriteria?: TaskSlaCriteria;
|
|
419
|
+
endCriteria?: TaskSlaCriteria;
|
|
420
|
+
status?: TaskSlaStatus;
|
|
421
|
+
}
|
|
422
|
+
interface TaskAssignment {
|
|
423
|
+
assignee?: UserLoginInfo;
|
|
424
|
+
task?: RawTaskGetResponse;
|
|
425
|
+
id?: number;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Base interface containing common fields shared across all task response types
|
|
429
|
+
*/
|
|
430
|
+
interface TaskBaseResponse {
|
|
431
|
+
status: TaskStatus;
|
|
432
|
+
title: string;
|
|
433
|
+
type: TaskType;
|
|
434
|
+
priority: TaskPriority;
|
|
435
|
+
folderId: number;
|
|
436
|
+
key: string;
|
|
437
|
+
isDeleted: boolean;
|
|
438
|
+
createdTime: string;
|
|
439
|
+
id: number;
|
|
440
|
+
action: string | null;
|
|
441
|
+
externalTag: string | null;
|
|
442
|
+
lastAssignedTime: string | null;
|
|
443
|
+
completedTime: string | null;
|
|
444
|
+
parentOperationId: string | null;
|
|
445
|
+
deleterUserId: number | null;
|
|
446
|
+
deletedTime: string | null;
|
|
447
|
+
lastModifiedTime: string | null;
|
|
448
|
+
}
|
|
449
|
+
interface TaskCreateOptions {
|
|
450
|
+
title: string;
|
|
451
|
+
data?: Record<string, unknown>;
|
|
452
|
+
priority?: TaskPriority;
|
|
453
|
+
}
|
|
454
|
+
interface RawTaskCreateResponse extends TaskBaseResponse {
|
|
455
|
+
waitJobState: JobState | null;
|
|
456
|
+
assignedToUser: UserLoginInfo | null;
|
|
457
|
+
taskSlaDetails: TaskSlaDetail[] | null;
|
|
458
|
+
completedByUser: UserLoginInfo | null;
|
|
459
|
+
taskAssignees: UserLoginInfo[] | null;
|
|
460
|
+
processingTime: number | null;
|
|
461
|
+
data: Record<string, unknown> | null;
|
|
462
|
+
}
|
|
463
|
+
interface RawTaskGetResponse extends TaskBaseResponse {
|
|
464
|
+
isCompleted: boolean;
|
|
465
|
+
encrypted: boolean;
|
|
466
|
+
bulkFormLayoutId: number | null;
|
|
467
|
+
formLayoutId: number | null;
|
|
468
|
+
taskSlaDetail: TaskSlaDetail | null;
|
|
469
|
+
taskAssigneeName: string | null;
|
|
470
|
+
lastModifierUserId: number | null;
|
|
471
|
+
assignedToUser: UserLoginInfo | null;
|
|
472
|
+
creatorUser?: UserLoginInfo;
|
|
473
|
+
lastModifierUser?: UserLoginInfo;
|
|
474
|
+
taskAssignments?: TaskAssignment[];
|
|
475
|
+
activities?: TaskActivity[];
|
|
476
|
+
tags?: Tag[];
|
|
477
|
+
formLayout?: Record<string, unknown>;
|
|
478
|
+
actionLabel?: string | null;
|
|
479
|
+
taskSlaDetails?: TaskSlaDetail[] | null;
|
|
480
|
+
completedByUser?: UserLoginInfo | null;
|
|
481
|
+
taskAssignmentCriteria?: string;
|
|
482
|
+
taskAssignees?: UserLoginInfo[] | null;
|
|
483
|
+
taskSource?: TaskSource | null;
|
|
484
|
+
processingTime?: number | null;
|
|
485
|
+
data?: Record<string, unknown> | null;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Options for task assignment operations when called from a task instance
|
|
489
|
+
* Requires either userId or userNameOrEmail, but not both
|
|
490
|
+
*/
|
|
491
|
+
type TaskAssignOptions = {
|
|
492
|
+
userId: number;
|
|
493
|
+
userNameOrEmail?: never;
|
|
494
|
+
} | {
|
|
495
|
+
userId?: never;
|
|
496
|
+
userNameOrEmail: string;
|
|
497
|
+
};
|
|
498
|
+
/**
|
|
499
|
+
* Options for task assignment operations when called from the service
|
|
500
|
+
* Extends TaskAssignOptions with the required taskId field
|
|
501
|
+
*/
|
|
502
|
+
type TaskAssignmentOptions = {
|
|
503
|
+
taskId: number;
|
|
504
|
+
} & TaskAssignOptions;
|
|
505
|
+
interface TasksUnassignOptions {
|
|
506
|
+
taskIds: number[];
|
|
507
|
+
}
|
|
508
|
+
interface TaskAssignmentResponse {
|
|
509
|
+
taskId?: number;
|
|
510
|
+
userId?: number;
|
|
511
|
+
errorCode?: number;
|
|
512
|
+
errorMessage?: string;
|
|
513
|
+
userNameOrEmail?: string;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Options for completing a task
|
|
517
|
+
*/
|
|
518
|
+
type TaskCompleteOptions = {
|
|
519
|
+
type: TaskType.External;
|
|
520
|
+
data?: any;
|
|
521
|
+
action?: string;
|
|
522
|
+
} | {
|
|
523
|
+
type: Exclude<TaskType, TaskType.External>;
|
|
524
|
+
data: any;
|
|
525
|
+
action: string;
|
|
526
|
+
};
|
|
527
|
+
/**
|
|
528
|
+
* Options for completing a task when called from the service
|
|
529
|
+
* Extends TaskCompleteOptions with the required taskId field
|
|
530
|
+
*/
|
|
531
|
+
type TaskCompletionOptions = TaskCompleteOptions & {
|
|
532
|
+
taskId: number;
|
|
533
|
+
};
|
|
534
|
+
/**
|
|
535
|
+
* Options for getting tasks across folders
|
|
536
|
+
*/
|
|
537
|
+
type TaskGetAllOptions = RequestOptions & PaginationOptions & {
|
|
538
|
+
/**
|
|
539
|
+
* Optional folder ID to filter tasks by folder
|
|
540
|
+
*/
|
|
541
|
+
folderId?: number;
|
|
542
|
+
/**
|
|
543
|
+
* Optional flag to fetch tasks using admin permissions
|
|
544
|
+
* When true, fetches tasks across folders
|
|
545
|
+
* where the user has at least Task.View, Task.Edit and TaskAssignment.Create permissions
|
|
546
|
+
* When false or omitted, fetches tasks across folders
|
|
547
|
+
* where the user has at least Task.View and Task.Edit permissions
|
|
548
|
+
*/
|
|
549
|
+
asTaskAdmin?: boolean;
|
|
550
|
+
};
|
|
551
|
+
/**
|
|
552
|
+
* Query options for getting a task by ID
|
|
553
|
+
*/
|
|
554
|
+
type TaskGetByIdOptions = BaseOptions;
|
|
555
|
+
/**
|
|
556
|
+
* Options for getting users with task permissions
|
|
557
|
+
*/
|
|
558
|
+
type TaskGetUsersOptions = RequestOptions & PaginationOptions;
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Service for managing UiPath Action Center
|
|
562
|
+
*
|
|
563
|
+
* Tasks are task-based automation components that can be integrated into applications and processes. They represent discrete units of work that can be triggered and monitored through the UiPath API. [UiPath Action Center Guide](https://docs.uipath.com/automation-cloud/docs/actions)
|
|
564
|
+
*
|
|
565
|
+
* ### Usage
|
|
566
|
+
*
|
|
567
|
+
* Prerequisites: Initialize the SDK first - see [Getting Started](/uipath-typescript/getting-started/#import-initialize)
|
|
568
|
+
*
|
|
569
|
+
* ```typescript
|
|
570
|
+
* import { Tasks } from '@uipath/uipath-typescript/tasks';
|
|
571
|
+
*
|
|
572
|
+
* const tasks = new Tasks(sdk);
|
|
573
|
+
* const allTasks = await tasks.getAll();
|
|
574
|
+
* ```
|
|
575
|
+
*/
|
|
576
|
+
interface TaskServiceModel {
|
|
577
|
+
/**
|
|
578
|
+
* Gets all tasks across folders with optional filtering
|
|
579
|
+
*
|
|
580
|
+
* @param options - Query options including optional folderId, asTaskAdmin flag and pagination options
|
|
581
|
+
* @returns Promise resolving to either an array of tasks NonPaginatedResponse<TaskGetResponse> or a PaginatedResponse<TaskGetResponse> when pagination options are used.
|
|
582
|
+
* {@link TaskGetResponse}
|
|
583
|
+
* @example
|
|
584
|
+
* ```typescript
|
|
585
|
+
* // Standard array return
|
|
586
|
+
* const allTasks = await tasks.getAll();
|
|
587
|
+
*
|
|
588
|
+
* // Get tasks within a specific folder
|
|
589
|
+
* const folderTasks = await tasks.getAll({
|
|
590
|
+
* folderId: 123
|
|
591
|
+
* });
|
|
592
|
+
*
|
|
593
|
+
* // Get tasks with admin permissions
|
|
594
|
+
* // This fetches tasks across folders where the user has Task.View, Task.Edit and TaskAssignment.Create permissions
|
|
595
|
+
* const adminTasks = await tasks.getAll({
|
|
596
|
+
* asTaskAdmin: true
|
|
597
|
+
* });
|
|
598
|
+
*
|
|
599
|
+
* // Get tasks without admin permissions (default)
|
|
600
|
+
* // This fetches tasks across folders where the user has Task.View and Task.Edit permissions
|
|
601
|
+
* const userTasks = await tasks.getAll({
|
|
602
|
+
* asTaskAdmin: false
|
|
603
|
+
* });
|
|
604
|
+
*
|
|
605
|
+
* // First page with pagination
|
|
606
|
+
* const page1 = await tasks.getAll({ pageSize: 10 });
|
|
607
|
+
*
|
|
608
|
+
* // Navigate using cursor
|
|
609
|
+
* if (page1.hasNextPage) {
|
|
610
|
+
* const page2 = await tasks.getAll({ cursor: page1.nextCursor });
|
|
611
|
+
* }
|
|
612
|
+
*
|
|
613
|
+
* // Jump to specific page
|
|
614
|
+
* const page5 = await tasks.getAll({
|
|
615
|
+
* jumpToPage: 5,
|
|
616
|
+
* pageSize: 10
|
|
617
|
+
* });
|
|
618
|
+
* ```
|
|
619
|
+
*/
|
|
620
|
+
getAll<T extends TaskGetAllOptions = TaskGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<TaskGetResponse> : NonPaginatedResponse<TaskGetResponse>>;
|
|
621
|
+
/**
|
|
622
|
+
* Gets a task by ID
|
|
623
|
+
* IMPORTANT: For form tasks, folderId must be provided.
|
|
624
|
+
* @param id - The ID of the task to retrieve
|
|
625
|
+
* @param options - Optional query parameters
|
|
626
|
+
* @param folderId - Optional folder ID (REQUIRED for form tasks)
|
|
627
|
+
* @returns Promise resolving to the task
|
|
628
|
+
* {@link TaskGetResponse}
|
|
629
|
+
* @example
|
|
630
|
+
* ```typescript
|
|
631
|
+
* // Get a task by ID
|
|
632
|
+
* const task = await tasks.getById(<taskId>);
|
|
633
|
+
*
|
|
634
|
+
* // Get a form task by ID
|
|
635
|
+
* const formTask = await tasks.getById(<taskId>, <folderId>);
|
|
636
|
+
*
|
|
637
|
+
* // Access form task properties
|
|
638
|
+
* console.log(formTask.formLayout);
|
|
639
|
+
* ```
|
|
640
|
+
*/
|
|
641
|
+
getById(id: number, options?: TaskGetByIdOptions, folderId?: number): Promise<TaskGetResponse>;
|
|
642
|
+
/**
|
|
643
|
+
* Creates a new task
|
|
644
|
+
*
|
|
645
|
+
* @param options - The task to be created
|
|
646
|
+
* @param folderId - Required folder ID
|
|
647
|
+
* @returns Promise resolving to the created task
|
|
648
|
+
* {@link TaskCreateResponse}
|
|
649
|
+
* @example
|
|
650
|
+
* ```typescript
|
|
651
|
+
* import { TaskPriority } from '@uipath/uipath-typescript';
|
|
652
|
+
* const task = await tasks.create({
|
|
653
|
+
* title: "My Task",
|
|
654
|
+
* priority: TaskPriority.Medium
|
|
655
|
+
* }, <folderId>); // folderId is required
|
|
656
|
+
* ```
|
|
657
|
+
*/
|
|
658
|
+
create(options: TaskCreateOptions, folderId: number): Promise<TaskCreateResponse>;
|
|
659
|
+
/**
|
|
660
|
+
* Assigns tasks to users
|
|
661
|
+
*
|
|
662
|
+
* @param options - Single task assignment or array of task assignments
|
|
663
|
+
* @returns Promise resolving to array of task assignment results
|
|
664
|
+
* {@link TaskAssignmentResponse}
|
|
665
|
+
* @example
|
|
666
|
+
* ```typescript
|
|
667
|
+
* // Assign a single task to a user by ID
|
|
668
|
+
* const result = await tasks.assign({
|
|
669
|
+
* taskId: <taskId>,
|
|
670
|
+
* userId: <userId>
|
|
671
|
+
* });
|
|
672
|
+
*
|
|
673
|
+
* // Or using instance method
|
|
674
|
+
* const task = await tasks.getById(<taskId>);
|
|
675
|
+
* const result = await task.assign({
|
|
676
|
+
* userId: <userId>
|
|
677
|
+
* });
|
|
678
|
+
*
|
|
679
|
+
* // Assign a single task to a user by email
|
|
680
|
+
* const result = await tasks.assign({
|
|
681
|
+
* taskId: <taskId>,
|
|
682
|
+
* userNameOrEmail: "user@example.com"
|
|
683
|
+
* });
|
|
684
|
+
*
|
|
685
|
+
* // Assign multiple tasks
|
|
686
|
+
* const result = await tasks.assign([
|
|
687
|
+
* { taskId: <taskId1>, userId: <userId> },
|
|
688
|
+
* { taskId: <taskId2>, userNameOrEmail: "user@example.com" }
|
|
689
|
+
* ]);
|
|
690
|
+
* ```
|
|
691
|
+
*/
|
|
692
|
+
assign(options: TaskAssignmentOptions | TaskAssignmentOptions[]): Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>;
|
|
693
|
+
/**
|
|
694
|
+
* Reassigns tasks to new users
|
|
695
|
+
*
|
|
696
|
+
* @param options - Single task assignment or array of task assignments
|
|
697
|
+
* @returns Promise resolving to array of task assignment results
|
|
698
|
+
* {@link TaskAssignmentResponse}
|
|
699
|
+
* @example
|
|
700
|
+
* ```typescript
|
|
701
|
+
* // Reassign a single task to a user by ID
|
|
702
|
+
* const result = await tasks.reassign({
|
|
703
|
+
* taskId: <taskId>,
|
|
704
|
+
* userId: <userId>
|
|
705
|
+
* });
|
|
706
|
+
*
|
|
707
|
+
* // Or using instance method
|
|
708
|
+
* const task = await tasks.getById(<taskId>);
|
|
709
|
+
* const result = await task.reassign({
|
|
710
|
+
* userId: <userId>
|
|
711
|
+
* });
|
|
712
|
+
*
|
|
713
|
+
* // Reassign a single task to a user by email
|
|
714
|
+
* const result = await tasks.reassign({
|
|
715
|
+
* taskId: <taskId>,
|
|
716
|
+
* userNameOrEmail: "user@example.com"
|
|
717
|
+
* });
|
|
718
|
+
*
|
|
719
|
+
* // Reassign multiple tasks
|
|
720
|
+
* const result = await tasks.reassign([
|
|
721
|
+
* { taskId: <taskId1>, userId: <userId> },
|
|
722
|
+
* { taskId: <taskId2>, userNameOrEmail: "user@example.com" }
|
|
723
|
+
* ]);
|
|
724
|
+
* ```
|
|
725
|
+
*/
|
|
726
|
+
reassign(options: TaskAssignmentOptions | TaskAssignmentOptions[]): Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>;
|
|
727
|
+
/**
|
|
728
|
+
* Unassigns tasks (removes current assignees)
|
|
729
|
+
*
|
|
730
|
+
* @param taskId - Single task ID or array of task IDs to unassign
|
|
731
|
+
* @returns Promise resolving to array of task assignment results
|
|
732
|
+
* {@link TaskAssignmentResponse}
|
|
733
|
+
* @example
|
|
734
|
+
* ```typescript
|
|
735
|
+
* // Unassign a single task
|
|
736
|
+
* const result = await tasks.unassign(<taskId>);
|
|
737
|
+
*
|
|
738
|
+
* // Or using instance method
|
|
739
|
+
* const task = await tasks.getById(<taskId>);
|
|
740
|
+
* const result = await task.unassign();
|
|
741
|
+
*
|
|
742
|
+
* // Unassign multiple tasks
|
|
743
|
+
* const result = await tasks.unassign([<taskId1>, <taskId2>, <taskId3>]);
|
|
744
|
+
* ```
|
|
745
|
+
*/
|
|
746
|
+
unassign(taskId: number | number[]): Promise<OperationResponse<{
|
|
747
|
+
taskId: number;
|
|
748
|
+
}[] | TaskAssignmentResponse[]>>;
|
|
749
|
+
/**
|
|
750
|
+
* Completes a task with the specified type and data
|
|
751
|
+
*
|
|
752
|
+
* @param options - The completion options including task type, taskId, data, and action
|
|
753
|
+
* @param folderId - Required folder ID
|
|
754
|
+
* @returns Promise resolving to completion result
|
|
755
|
+
* {@link TaskCompleteOptions}
|
|
756
|
+
* @example
|
|
757
|
+
* ```typescript
|
|
758
|
+
* // Complete an app task
|
|
759
|
+
* await tasks.complete({
|
|
760
|
+
* type: TaskType.App,
|
|
761
|
+
* taskId: <taskId>,
|
|
762
|
+
* data: {},
|
|
763
|
+
* action: "submit"
|
|
764
|
+
* }, <folderId>); // folderId is required
|
|
765
|
+
*
|
|
766
|
+
* // Complete an external task
|
|
767
|
+
* await tasks.complete({
|
|
768
|
+
* type: TaskType.External,
|
|
769
|
+
* taskId: <taskId>
|
|
770
|
+
* }, <folderId>); // folderId is required
|
|
771
|
+
* ```
|
|
772
|
+
*/
|
|
773
|
+
complete(options: TaskCompletionOptions, folderId: number): Promise<OperationResponse<TaskCompletionOptions>>;
|
|
774
|
+
/**
|
|
775
|
+
* Gets users in the given folder who have Tasks.View and Tasks.Edit permissions
|
|
776
|
+
* Returns a NonPaginatedResponse with data and totalCount when no pagination parameters are provided,
|
|
777
|
+
* or a PaginatedResponse when any pagination parameter is provided
|
|
778
|
+
*
|
|
779
|
+
* @param folderId - The folder ID to get users from
|
|
780
|
+
* @param options - Optional query and pagination parameters
|
|
781
|
+
* @returns Promise resolving to either an array of users NonPaginatedResponse<UserLoginInfo> or a PaginatedResponse<UserLoginInfo> when pagination options are used.
|
|
782
|
+
* {@link UserLoginInfo}
|
|
783
|
+
* @example
|
|
784
|
+
* ```typescript
|
|
785
|
+
* // Get users from a folder
|
|
786
|
+
* const users = await tasks.getUsers(<folderId>);
|
|
787
|
+
*
|
|
788
|
+
* // Access user properties
|
|
789
|
+
* console.log(users.items[0].name);
|
|
790
|
+
* console.log(users.items[0].emailAddress);
|
|
791
|
+
* ```
|
|
792
|
+
*/
|
|
793
|
+
getUsers<T extends TaskGetUsersOptions = TaskGetUsersOptions>(folderId: number, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<UserLoginInfo> : NonPaginatedResponse<UserLoginInfo>>;
|
|
794
|
+
}
|
|
795
|
+
interface TaskMethods {
|
|
796
|
+
/**
|
|
797
|
+
* Assigns this task to a user or users
|
|
798
|
+
*
|
|
799
|
+
* @param options - Assignment options (requires at least one of: userId, userNameOrEmail)
|
|
800
|
+
* @returns Promise resolving to task assignment results
|
|
801
|
+
*/
|
|
802
|
+
assign(options: TaskAssignOptions): Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>;
|
|
803
|
+
/**
|
|
804
|
+
* Reassigns this task to a new user
|
|
805
|
+
*
|
|
806
|
+
* @param options - Assignment options (requires at least one of: userId, userNameOrEmail)
|
|
807
|
+
* @returns Promise resolving to task assignment results
|
|
808
|
+
*/
|
|
809
|
+
reassign(options: TaskAssignOptions): Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>;
|
|
810
|
+
/**
|
|
811
|
+
* Unassigns this task (removes current assignee)
|
|
812
|
+
*
|
|
813
|
+
* @returns Promise resolving to task assignment results
|
|
814
|
+
*/
|
|
815
|
+
unassign(): Promise<OperationResponse<{
|
|
816
|
+
taskId: number;
|
|
817
|
+
}[] | TaskAssignmentResponse[]>>;
|
|
818
|
+
/**
|
|
819
|
+
* Completes this task with optional data and action
|
|
820
|
+
*
|
|
821
|
+
* @param options - Completion options
|
|
822
|
+
* @returns Promise resolving to completion result
|
|
823
|
+
*/
|
|
824
|
+
complete(options: TaskCompleteOptions): Promise<OperationResponse<TaskCompletionOptions>>;
|
|
825
|
+
}
|
|
826
|
+
type TaskGetResponse = RawTaskGetResponse & TaskMethods;
|
|
827
|
+
type TaskCreateResponse = RawTaskCreateResponse & TaskMethods;
|
|
828
|
+
/**
|
|
829
|
+
* Creates an actionable task by combining API task data with operational methods.
|
|
830
|
+
*
|
|
831
|
+
* @param taskData - The task data from API
|
|
832
|
+
* @param service - The task service instance
|
|
833
|
+
* @returns A task object with added methods
|
|
834
|
+
*/
|
|
835
|
+
declare function createTaskWithMethods(taskData: RawTaskGetResponse | RawTaskCreateResponse, service: TaskServiceModel): TaskGetResponse | TaskCreateResponse;
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Service for interacting with UiPath Tasks API
|
|
839
|
+
*/
|
|
840
|
+
declare class TaskService extends BaseService implements TaskServiceModel {
|
|
841
|
+
/**
|
|
842
|
+
* Creates a new task
|
|
843
|
+
* @param task - The task to be created
|
|
844
|
+
* @param folderId - Required folder ID
|
|
845
|
+
* @returns Promise resolving to the created task
|
|
846
|
+
*
|
|
847
|
+
* @example
|
|
848
|
+
* ```typescript
|
|
849
|
+
* import { Tasks } from '@uipath/uipath-typescript/tasks';
|
|
850
|
+
*
|
|
851
|
+
* const tasks = new Tasks(sdk);
|
|
852
|
+
* const task = await tasks.create({
|
|
853
|
+
* title: "My Task",
|
|
854
|
+
* priority: TaskPriority.Medium,
|
|
855
|
+
* data: { key: "value" }
|
|
856
|
+
* }, 123); // folderId is required
|
|
857
|
+
* ```
|
|
858
|
+
*/
|
|
859
|
+
create(task: TaskCreateOptions, folderId: number): Promise<TaskCreateResponse>;
|
|
860
|
+
/**
|
|
861
|
+
* Gets users in the given folder who have Tasks.View and Tasks.Edit permissions
|
|
862
|
+
*
|
|
863
|
+
* The method returns either:
|
|
864
|
+
* - An array of users (when no pagination parameters are provided)
|
|
865
|
+
* - A paginated result with navigation cursors (when any pagination parameter is provided)
|
|
866
|
+
*
|
|
867
|
+
* @param folderId - The folder ID to get users from
|
|
868
|
+
* @param options - Optional query and pagination parameters
|
|
869
|
+
* @returns Promise resolving to an array of users or paginated result
|
|
870
|
+
*
|
|
871
|
+
* @example
|
|
872
|
+
* ```typescript
|
|
873
|
+
* import { Tasks } from '@uipath/uipath-typescript/tasks';
|
|
874
|
+
*
|
|
875
|
+
* const tasks = new Tasks(sdk);
|
|
876
|
+
*
|
|
877
|
+
* // Standard array return
|
|
878
|
+
* const users = await tasks.getUsers(123);
|
|
879
|
+
*
|
|
880
|
+
* // Get users with filtering
|
|
881
|
+
* const users = await tasks.getUsers(123, {
|
|
882
|
+
* filter: "name eq 'abc'"
|
|
883
|
+
* });
|
|
884
|
+
*
|
|
885
|
+
* // First page with pagination
|
|
886
|
+
* const page1 = await tasks.getUsers(123, { pageSize: 10 });
|
|
887
|
+
*
|
|
888
|
+
* // Navigate using cursor
|
|
889
|
+
* if (page1.hasNextPage) {
|
|
890
|
+
* const page2 = await tasks.getUsers(123, { cursor: page1.nextCursor });
|
|
891
|
+
* }
|
|
892
|
+
*
|
|
893
|
+
* // Jump to specific page
|
|
894
|
+
* const page5 = await tasks.getUsers(123, {
|
|
895
|
+
* jumpToPage: 5,
|
|
896
|
+
* pageSize: 10
|
|
897
|
+
* });
|
|
898
|
+
* ```
|
|
899
|
+
*/
|
|
900
|
+
getUsers<T extends TaskGetUsersOptions = TaskGetUsersOptions>(folderId: number, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<UserLoginInfo> : NonPaginatedResponse<UserLoginInfo>>;
|
|
901
|
+
/**
|
|
902
|
+
* Gets tasks across folders with optional filtering and folder scoping
|
|
903
|
+
*
|
|
904
|
+
* The method returns either:
|
|
905
|
+
* - An array of tasks (when no pagination parameters are provided)
|
|
906
|
+
* - A paginated result with navigation cursors (when any pagination parameter is provided)
|
|
907
|
+
*
|
|
908
|
+
* @param options - Query options including optional folderId, asTaskAdmin flag and pagination options
|
|
909
|
+
* @returns Promise resolving to an array of tasks or paginated result
|
|
910
|
+
*
|
|
911
|
+
* @example
|
|
912
|
+
* ```typescript
|
|
913
|
+
* import { Tasks } from '@uipath/uipath-typescript/tasks';
|
|
914
|
+
*
|
|
915
|
+
* const tasks = new Tasks(sdk);
|
|
916
|
+
*
|
|
917
|
+
* // Standard array return
|
|
918
|
+
* const allTasks = await tasks.getAll();
|
|
919
|
+
*
|
|
920
|
+
* // Get tasks within a specific folder
|
|
921
|
+
* const folderTasks = await tasks.getAll({
|
|
922
|
+
* folderId: 123
|
|
923
|
+
* });
|
|
924
|
+
*
|
|
925
|
+
* // Get tasks with admin permissions
|
|
926
|
+
* const adminTasks = await tasks.getAll({
|
|
927
|
+
* asTaskAdmin: true
|
|
928
|
+
* });
|
|
929
|
+
*
|
|
930
|
+
* // First page with pagination
|
|
931
|
+
* const page1 = await tasks.getAll({ pageSize: 10 });
|
|
932
|
+
*
|
|
933
|
+
* // Navigate using cursor
|
|
934
|
+
* if (page1.hasNextPage) {
|
|
935
|
+
* const page2 = await tasks.getAll({ cursor: page1.nextCursor });
|
|
936
|
+
* }
|
|
937
|
+
*
|
|
938
|
+
* // Jump to specific page
|
|
939
|
+
* const page5 = await tasks.getAll({
|
|
940
|
+
* jumpToPage: 5,
|
|
941
|
+
* pageSize: 10
|
|
942
|
+
* });
|
|
943
|
+
* ```
|
|
944
|
+
*/
|
|
945
|
+
getAll<T extends TaskGetAllOptions = TaskGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<TaskGetResponse> : NonPaginatedResponse<TaskGetResponse>>;
|
|
946
|
+
/**
|
|
947
|
+
* Gets a task by ID
|
|
948
|
+
* IMPORTANT: For form tasks, folderId must be provided.
|
|
949
|
+
*
|
|
950
|
+
* @param id - The ID of the task to retrieve
|
|
951
|
+
* @param options - Optional query parameters
|
|
952
|
+
* @param folderId - Optional folder ID (REQUIRED for form tasks)
|
|
953
|
+
* @returns Promise resolving to the task (form tasks will return form-specific data)
|
|
954
|
+
*
|
|
955
|
+
* @example
|
|
956
|
+
* ```typescript
|
|
957
|
+
* import { Tasks } from '@uipath/uipath-typescript/tasks';
|
|
958
|
+
*
|
|
959
|
+
* const tasks = new Tasks(sdk);
|
|
960
|
+
*
|
|
961
|
+
* // Get task by ID
|
|
962
|
+
* const task = await tasks.getById(123);
|
|
963
|
+
*
|
|
964
|
+
* // If the task is a form task, it will automatically return form-specific data
|
|
965
|
+
* ```
|
|
966
|
+
*/
|
|
967
|
+
getById(id: number, options?: TaskGetByIdOptions, folderId?: number): Promise<TaskGetResponse>;
|
|
968
|
+
/**
|
|
969
|
+
* Assigns tasks to users
|
|
970
|
+
*
|
|
971
|
+
* @param taskAssignments - Single task assignment or array of task assignments
|
|
972
|
+
* @returns Promise resolving to array of task assignment results
|
|
973
|
+
*
|
|
974
|
+
* @example
|
|
975
|
+
* ```typescript
|
|
976
|
+
* import { Tasks } from '@uipath/uipath-typescript/tasks';
|
|
977
|
+
*
|
|
978
|
+
* const tasks = new Tasks(sdk);
|
|
979
|
+
*
|
|
980
|
+
* // Assign a single task to a user by ID
|
|
981
|
+
* const result = await tasks.assign({
|
|
982
|
+
* taskId: 123,
|
|
983
|
+
* userId: 456
|
|
984
|
+
* });
|
|
985
|
+
*
|
|
986
|
+
* // Assign a single task to a user by email
|
|
987
|
+
* const result = await tasks.assign({
|
|
988
|
+
* taskId: 123,
|
|
989
|
+
* userNameOrEmail: "user@example.com"
|
|
990
|
+
* });
|
|
991
|
+
*
|
|
992
|
+
* // Assign multiple tasks
|
|
993
|
+
* const result = await tasks.assign([
|
|
994
|
+
* {
|
|
995
|
+
* taskId: 123,
|
|
996
|
+
* userId: 456
|
|
997
|
+
* },
|
|
998
|
+
* {
|
|
999
|
+
* taskId: 789,
|
|
1000
|
+
* userNameOrEmail: "user@example.com"
|
|
1001
|
+
* }
|
|
1002
|
+
* ]);
|
|
1003
|
+
* ```
|
|
1004
|
+
*/
|
|
1005
|
+
assign(taskAssignments: TaskAssignmentOptions | TaskAssignmentOptions[]): Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>;
|
|
1006
|
+
/**
|
|
1007
|
+
* Reassigns tasks to new users
|
|
1008
|
+
*
|
|
1009
|
+
* @param taskAssignments - Single task assignment or array of task assignments
|
|
1010
|
+
* @returns Promise resolving to array of task assignment results
|
|
1011
|
+
*
|
|
1012
|
+
* @example
|
|
1013
|
+
* ```typescript
|
|
1014
|
+
* import { Tasks } from '@uipath/uipath-typescript/tasks';
|
|
1015
|
+
*
|
|
1016
|
+
* const tasks = new Tasks(sdk);
|
|
1017
|
+
*
|
|
1018
|
+
* // Reassign a single task to a user by ID
|
|
1019
|
+
* const result = await tasks.reassign({
|
|
1020
|
+
* taskId: 123,
|
|
1021
|
+
* userId: 456
|
|
1022
|
+
* });
|
|
1023
|
+
*
|
|
1024
|
+
* // Reassign a single task to a user by email
|
|
1025
|
+
* const result = await tasks.reassign({
|
|
1026
|
+
* taskId: 123,
|
|
1027
|
+
* userNameOrEmail: "user@example.com"
|
|
1028
|
+
* });
|
|
1029
|
+
*
|
|
1030
|
+
* // Reassign multiple tasks
|
|
1031
|
+
* const result = await tasks.reassign([
|
|
1032
|
+
* {
|
|
1033
|
+
* taskId: 123,
|
|
1034
|
+
* userId: 456
|
|
1035
|
+
* },
|
|
1036
|
+
* {
|
|
1037
|
+
* taskId: 789,
|
|
1038
|
+
* userNameOrEmail: "user@example.com"
|
|
1039
|
+
* }
|
|
1040
|
+
* ]);
|
|
1041
|
+
* ```
|
|
1042
|
+
*/
|
|
1043
|
+
reassign(taskAssignments: TaskAssignmentOptions | TaskAssignmentOptions[]): Promise<OperationResponse<TaskAssignmentOptions[] | TaskAssignmentResponse[]>>;
|
|
1044
|
+
/**
|
|
1045
|
+
* Unassigns tasks (removes current assignees)
|
|
1046
|
+
*
|
|
1047
|
+
* @param taskIds - Single task ID or array of task IDs to unassign
|
|
1048
|
+
* @returns Promise resolving to array of task assignment results
|
|
1049
|
+
*
|
|
1050
|
+
* @example
|
|
1051
|
+
* ```typescript
|
|
1052
|
+
* import { Tasks } from '@uipath/uipath-typescript/tasks';
|
|
1053
|
+
*
|
|
1054
|
+
* const tasks = new Tasks(sdk);
|
|
1055
|
+
*
|
|
1056
|
+
* // Unassign a single task
|
|
1057
|
+
* const result = await tasks.unassign(123);
|
|
1058
|
+
*
|
|
1059
|
+
* // Unassign multiple tasks
|
|
1060
|
+
* const result = await tasks.unassign([123, 456, 789]);
|
|
1061
|
+
* ```
|
|
1062
|
+
*/
|
|
1063
|
+
unassign(taskIds: number | number[]): Promise<OperationResponse<{
|
|
1064
|
+
taskId: number;
|
|
1065
|
+
}[] | TaskAssignmentResponse[]>>;
|
|
1066
|
+
/**
|
|
1067
|
+
* Completes a task with the specified type and data
|
|
1068
|
+
*
|
|
1069
|
+
* @param options - The completion options including task type, taskId, data, and action
|
|
1070
|
+
* @param folderId - Required folder ID
|
|
1071
|
+
* @returns Promise resolving to completion result
|
|
1072
|
+
*
|
|
1073
|
+
* @example
|
|
1074
|
+
* ```typescript
|
|
1075
|
+
* import { Tasks } from '@uipath/uipath-typescript/tasks';
|
|
1076
|
+
*
|
|
1077
|
+
* const tasks = new Tasks(sdk);
|
|
1078
|
+
*
|
|
1079
|
+
* // Complete an app task
|
|
1080
|
+
* await tasks.complete({
|
|
1081
|
+
* type: TaskType.App,
|
|
1082
|
+
* taskId: 456,
|
|
1083
|
+
* data: {},
|
|
1084
|
+
* action: "submit"
|
|
1085
|
+
* }, 123); // folderId is required
|
|
1086
|
+
*
|
|
1087
|
+
* // Complete an external task
|
|
1088
|
+
* await tasks.complete({
|
|
1089
|
+
* type: TaskType.External,
|
|
1090
|
+
* taskId: 789
|
|
1091
|
+
* }, 123); // folderId is required
|
|
1092
|
+
* ```
|
|
1093
|
+
*/
|
|
1094
|
+
complete(options: TaskCompletionOptions, folderId: number): Promise<OperationResponse<TaskCompletionOptions>>;
|
|
1095
|
+
/**
|
|
1096
|
+
* Gets a form task by ID (private method)
|
|
1097
|
+
*
|
|
1098
|
+
* @param id - The ID of the form task to retrieve
|
|
1099
|
+
* @param folderId - Required folder ID
|
|
1100
|
+
* @param options - Optional query parameters
|
|
1101
|
+
* @returns Promise resolving to the form task
|
|
1102
|
+
*/
|
|
1103
|
+
private getFormTaskById;
|
|
1104
|
+
/**
|
|
1105
|
+
* Process parameters for task queries with folder filtering
|
|
1106
|
+
* @param options - The REST API options to process
|
|
1107
|
+
* @param folderId - Optional folder ID to filter by
|
|
1108
|
+
* @returns Processed options with folder filtering applied if needed
|
|
1109
|
+
* @private
|
|
1110
|
+
*/
|
|
1111
|
+
private processTaskParameters;
|
|
1112
|
+
/**
|
|
1113
|
+
* Adds default expand parameters to options
|
|
1114
|
+
* @param options - The options object to add default expand to
|
|
1115
|
+
* @returns Options with default expand parameters added
|
|
1116
|
+
* @private
|
|
1117
|
+
*/
|
|
1118
|
+
private addDefaultExpand;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
export { TaskActivityType, TaskPriority, TaskService, TaskSlaCriteria, TaskSlaStatus, TaskSourceName, TaskStatus, TaskType, TaskService as Tasks, createTaskWithMethods };
|
|
1122
|
+
export type { RawTaskCreateResponse, RawTaskGetResponse, Tag, TaskActivity, TaskAssignOptions, TaskAssignment, TaskAssignmentOptions, TaskAssignmentResponse, TaskBaseResponse, TaskCompleteOptions, TaskCompletionOptions, TaskCreateOptions, TaskCreateResponse, TaskGetAllOptions, TaskGetByIdOptions, TaskGetResponse, TaskGetUsersOptions, TaskMethods, TaskServiceModel, TaskSlaDetail, TaskSource, TasksUnassignOptions, UserLoginInfo };
|