@gepetto/sdk 0.1.1 → 0.1.3

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 CHANGED
@@ -1,5 +1,7 @@
1
1
  # Gepetto SDK
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@gepetto/sdk)](https://www.npmjs.com/package/@gepetto/sdk)
4
+
3
5
  The official TypeScript / JavaScript SDK of the [Gepetto API v2](https://docs.gepettoapp.com): real estate photo editing. Enhance a photo, declutter a room, furnish it, change the sky, restyle it, repaint walls and floors, upscale. One call, an image URL in return.
4
6
 
5
7
  ```bash
@@ -44,7 +46,7 @@ CommonJS: `const { Gepetto } = require('@gepetto/sdk');`
44
46
 
45
47
  ## Tools
46
48
 
47
- The `url` (and `mask`) of every tool is a public http(s) URL of a JPEG, PNG, WebP or HEIC image: upload the photo to your own storage first. The output URL is public too; copy the image if you keep it.
49
+ The `url` of every tool is a public http(s) URL of a JPEG, PNG, WebP or HEIC image: upload the photo to your own storage first. The output URL is public too; copy the image if you keep it.
48
50
 
49
51
  | Method | What it does |
50
52
  | --- | --- |
@@ -61,7 +63,7 @@ The `url` (and `mask`) of every tool is a public http(s) URL of a JPEG, PNG, Web
61
63
  | `surfaces({ url, surface: 'finish', finishId })` | A finish applied |
62
64
  | `upscale({ url, resolution? })` | Enlarged to about 4 (`2k`) or 16 megapixels (`4k`, default) |
63
65
 
64
- A mask is a black image with the zone painted in white, drawn on the photo. Output sizes are in the docs (Images and masks).
66
+ A mask is a black image with the zone painted in white, drawn on the photo. Give its URL, or the image itself in base64: the value of `canvas.toDataURL('image/png')` works as is, so there is nothing to host. Output sizes are in the docs (Images and masks).
65
67
 
66
68
  Every tool takes a second argument:
67
69
 
@@ -166,6 +168,8 @@ new Gepetto({
166
168
 
167
169
  Keep the key on your server: it gives access to your account and bills it. The SDK refuses to run in a web page.
168
170
 
169
- ## Pricing
171
+ ## About Gepetto
172
+
173
+ Gepetto is the AI photo studio for real estate professionals. From a single photo, it furnishes an empty room, empties a cluttered one, restyles an interior, replaces a grey sky, repaints walls, changes floors, enhances the picture and animates the property on video, in seconds and with no technical skill. Launched in January 2023 in Bordeaux, France, Gepetto is used by more than 1,000 agencies, networks and real estate photographers, on the web, on iPhone and Android, and through this API inside real estate CRMs and platforms.
170
174
 
171
- Test keys are free: 200 renders per account. Live keys: 100 € excl. tax per month including 100 € of renders, then the price of each render. Only successful renders are charged. Details: [docs.gepettoapp.com](https://docs.gepettoapp.com).
175
+ [gepettoapp.com](https://gepettoapp.com) · [API documentation](https://docs.gepettoapp.com)
package/dist/index.cjs CHANGED
@@ -8,7 +8,7 @@
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.1.1';
11
+ exports.VERSION = '0.1.3';
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;
@@ -152,8 +152,8 @@ class Gepetto {
152
152
  usage() {
153
153
  return this.#get('/usage');
154
154
  }
155
- /** The payment link of the subscription (100 € excl. tax per month including 100 € of renders). A test key is
156
- * enough; once paid, the live key is on https://app.gepettoapp.com/easy/account/api. */
155
+ /** The payment link of the subscription. A test key is enough; once paid,
156
+ * the live key is on https://app.gepettoapp.com/easy/account/api. */
157
157
  async subscribe() {
158
158
  return this.#json(await this.#send('POST', '/subscribe', { body: {}, idempotencyKey: uniqueId() }));
159
159
  }
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.1.1";
7
+ export declare const VERSION = "0.1.3";
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`). */
@@ -62,6 +62,9 @@ export interface CompletedJob extends Job {
62
62
  }
63
63
  /** A public http(s) URL of a JPEG, PNG, WebP or HEIC image (100 megapixels at most). */
64
64
  export type ImageUrl = string | URL;
65
+ /** A black image with the zone painted in white, drawn on the photo: a public URL, or the image itself in base64 as
66
+ * a data URL, such as `canvas.toDataURL('image/png')` gives (5 MB at most; a black and white PNG weighs a few KB). */
67
+ export type MaskImage = string | URL;
65
68
  interface Common {
66
69
  /** The photo: a public http(s) URL. */
67
70
  url: ImageUrl;
@@ -76,8 +79,8 @@ export type DeclutterParams = Common & ({
76
79
  keepBathroom?: boolean;
77
80
  keepFireplace?: boolean;
78
81
  } | {
79
- /** A black image with the zone to remove painted in white, drawn on the photo. */
80
- mask: ImageUrl;
82
+ /** The zone to remove, painted in white on black: a URL, or base64 (`canvas.toDataURL('image/png')`). */
83
+ mask: MaskImage;
81
84
  });
82
85
  export type FurnishParams = Common & ({
83
86
  /** Without a mask, the whole room is furnished: the room must have the `auto` mode in `GET /rooms`. */
@@ -85,14 +88,15 @@ export type FurnishParams = Common & ({
85
88
  roomId: OrString<KnownAutoRoomId>;
86
89
  styleId: StyleId;
87
90
  } | {
88
- /** A black image with the zone to furnish painted in white, drawn on the photo. */
89
- mask: ImageUrl;
91
+ /** The zone to furnish, painted in white on black: a URL, or base64 (`canvas.toDataURL('image/png')`). */
92
+ mask: MaskImage;
90
93
  /** The zone furnished as a room (mode `zone` in `GET /rooms`). */
91
94
  roomId: OrString<KnownZoneRoomId>;
92
95
  styleId: StyleId;
93
96
  furnitureId?: undefined;
94
97
  } | {
95
- mask: ImageUrl;
98
+ /** The zone to furnish, painted in white on black: a URL, or base64 (`canvas.toDataURL('image/png')`). */
99
+ mask: MaskImage;
96
100
  /** One piece of furniture in the zone, instead of a room. */
97
101
  furnitureId: FurnitureId;
98
102
  styleId?: StyleId;
@@ -272,7 +276,7 @@ export declare class Gepetto {
272
276
  constructor(apiKeyOrOptions?: string | ClientOptions, options?: ClientOptions);
273
277
  /** True with a test key: renders are free (200 per account) and `priceCents` is 0. */
274
278
  get isTest(): boolean;
275
- /** Empty the whole room, or remove what a mask covers. 0.30 € per successful render. */
279
+ /** Empty the whole room, or remove what a mask covers. */
276
280
  declutter(params: DeclutterParams & {
277
281
  webhook: string | URL;
278
282
  }, options?: RequestOptions): Promise<Job>;
@@ -280,8 +284,7 @@ export declare class Gepetto {
280
284
  webhook?: undefined;
281
285
  }, options?: RequestOptions): Promise<CompletedJob>;
282
286
  declutter(params: DeclutterParams, options?: RequestOptions): Promise<Job>;
283
- /** Furnish a whole room (`roomId` + `styleId`), or the zone of a mask (as a room, or with one `furnitureId`).
284
- * 0.30 € per successful render. */
287
+ /** Furnish a whole room (`roomId` + `styleId`), or the zone of a mask (as a room, or with one `furnitureId`). */
285
288
  furnish(params: FurnishParams & {
286
289
  webhook: string | URL;
287
290
  }, options?: RequestOptions): Promise<Job>;
@@ -289,7 +292,7 @@ export declare class Gepetto {
289
292
  webhook?: undefined;
290
293
  }, options?: RequestOptions): Promise<CompletedJob>;
291
294
  furnish(params: FurnishParams, options?: RequestOptions): Promise<Job>;
292
- /** A blue sky (`skyId`) and the matching light, outside or through the windows. 0.30 € per successful render. */
295
+ /** A blue sky (`skyId`) and the matching light, outside or through the windows. */
293
296
  sunshine(params: SunshineParams & {
294
297
  webhook: string | URL;
295
298
  }, options?: RequestOptions): Promise<Job>;
@@ -297,7 +300,7 @@ export declare class Gepetto {
297
300
  webhook?: undefined;
298
301
  }, options?: RequestOptions): Promise<CompletedJob>;
299
302
  sunshine(params: SunshineParams, options?: RequestOptions): Promise<Job>;
300
- /** The room redesigned in a style. 0.30 € per successful render. */
303
+ /** The room redesigned in a style. */
301
304
  creativeRedesign(params: CreativeRedesignParams & {
302
305
  webhook: string | URL;
303
306
  }, options?: RequestOptions): Promise<Job>;
@@ -305,7 +308,7 @@ export declare class Gepetto {
305
308
  webhook?: undefined;
306
309
  }, options?: RequestOptions): Promise<CompletedJob>;
307
310
  creativeRedesign(params: CreativeRedesignParams, options?: RequestOptions): Promise<Job>;
308
- /** Repaint the walls, change the floor, or apply a finish: one `surface` per call. 0.30 € per successful render. */
311
+ /** Repaint the walls, change the floor, or apply a finish: one `surface` per call. */
309
312
  surfaces(params: SurfacesParams & {
310
313
  webhook: string | URL;
311
314
  }, options?: RequestOptions): Promise<Job>;
@@ -313,8 +316,7 @@ export declare class Gepetto {
313
316
  webhook?: undefined;
314
317
  }, options?: RequestOptions): Promise<CompletedJob>;
315
318
  surfaces(params: SurfacesParams, options?: RequestOptions): Promise<Job>;
316
- /** Light and colours corrected at the size of the photo, nothing redrawn; `straighten` for the verticals.
317
- * 0.20 € per successful render. */
319
+ /** Light and colours corrected at the size of the photo, nothing redrawn; `straighten` for the verticals. */
318
320
  enhance(params: EnhanceParams & {
319
321
  webhook: string | URL;
320
322
  }, options?: RequestOptions): Promise<Job>;
@@ -322,7 +324,7 @@ export declare class Gepetto {
322
324
  webhook?: undefined;
323
325
  }, options?: RequestOptions): Promise<CompletedJob>;
324
326
  enhance(params: EnhanceParams, options?: RequestOptions): Promise<Job>;
325
- /** Enlarge an image to about 4 (`2k`) or 16 megapixels (`4k`, the default). 0.10 € per successful render. */
327
+ /** Enlarge an image to about 4 (`2k`) or 16 megapixels (`4k`, the default). */
326
328
  upscale(params: UpscaleParams & {
327
329
  webhook: string | URL;
328
330
  }, options?: RequestOptions): Promise<Job>;
@@ -351,8 +353,8 @@ export declare class Gepetto {
351
353
  account(): Promise<Account>;
352
354
  /** Renders and consumption of the current period. */
353
355
  usage(): Promise<Usage>;
354
- /** The payment link of the subscription (100 € excl. tax per month including 100 € of renders). A test key is
355
- * enough; once paid, the live key is on https://app.gepettoapp.com/easy/account/api. */
356
+ /** The payment link of the subscription. A test key is enough; once paid,
357
+ * the live key is on https://app.gepettoapp.com/easy/account/api. */
356
358
  subscribe(): Promise<{
357
359
  url: string;
358
360
  message: string;
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.1.1";
7
+ export declare const VERSION = "0.1.3";
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`). */
@@ -62,6 +62,9 @@ export interface CompletedJob extends Job {
62
62
  }
63
63
  /** A public http(s) URL of a JPEG, PNG, WebP or HEIC image (100 megapixels at most). */
64
64
  export type ImageUrl = string | URL;
65
+ /** A black image with the zone painted in white, drawn on the photo: a public URL, or the image itself in base64 as
66
+ * a data URL, such as `canvas.toDataURL('image/png')` gives (5 MB at most; a black and white PNG weighs a few KB). */
67
+ export type MaskImage = string | URL;
65
68
  interface Common {
66
69
  /** The photo: a public http(s) URL. */
67
70
  url: ImageUrl;
@@ -76,8 +79,8 @@ export type DeclutterParams = Common & ({
76
79
  keepBathroom?: boolean;
77
80
  keepFireplace?: boolean;
78
81
  } | {
79
- /** A black image with the zone to remove painted in white, drawn on the photo. */
80
- mask: ImageUrl;
82
+ /** The zone to remove, painted in white on black: a URL, or base64 (`canvas.toDataURL('image/png')`). */
83
+ mask: MaskImage;
81
84
  });
82
85
  export type FurnishParams = Common & ({
83
86
  /** Without a mask, the whole room is furnished: the room must have the `auto` mode in `GET /rooms`. */
@@ -85,14 +88,15 @@ export type FurnishParams = Common & ({
85
88
  roomId: OrString<KnownAutoRoomId>;
86
89
  styleId: StyleId;
87
90
  } | {
88
- /** A black image with the zone to furnish painted in white, drawn on the photo. */
89
- mask: ImageUrl;
91
+ /** The zone to furnish, painted in white on black: a URL, or base64 (`canvas.toDataURL('image/png')`). */
92
+ mask: MaskImage;
90
93
  /** The zone furnished as a room (mode `zone` in `GET /rooms`). */
91
94
  roomId: OrString<KnownZoneRoomId>;
92
95
  styleId: StyleId;
93
96
  furnitureId?: undefined;
94
97
  } | {
95
- mask: ImageUrl;
98
+ /** The zone to furnish, painted in white on black: a URL, or base64 (`canvas.toDataURL('image/png')`). */
99
+ mask: MaskImage;
96
100
  /** One piece of furniture in the zone, instead of a room. */
97
101
  furnitureId: FurnitureId;
98
102
  styleId?: StyleId;
@@ -272,7 +276,7 @@ export declare class Gepetto {
272
276
  constructor(apiKeyOrOptions?: string | ClientOptions, options?: ClientOptions);
273
277
  /** True with a test key: renders are free (200 per account) and `priceCents` is 0. */
274
278
  get isTest(): boolean;
275
- /** Empty the whole room, or remove what a mask covers. 0.30 € per successful render. */
279
+ /** Empty the whole room, or remove what a mask covers. */
276
280
  declutter(params: DeclutterParams & {
277
281
  webhook: string | URL;
278
282
  }, options?: RequestOptions): Promise<Job>;
@@ -280,8 +284,7 @@ export declare class Gepetto {
280
284
  webhook?: undefined;
281
285
  }, options?: RequestOptions): Promise<CompletedJob>;
282
286
  declutter(params: DeclutterParams, options?: RequestOptions): Promise<Job>;
283
- /** Furnish a whole room (`roomId` + `styleId`), or the zone of a mask (as a room, or with one `furnitureId`).
284
- * 0.30 € per successful render. */
287
+ /** Furnish a whole room (`roomId` + `styleId`), or the zone of a mask (as a room, or with one `furnitureId`). */
285
288
  furnish(params: FurnishParams & {
286
289
  webhook: string | URL;
287
290
  }, options?: RequestOptions): Promise<Job>;
@@ -289,7 +292,7 @@ export declare class Gepetto {
289
292
  webhook?: undefined;
290
293
  }, options?: RequestOptions): Promise<CompletedJob>;
291
294
  furnish(params: FurnishParams, options?: RequestOptions): Promise<Job>;
292
- /** A blue sky (`skyId`) and the matching light, outside or through the windows. 0.30 € per successful render. */
295
+ /** A blue sky (`skyId`) and the matching light, outside or through the windows. */
293
296
  sunshine(params: SunshineParams & {
294
297
  webhook: string | URL;
295
298
  }, options?: RequestOptions): Promise<Job>;
@@ -297,7 +300,7 @@ export declare class Gepetto {
297
300
  webhook?: undefined;
298
301
  }, options?: RequestOptions): Promise<CompletedJob>;
299
302
  sunshine(params: SunshineParams, options?: RequestOptions): Promise<Job>;
300
- /** The room redesigned in a style. 0.30 € per successful render. */
303
+ /** The room redesigned in a style. */
301
304
  creativeRedesign(params: CreativeRedesignParams & {
302
305
  webhook: string | URL;
303
306
  }, options?: RequestOptions): Promise<Job>;
@@ -305,7 +308,7 @@ export declare class Gepetto {
305
308
  webhook?: undefined;
306
309
  }, options?: RequestOptions): Promise<CompletedJob>;
307
310
  creativeRedesign(params: CreativeRedesignParams, options?: RequestOptions): Promise<Job>;
308
- /** Repaint the walls, change the floor, or apply a finish: one `surface` per call. 0.30 € per successful render. */
311
+ /** Repaint the walls, change the floor, or apply a finish: one `surface` per call. */
309
312
  surfaces(params: SurfacesParams & {
310
313
  webhook: string | URL;
311
314
  }, options?: RequestOptions): Promise<Job>;
@@ -313,8 +316,7 @@ export declare class Gepetto {
313
316
  webhook?: undefined;
314
317
  }, options?: RequestOptions): Promise<CompletedJob>;
315
318
  surfaces(params: SurfacesParams, options?: RequestOptions): Promise<Job>;
316
- /** Light and colours corrected at the size of the photo, nothing redrawn; `straighten` for the verticals.
317
- * 0.20 € per successful render. */
319
+ /** Light and colours corrected at the size of the photo, nothing redrawn; `straighten` for the verticals. */
318
320
  enhance(params: EnhanceParams & {
319
321
  webhook: string | URL;
320
322
  }, options?: RequestOptions): Promise<Job>;
@@ -322,7 +324,7 @@ export declare class Gepetto {
322
324
  webhook?: undefined;
323
325
  }, options?: RequestOptions): Promise<CompletedJob>;
324
326
  enhance(params: EnhanceParams, options?: RequestOptions): Promise<Job>;
325
- /** Enlarge an image to about 4 (`2k`) or 16 megapixels (`4k`, the default). 0.10 € per successful render. */
327
+ /** Enlarge an image to about 4 (`2k`) or 16 megapixels (`4k`, the default). */
326
328
  upscale(params: UpscaleParams & {
327
329
  webhook: string | URL;
328
330
  }, options?: RequestOptions): Promise<Job>;
@@ -351,8 +353,8 @@ export declare class Gepetto {
351
353
  account(): Promise<Account>;
352
354
  /** Renders and consumption of the current period. */
353
355
  usage(): Promise<Usage>;
354
- /** The payment link of the subscription (100 € excl. tax per month including 100 € of renders). A test key is
355
- * enough; once paid, the live key is on https://app.gepettoapp.com/easy/account/api. */
356
+ /** The payment link of the subscription. A test key is enough; once paid,
357
+ * the live key is on https://app.gepettoapp.com/easy/account/api. */
356
358
  subscribe(): Promise<{
357
359
  url: string;
358
360
  message: string;
package/dist/index.js 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 const VERSION = '0.1.1';
7
+ export const VERSION = '0.1.3';
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;
@@ -147,8 +147,8 @@ export class Gepetto {
147
147
  usage() {
148
148
  return this.#get('/usage');
149
149
  }
150
- /** The payment link of the subscription (100 € excl. tax per month including 100 € of renders). A test key is
151
- * enough; once paid, the live key is on https://app.gepettoapp.com/easy/account/api. */
150
+ /** The payment link of the subscription. A test key is enough; once paid,
151
+ * the live key is on https://app.gepettoapp.com/easy/account/api. */
152
152
  async subscribe() {
153
153
  return this.#json(await this.#send('POST', '/subscribe', { body: {}, idempotencyKey: uniqueId() }));
154
154
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gepetto/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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",
@@ -30,7 +30,8 @@
30
30
  "scripts": {
31
31
  "build": "node scripts/build.mjs",
32
32
  "ids": "node scripts/generate-ids.mjs",
33
- "prepublishOnly": "npm run build"
33
+ "prepublishOnly": "npm run build",
34
+ "version": "node scripts/sync-version.mjs src/index.ts && git add src/index.ts"
34
35
  },
35
36
  "devDependencies": {
36
37
  "typescript": "5.6.3"
@@ -48,5 +49,9 @@
48
49
  "sdk"
49
50
  ],
50
51
  "homepage": "https://docs.gepettoapp.com",
51
- "license": "MIT"
52
+ "license": "MIT",
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "git+https://github.com/Gepetto-AI/gepetto-sdk.git"
56
+ }
52
57
  }