@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.
- package/README.md +32 -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 +297 -0
- package/dist/generated/sdk.gen.js +532 -0
- package/dist/generated/types.gen.d.ts +6850 -0
- package/dist/generated/types.gen.js +2 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.js +229 -0
- package/dist/webhooks.d.ts +29 -0
- package/dist/webhooks.js +69 -0
- package/package.json +40 -4
|
@@ -0,0 +1,297 @@
|
|
|
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, GetConversionAnchorsData, GetConversionAnchorsErrors, GetConversionAnchorsResponses, GetConversionCleanedData, GetConversionCleanedErrors, GetConversionCleanedResponses, GetConversionData, GetConversionErrors, GetConversionFactsData, GetConversionFactsErrors, GetConversionFactsResponses, GetConversionFeedbackData, GetConversionFeedbackErrors, GetConversionFeedbackResponses, GetConversionMachinesData, GetConversionMachinesErrors, GetConversionMachinesResponses, GetConversionOriginalData, GetConversionOriginalErrors, GetConversionOriginalFactsData, GetConversionOriginalFactsErrors, GetConversionOriginalFactsResponses, GetConversionOriginalResponses, GetConversionPaintsData, GetConversionPaintsErrors, GetConversionPaintsResponses, GetConversionPaletteData, GetConversionPaletteErrors, GetConversionPaletteResponses, GetConversionResponses, GetConversionShapesData, GetConversionShapesErrors, GetConversionShapesResponses, GetConversionTileBatchData, GetConversionTileBatchErrors, GetConversionTileBatchResponses, GetConversionTilesData, GetConversionTilesErrors, GetConversionTilesResponses, GetCreditsData, GetCreditsErrors, GetCreditsResponses, GetIdentityData, GetIdentityErrors, GetIdentityResponses, GetImageData, GetImageErrors, GetImageResponses, GetLimitsData, GetLimitsErrors, GetLimitsResponses, LiftConversionShapeData, LiftConversionShapeErrors, LiftConversionShapeResponses, ListConversionsData, ListConversionsErrors, ListConversionsResponses, ListConversionVariantsData, ListConversionVariantsErrors, ListConversionVariantsResponses, ListCreditHistoryData, ListCreditHistoryErrors, ListCreditHistoryResponses, ListImagesData, ListImagesErrors, ListImagesResponses, ListPalettesData, ListPalettesErrors, ListPalettesResponses, PreviewConversionData, PreviewConversionErrors, PreviewConversionResponses, PutConversionFeedbackData, PutConversionFeedbackErrors, PutConversionFeedbackResponses, RenameImageData, RenameImageErrors, RenameImageResponses, RestoreImageData, RestoreImageErrors, RestoreImageResponses, RestoreImagesData, RestoreImagesErrors, RestoreImagesResponses, TryConversionEditsData, TryConversionEditsErrors, TryConversionEditsResponses, 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 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.
|
|
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`; 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.
|
|
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). 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.
|
|
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). `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.
|
|
80
|
+
*/
|
|
81
|
+
export declare const previewConversion: <ThrowOnError extends boolean = false>(options: Options<PreviewConversionData, ThrowOnError>) => RequestResult<PreviewConversionResponses, PreviewConversionErrors, ThrowOnError>;
|
|
82
|
+
/**
|
|
83
|
+
* Figures for each machine
|
|
84
|
+
*
|
|
85
|
+
* 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`).
|
|
86
|
+
*/
|
|
87
|
+
export declare const getConversionMachines: <ThrowOnError extends boolean = false>(options: Options<GetConversionMachinesData, ThrowOnError>) => RequestResult<GetConversionMachinesResponses, GetConversionMachinesErrors, ThrowOnError>;
|
|
88
|
+
/**
|
|
89
|
+
* Tiles of a deeper zoom
|
|
90
|
+
*
|
|
91
|
+
* 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.
|
|
92
|
+
*/
|
|
93
|
+
export declare const getConversionTiles: <ThrowOnError extends boolean = false>(options: Options<GetConversionTilesData, ThrowOnError>) => RequestResult<GetConversionTilesResponses, GetConversionTilesErrors, ThrowOnError>;
|
|
94
|
+
/**
|
|
95
|
+
* Tiles of several layers at once
|
|
96
|
+
*
|
|
97
|
+
* 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).
|
|
98
|
+
*/
|
|
99
|
+
export declare const getConversionTileBatch: <ThrowOnError extends boolean = false>(options: Options<GetConversionTileBatchData, ThrowOnError>) => RequestResult<GetConversionTileBatchResponses, GetConversionTileBatchErrors, ThrowOnError>;
|
|
100
|
+
/**
|
|
101
|
+
* The original image
|
|
102
|
+
*
|
|
103
|
+
* 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`.
|
|
104
|
+
*/
|
|
105
|
+
export declare const getConversionOriginal: <ThrowOnError extends boolean = false>(options: Options<GetConversionOriginalData, ThrowOnError>) => RequestResult<GetConversionOriginalResponses, GetConversionOriginalErrors, ThrowOnError>;
|
|
106
|
+
/**
|
|
107
|
+
* What an uploaded SVG was
|
|
108
|
+
*
|
|
109
|
+
* 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.
|
|
110
|
+
*/
|
|
111
|
+
export declare const getConversionOriginalFacts: <ThrowOnError extends boolean = false>(options: Options<GetConversionOriginalFactsData, ThrowOnError>) => RequestResult<GetConversionOriginalFactsResponses, GetConversionOriginalFactsErrors, ThrowOnError>;
|
|
112
|
+
/**
|
|
113
|
+
* The result's facts
|
|
114
|
+
*
|
|
115
|
+
* 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.
|
|
116
|
+
*/
|
|
117
|
+
export declare const getConversionFacts: <ThrowOnError extends boolean = false>(options: Options<GetConversionFactsData, ThrowOnError>) => RequestResult<GetConversionFactsResponses, GetConversionFactsErrors, ThrowOnError>;
|
|
118
|
+
/**
|
|
119
|
+
* What a Clean did
|
|
120
|
+
*
|
|
121
|
+
* 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`.
|
|
122
|
+
*/
|
|
123
|
+
export declare const getConversionCleaned: <ThrowOnError extends boolean = false>(options: Options<GetConversionCleanedData, ThrowOnError>) => RequestResult<GetConversionCleanedResponses, GetConversionCleanedErrors, ThrowOnError>;
|
|
124
|
+
/**
|
|
125
|
+
* The result's shapes
|
|
126
|
+
*
|
|
127
|
+
* 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.
|
|
128
|
+
*/
|
|
129
|
+
export declare const getConversionShapes: <ThrowOnError extends boolean = false>(options: Options<GetConversionShapesData, ThrowOnError>) => RequestResult<GetConversionShapesResponses, GetConversionShapesErrors, ThrowOnError>;
|
|
130
|
+
/**
|
|
131
|
+
* Lift a shape
|
|
132
|
+
*
|
|
133
|
+
* 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).
|
|
134
|
+
*/
|
|
135
|
+
export declare const liftConversionShape: <ThrowOnError extends boolean = false>(options: Options<LiftConversionShapeData, ThrowOnError>) => RequestResult<LiftConversionShapeResponses, LiftConversionShapeErrors, ThrowOnError>;
|
|
136
|
+
/**
|
|
137
|
+
* Read a shape's anchors
|
|
138
|
+
*
|
|
139
|
+
* 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.
|
|
140
|
+
*/
|
|
141
|
+
export declare const getConversionAnchors: <ThrowOnError extends boolean = false>(options: Options<GetConversionAnchorsData, ThrowOnError>) => RequestResult<GetConversionAnchorsResponses, GetConversionAnchorsErrors, ThrowOnError>;
|
|
142
|
+
/**
|
|
143
|
+
* Try edits
|
|
144
|
+
*
|
|
145
|
+
* 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).
|
|
146
|
+
*/
|
|
147
|
+
export declare const tryConversionEdits: <ThrowOnError extends boolean = false>(options: Options<TryConversionEditsData, ThrowOnError>) => RequestResult<TryConversionEditsResponses, TryConversionEditsErrors, ThrowOnError>;
|
|
148
|
+
/**
|
|
149
|
+
* The result's paint map
|
|
150
|
+
*
|
|
151
|
+
* 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.
|
|
152
|
+
*/
|
|
153
|
+
export declare const getConversionPaints: <ThrowOnError extends boolean = false>(options: Options<GetConversionPaintsData, ThrowOnError>) => RequestResult<GetConversionPaintsResponses, GetConversionPaintsErrors, ThrowOnError>;
|
|
154
|
+
/**
|
|
155
|
+
* Preview fewer colors
|
|
156
|
+
*
|
|
157
|
+
* 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.
|
|
158
|
+
*/
|
|
159
|
+
export declare const getConversionPalette: <ThrowOnError extends boolean = false>(options: Options<GetConversionPaletteData, ThrowOnError>) => RequestResult<GetConversionPaletteResponses, GetConversionPaletteErrors, ThrowOnError>;
|
|
160
|
+
/**
|
|
161
|
+
* List a result's recolors
|
|
162
|
+
*
|
|
163
|
+
* 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).
|
|
164
|
+
*/
|
|
165
|
+
export declare const listConversionVariants: <ThrowOnError extends boolean = false>(options: Options<ListConversionVariantsData, ThrowOnError>) => RequestResult<ListConversionVariantsResponses, ListConversionVariantsErrors, ThrowOnError>;
|
|
166
|
+
/**
|
|
167
|
+
* Change a result: recolor it, edit its shapes
|
|
168
|
+
*
|
|
169
|
+
* 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.
|
|
170
|
+
*/
|
|
171
|
+
export declare const createConversionVariant: <ThrowOnError extends boolean = false>(options: Options<CreateConversionVariantData, ThrowOnError>) => RequestResult<CreateConversionVariantResponses, CreateConversionVariantErrors, ThrowOnError>;
|
|
172
|
+
/**
|
|
173
|
+
* Retrieve the verdict
|
|
174
|
+
*
|
|
175
|
+
* The caller's verdict on a result, or null.
|
|
176
|
+
*/
|
|
177
|
+
export declare const getConversionFeedback: <ThrowOnError extends boolean = false>(options: Options<GetConversionFeedbackData, ThrowOnError>) => RequestResult<GetConversionFeedbackResponses, GetConversionFeedbackErrors, ThrowOnError>;
|
|
178
|
+
/**
|
|
179
|
+
* Give a verdict
|
|
180
|
+
*
|
|
181
|
+
* 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.
|
|
182
|
+
*/
|
|
183
|
+
export declare const putConversionFeedback: <ThrowOnError extends boolean = false>(options: Options<PutConversionFeedbackData, ThrowOnError>) => RequestResult<PutConversionFeedbackResponses, PutConversionFeedbackErrors, ThrowOnError>;
|
|
184
|
+
/**
|
|
185
|
+
* List images
|
|
186
|
+
*
|
|
187
|
+
* 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).
|
|
188
|
+
*/
|
|
189
|
+
export declare const listImages: <ThrowOnError extends boolean = false>(options?: Options<ListImagesData, ThrowOnError>) => RequestResult<ListImagesResponses, ListImagesErrors, ThrowOnError>;
|
|
190
|
+
/**
|
|
191
|
+
* Delete an image
|
|
192
|
+
*
|
|
193
|
+
* 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.
|
|
194
|
+
*/
|
|
195
|
+
export declare const deleteImage: <ThrowOnError extends boolean = false>(options: Options<DeleteImageData, ThrowOnError>) => RequestResult<DeleteImageResponses, DeleteImageErrors, ThrowOnError>;
|
|
196
|
+
/**
|
|
197
|
+
* Retrieve an image
|
|
198
|
+
*
|
|
199
|
+
* One image, with every live version newest first.
|
|
200
|
+
*/
|
|
201
|
+
export declare const getImage: <ThrowOnError extends boolean = false>(options: Options<GetImageData, ThrowOnError>) => RequestResult<GetImageResponses, GetImageErrors, ThrowOnError>;
|
|
202
|
+
/**
|
|
203
|
+
* Name an image
|
|
204
|
+
*
|
|
205
|
+
* 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.
|
|
206
|
+
*/
|
|
207
|
+
export declare const renameImage: <ThrowOnError extends boolean = false>(options: Options<RenameImageData, ThrowOnError>) => RequestResult<RenameImageResponses, RenameImageErrors, ThrowOnError>;
|
|
208
|
+
/**
|
|
209
|
+
* Restore an image
|
|
210
|
+
*
|
|
211
|
+
* Back from Recently deleted, every version with it.
|
|
212
|
+
*/
|
|
213
|
+
export declare const restoreImage: <ThrowOnError extends boolean = false>(options: Options<RestoreImageData, ThrowOnError>) => RequestResult<RestoreImageResponses, RestoreImageErrors, ThrowOnError>;
|
|
214
|
+
/**
|
|
215
|
+
* Erase an image now
|
|
216
|
+
*
|
|
217
|
+
* 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).
|
|
218
|
+
*/
|
|
219
|
+
export declare const eraseImage: <ThrowOnError extends boolean = false>(options: Options<EraseImageData, ThrowOnError>) => RequestResult<EraseImageResponses, EraseImageErrors, ThrowOnError>;
|
|
220
|
+
/**
|
|
221
|
+
* Convert an image again
|
|
222
|
+
*
|
|
223
|
+
* 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.
|
|
224
|
+
*/
|
|
225
|
+
export declare const createImageConversion: <ThrowOnError extends boolean = false>(options: Options<CreateImageConversionData, ThrowOnError>) => RequestResult<CreateImageConversionResponses, CreateImageConversionErrors, ThrowOnError>;
|
|
226
|
+
/**
|
|
227
|
+
* Unlock several images
|
|
228
|
+
*
|
|
229
|
+
* 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.
|
|
230
|
+
*/
|
|
231
|
+
export declare const unlockImages: <ThrowOnError extends boolean = false>(options: Options<UnlockImagesData, ThrowOnError>) => RequestResult<UnlockImagesResponses, UnlockImagesErrors, ThrowOnError>;
|
|
232
|
+
/**
|
|
233
|
+
* Delete several images
|
|
234
|
+
*
|
|
235
|
+
* 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`.
|
|
236
|
+
*/
|
|
237
|
+
export declare const deleteImages: <ThrowOnError extends boolean = false>(options: Options<DeleteImagesData, ThrowOnError>) => RequestResult<DeleteImagesResponses, DeleteImagesErrors, ThrowOnError>;
|
|
238
|
+
/**
|
|
239
|
+
* Restore several images
|
|
240
|
+
*
|
|
241
|
+
* 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.
|
|
242
|
+
*/
|
|
243
|
+
export declare const restoreImages: <ThrowOnError extends boolean = false>(options: Options<RestoreImagesData, ThrowOnError>) => RequestResult<RestoreImagesResponses, RestoreImagesErrors, ThrowOnError>;
|
|
244
|
+
/**
|
|
245
|
+
* Erase images now
|
|
246
|
+
*
|
|
247
|
+
* 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.
|
|
248
|
+
*/
|
|
249
|
+
export declare const eraseImages: <ThrowOnError extends boolean = false>(options: Options<EraseImagesData, ThrowOnError>) => RequestResult<EraseImagesResponses, EraseImagesErrors, ThrowOnError>;
|
|
250
|
+
/**
|
|
251
|
+
* List palettes
|
|
252
|
+
*
|
|
253
|
+
* The account's palettes, the last changed first: at most 20, in one page.
|
|
254
|
+
*/
|
|
255
|
+
export declare const listPalettes: <ThrowOnError extends boolean = false>(options?: Options<ListPalettesData, ThrowOnError>) => RequestResult<ListPalettesResponses, ListPalettesErrors, ThrowOnError>;
|
|
256
|
+
/**
|
|
257
|
+
* Save a palette
|
|
258
|
+
*
|
|
259
|
+
* A new palette; an account keeps at most 20 (409 `palette_limit`).
|
|
260
|
+
*/
|
|
261
|
+
export declare const createPalette: <ThrowOnError extends boolean = false>(options: Options<CreatePaletteData, ThrowOnError>) => RequestResult<CreatePaletteResponses, CreatePaletteErrors, ThrowOnError>;
|
|
262
|
+
/**
|
|
263
|
+
* Delete a palette
|
|
264
|
+
*
|
|
265
|
+
* Removed for good. Another's is 404 `palette_not_found`, the same as none.
|
|
266
|
+
*/
|
|
267
|
+
export declare const deletePalette: <ThrowOnError extends boolean = false>(options: Options<DeletePaletteData, ThrowOnError>) => RequestResult<DeletePaletteResponses, DeletePaletteErrors, ThrowOnError>;
|
|
268
|
+
/**
|
|
269
|
+
* Change a palette
|
|
270
|
+
*
|
|
271
|
+
* Its name and colors, whole. Another's is 404 `palette_not_found`, the same as none.
|
|
272
|
+
*/
|
|
273
|
+
export declare const updatePalette: <ThrowOnError extends boolean = false>(options: Options<UpdatePaletteData, ThrowOnError>) => RequestResult<UpdatePaletteResponses, UpdatePaletteErrors, ThrowOnError>;
|
|
274
|
+
/**
|
|
275
|
+
* Retrieve whose account this is
|
|
276
|
+
*
|
|
277
|
+
* 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.
|
|
278
|
+
*/
|
|
279
|
+
export declare const getIdentity: <ThrowOnError extends boolean = false>(options?: Options<GetIdentityData, ThrowOnError>) => RequestResult<GetIdentityResponses, GetIdentityErrors, ThrowOnError>;
|
|
280
|
+
/**
|
|
281
|
+
* Retrieve the credit balance
|
|
282
|
+
*
|
|
283
|
+
* 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.
|
|
284
|
+
*/
|
|
285
|
+
export declare const getCredits: <ThrowOnError extends boolean = false>(options?: Options<GetCreditsData, ThrowOnError>) => RequestResult<GetCreditsResponses, GetCreditsErrors, ThrowOnError>;
|
|
286
|
+
/**
|
|
287
|
+
* List the credit history
|
|
288
|
+
*
|
|
289
|
+
* 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`).
|
|
290
|
+
*/
|
|
291
|
+
export declare const listCreditHistory: <ThrowOnError extends boolean = false>(options?: Options<ListCreditHistoryData, ThrowOnError>) => RequestResult<ListCreditHistoryResponses, ListCreditHistoryErrors, ThrowOnError>;
|
|
292
|
+
/**
|
|
293
|
+
* Retrieve today's limits
|
|
294
|
+
*
|
|
295
|
+
* 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.
|
|
296
|
+
*/
|
|
297
|
+
export declare const getLimits: <ThrowOnError extends boolean = false>(options?: Options<GetLimitsData, ThrowOnError>) => RequestResult<GetLimitsResponses, GetLimitsErrors, ThrowOnError>;
|