@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,243 @@
|
|
|
1
|
+
import type { Client, ClientMeta, Options as Options2, RequestResult, ServerSentEventsResult, TDataShape } from './client/index.ts';
|
|
2
|
+
import type { CancelConversionData, CancelConversionErrors, CancelConversionResponses, CreateConversionData, CreateConversionErrors, CreateConversionResponses, CreateConversionVariantData, CreateConversionVariantErrors, CreateConversionVariantResponses, CreateImageConversionData, CreateImageConversionErrors, CreateImageConversionResponses, CreatePaletteData, CreatePaletteErrors, CreatePaletteResponses, CreateUploadData, CreateUploadErrors, CreateUploadResponses, DeleteConversionData, DeleteConversionErrors, DeleteConversionResponses, DeleteImageData, DeleteImageErrors, DeleteImageResponses, DeleteImagesData, DeleteImagesErrors, DeleteImagesResponses, DeletePaletteData, DeletePaletteErrors, DeletePaletteResponses, DownloadConversionData, DownloadConversionErrors, DownloadConversionResponses, EraseImageData, EraseImageErrors, EraseImageResponses, EraseImagesData, EraseImagesErrors, EraseImagesResponses, GetConversionData, GetConversionErrors, GetConversionFactsData, GetConversionFactsErrors, GetConversionFactsResponses, GetConversionFeedbackData, GetConversionFeedbackErrors, GetConversionFeedbackResponses, GetConversionOriginalData, GetConversionOriginalErrors, GetConversionOriginalResponses, GetConversionPaintsData, GetConversionPaintsErrors, GetConversionPaintsResponses, GetConversionPaletteData, GetConversionPaletteErrors, GetConversionPaletteResponses, GetConversionResponses, GetConversionShapesData, GetConversionShapesErrors, GetConversionShapesResponses, GetConversionTilesData, GetConversionTilesErrors, GetConversionTilesResponses, GetCreditsData, GetCreditsErrors, GetCreditsResponses, GetImageData, GetImageErrors, GetImageResponses, GetLimitsData, GetLimitsErrors, GetLimitsResponses, ListConversionsData, ListConversionsErrors, ListConversionsResponses, ListConversionVariantsData, ListConversionVariantsErrors, ListConversionVariantsResponses, ListImagesData, ListImagesErrors, ListImagesResponses, ListPalettesData, ListPalettesErrors, ListPalettesResponses, PreviewConversionData, PreviewConversionErrors, PreviewConversionResponses, PutConversionFeedbackData, PutConversionFeedbackErrors, PutConversionFeedbackResponses, RenameImageData, RenameImageErrors, RenameImageResponses, RestoreImageData, RestoreImageErrors, RestoreImageResponses, RestoreImagesData, RestoreImagesErrors, RestoreImagesResponses, UnlockConversionData, UnlockConversionErrors, UnlockConversionResponses, UnlockImagesData, UnlockImagesErrors, UnlockImagesResponses, UpdatePaletteData, UpdatePaletteErrors, UpdatePaletteResponses, VectorizeData, VectorizeErrors, VectorizeResponses, WatchConversionData, WatchConversionResponse, WatchConversionResponses } from './types.gen.ts';
|
|
3
|
+
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
|
|
4
|
+
/**
|
|
5
|
+
* You can provide a client instance returned by `createClient()` instead of
|
|
6
|
+
* individual options. This might be also useful if you want to implement a
|
|
7
|
+
* custom client.
|
|
8
|
+
*/
|
|
9
|
+
client?: Client;
|
|
10
|
+
/**
|
|
11
|
+
* You can pass arbitrary values through the `meta` object. This can be
|
|
12
|
+
* used to access values that aren't defined as part of the SDK function.
|
|
13
|
+
*/
|
|
14
|
+
meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Vectorize an image
|
|
18
|
+
*
|
|
19
|
+
* 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.
|
|
20
|
+
*/
|
|
21
|
+
export declare const vectorize: <ThrowOnError extends boolean = false>(options: Options<VectorizeData, ThrowOnError>) => RequestResult<VectorizeResponses, VectorizeErrors, ThrowOnError>;
|
|
22
|
+
/**
|
|
23
|
+
* Create an upload
|
|
24
|
+
*
|
|
25
|
+
* 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.
|
|
26
|
+
*/
|
|
27
|
+
export declare const createUpload: <ThrowOnError extends boolean = false>(options: Options<CreateUploadData, ThrowOnError>) => RequestResult<CreateUploadResponses, CreateUploadErrors, ThrowOnError>;
|
|
28
|
+
/**
|
|
29
|
+
* List conversions
|
|
30
|
+
*
|
|
31
|
+
* 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).
|
|
32
|
+
*/
|
|
33
|
+
export declare const listConversions: <ThrowOnError extends boolean = false>(options?: Options<ListConversionsData, ThrowOnError>) => RequestResult<ListConversionsResponses, ListConversionsErrors, ThrowOnError>;
|
|
34
|
+
/**
|
|
35
|
+
* Create a conversion
|
|
36
|
+
*
|
|
37
|
+
* 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.
|
|
38
|
+
*/
|
|
39
|
+
export declare const createConversion: <ThrowOnError extends boolean = false>(options: Options<CreateConversionData, ThrowOnError>) => RequestResult<CreateConversionResponses, CreateConversionErrors, ThrowOnError>;
|
|
40
|
+
/**
|
|
41
|
+
* Delete a conversion
|
|
42
|
+
*
|
|
43
|
+
* 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.
|
|
44
|
+
*/
|
|
45
|
+
export declare const deleteConversion: <ThrowOnError extends boolean = false>(options: Options<DeleteConversionData, ThrowOnError>) => RequestResult<DeleteConversionResponses, DeleteConversionErrors, ThrowOnError>;
|
|
46
|
+
/**
|
|
47
|
+
* Retrieve a conversion
|
|
48
|
+
*
|
|
49
|
+
* 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.
|
|
50
|
+
*/
|
|
51
|
+
export declare const getConversion: <ThrowOnError extends boolean = false>(options: Options<GetConversionData, ThrowOnError>) => RequestResult<GetConversionResponses, GetConversionErrors, ThrowOnError>;
|
|
52
|
+
/**
|
|
53
|
+
* Cancel a waiting conversion
|
|
54
|
+
*
|
|
55
|
+
* 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.
|
|
56
|
+
*/
|
|
57
|
+
export declare const cancelConversion: <ThrowOnError extends boolean = false>(options: Options<CancelConversionData, ThrowOnError>) => RequestResult<CancelConversionResponses, CancelConversionErrors, ThrowOnError>;
|
|
58
|
+
/**
|
|
59
|
+
* Unlock a conversion's image
|
|
60
|
+
*
|
|
61
|
+
* 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.
|
|
62
|
+
*/
|
|
63
|
+
export declare const unlockConversion: <ThrowOnError extends boolean = false>(options: Options<UnlockConversionData, ThrowOnError>) => RequestResult<UnlockConversionResponses, UnlockConversionErrors, ThrowOnError>;
|
|
64
|
+
/**
|
|
65
|
+
* Watch a conversion
|
|
66
|
+
*
|
|
67
|
+
* 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.
|
|
68
|
+
*/
|
|
69
|
+
export declare const watchConversion: <ThrowOnError extends boolean = false>(options: Options<WatchConversionData, ThrowOnError, WatchConversionResponse>) => Promise<ServerSentEventsResult<WatchConversionResponses>>;
|
|
70
|
+
/**
|
|
71
|
+
* Download a file of the result
|
|
72
|
+
*
|
|
73
|
+
* 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.
|
|
74
|
+
*/
|
|
75
|
+
export declare const downloadConversion: <ThrowOnError extends boolean = false>(options: Options<DownloadConversionData, ThrowOnError>) => RequestResult<DownloadConversionResponses, DownloadConversionErrors, ThrowOnError>;
|
|
76
|
+
/**
|
|
77
|
+
* Preview the result
|
|
78
|
+
*
|
|
79
|
+
* 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).
|
|
80
|
+
*/
|
|
81
|
+
export declare const previewConversion: <ThrowOnError extends boolean = false>(options: Options<PreviewConversionData, ThrowOnError>) => RequestResult<PreviewConversionResponses, PreviewConversionErrors, ThrowOnError>;
|
|
82
|
+
/**
|
|
83
|
+
* Tiles of a deeper zoom
|
|
84
|
+
*
|
|
85
|
+
* 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.
|
|
86
|
+
*/
|
|
87
|
+
export declare const getConversionTiles: <ThrowOnError extends boolean = false>(options: Options<GetConversionTilesData, ThrowOnError>) => RequestResult<GetConversionTilesResponses, GetConversionTilesErrors, ThrowOnError>;
|
|
88
|
+
/**
|
|
89
|
+
* The original image
|
|
90
|
+
*
|
|
91
|
+
* 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`.
|
|
92
|
+
*/
|
|
93
|
+
export declare const getConversionOriginal: <ThrowOnError extends boolean = false>(options: Options<GetConversionOriginalData, ThrowOnError>) => RequestResult<GetConversionOriginalResponses, GetConversionOriginalErrors, ThrowOnError>;
|
|
94
|
+
/**
|
|
95
|
+
* The result's facts
|
|
96
|
+
*
|
|
97
|
+
* 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.
|
|
98
|
+
*/
|
|
99
|
+
export declare const getConversionFacts: <ThrowOnError extends boolean = false>(options: Options<GetConversionFactsData, ThrowOnError>) => RequestResult<GetConversionFactsResponses, GetConversionFactsErrors, ThrowOnError>;
|
|
100
|
+
/**
|
|
101
|
+
* The result's shapes
|
|
102
|
+
*
|
|
103
|
+
* 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.
|
|
104
|
+
*/
|
|
105
|
+
export declare const getConversionShapes: <ThrowOnError extends boolean = false>(options: Options<GetConversionShapesData, ThrowOnError>) => RequestResult<GetConversionShapesResponses, GetConversionShapesErrors, ThrowOnError>;
|
|
106
|
+
/**
|
|
107
|
+
* The result's paint map
|
|
108
|
+
*
|
|
109
|
+
* 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.
|
|
110
|
+
*/
|
|
111
|
+
export declare const getConversionPaints: <ThrowOnError extends boolean = false>(options: Options<GetConversionPaintsData, ThrowOnError>) => RequestResult<GetConversionPaintsResponses, GetConversionPaintsErrors, ThrowOnError>;
|
|
112
|
+
/**
|
|
113
|
+
* Preview fewer colors
|
|
114
|
+
*
|
|
115
|
+
* 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.
|
|
116
|
+
*/
|
|
117
|
+
export declare const getConversionPalette: <ThrowOnError extends boolean = false>(options: Options<GetConversionPaletteData, ThrowOnError>) => RequestResult<GetConversionPaletteResponses, GetConversionPaletteErrors, ThrowOnError>;
|
|
118
|
+
/**
|
|
119
|
+
* List a result's recolors
|
|
120
|
+
*
|
|
121
|
+
* 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).
|
|
122
|
+
*/
|
|
123
|
+
export declare const listConversionVariants: <ThrowOnError extends boolean = false>(options: Options<ListConversionVariantsData, ThrowOnError>) => RequestResult<ListConversionVariantsResponses, ListConversionVariantsErrors, ThrowOnError>;
|
|
124
|
+
/**
|
|
125
|
+
* Recolor a result
|
|
126
|
+
*
|
|
127
|
+
* `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=`).
|
|
128
|
+
*/
|
|
129
|
+
export declare const createConversionVariant: <ThrowOnError extends boolean = false>(options: Options<CreateConversionVariantData, ThrowOnError>) => RequestResult<CreateConversionVariantResponses, CreateConversionVariantErrors, ThrowOnError>;
|
|
130
|
+
/**
|
|
131
|
+
* Retrieve the verdict
|
|
132
|
+
*
|
|
133
|
+
* The caller's verdict on a result, or null.
|
|
134
|
+
*/
|
|
135
|
+
export declare const getConversionFeedback: <ThrowOnError extends boolean = false>(options: Options<GetConversionFeedbackData, ThrowOnError>) => RequestResult<GetConversionFeedbackResponses, GetConversionFeedbackErrors, ThrowOnError>;
|
|
136
|
+
/**
|
|
137
|
+
* Give a verdict
|
|
138
|
+
*
|
|
139
|
+
* 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.
|
|
140
|
+
*/
|
|
141
|
+
export declare const putConversionFeedback: <ThrowOnError extends boolean = false>(options: Options<PutConversionFeedbackData, ThrowOnError>) => RequestResult<PutConversionFeedbackResponses, PutConversionFeedbackErrors, ThrowOnError>;
|
|
142
|
+
/**
|
|
143
|
+
* List images
|
|
144
|
+
*
|
|
145
|
+
* 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).
|
|
146
|
+
*/
|
|
147
|
+
export declare const listImages: <ThrowOnError extends boolean = false>(options?: Options<ListImagesData, ThrowOnError>) => RequestResult<ListImagesResponses, ListImagesErrors, ThrowOnError>;
|
|
148
|
+
/**
|
|
149
|
+
* Delete an image
|
|
150
|
+
*
|
|
151
|
+
* 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.
|
|
152
|
+
*/
|
|
153
|
+
export declare const deleteImage: <ThrowOnError extends boolean = false>(options: Options<DeleteImageData, ThrowOnError>) => RequestResult<DeleteImageResponses, DeleteImageErrors, ThrowOnError>;
|
|
154
|
+
/**
|
|
155
|
+
* Retrieve an image
|
|
156
|
+
*
|
|
157
|
+
* One image, with every live version newest first.
|
|
158
|
+
*/
|
|
159
|
+
export declare const getImage: <ThrowOnError extends boolean = false>(options: Options<GetImageData, ThrowOnError>) => RequestResult<GetImageResponses, GetImageErrors, ThrowOnError>;
|
|
160
|
+
/**
|
|
161
|
+
* Name an image
|
|
162
|
+
*
|
|
163
|
+
* 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.
|
|
164
|
+
*/
|
|
165
|
+
export declare const renameImage: <ThrowOnError extends boolean = false>(options: Options<RenameImageData, ThrowOnError>) => RequestResult<RenameImageResponses, RenameImageErrors, ThrowOnError>;
|
|
166
|
+
/**
|
|
167
|
+
* Restore an image
|
|
168
|
+
*
|
|
169
|
+
* Back from Recently deleted, every version with it.
|
|
170
|
+
*/
|
|
171
|
+
export declare const restoreImage: <ThrowOnError extends boolean = false>(options: Options<RestoreImageData, ThrowOnError>) => RequestResult<RestoreImageResponses, RestoreImageErrors, ThrowOnError>;
|
|
172
|
+
/**
|
|
173
|
+
* Erase an image now
|
|
174
|
+
*
|
|
175
|
+
* 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).
|
|
176
|
+
*/
|
|
177
|
+
export declare const eraseImage: <ThrowOnError extends boolean = false>(options: Options<EraseImageData, ThrowOnError>) => RequestResult<EraseImageResponses, EraseImageErrors, ThrowOnError>;
|
|
178
|
+
/**
|
|
179
|
+
* Convert an image again
|
|
180
|
+
*
|
|
181
|
+
* 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.
|
|
182
|
+
*/
|
|
183
|
+
export declare const createImageConversion: <ThrowOnError extends boolean = false>(options: Options<CreateImageConversionData, ThrowOnError>) => RequestResult<CreateImageConversionResponses, CreateImageConversionErrors, ThrowOnError>;
|
|
184
|
+
/**
|
|
185
|
+
* Unlock several images
|
|
186
|
+
*
|
|
187
|
+
* 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.
|
|
188
|
+
*/
|
|
189
|
+
export declare const unlockImages: <ThrowOnError extends boolean = false>(options: Options<UnlockImagesData, ThrowOnError>) => RequestResult<UnlockImagesResponses, UnlockImagesErrors, ThrowOnError>;
|
|
190
|
+
/**
|
|
191
|
+
* Delete several images
|
|
192
|
+
*
|
|
193
|
+
* 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`.
|
|
194
|
+
*/
|
|
195
|
+
export declare const deleteImages: <ThrowOnError extends boolean = false>(options: Options<DeleteImagesData, ThrowOnError>) => RequestResult<DeleteImagesResponses, DeleteImagesErrors, ThrowOnError>;
|
|
196
|
+
/**
|
|
197
|
+
* Restore several images
|
|
198
|
+
*
|
|
199
|
+
* 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.
|
|
200
|
+
*/
|
|
201
|
+
export declare const restoreImages: <ThrowOnError extends boolean = false>(options: Options<RestoreImagesData, ThrowOnError>) => RequestResult<RestoreImagesResponses, RestoreImagesErrors, ThrowOnError>;
|
|
202
|
+
/**
|
|
203
|
+
* Erase images now
|
|
204
|
+
*
|
|
205
|
+
* 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.
|
|
206
|
+
*/
|
|
207
|
+
export declare const eraseImages: <ThrowOnError extends boolean = false>(options: Options<EraseImagesData, ThrowOnError>) => RequestResult<EraseImagesResponses, EraseImagesErrors, ThrowOnError>;
|
|
208
|
+
/**
|
|
209
|
+
* List palettes
|
|
210
|
+
*
|
|
211
|
+
* The account's palettes, the last changed first: at most 20, in one page.
|
|
212
|
+
*/
|
|
213
|
+
export declare const listPalettes: <ThrowOnError extends boolean = false>(options?: Options<ListPalettesData, ThrowOnError>) => RequestResult<ListPalettesResponses, ListPalettesErrors, ThrowOnError>;
|
|
214
|
+
/**
|
|
215
|
+
* Save a palette
|
|
216
|
+
*
|
|
217
|
+
* A new palette; an account keeps at most 20 (409 `palette_limit`).
|
|
218
|
+
*/
|
|
219
|
+
export declare const createPalette: <ThrowOnError extends boolean = false>(options: Options<CreatePaletteData, ThrowOnError>) => RequestResult<CreatePaletteResponses, CreatePaletteErrors, ThrowOnError>;
|
|
220
|
+
/**
|
|
221
|
+
* Delete a palette
|
|
222
|
+
*
|
|
223
|
+
* Removed for good. Another's is 404 `palette_not_found`, the same as none.
|
|
224
|
+
*/
|
|
225
|
+
export declare const deletePalette: <ThrowOnError extends boolean = false>(options: Options<DeletePaletteData, ThrowOnError>) => RequestResult<DeletePaletteResponses, DeletePaletteErrors, ThrowOnError>;
|
|
226
|
+
/**
|
|
227
|
+
* Change a palette
|
|
228
|
+
*
|
|
229
|
+
* Its name and colors, whole. Another's is 404 `palette_not_found`, the same as none.
|
|
230
|
+
*/
|
|
231
|
+
export declare const updatePalette: <ThrowOnError extends boolean = false>(options: Options<UpdatePaletteData, ThrowOnError>) => RequestResult<UpdatePaletteResponses, UpdatePaletteErrors, ThrowOnError>;
|
|
232
|
+
/**
|
|
233
|
+
* Retrieve the credit balance
|
|
234
|
+
*
|
|
235
|
+
* 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.
|
|
236
|
+
*/
|
|
237
|
+
export declare const getCredits: <ThrowOnError extends boolean = false>(options?: Options<GetCreditsData, ThrowOnError>) => RequestResult<GetCreditsResponses, GetCreditsErrors, ThrowOnError>;
|
|
238
|
+
/**
|
|
239
|
+
* Retrieve today's limits
|
|
240
|
+
*
|
|
241
|
+
* 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.
|
|
242
|
+
*/
|
|
243
|
+
export declare const getLimits: <ThrowOnError extends boolean = false>(options?: Options<GetLimitsData, ThrowOnError>) => RequestResult<GetLimitsResponses, GetLimitsErrors, ThrowOnError>;
|