@vecsnap/sdk 0.0.0-stage → 0.2.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.
Files changed (40) hide show
  1. package/README.md +32 -2
  2. package/dist/errors.d.ts +25 -0
  3. package/dist/errors.js +50 -0
  4. package/dist/generated/client/client.gen.d.ts +2 -0
  5. package/dist/generated/client/client.gen.js +216 -0
  6. package/dist/generated/client/index.d.ts +10 -0
  7. package/dist/generated/client/index.js +6 -0
  8. package/dist/generated/client/types.gen.d.ts +120 -0
  9. package/dist/generated/client/types.gen.js +2 -0
  10. package/dist/generated/client/utils.gen.d.ts +37 -0
  11. package/dist/generated/client/utils.gen.js +228 -0
  12. package/dist/generated/client.gen.d.ts +12 -0
  13. package/dist/generated/client.gen.js +3 -0
  14. package/dist/generated/core/auth.gen.d.ts +25 -0
  15. package/dist/generated/core/auth.gen.js +14 -0
  16. package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
  17. package/dist/generated/core/bodySerializer.gen.js +57 -0
  18. package/dist/generated/core/params.gen.d.ts +43 -0
  19. package/dist/generated/core/params.gen.js +109 -0
  20. package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
  21. package/dist/generated/core/pathSerializer.gen.js +106 -0
  22. package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
  23. package/dist/generated/core/queryKeySerializer.gen.js +92 -0
  24. package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
  25. package/dist/generated/core/serverSentEvents.gen.js +132 -0
  26. package/dist/generated/core/types.gen.d.ts +83 -0
  27. package/dist/generated/core/types.gen.js +2 -0
  28. package/dist/generated/core/utils.gen.d.ts +19 -0
  29. package/dist/generated/core/utils.gen.js +87 -0
  30. package/dist/generated/index.d.ts +2 -0
  31. package/dist/generated/index.js +2 -0
  32. package/dist/generated/sdk.gen.d.ts +297 -0
  33. package/dist/generated/sdk.gen.js +532 -0
  34. package/dist/generated/types.gen.d.ts +6850 -0
  35. package/dist/generated/types.gen.js +2 -0
  36. package/dist/index.d.ts +82 -0
  37. package/dist/index.js +229 -0
  38. package/dist/webhooks.d.ts +29 -0
  39. package/dist/webhooks.js +69 -0
  40. package/package.json +40 -4
