@vecsnap/sdk 0.0.0-stage → 0.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/README.md +23 -2
- package/dist/errors.d.ts +25 -0
- package/dist/errors.js +50 -0
- package/dist/generated/client/client.gen.d.ts +2 -0
- package/dist/generated/client/client.gen.js +216 -0
- package/dist/generated/client/index.d.ts +10 -0
- package/dist/generated/client/index.js +6 -0
- package/dist/generated/client/types.gen.d.ts +120 -0
- package/dist/generated/client/types.gen.js +2 -0
- package/dist/generated/client/utils.gen.d.ts +37 -0
- package/dist/generated/client/utils.gen.js +228 -0
- package/dist/generated/client.gen.d.ts +12 -0
- package/dist/generated/client.gen.js +3 -0
- package/dist/generated/core/auth.gen.d.ts +25 -0
- package/dist/generated/core/auth.gen.js +14 -0
- package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/core/bodySerializer.gen.js +57 -0
- package/dist/generated/core/params.gen.d.ts +43 -0
- package/dist/generated/core/params.gen.js +109 -0
- package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/core/pathSerializer.gen.js +106 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/core/queryKeySerializer.gen.js +92 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/core/serverSentEvents.gen.js +132 -0
- package/dist/generated/core/types.gen.d.ts +83 -0
- package/dist/generated/core/types.gen.js +2 -0
- package/dist/generated/core/utils.gen.d.ts +19 -0
- package/dist/generated/core/utils.gen.js +87 -0
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/index.js +2 -0
- package/dist/generated/sdk.gen.d.ts +243 -0
- package/dist/generated/sdk.gen.js +438 -0
- package/dist/generated/types.gen.d.ts +4954 -0
- package/dist/generated/types.gen.js +2 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +178 -0
- package/dist/webhooks.d.ts +29 -0
- package/dist/webhooks.js +69 -0
- package/package.json +37 -4
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
import { client } from "./client.gen.js";
|
|
3
|
+
/**
|
|
4
|
+
* Vectorize an image
|
|
5
|
+
*
|
|
6
|
+
* Converts one image and hands you its SVG in the same request. Send exactly one of `file` (multipart), `url` or `inputKey`. If it finishes within `wait` seconds the answer is 200 with the result and its files; otherwise 202 with the conversion, which finishes on its own (`Location` names it: read it, stream its events, or await your webhook). Every client MUST handle the 202: most images take seconds, a few take minutes. It always UNLOCKS: 1 credit per image, held now and refunded if the conversion fails; an image already unlocked costs nothing again. Past your limit of conversions at once it waits its turn instead of refusing. Test keys: free (the sample result). With `Accept: image/svg+xml` a finished conversion answers 303 to the web file itself.
|
|
7
|
+
*/
|
|
8
|
+
export const vectorize = (options) => (options.client ?? client).post({
|
|
9
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
10
|
+
url: '/vectorize',
|
|
11
|
+
...options,
|
|
12
|
+
headers: {
|
|
13
|
+
'Content-Type': 'application/json',
|
|
14
|
+
...options.headers
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Create an upload
|
|
19
|
+
*
|
|
20
|
+
* Mints a URL to PUT one image to, and the key a conversion names it by. Uploads never pass through the API (a request body is capped well under our 10485760-byte limit). The URL is signed for exactly `contentLength` bytes: the PUT must send that many. Its type and size are checked again, from the stored bytes, when the conversion is created.
|
|
21
|
+
*/
|
|
22
|
+
export const createUpload = (options) => (options.client ?? client).post({
|
|
23
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
24
|
+
url: '/uploads',
|
|
25
|
+
...options,
|
|
26
|
+
headers: {
|
|
27
|
+
'Content-Type': 'application/json',
|
|
28
|
+
...options.headers
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* List conversions
|
|
33
|
+
*
|
|
34
|
+
* The caller's conversions, newest first, a page at a time: pass a page's `nextCursor` back as `cursor`. With `live=true`, only the LIVE ones (waiting, queued, processing), oldest first: the queue as the server holds it, in one page (`limit` and `cursor` are then refused).
|
|
35
|
+
*/
|
|
36
|
+
export const listConversions = (options) => (options?.client ?? client).get({
|
|
37
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
38
|
+
url: '/conversions',
|
|
39
|
+
...options
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Create a conversion
|
|
43
|
+
*
|
|
44
|
+
* Converting is FREE: 1 credit = 1 image, spent when the image is UNLOCKED (here with `unlock: true`, or later with POST /conversions/{id}/unlock). A free conversion counts against the daily caps (guests 3 a UTC day, free accounts 10, customers 100). A guest never unlocks: `unlock: true` answers it 403 `account_required`. Accepted formats: PNG, JPG, WebP, AVIF, GIF, BMP and TIFF (read by their bytes; an animation or a multi-page TIFF at its first frame), at most 4096×4096. HEIC: send a PNG (the website converts it in the browser). Repeating an `idempotencyKey` answers 200 with the conversion it already made, never a second one and never a second charge.
|
|
45
|
+
*/
|
|
46
|
+
export const createConversion = (options) => (options.client ?? client).post({
|
|
47
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
48
|
+
url: '/conversions',
|
|
49
|
+
...options,
|
|
50
|
+
headers: {
|
|
51
|
+
'Content-Type': 'application/json',
|
|
52
|
+
...options.headers
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* Delete a conversion
|
|
57
|
+
*
|
|
58
|
+
* Deletes this VERSION of its image: erased at once, it leaves every list and permalink, and its files are deleted within the hour. The image's LAST version is not erased: deleting it deletes the image (Recently deleted, restorable), and `deleted` says which. Its unlock, if paid, stays the image's.
|
|
59
|
+
*/
|
|
60
|
+
export const deleteConversion = (options) => (options.client ?? client).delete({
|
|
61
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
62
|
+
url: '/conversions/{id}',
|
|
63
|
+
...options
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* Retrieve a conversion
|
|
67
|
+
*
|
|
68
|
+
* A permalink: for the slow tail this is the normal way a conversion is seen, and it answers the same an hour later as while it runs. Another's conversion is 404, the same as none.
|
|
69
|
+
*/
|
|
70
|
+
export const getConversion = (options) => (options.client ?? client).get({
|
|
71
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
72
|
+
url: '/conversions/{id}',
|
|
73
|
+
...options
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* Cancel a waiting conversion
|
|
77
|
+
*
|
|
78
|
+
* Only a WAITING conversion (created with `queue: true`, past the active limit) can be stopped: once it has started, a worker holds it. Stopped, it is `canceled`: a held credit comes back, it leaves the library (an image whose only version it was goes with it), and it is not counted against the day.
|
|
79
|
+
*/
|
|
80
|
+
export const cancelConversion = (options) => (options.client ?? client).post({
|
|
81
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
82
|
+
url: '/conversions/{id}/cancel',
|
|
83
|
+
...options
|
|
84
|
+
});
|
|
85
|
+
/**
|
|
86
|
+
* Unlock a conversion's image
|
|
87
|
+
*
|
|
88
|
+
* 1 credit, at most once per image (the same uploaded bytes in this account). After it every result of the image downloads in every format and every re-run of it is free. A repeat, or a conversion of an image already unlocked, spends nothing (`spent: 0`), so a retry is safe. A POST, never folded into the download: a GET that spends a credit is a GET a link previewer spends.
|
|
89
|
+
*/
|
|
90
|
+
export const unlockConversion = (options) => (options.client ?? client).post({
|
|
91
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
92
|
+
url: '/conversions/{id}/unlock',
|
|
93
|
+
...options
|
|
94
|
+
});
|
|
95
|
+
/**
|
|
96
|
+
* Watch a conversion
|
|
97
|
+
*
|
|
98
|
+
* Server-Sent Events: a `status` event at once with the current state, then one on each change of `status` or `phase`; its data is a `ConversionEvent`. The stream closes when the conversion ends. A serverless function has a bounded lifetime and a conversion can outlive it, so a client MUST reconnect and re-read the conversion rather than treat this stream as the only way to learn an outcome.
|
|
99
|
+
*/
|
|
100
|
+
export const watchConversion = (options) => (options.client ?? client).sse.get({
|
|
101
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
102
|
+
url: '/conversions/{id}/events',
|
|
103
|
+
...options
|
|
104
|
+
});
|
|
105
|
+
/**
|
|
106
|
+
* Download a file of the result
|
|
107
|
+
*
|
|
108
|
+
* A short-lived URL for one of the result's files: `format` names one of `result.formats` by id (absent, the web default). Served from the storage domain as an attachment, never inline from this origin: SVG is an active document format. Allowed once the conversion's IMAGE is unlocked, on every plan; then every format and re-download is free. A locked image answers 402 `unlock_required` (this GET never spends). `as` takes the format as a print-ready PDF (`pdf`, a design file's of outlines, never its `editableText` twin) or a picture (`png`, a web file's with a preview, `size` px on its long side): made from the stored result on first ask, after the unlock check.
|
|
109
|
+
*/
|
|
110
|
+
export const downloadConversion = (options) => (options.client ?? client).get({
|
|
111
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
112
|
+
url: '/conversions/{id}/download',
|
|
113
|
+
...options
|
|
114
|
+
});
|
|
115
|
+
/**
|
|
116
|
+
* Preview the result
|
|
117
|
+
*
|
|
118
|
+
* A short-lived URL for a web file's rendered PNG, on EVERY tier: the free tier is the product demo, a full-quality conversion, this preview and its figures, with the SVG withheld. Served inline (a PNG is inert). `format` names a web file of `result.formats` that is not `currentColor` (its background kept or dropped); absent, the web default's. 2048 px on its long side, at the drawing's own aspect. `layer=outline`: the anchor-point view at the same size, lying exactly on it (black hairlines and squares on transparency).
|
|
119
|
+
*/
|
|
120
|
+
export const previewConversion = (options) => (options.client ?? client).get({
|
|
121
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
122
|
+
url: '/conversions/{id}/preview',
|
|
123
|
+
...options
|
|
124
|
+
});
|
|
125
|
+
/**
|
|
126
|
+
* Tiles of a deeper zoom
|
|
127
|
+
*
|
|
128
|
+
* Every tier, like the preview: pictures of the file, never the SVG. Level L draws the drawing 2048·2^L px long, cut into 512-px squares (1 ≤ L ≤ 3); a tile is [x, y] within the square grid of its level. Missing tiles are made first, then served from storage.
|
|
129
|
+
*/
|
|
130
|
+
export const getConversionTiles = (options) => (options.client ?? client).post({
|
|
131
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
132
|
+
url: '/conversions/{id}/tiles',
|
|
133
|
+
...options,
|
|
134
|
+
headers: {
|
|
135
|
+
'Content-Type': 'application/json',
|
|
136
|
+
...options.headers
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
/**
|
|
140
|
+
* The original image
|
|
141
|
+
*
|
|
142
|
+
* A short-lived URL for the image the conversion was made from: the upload, kept with its result for the comparison (deleted with the result or the account, never in the shared cache). While it waits or runs, the upload itself, so a client can show the image being converted. Served inline, as the type its bytes proved at upload. A result made before originals were kept, a running conversion whose upload is gone, or a TIFF (which no browser but Safari draws) has none: 404 `original_unavailable`.
|
|
143
|
+
*/
|
|
144
|
+
export const getConversionOriginal = (options) => (options.client ?? client).get({
|
|
145
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
146
|
+
url: '/conversions/{id}/original',
|
|
147
|
+
...options
|
|
148
|
+
});
|
|
149
|
+
/**
|
|
150
|
+
* The result's facts
|
|
151
|
+
*
|
|
152
|
+
* Every tier: the engine's facts of the default file, in the ENGINE's names (the same object the site's examples show): the counts a layers panel would sum (anchor points, paths, circles, rectangles, rings, strokes, repeats, elements, the words kept as text) and every color the file draws with what it paints and its share of the frame.
|
|
153
|
+
*/
|
|
154
|
+
export const getConversionFacts = (options) => (options.client ?? client).get({
|
|
155
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
156
|
+
url: '/conversions/{id}/facts',
|
|
157
|
+
...options
|
|
158
|
+
});
|
|
159
|
+
/**
|
|
160
|
+
* The result's shapes
|
|
161
|
+
*
|
|
162
|
+
* Every tier, like the preview: a web file's shapes in the engine's order, and a link to its ID PICTURE at the preview's size: every pixel's color − 1 is the shape on top there, transparent where none is, never a blended pixel. Decode it with color conversion and premultiplying off. Its deeper zoom: POST /conversions/{id}/tiles with the layer `ids-{format}`. Made on the first ask, then served.
|
|
163
|
+
*/
|
|
164
|
+
export const getConversionShapes = (options) => (options.client ?? client).get({
|
|
165
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
166
|
+
url: '/conversions/{id}/shapes',
|
|
167
|
+
...options
|
|
168
|
+
});
|
|
169
|
+
/**
|
|
170
|
+
* The result's paint map
|
|
171
|
+
*
|
|
172
|
+
* Every tier, like the preview: the paints the file draws with its ground left out, in index order, each with its share of the frame, the ground, and a link to `paints.bin`: zlib of an index plane then a weight plane (width × height × 4 bytes each: every pixel's four largest paints, 255 = none, and their weights × 255). A pixel of any recolor is Σ w·c′ (premultiplied), with the ground under it as (1 − Σ w)·ground. Made on the first ask; a drawing of more than 24 paints has none.
|
|
173
|
+
*/
|
|
174
|
+
export const getConversionPaints = (options) => (options.client ?? client).get({
|
|
175
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
176
|
+
url: '/conversions/{id}/paints',
|
|
177
|
+
...options
|
|
178
|
+
});
|
|
179
|
+
/**
|
|
180
|
+
* Preview fewer colors
|
|
181
|
+
*
|
|
182
|
+
* Previews of a redraw with fewer colors. Without `count`: the WHOLE rail in one answer (`counts`), every count in the engine's bounds, colors only: what a client asks once, then reads. With `count`: the colors the engine REACHES for at most that many (from the result's kept original; it can be fewer), and the result's own colors MERGED into them (`mapping`), a recolor of the very drawing a client draws exactly. With `format` (a web file with a picture), also `picture`: the merged drawing at the preview's size; its deeper tiles are POST /conversions/{id}/tiles with `palette`. The redraw itself (POST /images/{id}/conversions with `options.maxColors`) traces new shapes.
|
|
183
|
+
*/
|
|
184
|
+
export const getConversionPalette = (options) => (options.client ?? client).get({
|
|
185
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
186
|
+
url: '/conversions/{id}/palette',
|
|
187
|
+
...options
|
|
188
|
+
});
|
|
189
|
+
/**
|
|
190
|
+
* List a result's recolors
|
|
191
|
+
*
|
|
192
|
+
* The result's recolors, the last used first: the 10 used last, in one page (`hasMore` says older ones exist; they are not listed, and saving one again brings it first).
|
|
193
|
+
*/
|
|
194
|
+
export const listConversionVariants = (options) => (options.client ?? client).get({
|
|
195
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
196
|
+
url: '/conversions/{id}/variants',
|
|
197
|
+
...options
|
|
198
|
+
});
|
|
199
|
+
/**
|
|
200
|
+
* Recolor a result
|
|
201
|
+
*
|
|
202
|
+
* `colors` maps the file's own colors to new ones, every use of each (fills, strokes, gradient stops, the ground); two to one value merge them. Keys are the result's paints and its ground (`/facts`); the mapping is stored canonical, and the same one saved again is the same variant, used now. Free; its files download under the image's unlock (`/download?variant=`).
|
|
203
|
+
*/
|
|
204
|
+
export const createConversionVariant = (options) => (options.client ?? client).post({
|
|
205
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
206
|
+
url: '/conversions/{id}/variants',
|
|
207
|
+
...options,
|
|
208
|
+
headers: {
|
|
209
|
+
'Content-Type': 'application/json',
|
|
210
|
+
...options.headers
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
/**
|
|
214
|
+
* Retrieve the verdict
|
|
215
|
+
*
|
|
216
|
+
* The caller's verdict on a result, or null.
|
|
217
|
+
*/
|
|
218
|
+
export const getConversionFeedback = (options) => (options.client ?? client).get({
|
|
219
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
220
|
+
url: '/conversions/{id}/feedback',
|
|
221
|
+
...options
|
|
222
|
+
});
|
|
223
|
+
/**
|
|
224
|
+
* Give a verdict
|
|
225
|
+
*
|
|
226
|
+
* One per result, given or changed: thumbs up or down; a down's reasons; a note; and `shareImage`. Moves no money: a failed result's credit comes back after a look, by an operator.
|
|
227
|
+
*/
|
|
228
|
+
export const putConversionFeedback = (options) => (options.client ?? client).put({
|
|
229
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
230
|
+
url: '/conversions/{id}/feedback',
|
|
231
|
+
...options,
|
|
232
|
+
headers: {
|
|
233
|
+
'Content-Type': 'application/json',
|
|
234
|
+
...options.headers
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
/**
|
|
238
|
+
* List images
|
|
239
|
+
*
|
|
240
|
+
* The caller's library, one entry per image, a page at a time: an image's versions are never cut at a page's edge. Pass a page's `nextCursor` back as `cursor`. `deleted=true` lists Recently deleted (newest deletion first).
|
|
241
|
+
*/
|
|
242
|
+
export const listImages = (options) => (options?.client ?? client).get({
|
|
243
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
244
|
+
url: '/images',
|
|
245
|
+
...options
|
|
246
|
+
});
|
|
247
|
+
/**
|
|
248
|
+
* Delete an image
|
|
249
|
+
*
|
|
250
|
+
* Into Recently deleted, restorable for 30 days (POST /images/{id}/restore); then every version and its files are erased. Converting the same bytes again brings it back. Its unlock, if paid, is never lost.
|
|
251
|
+
*/
|
|
252
|
+
export const deleteImage = (options) => (options.client ?? client).delete({
|
|
253
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
254
|
+
url: '/images/{id}',
|
|
255
|
+
...options
|
|
256
|
+
});
|
|
257
|
+
/**
|
|
258
|
+
* Retrieve an image
|
|
259
|
+
*
|
|
260
|
+
* One image, with every live version newest first.
|
|
261
|
+
*/
|
|
262
|
+
export const getImage = (options) => (options.client ?? client).get({
|
|
263
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
264
|
+
url: '/images/{id}',
|
|
265
|
+
...options
|
|
266
|
+
});
|
|
267
|
+
/**
|
|
268
|
+
* Name an image
|
|
269
|
+
*
|
|
270
|
+
* The person's name for it, cleaned to a printable label; `null` or a blank gives back its file's name. Its files download under it.
|
|
271
|
+
*/
|
|
272
|
+
export const renameImage = (options) => (options.client ?? client).patch({
|
|
273
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
274
|
+
url: '/images/{id}',
|
|
275
|
+
...options,
|
|
276
|
+
headers: {
|
|
277
|
+
'Content-Type': 'application/json',
|
|
278
|
+
...options.headers
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
/**
|
|
282
|
+
* Restore an image
|
|
283
|
+
*
|
|
284
|
+
* Back from Recently deleted, every version with it.
|
|
285
|
+
*/
|
|
286
|
+
export const restoreImage = (options) => (options.client ?? client).post({
|
|
287
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
288
|
+
url: '/images/{id}/restore',
|
|
289
|
+
...options
|
|
290
|
+
});
|
|
291
|
+
/**
|
|
292
|
+
* Erase an image now
|
|
293
|
+
*
|
|
294
|
+
* Before its 30 days: its versions are erased and their files deleted; it cannot be restored after. Only from Recently deleted: an image in the library is 409 `not_deleted` (delete it first).
|
|
295
|
+
*/
|
|
296
|
+
export const eraseImage = (options) => (options.client ?? client).post({
|
|
297
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
298
|
+
url: '/images/{id}/erase',
|
|
299
|
+
...options
|
|
300
|
+
});
|
|
301
|
+
/**
|
|
302
|
+
* Convert an image again
|
|
303
|
+
*
|
|
304
|
+
* A new version of the image with today's engine, from the bytes it was made from: the API copies them (its result's kept original, else a version's upload while kept), so nothing is uploaded again. Every rule of POST /conversions applies: free (an unlocked image's re-runs always are), counted by the daily caps. `options` absent keeps the newest version's; `{"maxColors": N}` redraws it with at most N colors (GET /conversions/{id}/palette previews it first). 409 `original_not_kept` when the image's file is no longer kept: upload it again.
|
|
305
|
+
*/
|
|
306
|
+
export const createImageConversion = (options) => (options.client ?? client).post({
|
|
307
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
308
|
+
url: '/images/{id}/conversions',
|
|
309
|
+
...options,
|
|
310
|
+
headers: {
|
|
311
|
+
'Content-Type': 'application/json',
|
|
312
|
+
...options.headers
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
/**
|
|
316
|
+
* Unlock several images
|
|
317
|
+
*
|
|
318
|
+
* 1 credit per image not yet unlocked, in ONE transaction: all or nothing. A short balance unlocks none (402); so does an image with no finished result (409 `not_ready`) or whose hold is still running (409 `unlock_pending`). An image already unlocked spends nothing, so a retry is safe.
|
|
319
|
+
*/
|
|
320
|
+
export const unlockImages = (options) => (options.client ?? client).post({
|
|
321
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
322
|
+
url: '/images/unlock',
|
|
323
|
+
...options,
|
|
324
|
+
headers: {
|
|
325
|
+
'Content-Type': 'application/json',
|
|
326
|
+
...options.headers
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
/**
|
|
330
|
+
* Delete several images
|
|
331
|
+
*
|
|
332
|
+
* ONE transaction, each image's outcome said back. Partial by design: one still converting is refused (`converting`) and the others are still deleted. Restorable for 30 days (POST /images/restore). A repeat keeps the first date (`already_deleted`); another's is `not_found`.
|
|
333
|
+
*/
|
|
334
|
+
export const deleteImages = (options) => (options.client ?? client).post({
|
|
335
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
336
|
+
url: '/images/delete',
|
|
337
|
+
...options,
|
|
338
|
+
headers: {
|
|
339
|
+
'Content-Type': 'application/json',
|
|
340
|
+
...options.headers
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
/**
|
|
344
|
+
* Restore several images
|
|
345
|
+
*
|
|
346
|
+
* ONE transaction, each image's outcome said back: `restored`, `in_library` (nothing to do), `not_found` (another's, or past its window). A delete's Undo.
|
|
347
|
+
*/
|
|
348
|
+
export const restoreImages = (options) => (options.client ?? client).post({
|
|
349
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
350
|
+
url: '/images/restore',
|
|
351
|
+
...options,
|
|
352
|
+
headers: {
|
|
353
|
+
'Content-Type': 'application/json',
|
|
354
|
+
...options.headers
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
/**
|
|
358
|
+
* Erase images now
|
|
359
|
+
*
|
|
360
|
+
* With `{ ids }`: those images, in ONE transaction, each one's outcome said back: `erased`, `not_deleted` (it is in the library: only Recently deleted is erased now), `not_found`. With `{ all: true }`: every image in Recently deleted ("Erase all now"); "all" is said, never inferred. Exactly one of the two. Versions erased are gone for good, their files deleted.
|
|
361
|
+
*/
|
|
362
|
+
export const eraseImages = (options) => (options.client ?? client).post({
|
|
363
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
364
|
+
url: '/images/erase',
|
|
365
|
+
...options,
|
|
366
|
+
headers: {
|
|
367
|
+
'Content-Type': 'application/json',
|
|
368
|
+
...options.headers
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
/**
|
|
372
|
+
* List palettes
|
|
373
|
+
*
|
|
374
|
+
* The account's palettes, the last changed first: at most 20, in one page.
|
|
375
|
+
*/
|
|
376
|
+
export const listPalettes = (options) => (options?.client ?? client).get({
|
|
377
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
378
|
+
url: '/palettes',
|
|
379
|
+
...options
|
|
380
|
+
});
|
|
381
|
+
/**
|
|
382
|
+
* Save a palette
|
|
383
|
+
*
|
|
384
|
+
* A new palette; an account keeps at most 20 (409 `palette_limit`).
|
|
385
|
+
*/
|
|
386
|
+
export const createPalette = (options) => (options.client ?? client).post({
|
|
387
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
388
|
+
url: '/palettes',
|
|
389
|
+
...options,
|
|
390
|
+
headers: {
|
|
391
|
+
'Content-Type': 'application/json',
|
|
392
|
+
...options.headers
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
/**
|
|
396
|
+
* Delete a palette
|
|
397
|
+
*
|
|
398
|
+
* Removed for good. Another's is 404 `palette_not_found`, the same as none.
|
|
399
|
+
*/
|
|
400
|
+
export const deletePalette = (options) => (options.client ?? client).delete({
|
|
401
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
402
|
+
url: '/palettes/{id}',
|
|
403
|
+
...options
|
|
404
|
+
});
|
|
405
|
+
/**
|
|
406
|
+
* Change a palette
|
|
407
|
+
*
|
|
408
|
+
* Its name and colors, whole. Another's is 404 `palette_not_found`, the same as none.
|
|
409
|
+
*/
|
|
410
|
+
export const updatePalette = (options) => (options.client ?? client).patch({
|
|
411
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
412
|
+
url: '/palettes/{id}',
|
|
413
|
+
...options,
|
|
414
|
+
headers: {
|
|
415
|
+
'Content-Type': 'application/json',
|
|
416
|
+
...options.headers
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
/**
|
|
420
|
+
* Retrieve the credit balance
|
|
421
|
+
*
|
|
422
|
+
* Derived from the ledger on every call: there is no balance column, since a cached total drifts under partial failure and the customer is the one who finds out. `unlockCost` is what unlocking one image costs, published so a client never hardcodes it; `tier` says which caps apply.
|
|
423
|
+
*/
|
|
424
|
+
export const getCredits = (options) => (options?.client ?? client).get({
|
|
425
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
426
|
+
url: '/credits',
|
|
427
|
+
...options
|
|
428
|
+
});
|
|
429
|
+
/**
|
|
430
|
+
* Retrieve today's limits
|
|
431
|
+
*
|
|
432
|
+
* The caps that apply to the caller (a guest, a free account or a customer) and how much of today is used: the same count the create refuses by. `usedToday` counts free conversions (waiting ones included) and refunded holds; a stopped one never ran and is not counted.
|
|
433
|
+
*/
|
|
434
|
+
export const getLimits = (options) => (options?.client ?? client).get({
|
|
435
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
436
|
+
url: '/limits',
|
|
437
|
+
...options
|
|
438
|
+
});
|