@leonardo-ai/sdk 4.0.1 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.speakeasy/gen.lock +7 -5
- package/README.md +5 -6
- package/docs/sdks/dataset/README.md +6 -6
- package/docs/sdks/generation/README.md +6 -7
- package/docs/sdks/initimage/README.md +2 -2
- package/docs/sdks/model/README.md +6 -7
- package/docs/sdks/variation/README.md +3 -3
- package/hooks/hooks.d.ts +21 -0
- package/hooks/hooks.d.ts.map +1 -0
- package/hooks/hooks.js +57 -0
- package/hooks/hooks.js.map +1 -0
- package/hooks/index.d.ts +3 -0
- package/hooks/index.d.ts.map +1 -0
- package/hooks/index.js +22 -0
- package/hooks/index.js.map +1 -0
- package/hooks/registration.d.ts +3 -0
- package/hooks/registration.d.ts.map +1 -0
- package/hooks/registration.js +16 -0
- package/hooks/registration.js.map +1 -0
- package/hooks/types.d.ts +53 -0
- package/hooks/types.d.ts.map +1 -0
- package/hooks/types.js +6 -0
- package/hooks/types.js.map +1 -0
- package/lib/config.d.ts +3 -3
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +3 -3
- package/lib/config.js.map +1 -1
- package/lib/retries.js +22 -1
- package/lib/retries.js.map +1 -1
- package/lib/sdks.d.ts +9 -1
- package/lib/sdks.d.ts.map +1 -1
- package/lib/sdks.js +20 -4
- package/lib/sdks.js.map +1 -1
- package/package.json +2 -3
- package/sdk/dataset.d.ts.map +1 -1
- package/sdk/dataset.js +49 -6
- package/sdk/dataset.js.map +1 -1
- package/sdk/element.d.ts.map +1 -1
- package/sdk/element.js +26 -2
- package/sdk/element.js.map +1 -1
- package/sdk/generation.d.ts.map +1 -1
- package/sdk/generation.js +61 -8
- package/sdk/generation.js.map +1 -1
- package/sdk/initimage.d.ts.map +1 -1
- package/sdk/initimage.js +35 -4
- package/sdk/initimage.js.map +1 -1
- package/sdk/model.d.ts.map +1 -1
- package/sdk/model.js +61 -7
- package/sdk/model.js.map +1 -1
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +14 -1
- package/sdk/sdk.js.map +1 -1
- package/sdk/user.d.ts.map +1 -1
- package/sdk/user.js +26 -2
- package/sdk/user.js.map +1 -1
- package/sdk/variation.d.ts.map +1 -1
- package/sdk/variation.js +42 -5
- package/sdk/variation.js.map +1 -1
- package/src/hooks/hooks.ts +85 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/registration.ts +14 -0
- package/src/hooks/types.ts +68 -0
- package/src/lib/config.ts +4 -4
- package/src/lib/retries.ts +23 -4
- package/src/lib/sdks.ts +33 -5
- package/src/sdk/dataset.ts +63 -11
- package/src/sdk/element.ts +33 -4
- package/src/sdk/generation.ts +78 -13
- package/src/sdk/initimage.ts +45 -7
- package/src/sdk/model.ts +78 -12
- package/src/sdk/sdk.ts +17 -2
- package/src/sdk/user.ts +33 -4
- package/src/sdk/variation.ts +54 -7
package/src/sdk/initimage.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { SDKHooks } from "../hooks";
|
|
5
6
|
import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config";
|
|
6
7
|
import * as enc$ from "../lib/encodings";
|
|
7
8
|
import { HTTPClient } from "../lib/http";
|
|
@@ -10,17 +11,32 @@ import * as errors from "../sdk/models/errors";
|
|
|
10
11
|
import * as operations from "../sdk/models/operations";
|
|
11
12
|
|
|
12
13
|
export class InitImage extends ClientSDK {
|
|
13
|
-
private readonly options$: SDKOptions;
|
|
14
|
+
private readonly options$: SDKOptions & { hooks?: SDKHooks };
|
|
14
15
|
|
|
15
16
|
constructor(options: SDKOptions = {}) {
|
|
17
|
+
const opt = options as unknown;
|
|
18
|
+
let hooks: SDKHooks;
|
|
19
|
+
if (
|
|
20
|
+
typeof opt === "object" &&
|
|
21
|
+
opt != null &&
|
|
22
|
+
"hooks" in opt &&
|
|
23
|
+
opt.hooks instanceof SDKHooks
|
|
24
|
+
) {
|
|
25
|
+
hooks = opt.hooks;
|
|
26
|
+
} else {
|
|
27
|
+
hooks = new SDKHooks();
|
|
28
|
+
}
|
|
29
|
+
|
|
16
30
|
super({
|
|
17
31
|
client: options.httpClient || new HTTPClient(),
|
|
18
32
|
baseURL: serverURLFromOptions(options),
|
|
33
|
+
hooks,
|
|
19
34
|
});
|
|
20
35
|
|
|
21
|
-
this.options$ = options;
|
|
36
|
+
this.options$ = { ...options, hooks };
|
|
22
37
|
void this.options$;
|
|
23
38
|
}
|
|
39
|
+
|
|
24
40
|
/**
|
|
25
41
|
* Delete init image
|
|
26
42
|
*
|
|
@@ -44,9 +60,10 @@ export class InitImage extends ClientSDK {
|
|
|
44
60
|
const pathParams$ = {
|
|
45
61
|
id: enc$.encodeSimple("id", payload$.id, { explode: false, charEncoding: "percent" }),
|
|
46
62
|
};
|
|
47
|
-
|
|
48
63
|
const path$ = this.templateURLComponent("/init-image/{id}")(pathParams$);
|
|
49
64
|
|
|
65
|
+
const query$ = "";
|
|
66
|
+
|
|
50
67
|
let security$;
|
|
51
68
|
if (typeof this.options$.bearerAuth === "function") {
|
|
52
69
|
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
@@ -57,17 +74,23 @@ export class InitImage extends ClientSDK {
|
|
|
57
74
|
}
|
|
58
75
|
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
59
76
|
|
|
60
|
-
const
|
|
77
|
+
const context = { operationID: "deleteInitImageById" };
|
|
78
|
+
const doOptions = { context, errorCodes: [] };
|
|
79
|
+
const request = await this.createRequest$(
|
|
61
80
|
{
|
|
81
|
+
context,
|
|
62
82
|
security: securitySettings$,
|
|
63
83
|
method: "DELETE",
|
|
64
84
|
path: path$,
|
|
65
85
|
headers: headers$,
|
|
86
|
+
query: query$,
|
|
66
87
|
body: body$,
|
|
67
88
|
},
|
|
68
89
|
options
|
|
69
90
|
);
|
|
70
91
|
|
|
92
|
+
const response = await this.do$(request, doOptions);
|
|
93
|
+
|
|
71
94
|
const responseFields$ = {
|
|
72
95
|
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
73
96
|
StatusCode: response.status,
|
|
@@ -110,9 +133,10 @@ export class InitImage extends ClientSDK {
|
|
|
110
133
|
const pathParams$ = {
|
|
111
134
|
id: enc$.encodeSimple("id", payload$.id, { explode: false, charEncoding: "percent" }),
|
|
112
135
|
};
|
|
113
|
-
|
|
114
136
|
const path$ = this.templateURLComponent("/init-image/{id}")(pathParams$);
|
|
115
137
|
|
|
138
|
+
const query$ = "";
|
|
139
|
+
|
|
116
140
|
let security$;
|
|
117
141
|
if (typeof this.options$.bearerAuth === "function") {
|
|
118
142
|
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
@@ -123,17 +147,23 @@ export class InitImage extends ClientSDK {
|
|
|
123
147
|
}
|
|
124
148
|
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
125
149
|
|
|
126
|
-
const
|
|
150
|
+
const context = { operationID: "getInitImageById" };
|
|
151
|
+
const doOptions = { context, errorCodes: [] };
|
|
152
|
+
const request = await this.createRequest$(
|
|
127
153
|
{
|
|
154
|
+
context,
|
|
128
155
|
security: securitySettings$,
|
|
129
156
|
method: "GET",
|
|
130
157
|
path: path$,
|
|
131
158
|
headers: headers$,
|
|
159
|
+
query: query$,
|
|
132
160
|
body: body$,
|
|
133
161
|
},
|
|
134
162
|
options
|
|
135
163
|
);
|
|
136
164
|
|
|
165
|
+
const response = await this.do$(request, doOptions);
|
|
166
|
+
|
|
137
167
|
const responseFields$ = {
|
|
138
168
|
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
139
169
|
StatusCode: response.status,
|
|
@@ -173,6 +203,8 @@ export class InitImage extends ClientSDK {
|
|
|
173
203
|
|
|
174
204
|
const path$ = this.templateURLComponent("/init-image")();
|
|
175
205
|
|
|
206
|
+
const query$ = "";
|
|
207
|
+
|
|
176
208
|
let security$;
|
|
177
209
|
if (typeof this.options$.bearerAuth === "function") {
|
|
178
210
|
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
@@ -183,17 +215,23 @@ export class InitImage extends ClientSDK {
|
|
|
183
215
|
}
|
|
184
216
|
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
185
217
|
|
|
186
|
-
const
|
|
218
|
+
const context = { operationID: "uploadInitImage" };
|
|
219
|
+
const doOptions = { context, errorCodes: [] };
|
|
220
|
+
const request = await this.createRequest$(
|
|
187
221
|
{
|
|
222
|
+
context,
|
|
188
223
|
security: securitySettings$,
|
|
189
224
|
method: "POST",
|
|
190
225
|
path: path$,
|
|
191
226
|
headers: headers$,
|
|
227
|
+
query: query$,
|
|
192
228
|
body: body$,
|
|
193
229
|
},
|
|
194
230
|
options
|
|
195
231
|
);
|
|
196
232
|
|
|
233
|
+
const response = await this.do$(request, doOptions);
|
|
234
|
+
|
|
197
235
|
const responseFields$ = {
|
|
198
236
|
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
199
237
|
StatusCode: response.status,
|
package/src/sdk/model.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { SDKHooks } from "../hooks";
|
|
5
6
|
import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config";
|
|
6
7
|
import * as enc$ from "../lib/encodings";
|
|
7
8
|
import { HTTPClient } from "../lib/http";
|
|
@@ -10,17 +11,32 @@ import * as errors from "../sdk/models/errors";
|
|
|
10
11
|
import * as operations from "../sdk/models/operations";
|
|
11
12
|
|
|
12
13
|
export class Model extends ClientSDK {
|
|
13
|
-
private readonly options$: SDKOptions;
|
|
14
|
+
private readonly options$: SDKOptions & { hooks?: SDKHooks };
|
|
14
15
|
|
|
15
16
|
constructor(options: SDKOptions = {}) {
|
|
17
|
+
const opt = options as unknown;
|
|
18
|
+
let hooks: SDKHooks;
|
|
19
|
+
if (
|
|
20
|
+
typeof opt === "object" &&
|
|
21
|
+
opt != null &&
|
|
22
|
+
"hooks" in opt &&
|
|
23
|
+
opt.hooks instanceof SDKHooks
|
|
24
|
+
) {
|
|
25
|
+
hooks = opt.hooks;
|
|
26
|
+
} else {
|
|
27
|
+
hooks = new SDKHooks();
|
|
28
|
+
}
|
|
29
|
+
|
|
16
30
|
super({
|
|
17
31
|
client: options.httpClient || new HTTPClient(),
|
|
18
32
|
baseURL: serverURLFromOptions(options),
|
|
33
|
+
hooks,
|
|
19
34
|
});
|
|
20
35
|
|
|
21
|
-
this.options$ = options;
|
|
36
|
+
this.options$ = { ...options, hooks };
|
|
22
37
|
void this.options$;
|
|
23
38
|
}
|
|
39
|
+
|
|
24
40
|
/**
|
|
25
41
|
* Train a Custom Model
|
|
26
42
|
*
|
|
@@ -41,6 +57,8 @@ export class Model extends ClientSDK {
|
|
|
41
57
|
|
|
42
58
|
const path$ = this.templateURLComponent("/models")();
|
|
43
59
|
|
|
60
|
+
const query$ = "";
|
|
61
|
+
|
|
44
62
|
let security$;
|
|
45
63
|
if (typeof this.options$.bearerAuth === "function") {
|
|
46
64
|
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
@@ -51,17 +69,23 @@ export class Model extends ClientSDK {
|
|
|
51
69
|
}
|
|
52
70
|
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
53
71
|
|
|
54
|
-
const
|
|
72
|
+
const context = { operationID: "createModel" };
|
|
73
|
+
const doOptions = { context, errorCodes: [] };
|
|
74
|
+
const request = await this.createRequest$(
|
|
55
75
|
{
|
|
76
|
+
context,
|
|
56
77
|
security: securitySettings$,
|
|
57
78
|
method: "POST",
|
|
58
79
|
path: path$,
|
|
59
80
|
headers: headers$,
|
|
81
|
+
query: query$,
|
|
60
82
|
body: body$,
|
|
61
83
|
},
|
|
62
84
|
options
|
|
63
85
|
);
|
|
64
86
|
|
|
87
|
+
const response = await this.do$(request, doOptions);
|
|
88
|
+
|
|
65
89
|
const responseFields$ = {
|
|
66
90
|
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
67
91
|
StatusCode: response.status,
|
|
@@ -104,9 +128,10 @@ export class Model extends ClientSDK {
|
|
|
104
128
|
const pathParams$ = {
|
|
105
129
|
id: enc$.encodeSimple("id", payload$.id, { explode: false, charEncoding: "percent" }),
|
|
106
130
|
};
|
|
107
|
-
|
|
108
131
|
const path$ = this.templateURLComponent("/models/{id}")(pathParams$);
|
|
109
132
|
|
|
133
|
+
const query$ = "";
|
|
134
|
+
|
|
110
135
|
let security$;
|
|
111
136
|
if (typeof this.options$.bearerAuth === "function") {
|
|
112
137
|
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
@@ -117,17 +142,23 @@ export class Model extends ClientSDK {
|
|
|
117
142
|
}
|
|
118
143
|
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
119
144
|
|
|
120
|
-
const
|
|
145
|
+
const context = { operationID: "deleteModelById" };
|
|
146
|
+
const doOptions = { context, errorCodes: [] };
|
|
147
|
+
const request = await this.createRequest$(
|
|
121
148
|
{
|
|
149
|
+
context,
|
|
122
150
|
security: securitySettings$,
|
|
123
151
|
method: "DELETE",
|
|
124
152
|
path: path$,
|
|
125
153
|
headers: headers$,
|
|
154
|
+
query: query$,
|
|
126
155
|
body: body$,
|
|
127
156
|
},
|
|
128
157
|
options
|
|
129
158
|
);
|
|
130
159
|
|
|
160
|
+
const response = await this.do$(request, doOptions);
|
|
161
|
+
|
|
131
162
|
const responseFields$ = {
|
|
132
163
|
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
133
164
|
StatusCode: response.status,
|
|
@@ -174,9 +205,10 @@ export class Model extends ClientSDK {
|
|
|
174
205
|
const pathParams$ = {
|
|
175
206
|
id: enc$.encodeSimple("id", payload$.id, { explode: false, charEncoding: "percent" }),
|
|
176
207
|
};
|
|
177
|
-
|
|
178
208
|
const path$ = this.templateURLComponent("/models-3d/{id}")(pathParams$);
|
|
179
209
|
|
|
210
|
+
const query$ = "";
|
|
211
|
+
|
|
180
212
|
let security$;
|
|
181
213
|
if (typeof this.options$.bearerAuth === "function") {
|
|
182
214
|
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
@@ -187,17 +219,23 @@ export class Model extends ClientSDK {
|
|
|
187
219
|
}
|
|
188
220
|
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
189
221
|
|
|
190
|
-
const
|
|
222
|
+
const context = { operationID: "delete_/models-3d/{id}" };
|
|
223
|
+
const doOptions = { context, errorCodes: [] };
|
|
224
|
+
const request = await this.createRequest$(
|
|
191
225
|
{
|
|
226
|
+
context,
|
|
192
227
|
security: securitySettings$,
|
|
193
228
|
method: "DELETE",
|
|
194
229
|
path: path$,
|
|
195
230
|
headers: headers$,
|
|
231
|
+
query: query$,
|
|
196
232
|
body: body$,
|
|
197
233
|
},
|
|
198
234
|
options
|
|
199
235
|
);
|
|
200
236
|
|
|
237
|
+
const response = await this.do$(request, doOptions);
|
|
238
|
+
|
|
201
239
|
const responseFields$ = {
|
|
202
240
|
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
203
241
|
StatusCode: response.status,
|
|
@@ -240,9 +278,10 @@ export class Model extends ClientSDK {
|
|
|
240
278
|
const pathParams$ = {
|
|
241
279
|
id: enc$.encodeSimple("id", payload$.id, { explode: false, charEncoding: "percent" }),
|
|
242
280
|
};
|
|
243
|
-
|
|
244
281
|
const path$ = this.templateURLComponent("/models/{id}")(pathParams$);
|
|
245
282
|
|
|
283
|
+
const query$ = "";
|
|
284
|
+
|
|
246
285
|
let security$;
|
|
247
286
|
if (typeof this.options$.bearerAuth === "function") {
|
|
248
287
|
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
@@ -253,17 +292,23 @@ export class Model extends ClientSDK {
|
|
|
253
292
|
}
|
|
254
293
|
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
255
294
|
|
|
256
|
-
const
|
|
295
|
+
const context = { operationID: "getModelById" };
|
|
296
|
+
const doOptions = { context, errorCodes: [] };
|
|
297
|
+
const request = await this.createRequest$(
|
|
257
298
|
{
|
|
299
|
+
context,
|
|
258
300
|
security: securitySettings$,
|
|
259
301
|
method: "GET",
|
|
260
302
|
path: path$,
|
|
261
303
|
headers: headers$,
|
|
304
|
+
query: query$,
|
|
262
305
|
body: body$,
|
|
263
306
|
},
|
|
264
307
|
options
|
|
265
308
|
);
|
|
266
309
|
|
|
310
|
+
const response = await this.do$(request, doOptions);
|
|
311
|
+
|
|
267
312
|
const responseFields$ = {
|
|
268
313
|
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
269
314
|
StatusCode: response.status,
|
|
@@ -298,6 +343,8 @@ export class Model extends ClientSDK {
|
|
|
298
343
|
|
|
299
344
|
const path$ = this.templateURLComponent("/platformModels")();
|
|
300
345
|
|
|
346
|
+
const query$ = "";
|
|
347
|
+
|
|
301
348
|
let security$;
|
|
302
349
|
if (typeof this.options$.bearerAuth === "function") {
|
|
303
350
|
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
@@ -308,11 +355,22 @@ export class Model extends ClientSDK {
|
|
|
308
355
|
}
|
|
309
356
|
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
310
357
|
|
|
311
|
-
const
|
|
312
|
-
|
|
358
|
+
const context = { operationID: "get_/platformModels" };
|
|
359
|
+
const doOptions = { context, errorCodes: [] };
|
|
360
|
+
const request = await this.createRequest$(
|
|
361
|
+
{
|
|
362
|
+
context,
|
|
363
|
+
security: securitySettings$,
|
|
364
|
+
method: "GET",
|
|
365
|
+
path: path$,
|
|
366
|
+
headers: headers$,
|
|
367
|
+
query: query$,
|
|
368
|
+
},
|
|
313
369
|
options
|
|
314
370
|
);
|
|
315
371
|
|
|
372
|
+
const response = await this.do$(request, doOptions);
|
|
373
|
+
|
|
316
374
|
const responseFields$ = {
|
|
317
375
|
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
318
376
|
StatusCode: response.status,
|
|
@@ -355,6 +413,8 @@ export class Model extends ClientSDK {
|
|
|
355
413
|
|
|
356
414
|
const path$ = this.templateURLComponent("/models-3d/upload")();
|
|
357
415
|
|
|
416
|
+
const query$ = "";
|
|
417
|
+
|
|
358
418
|
let security$;
|
|
359
419
|
if (typeof this.options$.bearerAuth === "function") {
|
|
360
420
|
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
@@ -365,17 +425,23 @@ export class Model extends ClientSDK {
|
|
|
365
425
|
}
|
|
366
426
|
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
367
427
|
|
|
368
|
-
const
|
|
428
|
+
const context = { operationID: "post_/models-3d/upload" };
|
|
429
|
+
const doOptions = { context, errorCodes: [] };
|
|
430
|
+
const request = await this.createRequest$(
|
|
369
431
|
{
|
|
432
|
+
context,
|
|
370
433
|
security: securitySettings$,
|
|
371
434
|
method: "POST",
|
|
372
435
|
path: path$,
|
|
373
436
|
headers: headers$,
|
|
437
|
+
query: query$,
|
|
374
438
|
body: body$,
|
|
375
439
|
},
|
|
376
440
|
options
|
|
377
441
|
);
|
|
378
442
|
|
|
443
|
+
const response = await this.do$(request, doOptions);
|
|
444
|
+
|
|
379
445
|
const responseFields$ = {
|
|
380
446
|
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
381
447
|
StatusCode: response.status,
|
package/src/sdk/sdk.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { SDKHooks } from "../hooks";
|
|
5
6
|
import { SDKOptions, serverURLFromOptions } from "../lib/config";
|
|
6
7
|
import { HTTPClient } from "../lib/http";
|
|
7
8
|
import { ClientSDK } from "../lib/sdks";
|
|
@@ -14,15 +15,29 @@ import { User } from "./user";
|
|
|
14
15
|
import { Variation } from "./variation";
|
|
15
16
|
|
|
16
17
|
export class Leonardo extends ClientSDK {
|
|
17
|
-
private readonly options$: SDKOptions;
|
|
18
|
+
private readonly options$: SDKOptions & { hooks?: SDKHooks };
|
|
18
19
|
|
|
19
20
|
constructor(options: SDKOptions = {}) {
|
|
21
|
+
const opt = options as unknown;
|
|
22
|
+
let hooks: SDKHooks;
|
|
23
|
+
if (
|
|
24
|
+
typeof opt === "object" &&
|
|
25
|
+
opt != null &&
|
|
26
|
+
"hooks" in opt &&
|
|
27
|
+
opt.hooks instanceof SDKHooks
|
|
28
|
+
) {
|
|
29
|
+
hooks = opt.hooks;
|
|
30
|
+
} else {
|
|
31
|
+
hooks = new SDKHooks();
|
|
32
|
+
}
|
|
33
|
+
|
|
20
34
|
super({
|
|
21
35
|
client: options.httpClient || new HTTPClient(),
|
|
22
36
|
baseURL: serverURLFromOptions(options),
|
|
37
|
+
hooks,
|
|
23
38
|
});
|
|
24
39
|
|
|
25
|
-
this.options$ = options;
|
|
40
|
+
this.options$ = { ...options, hooks };
|
|
26
41
|
void this.options$;
|
|
27
42
|
}
|
|
28
43
|
|
package/src/sdk/user.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { SDKHooks } from "../hooks";
|
|
5
6
|
import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config";
|
|
6
7
|
import { HTTPClient } from "../lib/http";
|
|
7
8
|
import { ClientSDK, RequestOptions } from "../lib/sdks";
|
|
@@ -9,17 +10,32 @@ import * as errors from "../sdk/models/errors";
|
|
|
9
10
|
import * as operations from "../sdk/models/operations";
|
|
10
11
|
|
|
11
12
|
export class User extends ClientSDK {
|
|
12
|
-
private readonly options$: SDKOptions;
|
|
13
|
+
private readonly options$: SDKOptions & { hooks?: SDKHooks };
|
|
13
14
|
|
|
14
15
|
constructor(options: SDKOptions = {}) {
|
|
16
|
+
const opt = options as unknown;
|
|
17
|
+
let hooks: SDKHooks;
|
|
18
|
+
if (
|
|
19
|
+
typeof opt === "object" &&
|
|
20
|
+
opt != null &&
|
|
21
|
+
"hooks" in opt &&
|
|
22
|
+
opt.hooks instanceof SDKHooks
|
|
23
|
+
) {
|
|
24
|
+
hooks = opt.hooks;
|
|
25
|
+
} else {
|
|
26
|
+
hooks = new SDKHooks();
|
|
27
|
+
}
|
|
28
|
+
|
|
15
29
|
super({
|
|
16
30
|
client: options.httpClient || new HTTPClient(),
|
|
17
31
|
baseURL: serverURLFromOptions(options),
|
|
32
|
+
hooks,
|
|
18
33
|
});
|
|
19
34
|
|
|
20
|
-
this.options$ = options;
|
|
35
|
+
this.options$ = { ...options, hooks };
|
|
21
36
|
void this.options$;
|
|
22
37
|
}
|
|
38
|
+
|
|
23
39
|
/**
|
|
24
40
|
* Get user information
|
|
25
41
|
*
|
|
@@ -33,6 +49,8 @@ export class User extends ClientSDK {
|
|
|
33
49
|
|
|
34
50
|
const path$ = this.templateURLComponent("/me")();
|
|
35
51
|
|
|
52
|
+
const query$ = "";
|
|
53
|
+
|
|
36
54
|
let security$;
|
|
37
55
|
if (typeof this.options$.bearerAuth === "function") {
|
|
38
56
|
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
@@ -43,11 +61,22 @@ export class User extends ClientSDK {
|
|
|
43
61
|
}
|
|
44
62
|
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
45
63
|
|
|
46
|
-
const
|
|
47
|
-
|
|
64
|
+
const context = { operationID: "getUserSelf" };
|
|
65
|
+
const doOptions = { context, errorCodes: [] };
|
|
66
|
+
const request = await this.createRequest$(
|
|
67
|
+
{
|
|
68
|
+
context,
|
|
69
|
+
security: securitySettings$,
|
|
70
|
+
method: "GET",
|
|
71
|
+
path: path$,
|
|
72
|
+
headers: headers$,
|
|
73
|
+
query: query$,
|
|
74
|
+
},
|
|
48
75
|
options
|
|
49
76
|
);
|
|
50
77
|
|
|
78
|
+
const response = await this.do$(request, doOptions);
|
|
79
|
+
|
|
51
80
|
const responseFields$ = {
|
|
52
81
|
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
53
82
|
StatusCode: response.status,
|
package/src/sdk/variation.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { SDKHooks } from "../hooks";
|
|
5
6
|
import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config";
|
|
6
7
|
import * as enc$ from "../lib/encodings";
|
|
7
8
|
import { HTTPClient } from "../lib/http";
|
|
@@ -10,17 +11,32 @@ import * as errors from "../sdk/models/errors";
|
|
|
10
11
|
import * as operations from "../sdk/models/operations";
|
|
11
12
|
|
|
12
13
|
export class Variation extends ClientSDK {
|
|
13
|
-
private readonly options$: SDKOptions;
|
|
14
|
+
private readonly options$: SDKOptions & { hooks?: SDKHooks };
|
|
14
15
|
|
|
15
16
|
constructor(options: SDKOptions = {}) {
|
|
17
|
+
const opt = options as unknown;
|
|
18
|
+
let hooks: SDKHooks;
|
|
19
|
+
if (
|
|
20
|
+
typeof opt === "object" &&
|
|
21
|
+
opt != null &&
|
|
22
|
+
"hooks" in opt &&
|
|
23
|
+
opt.hooks instanceof SDKHooks
|
|
24
|
+
) {
|
|
25
|
+
hooks = opt.hooks;
|
|
26
|
+
} else {
|
|
27
|
+
hooks = new SDKHooks();
|
|
28
|
+
}
|
|
29
|
+
|
|
16
30
|
super({
|
|
17
31
|
client: options.httpClient || new HTTPClient(),
|
|
18
32
|
baseURL: serverURLFromOptions(options),
|
|
33
|
+
hooks,
|
|
19
34
|
});
|
|
20
35
|
|
|
21
|
-
this.options$ = options;
|
|
36
|
+
this.options$ = { ...options, hooks };
|
|
22
37
|
void this.options$;
|
|
23
38
|
}
|
|
39
|
+
|
|
24
40
|
/**
|
|
25
41
|
* Create no background
|
|
26
42
|
*
|
|
@@ -41,6 +57,8 @@ export class Variation extends ClientSDK {
|
|
|
41
57
|
|
|
42
58
|
const path$ = this.templateURLComponent("/variations/nobg")();
|
|
43
59
|
|
|
60
|
+
const query$ = "";
|
|
61
|
+
|
|
44
62
|
let security$;
|
|
45
63
|
if (typeof this.options$.bearerAuth === "function") {
|
|
46
64
|
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
@@ -51,17 +69,23 @@ export class Variation extends ClientSDK {
|
|
|
51
69
|
}
|
|
52
70
|
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
53
71
|
|
|
54
|
-
const
|
|
72
|
+
const context = { operationID: "createVariationNoBG" };
|
|
73
|
+
const doOptions = { context, errorCodes: [] };
|
|
74
|
+
const request = await this.createRequest$(
|
|
55
75
|
{
|
|
76
|
+
context,
|
|
56
77
|
security: securitySettings$,
|
|
57
78
|
method: "POST",
|
|
58
79
|
path: path$,
|
|
59
80
|
headers: headers$,
|
|
81
|
+
query: query$,
|
|
60
82
|
body: body$,
|
|
61
83
|
},
|
|
62
84
|
options
|
|
63
85
|
);
|
|
64
86
|
|
|
87
|
+
const response = await this.do$(request, doOptions);
|
|
88
|
+
|
|
65
89
|
const responseFields$ = {
|
|
66
90
|
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
67
91
|
StatusCode: response.status,
|
|
@@ -104,6 +128,8 @@ export class Variation extends ClientSDK {
|
|
|
104
128
|
|
|
105
129
|
const path$ = this.templateURLComponent("/variations/upscale")();
|
|
106
130
|
|
|
131
|
+
const query$ = "";
|
|
132
|
+
|
|
107
133
|
let security$;
|
|
108
134
|
if (typeof this.options$.bearerAuth === "function") {
|
|
109
135
|
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
@@ -114,17 +140,23 @@ export class Variation extends ClientSDK {
|
|
|
114
140
|
}
|
|
115
141
|
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
116
142
|
|
|
117
|
-
const
|
|
143
|
+
const context = { operationID: "createVariationUpscale" };
|
|
144
|
+
const doOptions = { context, errorCodes: [] };
|
|
145
|
+
const request = await this.createRequest$(
|
|
118
146
|
{
|
|
147
|
+
context,
|
|
119
148
|
security: securitySettings$,
|
|
120
149
|
method: "POST",
|
|
121
150
|
path: path$,
|
|
122
151
|
headers: headers$,
|
|
152
|
+
query: query$,
|
|
123
153
|
body: body$,
|
|
124
154
|
},
|
|
125
155
|
options
|
|
126
156
|
);
|
|
127
157
|
|
|
158
|
+
const response = await this.do$(request, doOptions);
|
|
159
|
+
|
|
128
160
|
const responseFields$ = {
|
|
129
161
|
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
130
162
|
StatusCode: response.status,
|
|
@@ -167,9 +199,10 @@ export class Variation extends ClientSDK {
|
|
|
167
199
|
const pathParams$ = {
|
|
168
200
|
id: enc$.encodeSimple("id", payload$.id, { explode: false, charEncoding: "percent" }),
|
|
169
201
|
};
|
|
170
|
-
|
|
171
202
|
const path$ = this.templateURLComponent("/variations/{id}")(pathParams$);
|
|
172
203
|
|
|
204
|
+
const query$ = "";
|
|
205
|
+
|
|
173
206
|
let security$;
|
|
174
207
|
if (typeof this.options$.bearerAuth === "function") {
|
|
175
208
|
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
@@ -180,17 +213,23 @@ export class Variation extends ClientSDK {
|
|
|
180
213
|
}
|
|
181
214
|
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
182
215
|
|
|
183
|
-
const
|
|
216
|
+
const context = { operationID: "getVariationById" };
|
|
217
|
+
const doOptions = { context, errorCodes: [] };
|
|
218
|
+
const request = await this.createRequest$(
|
|
184
219
|
{
|
|
220
|
+
context,
|
|
185
221
|
security: securitySettings$,
|
|
186
222
|
method: "GET",
|
|
187
223
|
path: path$,
|
|
188
224
|
headers: headers$,
|
|
225
|
+
query: query$,
|
|
189
226
|
body: body$,
|
|
190
227
|
},
|
|
191
228
|
options
|
|
192
229
|
);
|
|
193
230
|
|
|
231
|
+
const response = await this.do$(request, doOptions);
|
|
232
|
+
|
|
194
233
|
const responseFields$ = {
|
|
195
234
|
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
196
235
|
StatusCode: response.status,
|
|
@@ -233,6 +272,8 @@ export class Variation extends ClientSDK {
|
|
|
233
272
|
|
|
234
273
|
const path$ = this.templateURLComponent("/variations/unzoom")();
|
|
235
274
|
|
|
275
|
+
const query$ = "";
|
|
276
|
+
|
|
236
277
|
let security$;
|
|
237
278
|
if (typeof this.options$.bearerAuth === "function") {
|
|
238
279
|
security$ = { bearerAuth: await this.options$.bearerAuth() };
|
|
@@ -243,17 +284,23 @@ export class Variation extends ClientSDK {
|
|
|
243
284
|
}
|
|
244
285
|
const securitySettings$ = this.resolveGlobalSecurity(security$);
|
|
245
286
|
|
|
246
|
-
const
|
|
287
|
+
const context = { operationID: "post_/variations/unzoom" };
|
|
288
|
+
const doOptions = { context, errorCodes: [] };
|
|
289
|
+
const request = await this.createRequest$(
|
|
247
290
|
{
|
|
291
|
+
context,
|
|
248
292
|
security: securitySettings$,
|
|
249
293
|
method: "POST",
|
|
250
294
|
path: path$,
|
|
251
295
|
headers: headers$,
|
|
296
|
+
query: query$,
|
|
252
297
|
body: body$,
|
|
253
298
|
},
|
|
254
299
|
options
|
|
255
300
|
);
|
|
256
301
|
|
|
302
|
+
const response = await this.do$(request, doOptions);
|
|
303
|
+
|
|
257
304
|
const responseFields$ = {
|
|
258
305
|
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
259
306
|
StatusCode: response.status,
|