@@ -0,0 +1,532 @@
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 UNLOCKS unless `unlock` is false: 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`; nor does a connected app's pass (403 `pass_not_allowed`: the person unlocks). Accepted formats: PNG, JPG, WebP, AVIF, GIF, BMP, TIFF, SVG and PDF (read by their bytes; an animation or a multi-page TIFF at its first frame), at most 4096×4096. HEIC, SVGZ: 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). Any design file, its `editableText` twin included, takes `layers`: its LAYER TREE, the drawing as JSON data for a design tool's own layers (groups, ellipses, rectangles, paths, components, text; the vocabulary is VecSnap's `LayerTree`). A design file of outlines also takes a maker's file: cut-ready (`cut`, each shape minus what is painted over it, for a cutting machine), a DXF (`dxf`, `units` mm or in, for a laser or a CNC), an EPS (`eps`, for a print shop), a 3D print raised `height` mm (`stl`, one body; `3mf`, one object per color, for a printer with several filaments), or its LINES: each edge drawn once, in a machine's order (`plot`, an SVG; `plot-dxf`, a DXF in `units`): a single-line version's lines, any other drawing's outlines. Each is 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). `layer=plot`: what a machine draws at the same size, in one ink; with `variant`, under its edits and colors, as its file downloads, with that drawing's figures in `plot`. `layer=cut`: the CUT-READY picture of the DESIGN file `format` names (a design file of outlines: what a cutter's blade follows), a revision's too.
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
+ * Figures for each machine
127
+ *
128
+ * A single-line version's figures for each kind of machine: `pen` (what a pen draws: a few short stretches gone over twice so it lifts less: its lines, the closed ones, its colors, the lines too short to draw cleanly) and `once` (the file a laser, a blade or CAD draws, each stretch once). With `variant`, a revision's, under its edits. A version's are made with it; a revision's are made on the first ask, under the long files' wait. A drawing the engine refuses, or too dense to walk in time, is refused (`file_not_makeable`), final. Both are null for a version that is not single lines. No credit is spent (figures, never the file); a walk made on the first ask counts toward the day's compute (`compute_limit_reached`).
129
+ */
130
+ export const getConversionMachines = (options) => (options.client ?? client).get({
131
+ security: [{ scheme: 'bearer', type: 'http' }],
132
+ url: '/conversions/{id}/machines',
133
+ ...options
134
+ });
135
+ /**
136
+ * Tiles of a deeper zoom
137
+ *
138
+ * 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. Several layers at once: POST /conversions/{id}/tiles/batch.
139
+ */
140
+ export const getConversionTiles = (options) => (options.client ?? client).post({
141
+ security: [{ scheme: 'bearer', type: 'http' }],
142
+ url: '/conversions/{id}/tiles',
143
+ ...options,
144
+ headers: {
145
+ 'Content-Type': 'application/json',
146
+ ...options.headers
147
+ }
148
+ });
149
+ /**
150
+ * Tiles of several layers at once
151
+ *
152
+ * The tiles of every layer one view shows (the picture, its Shapes ID picture, the outline), in one request: each ask is POST /conversions/{id}/tiles's, answered in the same order. At most 24 tiles in all, of one revision (`variant`) and one preview count (`palette`) at most; ask another's apart; it succeeds or fails whole. One request at a time per account makes files: another meanwhile waits its turn (up to 15 s), then, or with 8 already waiting, is refused with 429 `derive_busy` (nothing done; ask again after Retry-After).
153
+ */
154
+ export const getConversionTileBatch = (options) => (options.client ?? client).post({
155
+ security: [{ scheme: 'bearer', type: 'http' }],
156
+ url: '/conversions/{id}/tiles/batch',
157
+ ...options,
158
+ headers: {
159
+ 'Content-Type': 'application/json',
160
+ ...options.headers
161
+ }
162
+ });
163
+ /**
164
+ * The original image
165
+ *
166
+ * 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; an upload no page shows as itself (a TIFF, an SVG) is answered as its PICTURE, a PNG the engine drew of it, never the file. A result made before originals were kept, or a running conversion whose upload is gone, has none: 404 `original_unavailable`.
167
+ */
168
+ export const getConversionOriginal = (options) => (options.client ?? client).get({
169
+ security: [{ scheme: 'bearer', type: 'http' }],
170
+ url: '/conversions/{id}/original',
171
+ ...options
172
+ });
173
+ /**
174
+ * What an uploaded SVG was
175
+ *
176
+ * Every tier, an SVG upload's only, either tool: its anchor points, its size and its colors as the engine read them, and a short-lived link to its points as data. Written at conversion: an upload of another format, one the engine's SVG reader cannot read, or a result made before these existed has none: 404 `not_found`. A connected app's pass reads the counts alone: its `points` is null.
177
+ */
178
+ export const getConversionOriginalFacts = (options) => (options.client ?? client).get({
179
+ security: [{ scheme: 'bearer', type: 'http' }],
180
+ url: '/conversions/{id}/original/facts',
181
+ ...options
182
+ });
183
+ /**
184
+ * The result's facts
185
+ *
186
+ * 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. `lane`: whether the upload looks like what VecSnap is built for (`in`: logos, icons, illustrations) or like a photograph (`photo`), read by the engine before converting; null when not read (a result converted before it). `lineArt`: whether the drawing is made of lines, so a single-line version may suit it. `plot`: a single-line version's figures for a machine.
187
+ */
188
+ export const getConversionFacts = (options) => (options.client ?? client).get({
189
+ security: [{ scheme: 'bearer', type: 'http' }],
190
+ url: '/conversions/{id}/facts',
191
+ ...options
192
+ });
193
+ /**
194
+ * What a Clean did
195
+ *
196
+ * Every tier, a Clean's only (`tool: clean`): the upload's anchor points and the result's, the upload's size, the distance every outline was kept within, and each step that acted, by its setting's name (`cleanOptions`). A Redraw has none: 404 `not_found`.
197
+ */
198
+ export const getConversionCleaned = (options) => (options.client ?? client).get({
199
+ security: [{ scheme: 'bearer', type: 'http' }],
200
+ url: '/conversions/{id}/cleaned',
201
+ ...options
202
+ });
203
+ /**
204
+ * The result's shapes
205
+ *
206
+ * 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}`. The default web file's is made with the conversion; another's on the first ask; then served.
207
+ */
208
+ export const getConversionShapes = (options) => (options.client ?? client).get({
209
+ security: [{ scheme: 'bearer', type: 'http' }],
210
+ url: '/conversions/{id}/shapes',
211
+ ...options
212
+ });
213
+ /**
214
+ * Lift a shape
215
+ *
216
+ * Every tier, like the preview: two short-lived URLs to MOVE a shape on screen before the move is saved. `without` is the web file without the shape (its preview with one hide more, never saved), `alone` the shape alone, every other one hidden and drawn whole where another covered it; both 2048 px on the long side, lying exactly on the preview. `shape` is its number in a revision's edits (the Shapes table's `shape`); the ground can only be hidden, never lifted. Moving it is then ONE `place` edit (POST /conversions/{id}/variants).
217
+ */
218
+ export const liftConversionShape = (options) => (options.client ?? client).get({
219
+ security: [{ scheme: 'bearer', type: 'http' }],
220
+ url: '/conversions/{id}/lift',
221
+ ...options
222
+ });
223
+ /**
224
+ * Read a shape's anchors
225
+ *
226
+ * Once the image is UNLOCKED (402 `unlock_required` before: the anchors are the file's geometry): a shape's anchor points as data, numbered exactly as the anchor edits name them (`point`, `corner`, `add_point`, `delete_point`, `fillet`, saved by POST /conversions/{id}/variants), on the shape as the revision edits it. `x` and `y` are in the file's own units (the Shapes table's). `reach` is the largest `fillet` radius that fits there (`reachExact`: every radius up to it fits, between two straight sides); `segment` the one leaving the anchor (`add_point`'s `at` is a place on it; an arc takes none). A shape no anchor edit addresses answers an empty list.
227
+ */
228
+ export const getConversionAnchors = (options) => (options.client ?? client).get({
229
+ security: [{ scheme: 'bearer', type: 'http' }],
230
+ url: '/conversions/{id}/anchors',
231
+ ...options
232
+ });
233
+ /**
234
+ * Try edits
235
+ *
236
+ * Every tier, like the preview: a short-lived URL to the web file's preview with EDITS after a revision's own (or the result's), NEVER saved: what a press would draw before it is pressed. `edits` is a JSON list of 1 to 8 edits, in a revision's numbering and vocabulary (POST /conversions/{id}/variants); saving the same edits later draws from the same picture. Counted on its own budget, apart from what saving needs. An edit only the engine draws (simplify, round, point, corner, add_point, delete_point, fillet, merge, subtract, intersect, exclude, offset, outline, weight) is tried once the image is unlocked (402 `unlock_required` before).
237
+ */
238
+ export const tryConversionEdits = (options) => (options.client ?? client).get({
239
+ security: [{ scheme: 'bearer', type: 'http' }],
240
+ url: '/conversions/{id}/try',
241
+ ...options
242
+ });
243
+ /**
244
+ * The result's paint map
245
+ *
246
+ * 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 with the conversion (an older result's on the first ask); a drawing of more than 24 paints has none.
247
+ */
248
+ export const getConversionPaints = (options) => (options.client ?? client).get({
249
+ security: [{ scheme: 'bearer', type: 'http' }],
250
+ url: '/conversions/{id}/paints',
251
+ ...options
252
+ });
253
+ /**
254
+ * Preview fewer colors
255
+ *
256
+ * 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.
257
+ */
258
+ export const getConversionPalette = (options) => (options.client ?? client).get({
259
+ security: [{ scheme: 'bearer', type: 'http' }],
260
+ url: '/conversions/{id}/palette',
261
+ ...options
262
+ });
263
+ /**
264
+ * List a result's recolors
265
+ *
266
+ * 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).
267
+ */
268
+ export const listConversionVariants = (options) => (options.client ?? client).get({
269
+ security: [{ scheme: 'bearer', type: 'http' }],
270
+ url: '/conversions/{id}/variants',
271
+ ...options
272
+ });
273
+ /**
274
+ * Change a result: recolor it, edit its shapes
275
+ *
276
+ * A REVISION of the result. `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`). `edits` (at most 1000; at most 25 of them slow to replay: simplify, merge, subtract, intersect, exclude, offset, outline, fillet) change its shapes, applied in order before the colors: hide, duplicate, place, simplify, round, point, corner, add_point, delete_point, fillet, merge, arrange, paint, subtract, intersect, exclude, flip, offset, outline, stretch, align, weight. Each addresses a shape by its index in the table with the background kept; the background can only be hidden, and is no edit's other shape (into, by, with). It 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=`). An edit only the engine draws, the file's own geometry (simplify, round, point, corner, add_point, delete_point, fillet, merge, subtract, intersect, exclude, offset, outline, weight), is added once the image is unlocked (402 `unlock_required` before, nothing saved); one a saved revision of the result already holds is kept.
277
+ */
278
+ export const createConversionVariant = (options) => (options.client ?? client).post({
279
+ security: [{ scheme: 'bearer', type: 'http' }],
280
+ url: '/conversions/{id}/variants',
281
+ ...options,
282
+ headers: {
283
+ 'Content-Type': 'application/json',
284
+ ...options.headers
285
+ }
286
+ });
287
+ /**
288
+ * Retrieve the verdict
289
+ *
290
+ * The caller's verdict on a result, or null.
291
+ */
292
+ export const getConversionFeedback = (options) => (options.client ?? client).get({
293
+ security: [{ scheme: 'bearer', type: 'http' }],
294
+ url: '/conversions/{id}/feedback',
295
+ ...options
296
+ });
297
+ /**
298
+ * Give a verdict
299
+ *
300
+ * 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.
301
+ */
302
+ export const putConversionFeedback = (options) => (options.client ?? client).put({
303
+ security: [{ scheme: 'bearer', type: 'http' }],
304
+ url: '/conversions/{id}/feedback',
305
+ ...options,
306
+ headers: {
307
+ 'Content-Type': 'application/json',
308
+ ...options.headers
309
+ }
310
+ });
311
+ /**
312
+ * List images
313
+ *
314
+ * 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).
315
+ */
316
+ export const listImages = (options) => (options?.client ?? client).get({
317
+ security: [{ scheme: 'bearer', type: 'http' }],
318
+ url: '/images',
319
+ ...options
320
+ });
321
+ /**
322
+ * Delete an image
323
+ *
324
+ * 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.
325
+ */
326
+ export const deleteImage = (options) => (options.client ?? client).delete({
327
+ security: [{ scheme: 'bearer', type: 'http' }],
328
+ url: '/images/{id}',
329
+ ...options
330
+ });
331
+ /**
332
+ * Retrieve an image
333
+ *
334
+ * One image, with every live version newest first.
335
+ */
336
+ export const getImage = (options) => (options.client ?? client).get({
337
+ security: [{ scheme: 'bearer', type: 'http' }],
338
+ url: '/images/{id}',
339
+ ...options
340
+ });
341
+ /**
342
+ * Name an image
343
+ *
344
+ * 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.
345
+ */
346
+ export const renameImage = (options) => (options.client ?? client).patch({
347
+ security: [{ scheme: 'bearer', type: 'http' }],
348
+ url: '/images/{id}',
349
+ ...options,
350
+ headers: {
351
+ 'Content-Type': 'application/json',
352
+ ...options.headers
353
+ }
354
+ });
355
+ /**
356
+ * Restore an image
357
+ *
358
+ * Back from Recently deleted, every version with it.
359
+ */
360
+ export const restoreImage = (options) => (options.client ?? client).post({
361
+ security: [{ scheme: 'bearer', type: 'http' }],
362
+ url: '/images/{id}/restore',
363
+ ...options
364
+ });
365
+ /**
366
+ * Erase an image now
367
+ *
368
+ * 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).
369
+ */
370
+ export const eraseImage = (options) => (options.client ?? client).post({
371
+ security: [{ scheme: 'bearer', type: 'http' }],
372
+ url: '/images/{id}/erase',
373
+ ...options
374
+ });
375
+ /**
376
+ * Convert an image again
377
+ *
378
+ * 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. With no `tool`, `preset`, `options` or `cleanOptions`, the newest version's own recipe is kept; `{"maxColors": N}` redraws it with at most N colors (GET /conversions/{id}/palette previews it first); a `preset` that is not the version's redraws it in that preset, without the version's options. For an SVG, `tool: redraw` redraws a Clean's image and `tool: clean` with `cleanOptions` cleans it again with other settings. 409 `original_not_kept` when the image's file is no longer kept: upload it again.
379
+ */
380
+ export const createImageConversion = (options) => (options.client ?? client).post({
381
+ security: [{ scheme: 'bearer', type: 'http' }],
382
+ url: '/images/{id}/conversions',
383
+ ...options,
384
+ headers: {
385
+ 'Content-Type': 'application/json',
386
+ ...options.headers
387
+ }
388
+ });
389
+ /**
390
+ * Unlock several images
391
+ *
392
+ * 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.
393
+ */
394
+ export const unlockImages = (options) => (options.client ?? client).post({
395
+ security: [{ scheme: 'bearer', type: 'http' }],
396
+ url: '/images/unlock',
397
+ ...options,
398
+ headers: {
399
+ 'Content-Type': 'application/json',
400
+ ...options.headers
401
+ }
402
+ });
403
+ /**
404
+ * Delete several images
405
+ *
406
+ * 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`.
407
+ */
408
+ export const deleteImages = (options) => (options.client ?? client).post({
409
+ security: [{ scheme: 'bearer', type: 'http' }],
410
+ url: '/images/delete',
411
+ ...options,
412
+ headers: {
413
+ 'Content-Type': 'application/json',
414
+ ...options.headers
415
+ }
416
+ });
417
+ /**
418
+ * Restore several images
419
+ *
420
+ * 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.
421
+ */
422
+ export const restoreImages = (options) => (options.client ?? client).post({
423
+ security: [{ scheme: 'bearer', type: 'http' }],
424
+ url: '/images/restore',
425
+ ...options,
426
+ headers: {
427
+ 'Content-Type': 'application/json',
428
+ ...options.headers
429
+ }
430
+ });
431
+ /**
432
+ * Erase images now
433
+ *
434
+ * 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.
435
+ */
436
+ export const eraseImages = (options) => (options.client ?? client).post({
437
+ security: [{ scheme: 'bearer', type: 'http' }],
438
+ url: '/images/erase',
439
+ ...options,
440
+ headers: {
441
+ 'Content-Type': 'application/json',
442
+ ...options.headers
443
+ }
444
+ });
445
+ /**
446
+ * List palettes
447
+ *
448
+ * The account's palettes, the last changed first: at most 20, in one page.
449
+ */
450
+ export const listPalettes = (options) => (options?.client ?? client).get({
451
+ security: [{ scheme: 'bearer', type: 'http' }],
452
+ url: '/palettes',
453
+ ...options
454
+ });
455
+ /**
456
+ * Save a palette
457
+ *
458
+ * A new palette; an account keeps at most 20 (409 `palette_limit`).
459
+ */
460
+ export const createPalette = (options) => (options.client ?? client).post({
461
+ security: [{ scheme: 'bearer', type: 'http' }],
462
+ url: '/palettes',
463
+ ...options,
464
+ headers: {
465
+ 'Content-Type': 'application/json',
466
+ ...options.headers
467
+ }
468
+ });
469
+ /**
470
+ * Delete a palette
471
+ *
472
+ * Removed for good. Another's is 404 `palette_not_found`, the same as none.
473
+ */
474
+ export const deletePalette = (options) => (options.client ?? client).delete({
475
+ security: [{ scheme: 'bearer', type: 'http' }],
476
+ url: '/palettes/{id}',
477
+ ...options
478
+ });
479
+ /**
480
+ * Change a palette
481
+ *
482
+ * Its name and colors, whole. Another's is 404 `palette_not_found`, the same as none.
483
+ */
484
+ export const updatePalette = (options) => (options.client ?? client).patch({
485
+ security: [{ scheme: 'bearer', type: 'http' }],
486
+ url: '/palettes/{id}',
487
+ ...options,
488
+ headers: {
489
+ 'Content-Type': 'application/json',
490
+ ...options.headers
491
+ }
492
+ });
493
+ /**
494
+ * Retrieve whose account this is
495
+ *
496
+ * The email of the account the caller acts for, so a connected app can show its person which account it is connected to. A test key acts as the account's sandbox, which has none: `email` is null.
497
+ */
498
+ export const getIdentity = (options) => (options?.client ?? client).get({
499
+ security: [{ scheme: 'bearer', type: 'http' }],
500
+ url: '/identity',
501
+ ...options
502
+ });
503
+ /**
504
+ * Retrieve the credit balance
505
+ *
506
+ * 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.
507
+ */
508
+ export const getCredits = (options) => (options?.client ?? client).get({
509
+ security: [{ scheme: 'bearer', type: 'http' }],
510
+ url: '/credits',
511
+ ...options
512
+ });
513
+ /**
514
+ * List the credit history
515
+ *
516
+ * Every entry that moved the caller's balance, newest first, a page at a time: what added credits (the sign-up grant, packs, a plan's months) and what spent them (unlocks, conversions paid in credits), each with what it meant. Pass a page's `nextCursor` back as `cursor`. Their sum is the balance (`GET /credits`).
517
+ */
518
+ export const listCreditHistory = (options) => (options?.client ?? client).get({
519
+ security: [{ scheme: 'bearer', type: 'http' }],
520
+ url: '/credits/history',
521
+ ...options
522
+ });
523
+ /**
524
+ * Retrieve today's limits
525
+ *
526
+ * 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.
527
+ */
528
+ export const getLimits = (options) => (options?.client ?? client).get({
529
+ security: [{ scheme: 'bearer', type: 'http' }],
530
+ url: '/limits',
531
+ ...options
532
+ });