@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.
@@ -0,0 +1,819 @@
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
+ * Base service for services that need folder-specific functionality.
294
+ *
295
+ * Extends BaseService with additional methods for working with folder-scoped resources
296
+ * in UiPath Orchestrator. Services that work with folders (Assets, Queues) extend this class.
297
+ *
298
+ * @remarks
299
+ * This class provides helper methods for making folder-scoped API calls, handling folder IDs
300
+ * in request headers, and managing cross-folder queries.
301
+ */
302
+ declare class FolderScopedService extends BaseService {
303
+ /**
304
+ * Gets resources in a folder with optional query parameters
305
+ *
306
+ * @param endpoint - API endpoint to call
307
+ * @param folderId - required folder ID
308
+ * @param options - Query options
309
+ * @param transformFn - Optional function to transform the response data
310
+ * @returns Promise resolving to an array of resources
311
+ */
312
+ protected _getByFolder<T, R = T>(endpoint: string, folderId: number, options?: Record<string, any>, transformFn?: (item: T) => R): Promise<R[]>;
313
+ }
314
+
315
+ interface BaseOptions {
316
+ expand?: string;
317
+ select?: string;
318
+ }
319
+ /**
320
+ * Common request options interface used across services for querying data
321
+ */
322
+ interface RequestOptions extends BaseOptions {
323
+ filter?: string;
324
+ orderby?: string;
325
+ }
326
+
327
+ declare enum BucketOptions {
328
+ None = "None",
329
+ ReadOnly = "ReadOnly",
330
+ AuditReadAccess = "AuditReadAccess",
331
+ AccessDataThroughOrchestrator = "AccessDataThroughOrchestrator"
332
+ }
333
+ interface BucketGetResponse {
334
+ id: number;
335
+ name: string;
336
+ description: string | null;
337
+ identifier: string;
338
+ storageProvider: string | null;
339
+ storageParameters: string | null;
340
+ storageContainer: string | null;
341
+ options: BucketOptions;
342
+ credentialStoreId: number | null;
343
+ externalName: string | null;
344
+ password: string | null;
345
+ foldersCount: number;
346
+ }
347
+ type BucketGetAllOptions = RequestOptions & PaginationOptions & {
348
+ folderId?: number;
349
+ };
350
+ type BucketGetByIdOptions = BaseOptions;
351
+ /**
352
+ * Maps header names to their values
353
+ *
354
+ * @example
355
+ * ```typescript
356
+ * {
357
+ * "x-ms-blob-type": "BlockBlob"
358
+ * }
359
+ * ```
360
+ */
361
+ type ResponseDictionary = Record<string, string>;
362
+ /**
363
+ * Response from the GetReadUri API
364
+ */
365
+ interface BucketGetUriResponse {
366
+ /**
367
+ * The URI for accessing the blob file
368
+ */
369
+ uri: string;
370
+ /**
371
+ * HTTP method to use with the URI
372
+ */
373
+ httpMethod: string;
374
+ /**
375
+ * Whether authentication is required to access the URI
376
+ */
377
+ requiresAuth: boolean;
378
+ /**
379
+ * Headers to be included in the request
380
+ */
381
+ headers: ResponseDictionary;
382
+ }
383
+ interface BucketGetUriOptions extends BaseOptions {
384
+ /**
385
+ * The ID of the bucket
386
+ */
387
+ bucketId: number;
388
+ /**
389
+ * The ID of the folder
390
+ */
391
+ folderId: number;
392
+ /**
393
+ * The full path to the BlobFile
394
+ */
395
+ path: string;
396
+ /**
397
+ * URL expiration time in minutes (0 for default)
398
+ */
399
+ expiryInMinutes?: number;
400
+ }
401
+ /**
402
+ * Request options for getting a read URI for a file in a bucket
403
+ */
404
+ type BucketGetReadUriOptions = BucketGetUriOptions;
405
+ /**
406
+ * Request options for getting files in a bucket
407
+ */
408
+ interface BucketGetFileMetaDataOptions {
409
+ /**
410
+ * The path prefix to filter files by
411
+ */
412
+ prefix?: string;
413
+ }
414
+ /**
415
+ * Request options for getting files in a bucket with pagination support
416
+ */
417
+ type BucketGetFileMetaDataWithPaginationOptions = BucketGetFileMetaDataOptions & PaginationOptions;
418
+ /**
419
+ * Response from the GetFiles API
420
+ */
421
+ interface BucketGetFileMetaDataResponse {
422
+ /**
423
+ * Array of blob items in the bucket
424
+ */
425
+ blobItems: BlobItem[];
426
+ /**
427
+ * Token for retrieving the next set of results
428
+ */
429
+ continuationToken: string | null;
430
+ }
431
+ /**
432
+ * Represents a file or blob in a bucket
433
+ */
434
+ interface BlobItem {
435
+ /**
436
+ * Full path to the blob
437
+ */
438
+ path: string;
439
+ /**
440
+ * Content type of the blob
441
+ */
442
+ contentType: string;
443
+ /**
444
+ * Size of the blob in bytes
445
+ */
446
+ size: number;
447
+ /**
448
+ * Last modified timestamp
449
+ */
450
+ lastModified: string | null;
451
+ }
452
+ /**
453
+ * Options for uploading files to a bucket
454
+ */
455
+ interface BucketUploadFileOptions {
456
+ /**
457
+ * The ID of the bucket to upload to
458
+ */
459
+ bucketId: number;
460
+ /**
461
+ * The folder/organization unit ID for context
462
+ */
463
+ folderId: number;
464
+ /**
465
+ * Path where the file should be stored in the bucket
466
+ */
467
+ path: string;
468
+ /**
469
+ * File content to upload
470
+ */
471
+ content: Blob | Uint8Array<ArrayBuffer> | File;
472
+ }
473
+ /**
474
+ * Response from file upload operations
475
+ */
476
+ interface BucketUploadResponse {
477
+ /**
478
+ * Whether the upload was successful
479
+ */
480
+ success: boolean;
481
+ /**
482
+ * HTTP status code from the upload operation
483
+ */
484
+ statusCode: number;
485
+ }
486
+
487
+ /**
488
+ * Service for managing UiPath storage Buckets.
489
+ *
490
+ * Buckets are cloud storage containers that can be used to store and manage files used by automation processes. [UiPath Buckets Guide](https://docs.uipath.com/orchestrator/automation-cloud/latest/user-guide/about-storage-buckets)
491
+ *
492
+ * ### Usage
493
+ *
494
+ * Prerequisites: Initialize the SDK first - see [Getting Started](/uipath-typescript/getting-started/#import-initialize)
495
+ *
496
+ * ```typescript
497
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
498
+ *
499
+ * const buckets = new Buckets(sdk);
500
+ * const allBuckets = await buckets.getAll();
501
+ * ```
502
+ */
503
+ interface BucketServiceModel {
504
+ /**
505
+ * Gets all buckets across folders with optional filtering
506
+ *
507
+ * The method returns either:
508
+ * - A NonPaginatedResponse with data and totalCount (when no pagination parameters are provided)
509
+ * - A paginated result with navigation cursors (when any pagination parameter is provided)
510
+ *
511
+ * @param options - Query options including optional folderId and pagination options
512
+ * @returns Promise resolving to either an array of buckets NonPaginatedResponse<BucketGetResponse> or a PaginatedResponse<BucketGetResponse> when pagination options are used.
513
+ * {@link BucketGetResponse}
514
+ * @example
515
+ * ```typescript
516
+ * // Get all buckets across folders
517
+ * const allBuckets = await buckets.getAll();
518
+ *
519
+ * // Get buckets within a specific folder
520
+ * const folderBuckets = await buckets.getAll({
521
+ * folderId: <folderId>
522
+ * });
523
+ *
524
+ * // Get buckets with filtering
525
+ * const filteredBuckets = await buckets.getAll({
526
+ * filter: "name eq 'MyBucket'"
527
+ * });
528
+ *
529
+ * // First page with pagination
530
+ * const page1 = await buckets.getAll({ pageSize: 10 });
531
+ *
532
+ * // Navigate using cursor
533
+ * if (page1.hasNextPage) {
534
+ * const page2 = await buckets.getAll({ cursor: page1.nextCursor });
535
+ * }
536
+ *
537
+ * // Jump to specific page
538
+ * const page5 = await buckets.getAll({
539
+ * jumpToPage: 5,
540
+ * pageSize: 10
541
+ * });
542
+ * ```
543
+ */
544
+ getAll<T extends BucketGetAllOptions = BucketGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<BucketGetResponse> : NonPaginatedResponse<BucketGetResponse>>;
545
+ /**
546
+ * Gets a single bucket by ID
547
+ *
548
+ * @param bucketId - Bucket ID
549
+ * @param folderId - Required folder ID
550
+ * @param options - Optional query parameters
551
+ * @returns Promise resolving to a bucket definition
552
+ * {@link BucketGetResponse}
553
+ * @example
554
+ * ```typescript
555
+ * // Get bucket by ID
556
+ * const bucket = await buckets.getById(<bucketId>, <folderId>);
557
+ * ```
558
+ */
559
+ getById(bucketId: number, folderId: number, options?: BucketGetByIdOptions): Promise<BucketGetResponse>;
560
+ /**
561
+ * Gets metadata for files in a bucket with optional filtering and pagination
562
+ *
563
+ * The method returns either:
564
+ * - A NonPaginatedResponse with items array (when no pagination parameters are provided)
565
+ * - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
566
+ *
567
+ * @param bucketId - The ID of the bucket to get file metadata from
568
+ * @param folderId - Required folder ID for organization unit context
569
+ * @param options - Optional parameters for filtering, pagination and access URL generation
570
+ * @returns Promise resolving to either an array of files metadata NonPaginatedResponse<BlobItem> or a PaginatedResponse<BlobItem> when pagination options are used.
571
+ * {@link BlobItem}
572
+ * @example
573
+ * ```typescript
574
+ * // Get metadata for all files in a bucket
575
+ * const fileMetadata = await buckets.getFileMetaData(<bucketId>, <folderId>);
576
+ *
577
+ * // Get file metadata with a specific prefix
578
+ * const prefixMetadata = await buckets.getFileMetaData(<bucketId>, <folderId>, {
579
+ * prefix: '/folder1'
580
+ * });
581
+ *
582
+ * // First page with pagination
583
+ * const page1 = await buckets.getFileMetaData(<bucketId>, <folderId>, { pageSize: 10 });
584
+ *
585
+ * // Navigate using cursor
586
+ * if (page1.hasNextPage) {
587
+ * const page2 = await buckets.getFileMetaData(<bucketId>, <folderId>, { cursor: page1.nextCursor });
588
+ * }
589
+ * ```
590
+ */
591
+ getFileMetaData<T extends BucketGetFileMetaDataWithPaginationOptions = BucketGetFileMetaDataWithPaginationOptions>(bucketId: number, folderId: number, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<BlobItem> : NonPaginatedResponse<BlobItem>>;
592
+ /**
593
+ * Gets a direct download URL for a file in the bucket
594
+ *
595
+ * @param options - Contains bucketId, folderId, file path and optional expiry time
596
+ * @returns Promise resolving to blob file access information
597
+ * {@link BucketGetUriResponse}
598
+ * @example
599
+ * ```typescript
600
+ * // Get download URL for a file
601
+ * const fileAccess = await buckets.getReadUri({
602
+ * bucketId: <bucketId>,
603
+ * folderId: <folderId>,
604
+ * path: '/folder/file.pdf'
605
+ * });
606
+ * ```
607
+ */
608
+ getReadUri(options: BucketGetReadUriOptions): Promise<BucketGetUriResponse>;
609
+ /**
610
+ * Uploads a file to a bucket
611
+ *
612
+ * @param options - Options for file upload including bucket ID, folder ID, path, content, and optional parameters
613
+ * @returns Promise resolving bucket upload response
614
+ * {@link BucketUploadResponse}
615
+ * @example
616
+ * ```typescript
617
+ * // Upload a file from browser
618
+ * const file = new File(['file content'], 'example.txt');
619
+ * const result = await buckets.uploadFile({
620
+ * bucketId: <bucketId>,
621
+ * folderId: <folderId>,
622
+ * path: '/folder/example.txt',
623
+ * content: file
624
+ * });
625
+ *
626
+ * // In Node env with Uint8Array or Buffer
627
+ * const content = new TextEncoder().encode('file content');
628
+ * const result = await buckets.uploadFile({
629
+ * bucketId: <bucketId>,
630
+ * folderId: <folderId>,
631
+ * path: '/folder/example.txt',
632
+ * content,
633
+ * });
634
+ * ```
635
+ */
636
+ uploadFile(options: BucketUploadFileOptions): Promise<BucketUploadResponse>;
637
+ }
638
+
639
+ declare class BucketService extends FolderScopedService implements BucketServiceModel {
640
+ /**
641
+ * Gets a bucket by ID
642
+ * @param bucketId - The ID of the bucket to retrieve
643
+ * @param folderId - Folder ID for organization unit context
644
+ * @param options - Optional query parameters (expand, select)
645
+ * @returns Promise resolving to the bucket
646
+ *
647
+ * @example
648
+ * ```typescript
649
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
650
+ *
651
+ * const buckets = new Buckets(sdk);
652
+ *
653
+ * // Get bucket by ID
654
+ * const bucket = await buckets.getById(123, 456);
655
+ * ```
656
+ */
657
+ getById(id: number, folderId: number, options?: BucketGetByIdOptions): Promise<BucketGetResponse>;
658
+ /**
659
+ * Gets all buckets across folders with optional filtering and folder scoping
660
+ *
661
+ * The method returns either:
662
+ * - An array of buckets (when no pagination parameters are provided)
663
+ * - A paginated result with navigation cursors (when any pagination parameter is provided)
664
+ *
665
+ * @param options - Query options including optional folderId
666
+ * @returns Promise resolving to an array of buckets or paginated result
667
+ *
668
+ * @example
669
+ * ```typescript
670
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
671
+ *
672
+ * const buckets = new Buckets(sdk);
673
+ *
674
+ * // Get all buckets across folders
675
+ * const allBuckets = await buckets.getAll();
676
+ *
677
+ * // Get buckets within a specific folder
678
+ * const folderBuckets = await buckets.getAll({
679
+ * folderId: 123
680
+ * });
681
+ *
682
+ * // Get buckets with filtering
683
+ * const filteredBuckets = await buckets.getAll({
684
+ * filter: "name eq 'MyBucket'"
685
+ * });
686
+ *
687
+ * // First page with pagination
688
+ * const page1 = await buckets.getAll({ pageSize: 10 });
689
+ *
690
+ * // Navigate using cursor
691
+ * if (page1.hasNextPage) {
692
+ * const page2 = await buckets.getAll({ cursor: page1.nextCursor });
693
+ * }
694
+ *
695
+ * // Jump to specific page
696
+ * const page5 = await buckets.getAll({
697
+ * jumpToPage: 5,
698
+ * pageSize: 10
699
+ * });
700
+ * ```
701
+ */
702
+ getAll<T extends BucketGetAllOptions = BucketGetAllOptions>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<BucketGetResponse> : NonPaginatedResponse<BucketGetResponse>>;
703
+ /**
704
+ * Gets metadata for files in a bucket with optional filtering and pagination
705
+ *
706
+ * The method returns either:
707
+ * - A NonPaginatedResponse with items array (when no pagination parameters are provided)
708
+ * - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
709
+ *
710
+ * @param bucketId - The ID of the bucket to get file metadata from
711
+ * @param folderId - Required folder ID for organization unit context
712
+ * @param options - Optional parameters for filtering, pagination and access URL generation
713
+ * @returns Promise resolving to the list of file metadata in the bucket or paginated result
714
+ *
715
+ * @example
716
+ * ```typescript
717
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
718
+ *
719
+ * const buckets = new Buckets(sdk);
720
+ *
721
+ * // Get metadata for all files in a bucket
722
+ * const fileMetadata = await buckets.getFileMetaData(123, 456);
723
+ *
724
+ * // Get file metadata with a specific prefix
725
+ * const fileMetadata = await buckets.getFileMetaData(123, 456, {
726
+ * prefix: '/folder1'
727
+ * });
728
+ *
729
+ * // First page with pagination
730
+ * const page1 = await buckets.getFileMetaData(123, 456, { pageSize: 10 });
731
+ *
732
+ * // Navigate using cursor
733
+ * if (page1.hasNextPage) {
734
+ * const page2 = await buckets.getFileMetaData(123, 456, { cursor: page1.nextCursor });
735
+ * }
736
+ * ```
737
+ */
738
+ getFileMetaData<T extends BucketGetFileMetaDataWithPaginationOptions = BucketGetFileMetaDataWithPaginationOptions>(bucketId: number, folderId: number, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<BlobItem> : NonPaginatedResponse<BlobItem>>;
739
+ /**
740
+ * Uploads a file to a bucket
741
+ *
742
+ * @param options - Options for file upload including bucket ID, folder ID, path, content, and optional parameters
743
+ * @returns Promise resolving to a response with success status and HTTP status code
744
+ *
745
+ * @example
746
+ * ```typescript
747
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
748
+ *
749
+ * const buckets = new Buckets(sdk);
750
+ *
751
+ * // Upload a file from browser
752
+ * const file = new File(['file content'], 'example.txt');
753
+ * const result = await buckets.uploadFile({
754
+ * bucketId: 123,
755
+ * folderId: 456,
756
+ * path: '/folder/example.txt',
757
+ * content: file
758
+ * });
759
+ *
760
+ * // In Node env with Buffer
761
+ * const buffer = Buffer.from('file content');
762
+ * const result = await buckets.uploadFile({
763
+ * bucketId: 123,
764
+ * folderId: 456,
765
+ * path: '/folder/example.txt',
766
+ * content: buffer
767
+ * });
768
+ * ```
769
+ */
770
+ uploadFile(options: BucketUploadFileOptions): Promise<BucketUploadResponse>;
771
+ /**
772
+ * Gets a direct download URL for a file in the bucket
773
+ *
774
+ * @param options - Contains bucketId, folderId, file path and optional expiry time
775
+ * @returns Promise resolving to blob file access information
776
+ *
777
+ * @example
778
+ * ```typescript
779
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
780
+ *
781
+ * const buckets = new Buckets(sdk);
782
+ *
783
+ * // Get download URL for a file
784
+ * const fileAccess = await buckets.getReadUri({
785
+ * bucketId: 123,
786
+ * folderId: 456,
787
+ * path: '/folder/file.pdf'
788
+ * });
789
+ * ```
790
+ */
791
+ getReadUri(options: BucketGetReadUriOptions): Promise<BucketGetUriResponse>;
792
+ /**
793
+ * Uploads content to the provided URI
794
+ * @param uriResponse - Response from getWriteUri containing URL and headers
795
+ * @param content - The content to upload
796
+ * @returns The response from the upload request with status info
797
+ */
798
+ private _uploadToUri;
799
+ /**
800
+ * Private method to handle common URI request logic
801
+ * @param endpoint - The API endpoint to call
802
+ * @param bucketId - The bucket ID
803
+ * @param folderId - The folder ID
804
+ * @param path - The file path
805
+ * @param queryOptions - Additional query parameters
806
+ * @returns Promise resolving to blob file access information
807
+ */
808
+ private _getUri;
809
+ /**
810
+ * Gets a direct upload URL for a file in the bucket
811
+ *
812
+ * @param options - Contains bucketId, folderId, file path, optional expiry time
813
+ * @returns Promise resolving to blob file access information
814
+ */
815
+ private _getWriteUri;
816
+ }
817
+
818
+ export { BucketOptions, BucketService, BucketService as Buckets };
819
+ export type { BlobItem, BucketGetAllOptions, BucketGetByIdOptions, BucketGetFileMetaDataOptions, BucketGetFileMetaDataResponse, BucketGetFileMetaDataWithPaginationOptions, BucketGetReadUriOptions, BucketGetResponse, BucketGetUriOptions, BucketGetUriResponse, BucketServiceModel, BucketUploadFileOptions, BucketUploadResponse, ResponseDictionary };