@revenexx/sdk 0.0.4 → 0.0.6
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/dist/cjs/sdk.js +13491 -6163
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +13464 -6162
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +13491 -6163
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/enums/address-type.ts +4 -0
- package/src/enums/cart-export-format.ts +4 -0
- package/src/enums/cart-io-apply-mode.ts +5 -0
- package/src/enums/cart-io-direction.ts +4 -0
- package/src/enums/cart-io-entity.ts +4 -0
- package/src/enums/cart-io-format.ts +4 -0
- package/src/enums/cart-item-type.ts +5 -0
- package/src/enums/channel-status.ts +4 -0
- package/src/enums/channel-type.ts +7 -0
- package/src/enums/contact-role.ts +6 -0
- package/src/enums/contact-status.ts +5 -0
- package/src/enums/location-type.ts +6 -0
- package/src/enums/market-status.ts +4 -0
- package/src/enums/order-comment-visibility.ts +4 -0
- package/src/enums/order-item-type.ts +5 -0
- package/src/enums/order-list-kind.ts +4 -0
- package/src/enums/order-payment-status.ts +9 -0
- package/src/enums/organization-status.ts +4 -0
- package/src/enums/page-status.ts +5 -0
- package/src/enums/payment-fee-type.ts +5 -0
- package/src/enums/payment-method-kind.ts +4 -0
- package/src/enums/price-entry-type.ts +4 -0
- package/src/enums/price-list-status.ts +4 -0
- package/src/enums/shipping-method-matrix-basis.ts +6 -0
- package/src/enums/shipping-method-pricing-type.ts +5 -0
- package/src/enums/store-asset-request-visibility.ts +4 -0
- package/src/enums/visibility.ts +4 -0
- package/src/index.ts +28 -2
- package/src/models.ts +5309 -1009
- package/src/services/apps.ts +154 -154
- package/src/services/avatars.ts +57 -57
- package/src/services/carts.ts +739 -104
- package/src/services/channels.ts +147 -19
- package/src/services/customers.ts +809 -69
- package/src/services/greetings.ts +18 -18
- package/src/services/inventories.ts +620 -65
- package/src/services/locale.ts +16 -16
- package/src/services/markets.ts +690 -75
- package/src/services/messaging.ts +273 -273
- package/src/services/orderlists.ts +889 -0
- package/src/services/orders.ts +692 -137
- package/src/services/pages.ts +661 -155
- package/src/services/payments.ts +591 -64
- package/src/services/prices.ts +585 -59
- package/src/services/products.ts +1908 -272
- package/src/services/search.ts +24 -24
- package/src/services/shipping.ts +451 -59
- package/src/services/sites.ts +116 -116
- package/src/services/storage.ts +933 -599
- package/src/services/tokens.ts +14 -14
- package/types/enums/address-type.d.ts +4 -0
- package/types/enums/cart-export-format.d.ts +4 -0
- package/types/enums/cart-io-apply-mode.d.ts +5 -0
- package/types/enums/cart-io-direction.d.ts +4 -0
- package/types/enums/cart-io-entity.d.ts +4 -0
- package/types/enums/cart-io-format.d.ts +4 -0
- package/types/enums/cart-item-type.d.ts +5 -0
- package/types/enums/channel-status.d.ts +4 -0
- package/types/enums/channel-type.d.ts +7 -0
- package/types/enums/contact-role.d.ts +6 -0
- package/types/enums/contact-status.d.ts +5 -0
- package/types/enums/location-type.d.ts +6 -0
- package/types/enums/market-status.d.ts +4 -0
- package/types/enums/order-comment-visibility.d.ts +4 -0
- package/types/enums/order-item-type.d.ts +5 -0
- package/types/enums/order-list-kind.d.ts +4 -0
- package/types/enums/order-payment-status.d.ts +9 -0
- package/types/enums/organization-status.d.ts +4 -0
- package/types/enums/page-status.d.ts +5 -0
- package/types/enums/payment-fee-type.d.ts +5 -0
- package/types/enums/payment-method-kind.d.ts +4 -0
- package/types/enums/price-entry-type.d.ts +4 -0
- package/types/enums/price-list-status.d.ts +4 -0
- package/types/enums/shipping-method-matrix-basis.d.ts +6 -0
- package/types/enums/shipping-method-pricing-type.d.ts +5 -0
- package/types/enums/store-asset-request-visibility.d.ts +4 -0
- package/types/enums/visibility.d.ts +4 -0
- package/types/index.d.ts +28 -2
- package/types/models.d.ts +5170 -1010
- package/types/services/carts.d.ts +271 -12
- package/types/services/channels.d.ts +54 -2
- package/types/services/customers.d.ts +298 -12
- package/types/services/inventories.d.ts +225 -11
- package/types/services/markets.d.ts +235 -6
- package/types/services/orderlists.d.ts +324 -0
- package/types/services/orders.d.ts +238 -16
- package/types/services/pages.d.ts +190 -6
- package/types/services/payments.d.ts +221 -7
- package/types/services/prices.d.ts +218 -6
- package/types/services/products.d.ts +672 -32
- package/types/services/shipping.d.ts +168 -6
- package/types/services/storage.d.ts +353 -285
package/src/services/storage.ts
CHANGED
|
@@ -2,9 +2,7 @@ import { Service } from '../service';
|
|
|
2
2
|
import { RevenexxException, Client, type Payload, UploadProgress } from '../client';
|
|
3
3
|
import type { Models } from '../models';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { Gravity } from '../enums/gravity';
|
|
7
|
-
import { Output } from '../enums/output';
|
|
5
|
+
import { Visibility } from '../enums/visibility';
|
|
8
6
|
|
|
9
7
|
export class Storage {
|
|
10
8
|
client: Client;
|
|
@@ -14,57 +12,40 @@ export class Storage {
|
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
|
-
* Get a list of all the storage buckets. You can use the query params to filter your results.
|
|
18
15
|
*
|
|
19
|
-
* @param {string
|
|
20
|
-
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
|
|
21
|
-
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
16
|
+
* @param {string} params.search -
|
|
22
17
|
* @throws {RevenexxException}
|
|
23
|
-
* @returns {Promise<
|
|
18
|
+
* @returns {Promise<{}>}
|
|
24
19
|
*/
|
|
25
|
-
|
|
20
|
+
assetIndex(params?: { search?: string }): Promise<{}>;
|
|
26
21
|
/**
|
|
27
|
-
* Get a list of all the storage buckets. You can use the query params to filter your results.
|
|
28
22
|
*
|
|
29
|
-
* @param {string
|
|
30
|
-
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
|
|
31
|
-
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
23
|
+
* @param {string} search -
|
|
32
24
|
* @throws {RevenexxException}
|
|
33
|
-
* @returns {Promise<
|
|
25
|
+
* @returns {Promise<{}>}
|
|
34
26
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
35
27
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
paramsOrFirst?: {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
let params: { queries?: string[], search?: string, total?: boolean };
|
|
28
|
+
assetIndex(search?: string): Promise<{}>;
|
|
29
|
+
assetIndex(
|
|
30
|
+
paramsOrFirst?: { search?: string } | string
|
|
31
|
+
): Promise<{}> {
|
|
32
|
+
let params: { search?: string };
|
|
42
33
|
|
|
43
34
|
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
44
|
-
params = (paramsOrFirst || {}) as {
|
|
35
|
+
params = (paramsOrFirst || {}) as { search?: string };
|
|
45
36
|
} else {
|
|
46
37
|
params = {
|
|
47
|
-
|
|
48
|
-
search: rest[0] as string,
|
|
49
|
-
total: rest[1] as boolean
|
|
38
|
+
search: paramsOrFirst as string
|
|
50
39
|
};
|
|
51
40
|
}
|
|
52
41
|
|
|
53
|
-
const queries = params.queries;
|
|
54
42
|
const search = params.search;
|
|
55
|
-
const total = params.total;
|
|
56
43
|
|
|
57
44
|
|
|
58
|
-
const apiPath = '/v1/storage/
|
|
59
|
-
const
|
|
60
|
-
if (typeof queries !== 'undefined') {
|
|
61
|
-
payload['queries'] = queries;
|
|
62
|
-
}
|
|
45
|
+
const apiPath = '/v1/storage/assets';
|
|
46
|
+
const apiPayload: Payload = {};
|
|
63
47
|
if (typeof search !== 'undefined') {
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
if (typeof total !== 'undefined') {
|
|
67
|
-
payload['total'] = total;
|
|
48
|
+
apiPayload['search'] = search;
|
|
68
49
|
}
|
|
69
50
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
70
51
|
|
|
@@ -75,124 +56,167 @@ export class Storage {
|
|
|
75
56
|
'get',
|
|
76
57
|
uri,
|
|
77
58
|
apiHeaders,
|
|
78
|
-
|
|
59
|
+
apiPayload
|
|
79
60
|
);
|
|
80
61
|
}
|
|
81
62
|
|
|
82
63
|
/**
|
|
83
|
-
* Create a new storage bucket.
|
|
84
64
|
*
|
|
85
|
-
* @param {string} params.
|
|
86
|
-
* @param {string} params.
|
|
87
|
-
* @param {string
|
|
88
|
-
* @param {
|
|
89
|
-
* @param {
|
|
90
|
-
* @param {boolean} params.
|
|
91
|
-
* @param {
|
|
92
|
-
* @param {boolean} params.
|
|
93
|
-
* @param {
|
|
94
|
-
* @param {string[]} params.permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
95
|
-
* @param {boolean} params.transformations - Are image transformations enabled?
|
|
65
|
+
* @param {string} params.file -
|
|
66
|
+
* @param {string} params.altText -
|
|
67
|
+
* @param {string} params.description -
|
|
68
|
+
* @param {string} params.displayName -
|
|
69
|
+
* @param {string} params.folderId -
|
|
70
|
+
* @param {boolean} params.keepArchive -
|
|
71
|
+
* @param {string[]} params.tags -
|
|
72
|
+
* @param {boolean} params.unpack - Archives only: unpack the members after upload (see AssetController).
|
|
73
|
+
* @param {Visibility} params.visibility -
|
|
96
74
|
* @throws {RevenexxException}
|
|
97
|
-
* @returns {Promise<
|
|
75
|
+
* @returns {Promise<{}>}
|
|
98
76
|
*/
|
|
99
|
-
|
|
77
|
+
assetStore(params: { file: string, altText?: string, description?: string, displayName?: string, folderId?: string, keepArchive?: boolean, tags?: string[], unpack?: boolean, visibility?: Visibility, onProgress?: (progress: UploadProgress) => void }): Promise<{}>;
|
|
100
78
|
/**
|
|
101
|
-
* Create a new storage bucket.
|
|
102
79
|
*
|
|
103
|
-
* @param {string}
|
|
104
|
-
* @param {string}
|
|
105
|
-
* @param {string
|
|
106
|
-
* @param {
|
|
107
|
-
* @param {
|
|
108
|
-
* @param {boolean}
|
|
109
|
-
* @param {
|
|
110
|
-
* @param {boolean}
|
|
111
|
-
* @param {
|
|
112
|
-
* @param {string[]} permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
113
|
-
* @param {boolean} transformations - Are image transformations enabled?
|
|
80
|
+
* @param {string} file -
|
|
81
|
+
* @param {string} altText -
|
|
82
|
+
* @param {string} description -
|
|
83
|
+
* @param {string} displayName -
|
|
84
|
+
* @param {string} folderId -
|
|
85
|
+
* @param {boolean} keepArchive -
|
|
86
|
+
* @param {string[]} tags -
|
|
87
|
+
* @param {boolean} unpack - Archives only: unpack the members after upload (see AssetController).
|
|
88
|
+
* @param {Visibility} visibility -
|
|
114
89
|
* @throws {RevenexxException}
|
|
115
|
-
* @returns {Promise<
|
|
90
|
+
* @returns {Promise<{}>}
|
|
116
91
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
117
92
|
*/
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
paramsOrFirst: {
|
|
121
|
-
...rest: [(string)?, (string
|
|
122
|
-
): Promise<
|
|
123
|
-
let params: {
|
|
93
|
+
assetStore(file: string, altText?: string, description?: string, displayName?: string, folderId?: string, keepArchive?: boolean, tags?: string[], unpack?: boolean, visibility?: Visibility, onProgress?: (progress: UploadProgress) => void): Promise<{}>;
|
|
94
|
+
assetStore(
|
|
95
|
+
paramsOrFirst: { file: string, altText?: string, description?: string, displayName?: string, folderId?: string, keepArchive?: boolean, tags?: string[], unpack?: boolean, visibility?: Visibility, onProgress?: (progress: UploadProgress) => void } | string,
|
|
96
|
+
...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?, (string[])?, (boolean)?, (Visibility)?,((progress: UploadProgress) => void)?]
|
|
97
|
+
): Promise<{}> {
|
|
98
|
+
let params: { file: string, altText?: string, description?: string, displayName?: string, folderId?: string, keepArchive?: boolean, tags?: string[], unpack?: boolean, visibility?: Visibility };
|
|
99
|
+
let onProgress: ((progress: UploadProgress) => void);
|
|
124
100
|
|
|
125
101
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
126
|
-
params = (paramsOrFirst || {}) as {
|
|
102
|
+
params = (paramsOrFirst || {}) as { file: string, altText?: string, description?: string, displayName?: string, folderId?: string, keepArchive?: boolean, tags?: string[], unpack?: boolean, visibility?: Visibility };
|
|
103
|
+
onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void);
|
|
127
104
|
} else {
|
|
128
105
|
params = {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
permissions: rest[8] as string[],
|
|
139
|
-
transformations: rest[9] as boolean
|
|
106
|
+
file: paramsOrFirst as string,
|
|
107
|
+
altText: rest[0] as string,
|
|
108
|
+
description: rest[1] as string,
|
|
109
|
+
displayName: rest[2] as string,
|
|
110
|
+
folderId: rest[3] as string,
|
|
111
|
+
keepArchive: rest[4] as boolean,
|
|
112
|
+
tags: rest[5] as string[],
|
|
113
|
+
unpack: rest[6] as boolean,
|
|
114
|
+
visibility: rest[7] as Visibility
|
|
140
115
|
};
|
|
116
|
+
onProgress = rest[8] as ((progress: UploadProgress) => void);
|
|
141
117
|
}
|
|
142
118
|
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const
|
|
148
|
-
const
|
|
149
|
-
const
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (typeof bucketId === 'undefined') {
|
|
156
|
-
throw new RevenexxException('Missing required parameter: "bucketId"');
|
|
157
|
-
}
|
|
158
|
-
if (typeof name === 'undefined') {
|
|
159
|
-
throw new RevenexxException('Missing required parameter: "name"');
|
|
119
|
+
const file = params.file;
|
|
120
|
+
const altText = params.altText;
|
|
121
|
+
const description = params.description;
|
|
122
|
+
const displayName = params.displayName;
|
|
123
|
+
const folderId = params.folderId;
|
|
124
|
+
const keepArchive = params.keepArchive;
|
|
125
|
+
const tags = params.tags;
|
|
126
|
+
const unpack = params.unpack;
|
|
127
|
+
const visibility = params.visibility;
|
|
128
|
+
|
|
129
|
+
if (typeof file === 'undefined') {
|
|
130
|
+
throw new RevenexxException('Missing required parameter: "file"');
|
|
160
131
|
}
|
|
161
132
|
|
|
162
|
-
const apiPath = '/v1/storage/
|
|
163
|
-
const
|
|
164
|
-
if (typeof
|
|
165
|
-
|
|
133
|
+
const apiPath = '/v1/storage/assets';
|
|
134
|
+
const apiPayload: Payload = {};
|
|
135
|
+
if (typeof altText !== 'undefined') {
|
|
136
|
+
apiPayload['alt_text'] = altText;
|
|
166
137
|
}
|
|
167
|
-
if (typeof
|
|
168
|
-
|
|
138
|
+
if (typeof description !== 'undefined') {
|
|
139
|
+
apiPayload['description'] = description;
|
|
169
140
|
}
|
|
170
|
-
if (typeof
|
|
171
|
-
|
|
141
|
+
if (typeof displayName !== 'undefined') {
|
|
142
|
+
apiPayload['display_name'] = displayName;
|
|
172
143
|
}
|
|
173
|
-
if (typeof
|
|
174
|
-
|
|
144
|
+
if (typeof file !== 'undefined') {
|
|
145
|
+
apiPayload['file'] = file;
|
|
175
146
|
}
|
|
176
|
-
if (typeof
|
|
177
|
-
|
|
147
|
+
if (typeof folderId !== 'undefined') {
|
|
148
|
+
apiPayload['folder_id'] = folderId;
|
|
178
149
|
}
|
|
179
|
-
if (typeof
|
|
180
|
-
|
|
150
|
+
if (typeof keepArchive !== 'undefined') {
|
|
151
|
+
apiPayload['keep_archive'] = keepArchive;
|
|
181
152
|
}
|
|
182
|
-
if (typeof
|
|
183
|
-
|
|
153
|
+
if (typeof tags !== 'undefined') {
|
|
154
|
+
apiPayload['tags'] = tags;
|
|
184
155
|
}
|
|
185
|
-
if (typeof
|
|
186
|
-
|
|
156
|
+
if (typeof unpack !== 'undefined') {
|
|
157
|
+
apiPayload['unpack'] = unpack;
|
|
187
158
|
}
|
|
188
|
-
if (typeof
|
|
189
|
-
|
|
159
|
+
if (typeof visibility !== 'undefined') {
|
|
160
|
+
apiPayload['visibility'] = visibility;
|
|
161
|
+
}
|
|
162
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
163
|
+
|
|
164
|
+
const apiHeaders: { [header: string]: string } = {
|
|
165
|
+
'content-type': 'multipart/form-data',
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return this.client.chunkedUpload(
|
|
169
|
+
'post',
|
|
170
|
+
uri,
|
|
171
|
+
apiHeaders,
|
|
172
|
+
apiPayload,
|
|
173
|
+
onProgress
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
*
|
|
179
|
+
* @param {string} params.folderId -
|
|
180
|
+
* @param {string} params.visibility -
|
|
181
|
+
* @throws {RevenexxException}
|
|
182
|
+
* @returns {Promise<{}>}
|
|
183
|
+
*/
|
|
184
|
+
assetBulk(params?: { folderId?: string, visibility?: string }): Promise<{}>;
|
|
185
|
+
/**
|
|
186
|
+
*
|
|
187
|
+
* @param {string} folderId -
|
|
188
|
+
* @param {string} visibility -
|
|
189
|
+
* @throws {RevenexxException}
|
|
190
|
+
* @returns {Promise<{}>}
|
|
191
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
192
|
+
*/
|
|
193
|
+
assetBulk(folderId?: string, visibility?: string): Promise<{}>;
|
|
194
|
+
assetBulk(
|
|
195
|
+
paramsOrFirst?: { folderId?: string, visibility?: string } | string,
|
|
196
|
+
...rest: [(string)?]
|
|
197
|
+
): Promise<{}> {
|
|
198
|
+
let params: { folderId?: string, visibility?: string };
|
|
199
|
+
|
|
200
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
201
|
+
params = (paramsOrFirst || {}) as { folderId?: string, visibility?: string };
|
|
202
|
+
} else {
|
|
203
|
+
params = {
|
|
204
|
+
folderId: paramsOrFirst as string,
|
|
205
|
+
visibility: rest[0] as string
|
|
206
|
+
};
|
|
190
207
|
}
|
|
191
|
-
|
|
192
|
-
|
|
208
|
+
|
|
209
|
+
const folderId = params.folderId;
|
|
210
|
+
const visibility = params.visibility;
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
const apiPath = '/v1/storage/assets/bulk';
|
|
214
|
+
const apiPayload: Payload = {};
|
|
215
|
+
if (typeof folderId !== 'undefined') {
|
|
216
|
+
apiPayload['folder_id'] = folderId;
|
|
193
217
|
}
|
|
194
|
-
if (typeof
|
|
195
|
-
|
|
218
|
+
if (typeof visibility !== 'undefined') {
|
|
219
|
+
apiPayload['visibility'] = visibility;
|
|
196
220
|
}
|
|
197
221
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
198
222
|
|
|
@@ -204,48 +228,46 @@ export class Storage {
|
|
|
204
228
|
'post',
|
|
205
229
|
uri,
|
|
206
230
|
apiHeaders,
|
|
207
|
-
|
|
231
|
+
apiPayload
|
|
208
232
|
);
|
|
209
233
|
}
|
|
210
234
|
|
|
211
235
|
/**
|
|
212
|
-
* Delete a storage bucket by its unique ID.
|
|
213
236
|
*
|
|
214
|
-
* @param {string} params.
|
|
237
|
+
* @param {string} params.id -
|
|
215
238
|
* @throws {RevenexxException}
|
|
216
239
|
* @returns {Promise<{}>}
|
|
217
240
|
*/
|
|
218
|
-
|
|
241
|
+
assetDestroy(params: { id: string }): Promise<{}>;
|
|
219
242
|
/**
|
|
220
|
-
* Delete a storage bucket by its unique ID.
|
|
221
243
|
*
|
|
222
|
-
* @param {string}
|
|
244
|
+
* @param {string} id -
|
|
223
245
|
* @throws {RevenexxException}
|
|
224
246
|
* @returns {Promise<{}>}
|
|
225
247
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
226
248
|
*/
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
paramsOrFirst: {
|
|
249
|
+
assetDestroy(id: string): Promise<{}>;
|
|
250
|
+
assetDestroy(
|
|
251
|
+
paramsOrFirst: { id: string } | string
|
|
230
252
|
): Promise<{}> {
|
|
231
|
-
let params: {
|
|
253
|
+
let params: { id: string };
|
|
232
254
|
|
|
233
255
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
234
|
-
params = (paramsOrFirst || {}) as {
|
|
256
|
+
params = (paramsOrFirst || {}) as { id: string };
|
|
235
257
|
} else {
|
|
236
258
|
params = {
|
|
237
|
-
|
|
259
|
+
id: paramsOrFirst as string
|
|
238
260
|
};
|
|
239
261
|
}
|
|
240
262
|
|
|
241
|
-
const
|
|
263
|
+
const id = params.id;
|
|
242
264
|
|
|
243
|
-
if (typeof
|
|
244
|
-
throw new RevenexxException('Missing required parameter: "
|
|
265
|
+
if (typeof id === 'undefined') {
|
|
266
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
245
267
|
}
|
|
246
268
|
|
|
247
|
-
const apiPath = '/v1/storage/
|
|
248
|
-
const
|
|
269
|
+
const apiPath = '/v1/storage/assets/{id}'.replace('{id}', id);
|
|
270
|
+
const apiPayload: Payload = {};
|
|
249
271
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
250
272
|
|
|
251
273
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -255,48 +277,46 @@ export class Storage {
|
|
|
255
277
|
'delete',
|
|
256
278
|
uri,
|
|
257
279
|
apiHeaders,
|
|
258
|
-
|
|
280
|
+
apiPayload
|
|
259
281
|
);
|
|
260
282
|
}
|
|
261
283
|
|
|
262
284
|
/**
|
|
263
|
-
* Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
|
|
264
285
|
*
|
|
265
|
-
* @param {string} params.
|
|
286
|
+
* @param {string} params.id -
|
|
266
287
|
* @throws {RevenexxException}
|
|
267
|
-
* @returns {Promise<
|
|
288
|
+
* @returns {Promise<{}>}
|
|
268
289
|
*/
|
|
269
|
-
|
|
290
|
+
assetShow(params: { id: string }): Promise<{}>;
|
|
270
291
|
/**
|
|
271
|
-
* Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
|
|
272
292
|
*
|
|
273
|
-
* @param {string}
|
|
293
|
+
* @param {string} id -
|
|
274
294
|
* @throws {RevenexxException}
|
|
275
|
-
* @returns {Promise<
|
|
295
|
+
* @returns {Promise<{}>}
|
|
276
296
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
277
297
|
*/
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
paramsOrFirst: {
|
|
281
|
-
): Promise<
|
|
282
|
-
let params: {
|
|
298
|
+
assetShow(id: string): Promise<{}>;
|
|
299
|
+
assetShow(
|
|
300
|
+
paramsOrFirst: { id: string } | string
|
|
301
|
+
): Promise<{}> {
|
|
302
|
+
let params: { id: string };
|
|
283
303
|
|
|
284
304
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
285
|
-
params = (paramsOrFirst || {}) as {
|
|
305
|
+
params = (paramsOrFirst || {}) as { id: string };
|
|
286
306
|
} else {
|
|
287
307
|
params = {
|
|
288
|
-
|
|
308
|
+
id: paramsOrFirst as string
|
|
289
309
|
};
|
|
290
310
|
}
|
|
291
311
|
|
|
292
|
-
const
|
|
312
|
+
const id = params.id;
|
|
293
313
|
|
|
294
|
-
if (typeof
|
|
295
|
-
throw new RevenexxException('Missing required parameter: "
|
|
314
|
+
if (typeof id === 'undefined') {
|
|
315
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
296
316
|
}
|
|
297
317
|
|
|
298
|
-
const apiPath = '/v1/storage/
|
|
299
|
-
const
|
|
318
|
+
const apiPath = '/v1/storage/assets/{id}'.replace('{id}', id);
|
|
319
|
+
const apiPayload: Payload = {};
|
|
300
320
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
301
321
|
|
|
302
322
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -306,121 +326,95 @@ export class Storage {
|
|
|
306
326
|
'get',
|
|
307
327
|
uri,
|
|
308
328
|
apiHeaders,
|
|
309
|
-
|
|
329
|
+
apiPayload
|
|
310
330
|
);
|
|
311
331
|
}
|
|
312
332
|
|
|
313
333
|
/**
|
|
314
|
-
* Update a storage bucket by its unique ID.
|
|
315
334
|
*
|
|
316
|
-
* @param {string} params.
|
|
317
|
-
* @param {string} params.
|
|
318
|
-
* @param {string
|
|
319
|
-
* @param {
|
|
320
|
-
* @param {
|
|
321
|
-
* @param {
|
|
322
|
-
* @param {
|
|
323
|
-
* @param {
|
|
324
|
-
* @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB.
|
|
325
|
-
* @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
326
|
-
* @param {boolean} params.transformations - Are image transformations enabled?
|
|
335
|
+
* @param {string} params.id -
|
|
336
|
+
* @param {string} params.altText -
|
|
337
|
+
* @param {string} params.description -
|
|
338
|
+
* @param {string} params.displayName -
|
|
339
|
+
* @param {string} params.folderId -
|
|
340
|
+
* @param {string} params.name -
|
|
341
|
+
* @param {string[]} params.tags -
|
|
342
|
+
* @param {Visibility} params.visibility -
|
|
327
343
|
* @throws {RevenexxException}
|
|
328
|
-
* @returns {Promise<
|
|
344
|
+
* @returns {Promise<{}>}
|
|
329
345
|
*/
|
|
330
|
-
|
|
346
|
+
assetUpdate(params: { id: string, altText?: string, description?: string, displayName?: string, folderId?: string, name?: string, tags?: string[], visibility?: Visibility }): Promise<{}>;
|
|
331
347
|
/**
|
|
332
|
-
* Update a storage bucket by its unique ID.
|
|
333
348
|
*
|
|
334
|
-
* @param {string}
|
|
335
|
-
* @param {string}
|
|
336
|
-
* @param {string
|
|
337
|
-
* @param {
|
|
338
|
-
* @param {
|
|
339
|
-
* @param {
|
|
340
|
-
* @param {
|
|
341
|
-
* @param {
|
|
342
|
-
* @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB.
|
|
343
|
-
* @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
344
|
-
* @param {boolean} transformations - Are image transformations enabled?
|
|
349
|
+
* @param {string} id -
|
|
350
|
+
* @param {string} altText -
|
|
351
|
+
* @param {string} description -
|
|
352
|
+
* @param {string} displayName -
|
|
353
|
+
* @param {string} folderId -
|
|
354
|
+
* @param {string} name -
|
|
355
|
+
* @param {string[]} tags -
|
|
356
|
+
* @param {Visibility} visibility -
|
|
345
357
|
* @throws {RevenexxException}
|
|
346
|
-
* @returns {Promise<
|
|
358
|
+
* @returns {Promise<{}>}
|
|
347
359
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
348
360
|
*/
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
paramsOrFirst: {
|
|
352
|
-
...rest: [(string)?, (string
|
|
353
|
-
): Promise<
|
|
354
|
-
let params: {
|
|
361
|
+
assetUpdate(id: string, altText?: string, description?: string, displayName?: string, folderId?: string, name?: string, tags?: string[], visibility?: Visibility): Promise<{}>;
|
|
362
|
+
assetUpdate(
|
|
363
|
+
paramsOrFirst: { id: string, altText?: string, description?: string, displayName?: string, folderId?: string, name?: string, tags?: string[], visibility?: Visibility } | string,
|
|
364
|
+
...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string[])?, (Visibility)?]
|
|
365
|
+
): Promise<{}> {
|
|
366
|
+
let params: { id: string, altText?: string, description?: string, displayName?: string, folderId?: string, name?: string, tags?: string[], visibility?: Visibility };
|
|
355
367
|
|
|
356
368
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
357
|
-
params = (paramsOrFirst || {}) as {
|
|
369
|
+
params = (paramsOrFirst || {}) as { id: string, altText?: string, description?: string, displayName?: string, folderId?: string, name?: string, tags?: string[], visibility?: Visibility };
|
|
358
370
|
} else {
|
|
359
371
|
params = {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
maximumFileSize: rest[7] as number,
|
|
369
|
-
permissions: rest[8] as string[],
|
|
370
|
-
transformations: rest[9] as boolean
|
|
372
|
+
id: paramsOrFirst as string,
|
|
373
|
+
altText: rest[0] as string,
|
|
374
|
+
description: rest[1] as string,
|
|
375
|
+
displayName: rest[2] as string,
|
|
376
|
+
folderId: rest[3] as string,
|
|
377
|
+
name: rest[4] as string,
|
|
378
|
+
tags: rest[5] as string[],
|
|
379
|
+
visibility: rest[6] as Visibility
|
|
371
380
|
};
|
|
372
381
|
}
|
|
373
382
|
|
|
374
|
-
const
|
|
383
|
+
const id = params.id;
|
|
384
|
+
const altText = params.altText;
|
|
385
|
+
const description = params.description;
|
|
386
|
+
const displayName = params.displayName;
|
|
387
|
+
const folderId = params.folderId;
|
|
375
388
|
const name = params.name;
|
|
376
|
-
const
|
|
377
|
-
const
|
|
378
|
-
const compression = params.compression;
|
|
379
|
-
const enabled = params.enabled;
|
|
380
|
-
const encryption = params.encryption;
|
|
381
|
-
const fileSecurity = params.fileSecurity;
|
|
382
|
-
const maximumFileSize = params.maximumFileSize;
|
|
383
|
-
const permissions = params.permissions;
|
|
384
|
-
const transformations = params.transformations;
|
|
385
|
-
|
|
386
|
-
if (typeof bucketId === 'undefined') {
|
|
387
|
-
throw new RevenexxException('Missing required parameter: "bucketId"');
|
|
388
|
-
}
|
|
389
|
-
if (typeof name === 'undefined') {
|
|
390
|
-
throw new RevenexxException('Missing required parameter: "name"');
|
|
391
|
-
}
|
|
389
|
+
const tags = params.tags;
|
|
390
|
+
const visibility = params.visibility;
|
|
392
391
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
if (typeof allowedFileExtensions !== 'undefined') {
|
|
396
|
-
payload['allowedFileExtensions'] = allowedFileExtensions;
|
|
397
|
-
}
|
|
398
|
-
if (typeof antivirus !== 'undefined') {
|
|
399
|
-
payload['antivirus'] = antivirus;
|
|
400
|
-
}
|
|
401
|
-
if (typeof compression !== 'undefined') {
|
|
402
|
-
payload['compression'] = compression;
|
|
392
|
+
if (typeof id === 'undefined') {
|
|
393
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
403
394
|
}
|
|
404
|
-
|
|
405
|
-
|
|
395
|
+
|
|
396
|
+
const apiPath = '/v1/storage/assets/{id}'.replace('{id}', id);
|
|
397
|
+
const apiPayload: Payload = {};
|
|
398
|
+
if (typeof altText !== 'undefined') {
|
|
399
|
+
apiPayload['alt_text'] = altText;
|
|
406
400
|
}
|
|
407
|
-
if (typeof
|
|
408
|
-
|
|
401
|
+
if (typeof description !== 'undefined') {
|
|
402
|
+
apiPayload['description'] = description;
|
|
409
403
|
}
|
|
410
|
-
if (typeof
|
|
411
|
-
|
|
404
|
+
if (typeof displayName !== 'undefined') {
|
|
405
|
+
apiPayload['display_name'] = displayName;
|
|
412
406
|
}
|
|
413
|
-
if (typeof
|
|
414
|
-
|
|
407
|
+
if (typeof folderId !== 'undefined') {
|
|
408
|
+
apiPayload['folder_id'] = folderId;
|
|
415
409
|
}
|
|
416
410
|
if (typeof name !== 'undefined') {
|
|
417
|
-
|
|
411
|
+
apiPayload['name'] = name;
|
|
418
412
|
}
|
|
419
|
-
if (typeof
|
|
420
|
-
|
|
413
|
+
if (typeof tags !== 'undefined') {
|
|
414
|
+
apiPayload['tags'] = tags;
|
|
421
415
|
}
|
|
422
|
-
if (typeof
|
|
423
|
-
|
|
416
|
+
if (typeof visibility !== 'undefined') {
|
|
417
|
+
apiPayload['visibility'] = visibility;
|
|
424
418
|
}
|
|
425
419
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
426
420
|
|
|
@@ -429,73 +423,49 @@ export class Storage {
|
|
|
429
423
|
}
|
|
430
424
|
|
|
431
425
|
return this.client.call(
|
|
432
|
-
'
|
|
426
|
+
'patch',
|
|
433
427
|
uri,
|
|
434
428
|
apiHeaders,
|
|
435
|
-
|
|
429
|
+
apiPayload
|
|
436
430
|
);
|
|
437
431
|
}
|
|
438
432
|
|
|
439
433
|
/**
|
|
440
|
-
* Get a list of all the user files. You can use the query params to filter your results.
|
|
441
434
|
*
|
|
442
|
-
* @param {string} params.
|
|
443
|
-
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded
|
|
444
|
-
* @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
|
|
445
|
-
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
435
|
+
* @param {string} params.id -
|
|
446
436
|
* @throws {RevenexxException}
|
|
447
|
-
* @returns {Promise<
|
|
437
|
+
* @returns {Promise<{}>}
|
|
448
438
|
*/
|
|
449
|
-
|
|
439
|
+
assetDownload(params: { id: string }): Promise<{}>;
|
|
450
440
|
/**
|
|
451
|
-
* Get a list of all the user files. You can use the query params to filter your results.
|
|
452
441
|
*
|
|
453
|
-
* @param {string}
|
|
454
|
-
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded
|
|
455
|
-
* @param {string} search - Search term to filter your list results. Max length: 256 chars.
|
|
456
|
-
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
442
|
+
* @param {string} id -
|
|
457
443
|
* @throws {RevenexxException}
|
|
458
|
-
* @returns {Promise<
|
|
444
|
+
* @returns {Promise<{}>}
|
|
459
445
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
460
446
|
*/
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
paramsOrFirst: {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
let params: { bucketId: string, queries?: string[], search?: string, total?: boolean };
|
|
447
|
+
assetDownload(id: string): Promise<{}>;
|
|
448
|
+
assetDownload(
|
|
449
|
+
paramsOrFirst: { id: string } | string
|
|
450
|
+
): Promise<{}> {
|
|
451
|
+
let params: { id: string };
|
|
467
452
|
|
|
468
453
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
469
|
-
params = (paramsOrFirst || {}) as {
|
|
454
|
+
params = (paramsOrFirst || {}) as { id: string };
|
|
470
455
|
} else {
|
|
471
456
|
params = {
|
|
472
|
-
|
|
473
|
-
queries: rest[0] as string[],
|
|
474
|
-
search: rest[1] as string,
|
|
475
|
-
total: rest[2] as boolean
|
|
457
|
+
id: paramsOrFirst as string
|
|
476
458
|
};
|
|
477
459
|
}
|
|
478
460
|
|
|
479
|
-
const
|
|
480
|
-
const queries = params.queries;
|
|
481
|
-
const search = params.search;
|
|
482
|
-
const total = params.total;
|
|
461
|
+
const id = params.id;
|
|
483
462
|
|
|
484
|
-
if (typeof
|
|
485
|
-
throw new RevenexxException('Missing required parameter: "
|
|
463
|
+
if (typeof id === 'undefined') {
|
|
464
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
486
465
|
}
|
|
487
466
|
|
|
488
|
-
const apiPath = '/v1/storage/
|
|
489
|
-
const
|
|
490
|
-
if (typeof queries !== 'undefined') {
|
|
491
|
-
payload['queries'] = queries;
|
|
492
|
-
}
|
|
493
|
-
if (typeof search !== 'undefined') {
|
|
494
|
-
payload['search'] = search;
|
|
495
|
-
}
|
|
496
|
-
if (typeof total !== 'undefined') {
|
|
497
|
-
payload['total'] = total;
|
|
498
|
-
}
|
|
467
|
+
const apiPath = '/v1/storage/assets/{id}/download'.replace('{id}', id);
|
|
468
|
+
const apiPayload: Payload = {};
|
|
499
469
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
500
470
|
|
|
501
471
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -505,213 +475,289 @@ export class Storage {
|
|
|
505
475
|
'get',
|
|
506
476
|
uri,
|
|
507
477
|
apiHeaders,
|
|
508
|
-
|
|
478
|
+
apiPayload
|
|
509
479
|
);
|
|
510
480
|
}
|
|
511
481
|
|
|
512
482
|
/**
|
|
513
|
-
* Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://app.revenexx.com/docs/server/storage#storageCreateBucket) API or directly from your Revenexx console.
|
|
514
|
-
*
|
|
515
|
-
* Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
|
|
516
|
-
*
|
|
517
|
-
* When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-revenexx-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
|
|
518
|
-
*
|
|
519
|
-
* If you're creating a new file using one of the Revenexx SDKs, all the chunking logic will be managed by the SDK internally.
|
|
520
|
-
*
|
|
521
483
|
*
|
|
522
|
-
* @param {string} params.
|
|
523
|
-
* @param {string} params.file - Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file).
|
|
524
|
-
* @param {string} params.fileId - File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
525
|
-
* @param {string[]} params.permissions - An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
484
|
+
* @param {string} params.id -
|
|
526
485
|
* @throws {RevenexxException}
|
|
527
|
-
* @returns {Promise<
|
|
486
|
+
* @returns {Promise<{}>}
|
|
528
487
|
*/
|
|
529
|
-
|
|
488
|
+
assetPermanent(params: { id: string }): Promise<{}>;
|
|
530
489
|
/**
|
|
531
|
-
* Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://app.revenexx.com/docs/server/storage#storageCreateBucket) API or directly from your Revenexx console.
|
|
532
|
-
*
|
|
533
|
-
* Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
|
|
534
|
-
*
|
|
535
|
-
* When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-revenexx-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
|
|
536
|
-
*
|
|
537
|
-
* If you're creating a new file using one of the Revenexx SDKs, all the chunking logic will be managed by the SDK internally.
|
|
538
|
-
*
|
|
539
490
|
*
|
|
540
|
-
* @param {string}
|
|
541
|
-
* @param {string} file - Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file).
|
|
542
|
-
* @param {string} fileId - File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
543
|
-
* @param {string[]} permissions - An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
491
|
+
* @param {string} id -
|
|
544
492
|
* @throws {RevenexxException}
|
|
545
|
-
* @returns {Promise<
|
|
493
|
+
* @returns {Promise<{}>}
|
|
546
494
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
547
495
|
*/
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
paramsOrFirst: {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
let params: { bucketId: string, file: string, fileId: string, permissions?: string[] };
|
|
554
|
-
let onProgress: ((progress: UploadProgress) => void);
|
|
496
|
+
assetPermanent(id: string): Promise<{}>;
|
|
497
|
+
assetPermanent(
|
|
498
|
+
paramsOrFirst: { id: string } | string
|
|
499
|
+
): Promise<{}> {
|
|
500
|
+
let params: { id: string };
|
|
555
501
|
|
|
556
502
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
557
|
-
params = (paramsOrFirst || {}) as {
|
|
558
|
-
onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void);
|
|
503
|
+
params = (paramsOrFirst || {}) as { id: string };
|
|
559
504
|
} else {
|
|
560
505
|
params = {
|
|
561
|
-
|
|
562
|
-
file: rest[0] as string,
|
|
563
|
-
fileId: rest[1] as string,
|
|
564
|
-
permissions: rest[2] as string[]
|
|
506
|
+
id: paramsOrFirst as string
|
|
565
507
|
};
|
|
566
|
-
onProgress = rest[3] as ((progress: UploadProgress) => void);
|
|
567
508
|
}
|
|
568
509
|
|
|
569
|
-
const
|
|
570
|
-
const file = params.file;
|
|
571
|
-
const fileId = params.fileId;
|
|
572
|
-
const permissions = params.permissions;
|
|
510
|
+
const id = params.id;
|
|
573
511
|
|
|
574
|
-
if (typeof
|
|
575
|
-
throw new RevenexxException('Missing required parameter: "
|
|
512
|
+
if (typeof id === 'undefined') {
|
|
513
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
576
514
|
}
|
|
577
|
-
|
|
578
|
-
|
|
515
|
+
|
|
516
|
+
const apiPath = '/v1/storage/assets/{id}/permanent'.replace('{id}', id);
|
|
517
|
+
const apiPayload: Payload = {};
|
|
518
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
519
|
+
|
|
520
|
+
const apiHeaders: { [header: string]: string } = {
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
return this.client.call(
|
|
524
|
+
'delete',
|
|
525
|
+
uri,
|
|
526
|
+
apiHeaders,
|
|
527
|
+
apiPayload
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
*
|
|
533
|
+
* @param {string} params.id -
|
|
534
|
+
* @throws {RevenexxException}
|
|
535
|
+
* @returns {Promise<{}>}
|
|
536
|
+
*/
|
|
537
|
+
assetReprocess(params: { id: string }): Promise<{}>;
|
|
538
|
+
/**
|
|
539
|
+
*
|
|
540
|
+
* @param {string} id -
|
|
541
|
+
* @throws {RevenexxException}
|
|
542
|
+
* @returns {Promise<{}>}
|
|
543
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
544
|
+
*/
|
|
545
|
+
assetReprocess(id: string): Promise<{}>;
|
|
546
|
+
assetReprocess(
|
|
547
|
+
paramsOrFirst: { id: string } | string
|
|
548
|
+
): Promise<{}> {
|
|
549
|
+
let params: { id: string };
|
|
550
|
+
|
|
551
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
552
|
+
params = (paramsOrFirst || {}) as { id: string };
|
|
553
|
+
} else {
|
|
554
|
+
params = {
|
|
555
|
+
id: paramsOrFirst as string
|
|
556
|
+
};
|
|
579
557
|
}
|
|
580
|
-
|
|
581
|
-
|
|
558
|
+
|
|
559
|
+
const id = params.id;
|
|
560
|
+
|
|
561
|
+
if (typeof id === 'undefined') {
|
|
562
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
582
563
|
}
|
|
583
564
|
|
|
584
|
-
const apiPath = '/v1/storage/
|
|
585
|
-
const
|
|
586
|
-
|
|
587
|
-
|
|
565
|
+
const apiPath = '/v1/storage/assets/{id}/reprocess'.replace('{id}', id);
|
|
566
|
+
const apiPayload: Payload = {};
|
|
567
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
568
|
+
|
|
569
|
+
const apiHeaders: { [header: string]: string } = {
|
|
588
570
|
}
|
|
589
|
-
|
|
590
|
-
|
|
571
|
+
|
|
572
|
+
return this.client.call(
|
|
573
|
+
'post',
|
|
574
|
+
uri,
|
|
575
|
+
apiHeaders,
|
|
576
|
+
apiPayload
|
|
577
|
+
);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
*
|
|
582
|
+
* @param {string} params.id -
|
|
583
|
+
* @throws {RevenexxException}
|
|
584
|
+
* @returns {Promise<{}>}
|
|
585
|
+
*/
|
|
586
|
+
assetRestore(params: { id: string }): Promise<{}>;
|
|
587
|
+
/**
|
|
588
|
+
*
|
|
589
|
+
* @param {string} id -
|
|
590
|
+
* @throws {RevenexxException}
|
|
591
|
+
* @returns {Promise<{}>}
|
|
592
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
593
|
+
*/
|
|
594
|
+
assetRestore(id: string): Promise<{}>;
|
|
595
|
+
assetRestore(
|
|
596
|
+
paramsOrFirst: { id: string } | string
|
|
597
|
+
): Promise<{}> {
|
|
598
|
+
let params: { id: string };
|
|
599
|
+
|
|
600
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
601
|
+
params = (paramsOrFirst || {}) as { id: string };
|
|
602
|
+
} else {
|
|
603
|
+
params = {
|
|
604
|
+
id: paramsOrFirst as string
|
|
605
|
+
};
|
|
591
606
|
}
|
|
592
|
-
|
|
593
|
-
|
|
607
|
+
|
|
608
|
+
const id = params.id;
|
|
609
|
+
|
|
610
|
+
if (typeof id === 'undefined') {
|
|
611
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
594
612
|
}
|
|
613
|
+
|
|
614
|
+
const apiPath = '/v1/storage/assets/{id}/restore'.replace('{id}', id);
|
|
615
|
+
const apiPayload: Payload = {};
|
|
595
616
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
596
617
|
|
|
597
618
|
const apiHeaders: { [header: string]: string } = {
|
|
598
|
-
'content-type': 'multipart/form-data',
|
|
599
619
|
}
|
|
600
620
|
|
|
601
|
-
return this.client.
|
|
621
|
+
return this.client.call(
|
|
602
622
|
'post',
|
|
603
623
|
uri,
|
|
604
624
|
apiHeaders,
|
|
605
|
-
|
|
606
|
-
onProgress
|
|
625
|
+
apiPayload
|
|
607
626
|
);
|
|
608
627
|
}
|
|
609
628
|
|
|
610
629
|
/**
|
|
611
|
-
* Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
|
|
612
630
|
*
|
|
613
|
-
* @param {string} params.
|
|
614
|
-
* @param {
|
|
631
|
+
* @param {string} params.id -
|
|
632
|
+
* @param {number} params.ttlSeconds -
|
|
615
633
|
* @throws {RevenexxException}
|
|
616
634
|
* @returns {Promise<{}>}
|
|
617
635
|
*/
|
|
618
|
-
|
|
636
|
+
assetSign(params: { id: string, ttlSeconds?: number }): Promise<{}>;
|
|
619
637
|
/**
|
|
620
|
-
* Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
|
|
621
638
|
*
|
|
622
|
-
* @param {string}
|
|
623
|
-
* @param {
|
|
639
|
+
* @param {string} id -
|
|
640
|
+
* @param {number} ttlSeconds -
|
|
624
641
|
* @throws {RevenexxException}
|
|
625
642
|
* @returns {Promise<{}>}
|
|
626
643
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
627
644
|
*/
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
paramsOrFirst: {
|
|
631
|
-
...rest: [(
|
|
645
|
+
assetSign(id: string, ttlSeconds?: number): Promise<{}>;
|
|
646
|
+
assetSign(
|
|
647
|
+
paramsOrFirst: { id: string, ttlSeconds?: number } | string,
|
|
648
|
+
...rest: [(number)?]
|
|
632
649
|
): Promise<{}> {
|
|
633
|
-
let params: {
|
|
650
|
+
let params: { id: string, ttlSeconds?: number };
|
|
634
651
|
|
|
635
652
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
636
|
-
params = (paramsOrFirst || {}) as {
|
|
653
|
+
params = (paramsOrFirst || {}) as { id: string, ttlSeconds?: number };
|
|
637
654
|
} else {
|
|
638
655
|
params = {
|
|
639
|
-
|
|
640
|
-
|
|
656
|
+
id: paramsOrFirst as string,
|
|
657
|
+
ttlSeconds: rest[0] as number
|
|
641
658
|
};
|
|
642
659
|
}
|
|
643
660
|
|
|
644
|
-
const
|
|
645
|
-
const
|
|
661
|
+
const id = params.id;
|
|
662
|
+
const ttlSeconds = params.ttlSeconds;
|
|
646
663
|
|
|
647
|
-
if (typeof
|
|
648
|
-
throw new RevenexxException('Missing required parameter: "
|
|
649
|
-
}
|
|
650
|
-
if (typeof fileId === 'undefined') {
|
|
651
|
-
throw new RevenexxException('Missing required parameter: "fileId"');
|
|
664
|
+
if (typeof id === 'undefined') {
|
|
665
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
652
666
|
}
|
|
653
667
|
|
|
654
|
-
const apiPath = '/v1/storage/
|
|
655
|
-
const
|
|
668
|
+
const apiPath = '/v1/storage/assets/{id}/sign'.replace('{id}', id);
|
|
669
|
+
const apiPayload: Payload = {};
|
|
670
|
+
if (typeof ttlSeconds !== 'undefined') {
|
|
671
|
+
apiPayload['ttl_seconds'] = ttlSeconds;
|
|
672
|
+
}
|
|
656
673
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
657
674
|
|
|
658
675
|
const apiHeaders: { [header: string]: string } = {
|
|
676
|
+
'content-type': 'application/json',
|
|
659
677
|
}
|
|
660
678
|
|
|
661
679
|
return this.client.call(
|
|
662
|
-
'
|
|
680
|
+
'post',
|
|
663
681
|
uri,
|
|
664
682
|
apiHeaders,
|
|
665
|
-
|
|
683
|
+
apiPayload
|
|
666
684
|
);
|
|
667
685
|
}
|
|
668
686
|
|
|
669
687
|
/**
|
|
670
|
-
* Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
|
|
671
688
|
*
|
|
672
|
-
* @param {string} params.
|
|
673
|
-
* @param {
|
|
689
|
+
* @param {string} params.id -
|
|
690
|
+
* @param {boolean} params.keepArchive -
|
|
691
|
+
* @param {string} params.targetFolderId -
|
|
674
692
|
* @throws {RevenexxException}
|
|
675
|
-
* @returns {Promise<
|
|
693
|
+
* @returns {Promise<{}>}
|
|
676
694
|
*/
|
|
677
|
-
|
|
695
|
+
assetUnpack(params: { id: string, keepArchive?: boolean, targetFolderId?: string }): Promise<{}>;
|
|
678
696
|
/**
|
|
679
|
-
* Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
|
|
680
697
|
*
|
|
681
|
-
* @param {string}
|
|
682
|
-
* @param {
|
|
698
|
+
* @param {string} id -
|
|
699
|
+
* @param {boolean} keepArchive -
|
|
700
|
+
* @param {string} targetFolderId -
|
|
683
701
|
* @throws {RevenexxException}
|
|
684
|
-
* @returns {Promise<
|
|
702
|
+
* @returns {Promise<{}>}
|
|
685
703
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
686
704
|
*/
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
paramsOrFirst: {
|
|
690
|
-
...rest: [(string)?]
|
|
691
|
-
): Promise<
|
|
692
|
-
let params: {
|
|
705
|
+
assetUnpack(id: string, keepArchive?: boolean, targetFolderId?: string): Promise<{}>;
|
|
706
|
+
assetUnpack(
|
|
707
|
+
paramsOrFirst: { id: string, keepArchive?: boolean, targetFolderId?: string } | string,
|
|
708
|
+
...rest: [(boolean)?, (string)?]
|
|
709
|
+
): Promise<{}> {
|
|
710
|
+
let params: { id: string, keepArchive?: boolean, targetFolderId?: string };
|
|
693
711
|
|
|
694
712
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
695
|
-
params = (paramsOrFirst || {}) as {
|
|
713
|
+
params = (paramsOrFirst || {}) as { id: string, keepArchive?: boolean, targetFolderId?: string };
|
|
696
714
|
} else {
|
|
697
715
|
params = {
|
|
698
|
-
|
|
699
|
-
|
|
716
|
+
id: paramsOrFirst as string,
|
|
717
|
+
keepArchive: rest[0] as boolean,
|
|
718
|
+
targetFolderId: rest[1] as string
|
|
700
719
|
};
|
|
701
720
|
}
|
|
702
721
|
|
|
703
|
-
const
|
|
704
|
-
const
|
|
722
|
+
const id = params.id;
|
|
723
|
+
const keepArchive = params.keepArchive;
|
|
724
|
+
const targetFolderId = params.targetFolderId;
|
|
725
|
+
|
|
726
|
+
if (typeof id === 'undefined') {
|
|
727
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
728
|
+
}
|
|
705
729
|
|
|
706
|
-
|
|
707
|
-
|
|
730
|
+
const apiPath = '/v1/storage/assets/{id}/unpack'.replace('{id}', id);
|
|
731
|
+
const apiPayload: Payload = {};
|
|
732
|
+
if (typeof keepArchive !== 'undefined') {
|
|
733
|
+
apiPayload['keep_archive'] = keepArchive;
|
|
708
734
|
}
|
|
709
|
-
if (typeof
|
|
710
|
-
|
|
735
|
+
if (typeof targetFolderId !== 'undefined') {
|
|
736
|
+
apiPayload['target_folder_id'] = targetFolderId;
|
|
711
737
|
}
|
|
738
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
739
|
+
|
|
740
|
+
const apiHeaders: { [header: string]: string } = {
|
|
741
|
+
'content-type': 'application/json',
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
return this.client.call(
|
|
745
|
+
'post',
|
|
746
|
+
uri,
|
|
747
|
+
apiHeaders,
|
|
748
|
+
apiPayload
|
|
749
|
+
);
|
|
750
|
+
}
|
|
712
751
|
|
|
713
|
-
|
|
714
|
-
|
|
752
|
+
/**
|
|
753
|
+
*
|
|
754
|
+
* @throws {RevenexxException}
|
|
755
|
+
* @returns {Promise<{}>}
|
|
756
|
+
*/
|
|
757
|
+
folderIndex(): Promise<{}> {
|
|
758
|
+
|
|
759
|
+
const apiPath = '/v1/storage/folders';
|
|
760
|
+
const apiPayload: Payload = {};
|
|
715
761
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
716
762
|
|
|
717
763
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -721,69 +767,56 @@ export class Storage {
|
|
|
721
767
|
'get',
|
|
722
768
|
uri,
|
|
723
769
|
apiHeaders,
|
|
724
|
-
|
|
770
|
+
apiPayload
|
|
725
771
|
);
|
|
726
772
|
}
|
|
727
773
|
|
|
728
774
|
/**
|
|
729
|
-
* Update a file by its unique ID. Only users with write permissions have access to update this resource.
|
|
730
775
|
*
|
|
731
|
-
* @param {string} params.
|
|
732
|
-
* @param {string} params.
|
|
733
|
-
* @param {string} params.name - File name.
|
|
734
|
-
* @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
776
|
+
* @param {string} params.name -
|
|
777
|
+
* @param {string} params.parentId -
|
|
735
778
|
* @throws {RevenexxException}
|
|
736
|
-
* @returns {Promise<
|
|
779
|
+
* @returns {Promise<{}>}
|
|
737
780
|
*/
|
|
738
|
-
|
|
781
|
+
folderStore(params: { name: string, parentId?: string }): Promise<{}>;
|
|
739
782
|
/**
|
|
740
|
-
* Update a file by its unique ID. Only users with write permissions have access to update this resource.
|
|
741
783
|
*
|
|
742
|
-
* @param {string}
|
|
743
|
-
* @param {string}
|
|
744
|
-
* @param {string} name - File name.
|
|
745
|
-
* @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
784
|
+
* @param {string} name -
|
|
785
|
+
* @param {string} parentId -
|
|
746
786
|
* @throws {RevenexxException}
|
|
747
|
-
* @returns {Promise<
|
|
787
|
+
* @returns {Promise<{}>}
|
|
748
788
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
749
789
|
*/
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
paramsOrFirst: {
|
|
753
|
-
...rest: [(string)
|
|
754
|
-
): Promise<
|
|
755
|
-
let params: {
|
|
790
|
+
folderStore(name: string, parentId?: string): Promise<{}>;
|
|
791
|
+
folderStore(
|
|
792
|
+
paramsOrFirst: { name: string, parentId?: string } | string,
|
|
793
|
+
...rest: [(string)?]
|
|
794
|
+
): Promise<{}> {
|
|
795
|
+
let params: { name: string, parentId?: string };
|
|
756
796
|
|
|
757
797
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
758
|
-
params = (paramsOrFirst || {}) as {
|
|
798
|
+
params = (paramsOrFirst || {}) as { name: string, parentId?: string };
|
|
759
799
|
} else {
|
|
760
800
|
params = {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
name: rest[1] as string,
|
|
764
|
-
permissions: rest[2] as string[]
|
|
801
|
+
name: paramsOrFirst as string,
|
|
802
|
+
parentId: rest[0] as string
|
|
765
803
|
};
|
|
766
804
|
}
|
|
767
805
|
|
|
768
|
-
const bucketId = params.bucketId;
|
|
769
|
-
const fileId = params.fileId;
|
|
770
806
|
const name = params.name;
|
|
771
|
-
const
|
|
807
|
+
const parentId = params.parentId;
|
|
772
808
|
|
|
773
|
-
if (typeof
|
|
774
|
-
throw new RevenexxException('Missing required parameter: "
|
|
775
|
-
}
|
|
776
|
-
if (typeof fileId === 'undefined') {
|
|
777
|
-
throw new RevenexxException('Missing required parameter: "fileId"');
|
|
809
|
+
if (typeof name === 'undefined') {
|
|
810
|
+
throw new RevenexxException('Missing required parameter: "name"');
|
|
778
811
|
}
|
|
779
812
|
|
|
780
|
-
const apiPath = '/v1/storage/
|
|
781
|
-
const
|
|
813
|
+
const apiPath = '/v1/storage/folders';
|
|
814
|
+
const apiPayload: Payload = {};
|
|
782
815
|
if (typeof name !== 'undefined') {
|
|
783
|
-
|
|
816
|
+
apiPayload['name'] = name;
|
|
784
817
|
}
|
|
785
|
-
if (typeof
|
|
786
|
-
|
|
818
|
+
if (typeof parentId !== 'undefined') {
|
|
819
|
+
apiPayload['parent_id'] = parentId;
|
|
787
820
|
}
|
|
788
821
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
789
822
|
|
|
@@ -792,66 +825,193 @@ export class Storage {
|
|
|
792
825
|
}
|
|
793
826
|
|
|
794
827
|
return this.client.call(
|
|
795
|
-
'
|
|
828
|
+
'post',
|
|
829
|
+
uri,
|
|
830
|
+
apiHeaders,
|
|
831
|
+
apiPayload
|
|
832
|
+
);
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
*
|
|
837
|
+
* @param {string} params.id -
|
|
838
|
+
* @param {boolean} params.recursive -
|
|
839
|
+
* @throws {RevenexxException}
|
|
840
|
+
* @returns {Promise<{}>}
|
|
841
|
+
*/
|
|
842
|
+
folderDestroy(params: { id: string, recursive?: boolean }): Promise<{}>;
|
|
843
|
+
/**
|
|
844
|
+
*
|
|
845
|
+
* @param {string} id -
|
|
846
|
+
* @param {boolean} recursive -
|
|
847
|
+
* @throws {RevenexxException}
|
|
848
|
+
* @returns {Promise<{}>}
|
|
849
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
850
|
+
*/
|
|
851
|
+
folderDestroy(id: string, recursive?: boolean): Promise<{}>;
|
|
852
|
+
folderDestroy(
|
|
853
|
+
paramsOrFirst: { id: string, recursive?: boolean } | string,
|
|
854
|
+
...rest: [(boolean)?]
|
|
855
|
+
): Promise<{}> {
|
|
856
|
+
let params: { id: string, recursive?: boolean };
|
|
857
|
+
|
|
858
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
859
|
+
params = (paramsOrFirst || {}) as { id: string, recursive?: boolean };
|
|
860
|
+
} else {
|
|
861
|
+
params = {
|
|
862
|
+
id: paramsOrFirst as string,
|
|
863
|
+
recursive: rest[0] as boolean
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
const id = params.id;
|
|
868
|
+
const recursive = params.recursive;
|
|
869
|
+
|
|
870
|
+
if (typeof id === 'undefined') {
|
|
871
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
const apiPath = '/v1/storage/folders/{id}'.replace('{id}', id);
|
|
875
|
+
const apiPayload: Payload = {};
|
|
876
|
+
if (typeof recursive !== 'undefined') {
|
|
877
|
+
apiPayload['recursive'] = recursive;
|
|
878
|
+
}
|
|
879
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
880
|
+
|
|
881
|
+
const apiHeaders: { [header: string]: string } = {
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
return this.client.call(
|
|
885
|
+
'delete',
|
|
796
886
|
uri,
|
|
797
887
|
apiHeaders,
|
|
798
|
-
|
|
888
|
+
apiPayload
|
|
799
889
|
);
|
|
800
890
|
}
|
|
801
891
|
|
|
802
892
|
/**
|
|
803
|
-
* Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.
|
|
804
893
|
*
|
|
805
|
-
* @param {string} params.
|
|
806
|
-
* @param {string} params.fileId - File ID.
|
|
807
|
-
* @param {string} params.token - File token for accessing this file.
|
|
894
|
+
* @param {string} params.id -
|
|
808
895
|
* @throws {RevenexxException}
|
|
809
896
|
* @returns {Promise<{}>}
|
|
810
897
|
*/
|
|
811
|
-
|
|
898
|
+
folderShow(params: { id: string }): Promise<{}>;
|
|
812
899
|
/**
|
|
813
|
-
* Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.
|
|
814
900
|
*
|
|
815
|
-
* @param {string}
|
|
816
|
-
* @param {string} fileId - File ID.
|
|
817
|
-
* @param {string} token - File token for accessing this file.
|
|
901
|
+
* @param {string} id -
|
|
818
902
|
* @throws {RevenexxException}
|
|
819
903
|
* @returns {Promise<{}>}
|
|
820
904
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
821
905
|
*/
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
paramsOrFirst: {
|
|
906
|
+
folderShow(id: string): Promise<{}>;
|
|
907
|
+
folderShow(
|
|
908
|
+
paramsOrFirst: { id: string } | string
|
|
909
|
+
): Promise<{}> {
|
|
910
|
+
let params: { id: string };
|
|
911
|
+
|
|
912
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
913
|
+
params = (paramsOrFirst || {}) as { id: string };
|
|
914
|
+
} else {
|
|
915
|
+
params = {
|
|
916
|
+
id: paramsOrFirst as string
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
const id = params.id;
|
|
921
|
+
|
|
922
|
+
if (typeof id === 'undefined') {
|
|
923
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
const apiPath = '/v1/storage/folders/{id}'.replace('{id}', id);
|
|
927
|
+
const apiPayload: Payload = {};
|
|
928
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
929
|
+
|
|
930
|
+
const apiHeaders: { [header: string]: string } = {
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
return this.client.call(
|
|
934
|
+
'get',
|
|
935
|
+
uri,
|
|
936
|
+
apiHeaders,
|
|
937
|
+
apiPayload
|
|
938
|
+
);
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
*
|
|
943
|
+
* @param {string} params.id -
|
|
944
|
+
* @param {string} params.name -
|
|
945
|
+
* @param {string} params.parentId -
|
|
946
|
+
* @throws {RevenexxException}
|
|
947
|
+
* @returns {Promise<{}>}
|
|
948
|
+
*/
|
|
949
|
+
folderUpdate(params: { id: string, name?: string, parentId?: string }): Promise<{}>;
|
|
950
|
+
/**
|
|
951
|
+
*
|
|
952
|
+
* @param {string} id -
|
|
953
|
+
* @param {string} name -
|
|
954
|
+
* @param {string} parentId -
|
|
955
|
+
* @throws {RevenexxException}
|
|
956
|
+
* @returns {Promise<{}>}
|
|
957
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
958
|
+
*/
|
|
959
|
+
folderUpdate(id: string, name?: string, parentId?: string): Promise<{}>;
|
|
960
|
+
folderUpdate(
|
|
961
|
+
paramsOrFirst: { id: string, name?: string, parentId?: string } | string,
|
|
825
962
|
...rest: [(string)?, (string)?]
|
|
826
963
|
): Promise<{}> {
|
|
827
|
-
let params: {
|
|
964
|
+
let params: { id: string, name?: string, parentId?: string };
|
|
828
965
|
|
|
829
966
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
830
|
-
params = (paramsOrFirst || {}) as {
|
|
967
|
+
params = (paramsOrFirst || {}) as { id: string, name?: string, parentId?: string };
|
|
831
968
|
} else {
|
|
832
969
|
params = {
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
970
|
+
id: paramsOrFirst as string,
|
|
971
|
+
name: rest[0] as string,
|
|
972
|
+
parentId: rest[1] as string
|
|
836
973
|
};
|
|
837
974
|
}
|
|
838
975
|
|
|
839
|
-
const
|
|
840
|
-
const
|
|
841
|
-
const
|
|
976
|
+
const id = params.id;
|
|
977
|
+
const name = params.name;
|
|
978
|
+
const parentId = params.parentId;
|
|
979
|
+
|
|
980
|
+
if (typeof id === 'undefined') {
|
|
981
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
982
|
+
}
|
|
842
983
|
|
|
843
|
-
|
|
844
|
-
|
|
984
|
+
const apiPath = '/v1/storage/folders/{id}'.replace('{id}', id);
|
|
985
|
+
const apiPayload: Payload = {};
|
|
986
|
+
if (typeof name !== 'undefined') {
|
|
987
|
+
apiPayload['name'] = name;
|
|
845
988
|
}
|
|
846
|
-
if (typeof
|
|
847
|
-
|
|
989
|
+
if (typeof parentId !== 'undefined') {
|
|
990
|
+
apiPayload['parent_id'] = parentId;
|
|
848
991
|
}
|
|
992
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
849
993
|
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
if (typeof token !== 'undefined') {
|
|
853
|
-
payload['token'] = token;
|
|
994
|
+
const apiHeaders: { [header: string]: string } = {
|
|
995
|
+
'content-type': 'application/json',
|
|
854
996
|
}
|
|
997
|
+
|
|
998
|
+
return this.client.call(
|
|
999
|
+
'patch',
|
|
1000
|
+
uri,
|
|
1001
|
+
apiHeaders,
|
|
1002
|
+
apiPayload
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
*
|
|
1008
|
+
* @throws {RevenexxException}
|
|
1009
|
+
* @returns {Promise<{}>}
|
|
1010
|
+
*/
|
|
1011
|
+
syncRuleIndex(): Promise<{}> {
|
|
1012
|
+
|
|
1013
|
+
const apiPath = '/v1/storage/sftp/rules';
|
|
1014
|
+
const apiPayload: Payload = {};
|
|
855
1015
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
856
1016
|
|
|
857
1017
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -861,140 +1021,272 @@ export class Storage {
|
|
|
861
1021
|
'get',
|
|
862
1022
|
uri,
|
|
863
1023
|
apiHeaders,
|
|
864
|
-
|
|
1024
|
+
apiPayload
|
|
1025
|
+
);
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
*
|
|
1030
|
+
* @throws {RevenexxException}
|
|
1031
|
+
* @returns {Promise<{}>}
|
|
1032
|
+
*/
|
|
1033
|
+
syncRuleStore(): Promise<{}> {
|
|
1034
|
+
|
|
1035
|
+
const apiPath = '/v1/storage/sftp/rules';
|
|
1036
|
+
const apiPayload: Payload = {};
|
|
1037
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1038
|
+
|
|
1039
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
return this.client.call(
|
|
1043
|
+
'post',
|
|
1044
|
+
uri,
|
|
1045
|
+
apiHeaders,
|
|
1046
|
+
apiPayload
|
|
865
1047
|
);
|
|
866
1048
|
}
|
|
867
1049
|
|
|
868
1050
|
/**
|
|
869
|
-
* Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.
|
|
870
1051
|
*
|
|
871
|
-
* @param {string} params.
|
|
872
|
-
* @param {string} params.fileId - File ID
|
|
873
|
-
* @param {number} params.width - Resize preview image width, Pass an integer between 0 to 4000.
|
|
874
|
-
* @param {number} params.height - Resize preview image height, Pass an integer between 0 to 4000.
|
|
875
|
-
* @param {Gravity} params.gravity - Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
|
|
876
|
-
* @param {number} params.quality - Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
|
|
877
|
-
* @param {number} params.borderWidth - Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.
|
|
878
|
-
* @param {string} params.borderColor - Preview image border color. Use a valid HEX color, no # is needed for prefix.
|
|
879
|
-
* @param {number} params.borderRadius - Preview image border radius in pixels. Pass an integer between 0 to 4000.
|
|
880
|
-
* @param {number} params.opacity - Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.
|
|
881
|
-
* @param {number} params.rotation - Preview image rotation in degrees. Pass an integer between -360 and 360.
|
|
882
|
-
* @param {string} params.background - Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.
|
|
883
|
-
* @param {Output} params.output - Output format type (jpeg, jpg, png, gif and webp).
|
|
884
|
-
* @param {string} params.token - File token for accessing this file.
|
|
1052
|
+
* @param {string} params.id -
|
|
885
1053
|
* @throws {RevenexxException}
|
|
886
1054
|
* @returns {Promise<{}>}
|
|
887
1055
|
*/
|
|
888
|
-
|
|
1056
|
+
syncRuleDestroy(params: { id: string }): Promise<{}>;
|
|
889
1057
|
/**
|
|
890
|
-
* Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.
|
|
891
1058
|
*
|
|
892
|
-
* @param {string}
|
|
893
|
-
* @param {string} fileId - File ID
|
|
894
|
-
* @param {number} width - Resize preview image width, Pass an integer between 0 to 4000.
|
|
895
|
-
* @param {number} height - Resize preview image height, Pass an integer between 0 to 4000.
|
|
896
|
-
* @param {Gravity} gravity - Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
|
|
897
|
-
* @param {number} quality - Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
|
|
898
|
-
* @param {number} borderWidth - Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.
|
|
899
|
-
* @param {string} borderColor - Preview image border color. Use a valid HEX color, no # is needed for prefix.
|
|
900
|
-
* @param {number} borderRadius - Preview image border radius in pixels. Pass an integer between 0 to 4000.
|
|
901
|
-
* @param {number} opacity - Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.
|
|
902
|
-
* @param {number} rotation - Preview image rotation in degrees. Pass an integer between -360 and 360.
|
|
903
|
-
* @param {string} background - Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.
|
|
904
|
-
* @param {Output} output - Output format type (jpeg, jpg, png, gif and webp).
|
|
905
|
-
* @param {string} token - File token for accessing this file.
|
|
1059
|
+
* @param {string} id -
|
|
906
1060
|
* @throws {RevenexxException}
|
|
907
1061
|
* @returns {Promise<{}>}
|
|
908
1062
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
909
1063
|
*/
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
paramsOrFirst: {
|
|
913
|
-
...rest: [(string)?, (number)?, (number)?, (Gravity)?, (number)?, (number)?, (string)?, (number)?, (number)?, (number)?, (string)?, (Output)?, (string)?]
|
|
1064
|
+
syncRuleDestroy(id: string): Promise<{}>;
|
|
1065
|
+
syncRuleDestroy(
|
|
1066
|
+
paramsOrFirst: { id: string } | string
|
|
914
1067
|
): Promise<{}> {
|
|
915
|
-
let params: {
|
|
1068
|
+
let params: { id: string };
|
|
916
1069
|
|
|
917
1070
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
918
|
-
params = (paramsOrFirst || {}) as {
|
|
1071
|
+
params = (paramsOrFirst || {}) as { id: string };
|
|
919
1072
|
} else {
|
|
920
1073
|
params = {
|
|
921
|
-
|
|
922
|
-
fileId: rest[0] as string,
|
|
923
|
-
width: rest[1] as number,
|
|
924
|
-
height: rest[2] as number,
|
|
925
|
-
gravity: rest[3] as Gravity,
|
|
926
|
-
quality: rest[4] as number,
|
|
927
|
-
borderWidth: rest[5] as number,
|
|
928
|
-
borderColor: rest[6] as string,
|
|
929
|
-
borderRadius: rest[7] as number,
|
|
930
|
-
opacity: rest[8] as number,
|
|
931
|
-
rotation: rest[9] as number,
|
|
932
|
-
background: rest[10] as string,
|
|
933
|
-
output: rest[11] as Output,
|
|
934
|
-
token: rest[12] as string
|
|
1074
|
+
id: paramsOrFirst as string
|
|
935
1075
|
};
|
|
936
1076
|
}
|
|
937
1077
|
|
|
938
|
-
const
|
|
939
|
-
const fileId = params.fileId;
|
|
940
|
-
const width = params.width;
|
|
941
|
-
const height = params.height;
|
|
942
|
-
const gravity = params.gravity;
|
|
943
|
-
const quality = params.quality;
|
|
944
|
-
const borderWidth = params.borderWidth;
|
|
945
|
-
const borderColor = params.borderColor;
|
|
946
|
-
const borderRadius = params.borderRadius;
|
|
947
|
-
const opacity = params.opacity;
|
|
948
|
-
const rotation = params.rotation;
|
|
949
|
-
const background = params.background;
|
|
950
|
-
const output = params.output;
|
|
951
|
-
const token = params.token;
|
|
1078
|
+
const id = params.id;
|
|
952
1079
|
|
|
953
|
-
if (typeof
|
|
954
|
-
throw new RevenexxException('Missing required parameter: "
|
|
1080
|
+
if (typeof id === 'undefined') {
|
|
1081
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
955
1082
|
}
|
|
956
|
-
|
|
957
|
-
|
|
1083
|
+
|
|
1084
|
+
const apiPath = '/v1/storage/sftp/rules/{id}'.replace('{id}', id);
|
|
1085
|
+
const apiPayload: Payload = {};
|
|
1086
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1087
|
+
|
|
1088
|
+
const apiHeaders: { [header: string]: string } = {
|
|
958
1089
|
}
|
|
959
1090
|
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
1091
|
+
return this.client.call(
|
|
1092
|
+
'delete',
|
|
1093
|
+
uri,
|
|
1094
|
+
apiHeaders,
|
|
1095
|
+
apiPayload
|
|
1096
|
+
);
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
*
|
|
1101
|
+
* @param {string} params.id -
|
|
1102
|
+
* @throws {RevenexxException}
|
|
1103
|
+
* @returns {Promise<{}>}
|
|
1104
|
+
*/
|
|
1105
|
+
syncRuleShow(params: { id: string }): Promise<{}>;
|
|
1106
|
+
/**
|
|
1107
|
+
*
|
|
1108
|
+
* @param {string} id -
|
|
1109
|
+
* @throws {RevenexxException}
|
|
1110
|
+
* @returns {Promise<{}>}
|
|
1111
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1112
|
+
*/
|
|
1113
|
+
syncRuleShow(id: string): Promise<{}>;
|
|
1114
|
+
syncRuleShow(
|
|
1115
|
+
paramsOrFirst: { id: string } | string
|
|
1116
|
+
): Promise<{}> {
|
|
1117
|
+
let params: { id: string };
|
|
1118
|
+
|
|
1119
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1120
|
+
params = (paramsOrFirst || {}) as { id: string };
|
|
1121
|
+
} else {
|
|
1122
|
+
params = {
|
|
1123
|
+
id: paramsOrFirst as string
|
|
1124
|
+
};
|
|
964
1125
|
}
|
|
965
|
-
|
|
966
|
-
|
|
1126
|
+
|
|
1127
|
+
const id = params.id;
|
|
1128
|
+
|
|
1129
|
+
if (typeof id === 'undefined') {
|
|
1130
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
967
1131
|
}
|
|
968
|
-
|
|
969
|
-
|
|
1132
|
+
|
|
1133
|
+
const apiPath = '/v1/storage/sftp/rules/{id}'.replace('{id}', id);
|
|
1134
|
+
const apiPayload: Payload = {};
|
|
1135
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1136
|
+
|
|
1137
|
+
const apiHeaders: { [header: string]: string } = {
|
|
970
1138
|
}
|
|
971
|
-
|
|
972
|
-
|
|
1139
|
+
|
|
1140
|
+
return this.client.call(
|
|
1141
|
+
'get',
|
|
1142
|
+
uri,
|
|
1143
|
+
apiHeaders,
|
|
1144
|
+
apiPayload
|
|
1145
|
+
);
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
*
|
|
1150
|
+
* @param {string} params.id -
|
|
1151
|
+
* @throws {RevenexxException}
|
|
1152
|
+
* @returns {Promise<{}>}
|
|
1153
|
+
*/
|
|
1154
|
+
syncRuleUpdate(params: { id: string }): Promise<{}>;
|
|
1155
|
+
/**
|
|
1156
|
+
*
|
|
1157
|
+
* @param {string} id -
|
|
1158
|
+
* @throws {RevenexxException}
|
|
1159
|
+
* @returns {Promise<{}>}
|
|
1160
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1161
|
+
*/
|
|
1162
|
+
syncRuleUpdate(id: string): Promise<{}>;
|
|
1163
|
+
syncRuleUpdate(
|
|
1164
|
+
paramsOrFirst: { id: string } | string
|
|
1165
|
+
): Promise<{}> {
|
|
1166
|
+
let params: { id: string };
|
|
1167
|
+
|
|
1168
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1169
|
+
params = (paramsOrFirst || {}) as { id: string };
|
|
1170
|
+
} else {
|
|
1171
|
+
params = {
|
|
1172
|
+
id: paramsOrFirst as string
|
|
1173
|
+
};
|
|
973
1174
|
}
|
|
974
|
-
|
|
975
|
-
|
|
1175
|
+
|
|
1176
|
+
const id = params.id;
|
|
1177
|
+
|
|
1178
|
+
if (typeof id === 'undefined') {
|
|
1179
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
976
1180
|
}
|
|
977
|
-
|
|
978
|
-
|
|
1181
|
+
|
|
1182
|
+
const apiPath = '/v1/storage/sftp/rules/{id}'.replace('{id}', id);
|
|
1183
|
+
const apiPayload: Payload = {};
|
|
1184
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1185
|
+
|
|
1186
|
+
const apiHeaders: { [header: string]: string } = {
|
|
979
1187
|
}
|
|
980
|
-
|
|
981
|
-
|
|
1188
|
+
|
|
1189
|
+
return this.client.call(
|
|
1190
|
+
'patch',
|
|
1191
|
+
uri,
|
|
1192
|
+
apiHeaders,
|
|
1193
|
+
apiPayload
|
|
1194
|
+
);
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
*
|
|
1199
|
+
* @param {string} params.id -
|
|
1200
|
+
* @throws {RevenexxException}
|
|
1201
|
+
* @returns {Promise<{}>}
|
|
1202
|
+
*/
|
|
1203
|
+
syncRuleRun(params: { id: string }): Promise<{}>;
|
|
1204
|
+
/**
|
|
1205
|
+
*
|
|
1206
|
+
* @param {string} id -
|
|
1207
|
+
* @throws {RevenexxException}
|
|
1208
|
+
* @returns {Promise<{}>}
|
|
1209
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1210
|
+
*/
|
|
1211
|
+
syncRuleRun(id: string): Promise<{}>;
|
|
1212
|
+
syncRuleRun(
|
|
1213
|
+
paramsOrFirst: { id: string } | string
|
|
1214
|
+
): Promise<{}> {
|
|
1215
|
+
let params: { id: string };
|
|
1216
|
+
|
|
1217
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1218
|
+
params = (paramsOrFirst || {}) as { id: string };
|
|
1219
|
+
} else {
|
|
1220
|
+
params = {
|
|
1221
|
+
id: paramsOrFirst as string
|
|
1222
|
+
};
|
|
982
1223
|
}
|
|
983
|
-
|
|
984
|
-
|
|
1224
|
+
|
|
1225
|
+
const id = params.id;
|
|
1226
|
+
|
|
1227
|
+
if (typeof id === 'undefined') {
|
|
1228
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
985
1229
|
}
|
|
986
|
-
|
|
987
|
-
|
|
1230
|
+
|
|
1231
|
+
const apiPath = '/v1/storage/sftp/rules/{id}/run'.replace('{id}', id);
|
|
1232
|
+
const apiPayload: Payload = {};
|
|
1233
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1234
|
+
|
|
1235
|
+
const apiHeaders: { [header: string]: string } = {
|
|
988
1236
|
}
|
|
989
|
-
|
|
990
|
-
|
|
1237
|
+
|
|
1238
|
+
return this.client.call(
|
|
1239
|
+
'post',
|
|
1240
|
+
uri,
|
|
1241
|
+
apiHeaders,
|
|
1242
|
+
apiPayload
|
|
1243
|
+
);
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
/**
|
|
1247
|
+
*
|
|
1248
|
+
* @param {string} params.id -
|
|
1249
|
+
* @param {string} params.runId -
|
|
1250
|
+
* @throws {RevenexxException}
|
|
1251
|
+
* @returns {Promise<{}>}
|
|
1252
|
+
*/
|
|
1253
|
+
syncRuleRunProtocol(params: { id: string, runId: string }): Promise<{}>;
|
|
1254
|
+
/**
|
|
1255
|
+
*
|
|
1256
|
+
* @param {string} id -
|
|
1257
|
+
* @param {string} runId -
|
|
1258
|
+
* @throws {RevenexxException}
|
|
1259
|
+
* @returns {Promise<{}>}
|
|
1260
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1261
|
+
*/
|
|
1262
|
+
syncRuleRunProtocol(id: string, runId: string): Promise<{}>;
|
|
1263
|
+
syncRuleRunProtocol(
|
|
1264
|
+
paramsOrFirst: { id: string, runId: string } | string,
|
|
1265
|
+
...rest: [(string)?]
|
|
1266
|
+
): Promise<{}> {
|
|
1267
|
+
let params: { id: string, runId: string };
|
|
1268
|
+
|
|
1269
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1270
|
+
params = (paramsOrFirst || {}) as { id: string, runId: string };
|
|
1271
|
+
} else {
|
|
1272
|
+
params = {
|
|
1273
|
+
id: paramsOrFirst as string,
|
|
1274
|
+
runId: rest[0] as string
|
|
1275
|
+
};
|
|
991
1276
|
}
|
|
992
|
-
|
|
993
|
-
|
|
1277
|
+
|
|
1278
|
+
const id = params.id;
|
|
1279
|
+
const runId = params.runId;
|
|
1280
|
+
|
|
1281
|
+
if (typeof id === 'undefined') {
|
|
1282
|
+
throw new RevenexxException('Missing required parameter: "id"');
|
|
994
1283
|
}
|
|
995
|
-
if (typeof
|
|
996
|
-
|
|
1284
|
+
if (typeof runId === 'undefined') {
|
|
1285
|
+
throw new RevenexxException('Missing required parameter: "runId"');
|
|
997
1286
|
}
|
|
1287
|
+
|
|
1288
|
+
const apiPath = '/v1/storage/sftp/rules/{id}/runs/{runId}'.replace('{id}', id).replace('{runId}', runId);
|
|
1289
|
+
const apiPayload: Payload = {};
|
|
998
1290
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
999
1291
|
|
|
1000
1292
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -1004,63 +1296,105 @@ export class Storage {
|
|
|
1004
1296
|
'get',
|
|
1005
1297
|
uri,
|
|
1006
1298
|
apiHeaders,
|
|
1007
|
-
|
|
1299
|
+
apiPayload
|
|
1008
1300
|
);
|
|
1009
1301
|
}
|
|
1010
1302
|
|
|
1011
1303
|
/**
|
|
1012
|
-
* Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.
|
|
1013
1304
|
*
|
|
1014
|
-
* @param {string} params.
|
|
1015
|
-
* @param {string} params.
|
|
1016
|
-
* @param {string} params.
|
|
1305
|
+
* @param {string} params.ruleId -
|
|
1306
|
+
* @param {string} params.from -
|
|
1307
|
+
* @param {string} params.to -
|
|
1017
1308
|
* @throws {RevenexxException}
|
|
1018
1309
|
* @returns {Promise<{}>}
|
|
1019
1310
|
*/
|
|
1020
|
-
|
|
1311
|
+
syncRuleHistory(params?: { ruleId?: string, from?: string, to?: string }): Promise<{}>;
|
|
1021
1312
|
/**
|
|
1022
|
-
* Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.
|
|
1023
1313
|
*
|
|
1024
|
-
* @param {string}
|
|
1025
|
-
* @param {string}
|
|
1026
|
-
* @param {string}
|
|
1314
|
+
* @param {string} ruleId -
|
|
1315
|
+
* @param {string} from -
|
|
1316
|
+
* @param {string} to -
|
|
1027
1317
|
* @throws {RevenexxException}
|
|
1028
1318
|
* @returns {Promise<{}>}
|
|
1029
1319
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1030
1320
|
*/
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
paramsOrFirst
|
|
1321
|
+
syncRuleHistory(ruleId?: string, from?: string, to?: string): Promise<{}>;
|
|
1322
|
+
syncRuleHistory(
|
|
1323
|
+
paramsOrFirst?: { ruleId?: string, from?: string, to?: string } | string,
|
|
1034
1324
|
...rest: [(string)?, (string)?]
|
|
1035
1325
|
): Promise<{}> {
|
|
1036
|
-
let params: {
|
|
1326
|
+
let params: { ruleId?: string, from?: string, to?: string };
|
|
1037
1327
|
|
|
1038
|
-
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1039
|
-
params = (paramsOrFirst || {}) as {
|
|
1328
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1329
|
+
params = (paramsOrFirst || {}) as { ruleId?: string, from?: string, to?: string };
|
|
1040
1330
|
} else {
|
|
1041
1331
|
params = {
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1332
|
+
ruleId: paramsOrFirst as string,
|
|
1333
|
+
from: rest[0] as string,
|
|
1334
|
+
to: rest[1] as string
|
|
1045
1335
|
};
|
|
1046
1336
|
}
|
|
1047
1337
|
|
|
1048
|
-
const
|
|
1049
|
-
const
|
|
1050
|
-
const
|
|
1338
|
+
const ruleId = params.ruleId;
|
|
1339
|
+
const from = params.from;
|
|
1340
|
+
const to = params.to;
|
|
1341
|
+
|
|
1051
1342
|
|
|
1052
|
-
|
|
1053
|
-
|
|
1343
|
+
const apiPath = '/v1/storage/sftp/sync-history';
|
|
1344
|
+
const apiPayload: Payload = {};
|
|
1345
|
+
if (typeof ruleId !== 'undefined') {
|
|
1346
|
+
apiPayload['rule_id'] = ruleId;
|
|
1054
1347
|
}
|
|
1055
|
-
if (typeof
|
|
1056
|
-
|
|
1348
|
+
if (typeof from !== 'undefined') {
|
|
1349
|
+
apiPayload['from'] = from;
|
|
1057
1350
|
}
|
|
1351
|
+
if (typeof to !== 'undefined') {
|
|
1352
|
+
apiPayload['to'] = to;
|
|
1353
|
+
}
|
|
1354
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1058
1355
|
|
|
1059
|
-
const
|
|
1060
|
-
const payload: Payload = {};
|
|
1061
|
-
if (typeof token !== 'undefined') {
|
|
1062
|
-
payload['token'] = token;
|
|
1356
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1063
1357
|
}
|
|
1358
|
+
|
|
1359
|
+
return this.client.call(
|
|
1360
|
+
'get',
|
|
1361
|
+
uri,
|
|
1362
|
+
apiHeaders,
|
|
1363
|
+
apiPayload
|
|
1364
|
+
);
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
/**
|
|
1368
|
+
*
|
|
1369
|
+
* @throws {RevenexxException}
|
|
1370
|
+
* @returns {Promise<{}>}
|
|
1371
|
+
*/
|
|
1372
|
+
tenantStats(): Promise<{}> {
|
|
1373
|
+
|
|
1374
|
+
const apiPath = '/v1/storage/tenant/stats';
|
|
1375
|
+
const apiPayload: Payload = {};
|
|
1376
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1377
|
+
|
|
1378
|
+
const apiHeaders: { [header: string]: string } = {
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
return this.client.call(
|
|
1382
|
+
'get',
|
|
1383
|
+
uri,
|
|
1384
|
+
apiHeaders,
|
|
1385
|
+
apiPayload
|
|
1386
|
+
);
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
/**
|
|
1390
|
+
*
|
|
1391
|
+
* @throws {RevenexxException}
|
|
1392
|
+
* @returns {Promise<{}>}
|
|
1393
|
+
*/
|
|
1394
|
+
tenantUsage(): Promise<{}> {
|
|
1395
|
+
|
|
1396
|
+
const apiPath = '/v1/storage/tenant/usage';
|
|
1397
|
+
const apiPayload: Payload = {};
|
|
1064
1398
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1065
1399
|
|
|
1066
1400
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -1070,7 +1404,7 @@ export class Storage {
|
|
|
1070
1404
|
'get',
|
|
1071
1405
|
uri,
|
|
1072
1406
|
apiHeaders,
|
|
1073
|
-
|
|
1407
|
+
apiPayload
|
|
1074
1408
|
);
|
|
1075
1409
|
}
|
|
1076
1410
|
}
|