-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathbulk.ts
More file actions
171 lines (154 loc) · 4.65 KB
/
bulk.ts
File metadata and controls
171 lines (154 loc) · 4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
export class Bulk extends APIResource {
/**
* This API deletes multiple files and all their file versions permanently.
*
* Note: If a file or specific transformation has been requested in the past, then
* the response is cached. Deleting a file does not purge the cache. You can purge
* the cache using purge cache API.
*
* A maximum of 100 files can be deleted at a time.
*
* @example
* ```ts
* const bulk = await client.files.bulk.delete({
* fileIds: [
* '598821f949c0a938d57563bd',
* '598821f949c0a938d57563be',
* ],
* });
* ```
*/
delete(body: BulkDeleteParams, options?: RequestOptions): APIPromise<BulkDeleteResponse> {
return this._client.post('/v1/files/batch/deleteByFileIds', { body, ...options });
}
/**
* This API adds tags to multiple files in bulk. A maximum of 50 files can be
* specified at a time.
*
* @example
* ```ts
* const response = await client.files.bulk.addTags({
* fileIds: [
* '598821f949c0a938d57563bd',
* '598821f949c0a938d57563be',
* ],
* tags: ['t-shirt', 'round-neck', 'sale2019'],
* });
* ```
*/
addTags(body: BulkAddTagsParams, options?: RequestOptions): APIPromise<BulkAddTagsResponse> {
return this._client.post('/v1/files/addTags', { body, ...options });
}
/**
* This API removes AITags from multiple files in bulk. A maximum of 50 files can
* be specified at a time.
*
* @example
* ```ts
* const response = await client.files.bulk.removeAITags({
* AITags: ['t-shirt', 'round-neck', 'sale2019'],
* fileIds: [
* '598821f949c0a938d57563bd',
* '598821f949c0a938d57563be',
* ],
* });
* ```
*/
removeAITags(body: BulkRemoveAITagsParams, options?: RequestOptions): APIPromise<BulkRemoveAITagsResponse> {
return this._client.post('/v1/files/removeAITags', { body, ...options });
}
/**
* This API removes tags from multiple files in bulk. A maximum of 50 files can be
* specified at a time.
*
* @example
* ```ts
* const response = await client.files.bulk.removeTags({
* fileIds: [
* '598821f949c0a938d57563bd',
* '598821f949c0a938d57563be',
* ],
* tags: ['t-shirt', 'round-neck', 'sale2019'],
* });
* ```
*/
removeTags(body: BulkRemoveTagsParams, options?: RequestOptions): APIPromise<BulkRemoveTagsResponse> {
return this._client.post('/v1/files/removeTags', { body, ...options });
}
}
export interface BulkDeleteResponse {
/**
* An array of fileIds that were successfully deleted.
*/
successfullyDeletedFileIds?: Array<string>;
}
export interface BulkAddTagsResponse {
/**
* An array of fileIds that in which tags were successfully added.
*/
successfullyUpdatedFileIds?: Array<string>;
}
export interface BulkRemoveAITagsResponse {
/**
* An array of fileIds that in which AITags were successfully removed.
*/
successfullyUpdatedFileIds?: Array<string>;
}
export interface BulkRemoveTagsResponse {
/**
* An array of fileIds that in which tags were successfully removed.
*/
successfullyUpdatedFileIds?: Array<string>;
}
export interface BulkDeleteParams {
/**
* An array of fileIds which you want to delete.
*/
fileIds: Array<string>;
}
export interface BulkAddTagsParams {
/**
* An array of fileIds to which you want to add tags.
*/
fileIds: Array<string>;
/**
* An array of tags that you want to add to the files.
*/
tags: Array<string>;
}
export interface BulkRemoveAITagsParams {
/**
* An array of AITags that you want to remove from the files.
*/
AITags: Array<string>;
/**
* An array of fileIds from which you want to remove AITags.
*/
fileIds: Array<string>;
}
export interface BulkRemoveTagsParams {
/**
* An array of fileIds from which you want to remove tags.
*/
fileIds: Array<string>;
/**
* An array of tags that you want to remove from the files.
*/
tags: Array<string>;
}
export declare namespace Bulk {
export {
type BulkDeleteResponse as BulkDeleteResponse,
type BulkAddTagsResponse as BulkAddTagsResponse,
type BulkRemoveAITagsResponse as BulkRemoveAITagsResponse,
type BulkRemoveTagsResponse as BulkRemoveTagsResponse,
type BulkDeleteParams as BulkDeleteParams,
type BulkAddTagsParams as BulkAddTagsParams,
type BulkRemoveAITagsParams as BulkRemoveAITagsParams,
type BulkRemoveTagsParams as BulkRemoveTagsParams,
};
}