@gepetto/sdk 0.1.3 → 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 +18 -0
- package/dist/index.cjs +13 -1
- package/dist/index.d.cts +66 -5
- package/dist/index.d.ts +66 -5
- package/dist/index.js +13 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -80,6 +80,23 @@ await gepetto.enhance(
|
|
|
80
80
|
|
|
81
81
|
A key always answers the job it first started, whatever the tool and even if that render failed: use one key per photo and per tool, and a new key to try a failed render again.
|
|
82
82
|
|
|
83
|
+
## Videos
|
|
84
|
+
|
|
85
|
+
Two 6-second videos, as MP4. They need a live key (a test key gets `live_key_required`) and take 2 to 10 minutes: the method waits up to 30 minutes, or returns at once with `webhook`.
|
|
86
|
+
|
|
87
|
+
| Method | What it does |
|
|
88
|
+
| --- | --- |
|
|
89
|
+
| `cameraMove({ url, camera, timelapse?, resolution? })` | A slow camera move in the photo (`zoom_in`, `zoom_out`, `crane_up`, `crab_left`...), 0.80 € |
|
|
90
|
+
| `transition({ jobId, transitionId })` | From the original of a finished render to its result, 1.60 € |
|
|
91
|
+
| `transition({ url, endUrl, prompt })` | From one photo to another, with your own animation |
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
const staged = await gepetto.furnish({ url, roomId: 'living_room', styleId: 'scandinave' });
|
|
95
|
+
const transitions = await gepetto.listTransitions(); // the animations, with their names
|
|
96
|
+
const video = await gepetto.transition({ jobId: staged.id, transitionId: transitions[0].id });
|
|
97
|
+
console.log(video.output); // https://assets.gepettoapp.com/api/v2/jobs/.../output.mp4
|
|
98
|
+
```
|
|
99
|
+
|
|
83
100
|
## Lists
|
|
84
101
|
|
|
85
102
|
The valid ids, with their names in French, English, Spanish, Portuguese and German:
|
|
@@ -89,6 +106,7 @@ await gepetto.listRooms(); // [{ id: 'living_room', name_en: 'Living room',
|
|
|
89
106
|
await gepetto.listStyles();
|
|
90
107
|
await gepetto.listFurnitures(); // grouped by type: { interior: [...], kitchen: [...], ... }
|
|
91
108
|
await gepetto.listSkies();
|
|
109
|
+
await gepetto.listTransitions(); // for transition
|
|
92
110
|
await gepetto.listSurfaces(); // { walls, floors, finishes }
|
|
93
111
|
```
|
|
94
112
|
|
package/dist/index.cjs
CHANGED
|
@@ -8,10 +8,12 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.Gepetto = exports.GepettoError = exports.VERSION = void 0;
|
|
10
10
|
exports.verifyWebhook = verifyWebhook;
|
|
11
|
-
exports.VERSION = '0.
|
|
11
|
+
exports.VERSION = '0.2.0';
|
|
12
12
|
const DEFAULT_BASE_URL = 'https://europe-west1-gepettoai.cloudfunctions.net/v2';
|
|
13
13
|
/** A render is stopped by the API after 450 s: 10 minutes covers it, retries included. */
|
|
14
14
|
const DEFAULT_TIMEOUT_MS = 10 * 60 * 1000;
|
|
15
|
+
/** A video takes 2 to 10 minutes; the API gives it up after 30. */
|
|
16
|
+
const VIDEO_TIMEOUT_MS = 30 * 60 * 1000;
|
|
15
17
|
const DEFAULT_MAX_RETRIES = 2;
|
|
16
18
|
const POLL_INTERVAL_MS = 2500;
|
|
17
19
|
/**
|
|
@@ -105,6 +107,12 @@ class Gepetto {
|
|
|
105
107
|
upscale(params, options) {
|
|
106
108
|
return this.#render('/upscale', params, options);
|
|
107
109
|
}
|
|
110
|
+
cameraMove(params, options = {}) {
|
|
111
|
+
return this.#render('/video/camera-move', params, { ...options, timeout: options.timeout ?? VIDEO_TIMEOUT_MS });
|
|
112
|
+
}
|
|
113
|
+
transition(params, options = {}) {
|
|
114
|
+
return this.#render('/video/transition', params, { ...options, timeout: options.timeout ?? VIDEO_TIMEOUT_MS });
|
|
115
|
+
}
|
|
108
116
|
// --- Jobs
|
|
109
117
|
/** A job as it is now. */
|
|
110
118
|
async getJob(id, options = {}) {
|
|
@@ -139,6 +147,10 @@ class Gepetto {
|
|
|
139
147
|
listSkies() {
|
|
140
148
|
return this.#get('/skies');
|
|
141
149
|
}
|
|
150
|
+
/** The animations of `transition`, for `transitionId`. */
|
|
151
|
+
listTransitions() {
|
|
152
|
+
return this.#get('/video/transitions');
|
|
153
|
+
}
|
|
142
154
|
/** Wall colours, floors and finishes, for `surfaces`. */
|
|
143
155
|
listSurfaces() {
|
|
144
156
|
return this.#get('/surfaces');
|
package/dist/index.d.cts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Methods and fields have the names of the API: what the docs say of an endpoint is true of the method.
|
|
6
6
|
*/
|
|
7
|
-
export declare const VERSION = "0.
|
|
7
|
+
export declare const VERSION = "0.2.0";
|
|
8
8
|
/** Rooms of `GET /rooms`. */
|
|
9
9
|
export type KnownRoomId = 'bar' | 'bath_room' | 'bedroom' | 'clothing_store' | 'coworking_space' | 'dining_room' | 'dressing' | 'gaming_room' | 'hall' | 'home_office' | 'kitchen' | 'kitchen_living' | 'living_dining' | 'living_room' | 'meeting_room' | 'office' | 'optician' | 'osteopathy_clinic' | 'outdoor_garden' | 'outdoor_piscine' | 'outdoor_snowy_garden' | 'outdoor_terrace' | 'psychologist_office' | 'restaurant' | 'salle_de_sport' | 'shoe_store' | 'teenager_bedroom' | 'toilet';
|
|
10
10
|
/** Rooms that can be furnished whole, without a mask (mode `auto`). */
|
|
@@ -32,7 +32,7 @@ export type SkyId = OrString<KnownSkyId>;
|
|
|
32
32
|
export type WallTypeId = OrString<KnownWallTypeId>;
|
|
33
33
|
export type FloorTypeId = OrString<KnownFloorTypeId>;
|
|
34
34
|
export type FinishId = OrString<KnownFinishId>;
|
|
35
|
-
export type Tool = 'declutter' | 'furnish' | 'sunshine' | 'creative-redesign' | 'surfaces' | 'enhance' | 'upscale';
|
|
35
|
+
export type Tool = 'declutter' | 'furnish' | 'sunshine' | 'creative-redesign' | 'surfaces' | 'enhance' | 'upscale' | 'camera-move' | 'transition';
|
|
36
36
|
export type JobStatus = 'pending' | 'processing' | 'success' | 'error';
|
|
37
37
|
/** A render, as the API returns it (synchronous answer, `GET /job/{id}`, webhook body). */
|
|
38
38
|
export interface Job {
|
|
@@ -40,9 +40,11 @@ export interface Job {
|
|
|
40
40
|
status: JobStatus;
|
|
41
41
|
tool: Tool;
|
|
42
42
|
/** declutter and furnish: `auto` or `zone`; sunshine: the sky id; surfaces: `walls`, `floor` or `finish`;
|
|
43
|
-
* enhance: `straighten` or null; upscale: `2k` or `4k`; creative-redesign: null
|
|
43
|
+
* enhance: `straighten` or null; upscale: `2k` or `4k`; creative-redesign: null; camera-move: the camera;
|
|
44
|
+
* transition: the transitionId, or `custom`. */
|
|
44
45
|
mode: string | null;
|
|
45
|
-
/** The image, once `status` is `success`. Public URL: copy it to
|
|
46
|
+
/** The image (an MP4 video for camera-move and transition), once `status` is `success`. Public URL: copy it to
|
|
47
|
+
* your storage if you keep it. */
|
|
46
48
|
output: string | null;
|
|
47
49
|
error: {
|
|
48
50
|
code: string;
|
|
@@ -142,6 +144,47 @@ export interface UpscaleParams extends Common {
|
|
|
142
144
|
/** About 4 megapixels (`2k`) or 16 megapixels (`4k`, the default). */
|
|
143
145
|
resolution?: '2k' | '4k';
|
|
144
146
|
}
|
|
147
|
+
/** The camera moves of `cameraMove`. */
|
|
148
|
+
export type CameraMove = 'zoom_in' | 'zoom_out' | 'zoom_in_pan_left' | 'zoom_in_pan_right' | 'crane_up' | 'crane_down' | 'crab_left' | 'crab_right';
|
|
149
|
+
export interface CameraMoveParams extends Common {
|
|
150
|
+
camera: CameraMove;
|
|
151
|
+
/** The hours of the day passing, with the lights turning on, ending at night. */
|
|
152
|
+
timelapse?: boolean;
|
|
153
|
+
/** `1080p` by default. */
|
|
154
|
+
resolution?: '768p' | '1080p';
|
|
155
|
+
}
|
|
156
|
+
/** The two images of a transition: a finished job of your account, or two URLs of the same proportions. */
|
|
157
|
+
type TransitionImages = {
|
|
158
|
+
/** A finished image job: its original goes to its result. */
|
|
159
|
+
jobId: string;
|
|
160
|
+
url?: undefined;
|
|
161
|
+
endUrl?: undefined;
|
|
162
|
+
} | {
|
|
163
|
+
/** The photo before. */
|
|
164
|
+
url: ImageUrl;
|
|
165
|
+
/** The photo after, same proportions. */
|
|
166
|
+
endUrl: ImageUrl;
|
|
167
|
+
jobId?: undefined;
|
|
168
|
+
};
|
|
169
|
+
/** The animation: one of `listTransitions()`, or your own prompt. */
|
|
170
|
+
type TransitionAnimation = {
|
|
171
|
+
transitionId: string;
|
|
172
|
+
prompt?: undefined;
|
|
173
|
+
negativePrompt?: undefined;
|
|
174
|
+
} | {
|
|
175
|
+
/** Your own animation, in English (2000 characters at most), sent as it is. */
|
|
176
|
+
prompt: string;
|
|
177
|
+
/** What the video must avoid. */
|
|
178
|
+
negativePrompt?: string;
|
|
179
|
+
transitionId?: undefined;
|
|
180
|
+
};
|
|
181
|
+
export type TransitionParams = TransitionImages & TransitionAnimation & {
|
|
182
|
+
webhook?: string | URL;
|
|
183
|
+
};
|
|
184
|
+
export interface Transition extends NamedItem {
|
|
185
|
+
/** A sample video, when there is one. */
|
|
186
|
+
preview: string | null;
|
|
187
|
+
}
|
|
145
188
|
/** Options of one call. */
|
|
146
189
|
export interface RequestOptions {
|
|
147
190
|
/** Any unique string (your photo id, for example): the same key never starts, nor bills, a second render. One is
|
|
@@ -224,7 +267,7 @@ export interface Usage {
|
|
|
224
267
|
}
|
|
225
268
|
/** Codes of the API (docs: Errors), plus those of the SDK itself: `connection_error`, `timeout`, `aborted`,
|
|
226
269
|
* `invalid_response`, `invalid_signature`. */
|
|
227
|
-
export type ErrorCode = OrString<'missing_parameter' | 'invalid_parameter' | 'invalid_url' | 'private_url' | 'image_unreachable' | 'unsupported_image' | 'image_too_large' | 'mask_size_mismatch' | 'empty_mask' | 'unknown_room' | 'mode_not_available' | 'unknown_style' | 'unknown_furniture' | 'unknown_sky' | 'unknown_wall_type' | 'unknown_floor_type' | 'unknown_finish' | 'missing_api_key' | 'invalid_api_key' | 'api_key_inactive' | 'test_limit_reached' | 'api_v2_subscription_required' | 'job_not_found' | 'not_found' | 'account_not_found' | 'already_subscribed' | 'api_v1_subscription_active' | 'rate_limited' | 'internal_error' | 'render_failed' | 'render_timeout' | 'connection_error' | 'timeout' | 'aborted' | 'invalid_response' | 'invalid_signature'>;
|
|
270
|
+
export type ErrorCode = OrString<'missing_parameter' | 'invalid_parameter' | 'invalid_url' | 'private_url' | 'image_unreachable' | 'unsupported_image' | 'image_too_large' | 'mask_size_mismatch' | 'empty_mask' | 'unknown_room' | 'mode_not_available' | 'unknown_style' | 'unknown_furniture' | 'unknown_sky' | 'unknown_wall_type' | 'unknown_floor_type' | 'unknown_finish' | 'missing_api_key' | 'invalid_api_key' | 'api_key_inactive' | 'test_limit_reached' | 'live_key_required' | 'unknown_camera' | 'unknown_transition' | 'images_mismatch' | 'api_v2_subscription_required' | 'job_not_found' | 'not_found' | 'account_not_found' | 'already_subscribed' | 'api_v1_subscription_active' | 'rate_limited' | 'internal_error' | 'render_failed' | 'render_timeout' | 'connection_error' | 'timeout' | 'aborted' | 'invalid_response' | 'invalid_signature'>;
|
|
228
271
|
/**
|
|
229
272
|
* Every failure: an invalid request, a failed render (not charged), a network problem. `message` says what to do
|
|
230
273
|
* next; `code` is stable, for your code.
|
|
@@ -332,6 +375,22 @@ export declare class Gepetto {
|
|
|
332
375
|
webhook?: undefined;
|
|
333
376
|
}, options?: RequestOptions): Promise<CompletedJob>;
|
|
334
377
|
upscale(params: UpscaleParams, options?: RequestOptions): Promise<Job>;
|
|
378
|
+
/** A slow camera move in the photo. 0.80 € per video. */
|
|
379
|
+
cameraMove(params: CameraMoveParams & {
|
|
380
|
+
webhook: string | URL;
|
|
381
|
+
}, options?: RequestOptions): Promise<Job>;
|
|
382
|
+
cameraMove(params: CameraMoveParams & {
|
|
383
|
+
webhook?: undefined;
|
|
384
|
+
}, options?: RequestOptions): Promise<CompletedJob>;
|
|
385
|
+
cameraMove(params: CameraMoveParams, options?: RequestOptions): Promise<Job>;
|
|
386
|
+
/** From a photo to its edited version: `jobId` of a finished render, or `url` and `endUrl`. 1.60 € per video. */
|
|
387
|
+
transition(params: TransitionParams & {
|
|
388
|
+
webhook: string | URL;
|
|
389
|
+
}, options?: RequestOptions): Promise<Job>;
|
|
390
|
+
transition(params: TransitionParams & {
|
|
391
|
+
webhook?: undefined;
|
|
392
|
+
}, options?: RequestOptions): Promise<CompletedJob>;
|
|
393
|
+
transition(params: TransitionParams, options?: RequestOptions): Promise<Job>;
|
|
335
394
|
/** A job as it is now. */
|
|
336
395
|
getJob(id: string, options?: {
|
|
337
396
|
signal?: AbortSignal;
|
|
@@ -347,6 +406,8 @@ export declare class Gepetto {
|
|
|
347
406
|
listStyles(): Promise<Style[]>;
|
|
348
407
|
listFurnitures(): Promise<FurnitureCatalog>;
|
|
349
408
|
listSkies(): Promise<NamedItem[]>;
|
|
409
|
+
/** The animations of `transition`, for `transitionId`. */
|
|
410
|
+
listTransitions(): Promise<Transition[]>;
|
|
350
411
|
/** Wall colours, floors and finishes, for `surfaces`. */
|
|
351
412
|
listSurfaces(): Promise<SurfaceOptions>;
|
|
352
413
|
/** The account of the key, its test renders, the subscription, and the webhook secret of this key type. */
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Methods and fields have the names of the API: what the docs say of an endpoint is true of the method.
|
|
6
6
|
*/
|
|
7
|
-
export declare const VERSION = "0.
|
|
7
|
+
export declare const VERSION = "0.2.0";
|
|
8
8
|
/** Rooms of `GET /rooms`. */
|
|
9
9
|
export type KnownRoomId = 'bar' | 'bath_room' | 'bedroom' | 'clothing_store' | 'coworking_space' | 'dining_room' | 'dressing' | 'gaming_room' | 'hall' | 'home_office' | 'kitchen' | 'kitchen_living' | 'living_dining' | 'living_room' | 'meeting_room' | 'office' | 'optician' | 'osteopathy_clinic' | 'outdoor_garden' | 'outdoor_piscine' | 'outdoor_snowy_garden' | 'outdoor_terrace' | 'psychologist_office' | 'restaurant' | 'salle_de_sport' | 'shoe_store' | 'teenager_bedroom' | 'toilet';
|
|
10
10
|
/** Rooms that can be furnished whole, without a mask (mode `auto`). */
|
|
@@ -32,7 +32,7 @@ export type SkyId = OrString<KnownSkyId>;
|
|
|
32
32
|
export type WallTypeId = OrString<KnownWallTypeId>;
|
|
33
33
|
export type FloorTypeId = OrString<KnownFloorTypeId>;
|
|
34
34
|
export type FinishId = OrString<KnownFinishId>;
|
|
35
|
-
export type Tool = 'declutter' | 'furnish' | 'sunshine' | 'creative-redesign' | 'surfaces' | 'enhance' | 'upscale';
|
|
35
|
+
export type Tool = 'declutter' | 'furnish' | 'sunshine' | 'creative-redesign' | 'surfaces' | 'enhance' | 'upscale' | 'camera-move' | 'transition';
|
|
36
36
|
export type JobStatus = 'pending' | 'processing' | 'success' | 'error';
|
|
37
37
|
/** A render, as the API returns it (synchronous answer, `GET /job/{id}`, webhook body). */
|
|
38
38
|
export interface Job {
|
|
@@ -40,9 +40,11 @@ export interface Job {
|
|
|
40
40
|
status: JobStatus;
|
|
41
41
|
tool: Tool;
|
|
42
42
|
/** declutter and furnish: `auto` or `zone`; sunshine: the sky id; surfaces: `walls`, `floor` or `finish`;
|
|
43
|
-
* enhance: `straighten` or null; upscale: `2k` or `4k`; creative-redesign: null
|
|
43
|
+
* enhance: `straighten` or null; upscale: `2k` or `4k`; creative-redesign: null; camera-move: the camera;
|
|
44
|
+
* transition: the transitionId, or `custom`. */
|
|
44
45
|
mode: string | null;
|
|
45
|
-
/** The image, once `status` is `success`. Public URL: copy it to
|
|
46
|
+
/** The image (an MP4 video for camera-move and transition), once `status` is `success`. Public URL: copy it to
|
|
47
|
+
* your storage if you keep it. */
|
|
46
48
|
output: string | null;
|
|
47
49
|
error: {
|
|
48
50
|
code: string;
|
|
@@ -142,6 +144,47 @@ export interface UpscaleParams extends Common {
|
|
|
142
144
|
/** About 4 megapixels (`2k`) or 16 megapixels (`4k`, the default). */
|
|
143
145
|
resolution?: '2k' | '4k';
|
|
144
146
|
}
|
|
147
|
+
/** The camera moves of `cameraMove`. */
|
|
148
|
+
export type CameraMove = 'zoom_in' | 'zoom_out' | 'zoom_in_pan_left' | 'zoom_in_pan_right' | 'crane_up' | 'crane_down' | 'crab_left' | 'crab_right';
|
|
149
|
+
export interface CameraMoveParams extends Common {
|
|
150
|
+
camera: CameraMove;
|
|
151
|
+
/** The hours of the day passing, with the lights turning on, ending at night. */
|
|
152
|
+
timelapse?: boolean;
|
|
153
|
+
/** `1080p` by default. */
|
|
154
|
+
resolution?: '768p' | '1080p';
|
|
155
|
+
}
|
|
156
|
+
/** The two images of a transition: a finished job of your account, or two URLs of the same proportions. */
|
|
157
|
+
type TransitionImages = {
|
|
158
|
+
/** A finished image job: its original goes to its result. */
|
|
159
|
+
jobId: string;
|
|
160
|
+
url?: undefined;
|
|
161
|
+
endUrl?: undefined;
|
|
162
|
+
} | {
|
|
163
|
+
/** The photo before. */
|
|
164
|
+
url: ImageUrl;
|
|
165
|
+
/** The photo after, same proportions. */
|
|
166
|
+
endUrl: ImageUrl;
|
|
167
|
+
jobId?: undefined;
|
|
168
|
+
};
|
|
169
|
+
/** The animation: one of `listTransitions()`, or your own prompt. */
|
|
170
|
+
type TransitionAnimation = {
|
|
171
|
+
transitionId: string;
|
|
172
|
+
prompt?: undefined;
|
|
173
|
+
negativePrompt?: undefined;
|
|
174
|
+
} | {
|
|
175
|
+
/** Your own animation, in English (2000 characters at most), sent as it is. */
|
|
176
|
+
prompt: string;
|
|
177
|
+
/** What the video must avoid. */
|
|
178
|
+
negativePrompt?: string;
|
|
179
|
+
transitionId?: undefined;
|
|
180
|
+
};
|
|
181
|
+
export type TransitionParams = TransitionImages & TransitionAnimation & {
|
|
182
|
+
webhook?: string | URL;
|
|
183
|
+
};
|
|
184
|
+
export interface Transition extends NamedItem {
|
|
185
|
+
/** A sample video, when there is one. */
|
|
186
|
+
preview: string | null;
|
|
187
|
+
}
|
|
145
188
|
/** Options of one call. */
|
|
146
189
|
export interface RequestOptions {
|
|
147
190
|
/** Any unique string (your photo id, for example): the same key never starts, nor bills, a second render. One is
|
|
@@ -224,7 +267,7 @@ export interface Usage {
|
|
|
224
267
|
}
|
|
225
268
|
/** Codes of the API (docs: Errors), plus those of the SDK itself: `connection_error`, `timeout`, `aborted`,
|
|
226
269
|
* `invalid_response`, `invalid_signature`. */
|
|
227
|
-
export type ErrorCode = OrString<'missing_parameter' | 'invalid_parameter' | 'invalid_url' | 'private_url' | 'image_unreachable' | 'unsupported_image' | 'image_too_large' | 'mask_size_mismatch' | 'empty_mask' | 'unknown_room' | 'mode_not_available' | 'unknown_style' | 'unknown_furniture' | 'unknown_sky' | 'unknown_wall_type' | 'unknown_floor_type' | 'unknown_finish' | 'missing_api_key' | 'invalid_api_key' | 'api_key_inactive' | 'test_limit_reached' | 'api_v2_subscription_required' | 'job_not_found' | 'not_found' | 'account_not_found' | 'already_subscribed' | 'api_v1_subscription_active' | 'rate_limited' | 'internal_error' | 'render_failed' | 'render_timeout' | 'connection_error' | 'timeout' | 'aborted' | 'invalid_response' | 'invalid_signature'>;
|
|
270
|
+
export type ErrorCode = OrString<'missing_parameter' | 'invalid_parameter' | 'invalid_url' | 'private_url' | 'image_unreachable' | 'unsupported_image' | 'image_too_large' | 'mask_size_mismatch' | 'empty_mask' | 'unknown_room' | 'mode_not_available' | 'unknown_style' | 'unknown_furniture' | 'unknown_sky' | 'unknown_wall_type' | 'unknown_floor_type' | 'unknown_finish' | 'missing_api_key' | 'invalid_api_key' | 'api_key_inactive' | 'test_limit_reached' | 'live_key_required' | 'unknown_camera' | 'unknown_transition' | 'images_mismatch' | 'api_v2_subscription_required' | 'job_not_found' | 'not_found' | 'account_not_found' | 'already_subscribed' | 'api_v1_subscription_active' | 'rate_limited' | 'internal_error' | 'render_failed' | 'render_timeout' | 'connection_error' | 'timeout' | 'aborted' | 'invalid_response' | 'invalid_signature'>;
|
|
228
271
|
/**
|
|
229
272
|
* Every failure: an invalid request, a failed render (not charged), a network problem. `message` says what to do
|
|
230
273
|
* next; `code` is stable, for your code.
|
|
@@ -332,6 +375,22 @@ export declare class Gepetto {
|
|
|
332
375
|
webhook?: undefined;
|
|
333
376
|
}, options?: RequestOptions): Promise<CompletedJob>;
|
|
334
377
|
upscale(params: UpscaleParams, options?: RequestOptions): Promise<Job>;
|
|
378
|
+
/** A slow camera move in the photo. 0.80 € per video. */
|
|
379
|
+
cameraMove(params: CameraMoveParams & {
|
|
380
|
+
webhook: string | URL;
|
|
381
|
+
}, options?: RequestOptions): Promise<Job>;
|
|
382
|
+
cameraMove(params: CameraMoveParams & {
|
|
383
|
+
webhook?: undefined;
|
|
384
|
+
}, options?: RequestOptions): Promise<CompletedJob>;
|
|
385
|
+
cameraMove(params: CameraMoveParams, options?: RequestOptions): Promise<Job>;
|
|
386
|
+
/** From a photo to its edited version: `jobId` of a finished render, or `url` and `endUrl`. 1.60 € per video. */
|
|
387
|
+
transition(params: TransitionParams & {
|
|
388
|
+
webhook: string | URL;
|
|
389
|
+
}, options?: RequestOptions): Promise<Job>;
|
|
390
|
+
transition(params: TransitionParams & {
|
|
391
|
+
webhook?: undefined;
|
|
392
|
+
}, options?: RequestOptions): Promise<CompletedJob>;
|
|
393
|
+
transition(params: TransitionParams, options?: RequestOptions): Promise<Job>;
|
|
335
394
|
/** A job as it is now. */
|
|
336
395
|
getJob(id: string, options?: {
|
|
337
396
|
signal?: AbortSignal;
|
|
@@ -347,6 +406,8 @@ export declare class Gepetto {
|
|
|
347
406
|
listStyles(): Promise<Style[]>;
|
|
348
407
|
listFurnitures(): Promise<FurnitureCatalog>;
|
|
349
408
|
listSkies(): Promise<NamedItem[]>;
|
|
409
|
+
/** The animations of `transition`, for `transitionId`. */
|
|
410
|
+
listTransitions(): Promise<Transition[]>;
|
|
350
411
|
/** Wall colours, floors and finishes, for `surfaces`. */
|
|
351
412
|
listSurfaces(): Promise<SurfaceOptions>;
|
|
352
413
|
/** The account of the key, its test renders, the subscription, and the webhook secret of this key type. */
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Methods and fields have the names of the API: what the docs say of an endpoint is true of the method.
|
|
6
6
|
*/
|
|
7
|
-
export const VERSION = '0.
|
|
7
|
+
export const VERSION = '0.2.0';
|
|
8
8
|
const DEFAULT_BASE_URL = 'https://europe-west1-gepettoai.cloudfunctions.net/v2';
|
|
9
9
|
/** A render is stopped by the API after 450 s: 10 minutes covers it, retries included. */
|
|
10
10
|
const DEFAULT_TIMEOUT_MS = 10 * 60 * 1000;
|
|
11
|
+
/** A video takes 2 to 10 minutes; the API gives it up after 30. */
|
|
12
|
+
const VIDEO_TIMEOUT_MS = 30 * 60 * 1000;
|
|
11
13
|
const DEFAULT_MAX_RETRIES = 2;
|
|
12
14
|
const POLL_INTERVAL_MS = 2500;
|
|
13
15
|
/**
|
|
@@ -100,6 +102,12 @@ export class Gepetto {
|
|
|
100
102
|
upscale(params, options) {
|
|
101
103
|
return this.#render('/upscale', params, options);
|
|
102
104
|
}
|
|
105
|
+
cameraMove(params, options = {}) {
|
|
106
|
+
return this.#render('/video/camera-move', params, { ...options, timeout: options.timeout ?? VIDEO_TIMEOUT_MS });
|
|
107
|
+
}
|
|
108
|
+
transition(params, options = {}) {
|
|
109
|
+
return this.#render('/video/transition', params, { ...options, timeout: options.timeout ?? VIDEO_TIMEOUT_MS });
|
|
110
|
+
}
|
|
103
111
|
// --- Jobs
|
|
104
112
|
/** A job as it is now. */
|
|
105
113
|
async getJob(id, options = {}) {
|
|
@@ -134,6 +142,10 @@ export class Gepetto {
|
|
|
134
142
|
listSkies() {
|
|
135
143
|
return this.#get('/skies');
|
|
136
144
|
}
|
|
145
|
+
/** The animations of `transition`, for `transitionId`. */
|
|
146
|
+
listTransitions() {
|
|
147
|
+
return this.#get('/video/transitions');
|
|
148
|
+
}
|
|
137
149
|
/** Wall colours, floors and finishes, for `surfaces`. */
|
|
138
150
|
listSurfaces() {
|
|
139
151
|
return this.#get('/surfaces');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gepetto/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Official TypeScript / JavaScript SDK of the Gepetto API v2: real estate photo editing (enhance, declutter, furnish, sky, restyle, walls and floors, upscale).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|