@magiclabs.ai/magicbook-client 0.5.1 → 0.5.5

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.
@@ -1,4 +1,5 @@
1
1
  import { Images } from './image';
2
+ import { MagicBookClient } from '../client';
2
3
  import { bookSizes, coverTypes, embellishmentLevels, imageDensities, imageFilteringLevels, occasions, pageTypes, states, styles, textStickerLevels } from '../../data/design-request';
3
4
  export type Occasion = typeof occasions[number];
4
5
  export type Style = keyof typeof styles;
@@ -27,7 +28,7 @@ export type DesignRequestEventDetail = {
27
28
  };
28
29
  export type DesignRequestEvent = CustomEvent<DesignRequestEventDetail>;
29
30
  export declare class DesignRequest {
30
- private apiKey;
31
+ client: MagicBookClient;
31
32
  parentId: string;
32
33
  title: string;
33
34
  occasion: Occasion;
@@ -41,7 +42,7 @@ export declare class DesignRequest {
41
42
  textStickerLevel: TextStickerLevel;
42
43
  images: Images;
43
44
  guid?: string;
44
- constructor(parentId: string, apiKey: string, designRequestProps?: DesignRequestProps);
45
+ constructor(parentId: string, client: MagicBookClient, designRequestProps?: DesignRequestProps);
45
46
  getOptions(imageCount?: number): Promise<{
46
47
  densities: {
47
48
  low: {
@@ -80,7 +81,7 @@ export declare class DesignRequest {
80
81
  pageNum: number;
81
82
  canvas: {
82
83
  backgroundId: string | null;
83
- assets: {
84
+ assets?: {
84
85
  type: string;
85
86
  position: {
86
87
  x: number;
@@ -103,7 +104,7 @@ export declare class DesignRequest {
103
104
  fontSize?: number | undefined;
104
105
  fontColor?: string | undefined;
105
106
  frame?: string | undefined;
106
- }[];
107
+ }[] | undefined;
107
108
  };
108
109
  }[];
109
110
  photoStrip: {
@@ -289,7 +289,7 @@ export declare const reportingDataSchema: z.ZodObject<{
289
289
  export type ReportingData = z.infer<typeof reportingDataSchema>;
290
290
  export declare const canvasSchema: z.ZodObject<{
291
291
  backgroundId: z.ZodNullable<z.ZodString>;
292
- assets: z.ZodArray<z.ZodObject<{
292
+ assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
293
293
  type: z.ZodString;
294
294
  imageAssignment: z.ZodOptional<z.ZodObject<{
295
295
  photoRefId: z.ZodString;
@@ -376,10 +376,10 @@ export declare const canvasSchema: z.ZodObject<{
376
376
  fontSize?: number | undefined;
377
377
  fontColor?: string | undefined;
378
378
  frame?: string | undefined;
379
- }>, "many">;
379
+ }>, "many">>;
380
380
  }, "strip", z.ZodTypeAny, {
381
381
  backgroundId: string | null;
382
- assets: {
382
+ assets?: {
383
383
  type: string;
384
384
  position: {
385
385
  x: number;
@@ -402,10 +402,10 @@ export declare const canvasSchema: z.ZodObject<{
402
402
  fontSize?: number | undefined;
403
403
  fontColor?: string | undefined;
404
404
  frame?: string | undefined;
405
- }[];
405
+ }[] | undefined;
406
406
  }, {
407
407
  backgroundId: string | null;
408
- assets: {
408
+ assets?: {
409
409
  type: string;
410
410
  position: {
411
411
  x: number;
@@ -428,7 +428,7 @@ export declare const canvasSchema: z.ZodObject<{
428
428
  fontSize?: number | undefined;
429
429
  fontColor?: string | undefined;
430
430
  frame?: string | undefined;
431
- }[];
431
+ }[] | undefined;
432
432
  }>;
433
433
  export type Canvas = z.infer<typeof canvasSchema>;
434
434
  export declare const pageSchema: z.ZodObject<{
@@ -436,7 +436,7 @@ export declare const pageSchema: z.ZodObject<{
436
436
  type: z.ZodString;
437
437
  canvas: z.ZodObject<{
438
438
  backgroundId: z.ZodNullable<z.ZodString>;
439
- assets: z.ZodArray<z.ZodObject<{
439
+ assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
440
440
  type: z.ZodString;
441
441
  imageAssignment: z.ZodOptional<z.ZodObject<{
442
442
  photoRefId: z.ZodString;
@@ -523,10 +523,10 @@ export declare const pageSchema: z.ZodObject<{
523
523
  fontSize?: number | undefined;
524
524
  fontColor?: string | undefined;
525
525
  frame?: string | undefined;
526
- }>, "many">;
526
+ }>, "many">>;
527
527
  }, "strip", z.ZodTypeAny, {
528
528
  backgroundId: string | null;
529
- assets: {
529
+ assets?: {
530
530
  type: string;
531
531
  position: {
532
532
  x: number;
@@ -549,10 +549,10 @@ export declare const pageSchema: z.ZodObject<{
549
549
  fontSize?: number | undefined;
550
550
  fontColor?: string | undefined;
551
551
  frame?: string | undefined;
552
- }[];
552
+ }[] | undefined;
553
553
  }, {
554
554
  backgroundId: string | null;
555
- assets: {
555
+ assets?: {
556
556
  type: string;
557
557
  position: {
558
558
  x: number;
@@ -575,14 +575,14 @@ export declare const pageSchema: z.ZodObject<{
575
575
  fontSize?: number | undefined;
576
576
  fontColor?: string | undefined;
577
577
  frame?: string | undefined;
578
- }[];
578
+ }[] | undefined;
579
579
  }>;
580
580
  }, "strip", z.ZodTypeAny, {
581
581
  type: string;
582
582
  pageNum: number;
583
583
  canvas: {
584
584
  backgroundId: string | null;
585
- assets: {
585
+ assets?: {
586
586
  type: string;
587
587
  position: {
588
588
  x: number;
@@ -605,14 +605,14 @@ export declare const pageSchema: z.ZodObject<{
605
605
  fontSize?: number | undefined;
606
606
  fontColor?: string | undefined;
607
607
  frame?: string | undefined;
608
- }[];
608
+ }[] | undefined;
609
609
  };
610
610
  }, {
611
611
  type: string;
612
612
  pageNum: number;
613
613
  canvas: {
614
614
  backgroundId: string | null;
615
- assets: {
615
+ assets?: {
616
616
  type: string;
617
617
  position: {
618
618
  x: number;
@@ -635,7 +635,7 @@ export declare const pageSchema: z.ZodObject<{
635
635
  fontSize?: number | undefined;
636
636
  fontColor?: string | undefined;
637
637
  frame?: string | undefined;
638
- }[];
638
+ }[] | undefined;
639
639
  };
640
640
  }>;
641
641
  export type Page = z.infer<typeof pageSchema>;
@@ -645,7 +645,7 @@ export declare const magicShopBookSchema: z.ZodObject<{
645
645
  type: z.ZodString;
646
646
  canvas: z.ZodObject<{
647
647
  backgroundId: z.ZodNullable<z.ZodString>;
648
- assets: z.ZodArray<z.ZodObject<{
648
+ assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
649
649
  type: z.ZodString;
650
650
  imageAssignment: z.ZodOptional<z.ZodObject<{
651
651
  photoRefId: z.ZodString;
@@ -732,10 +732,10 @@ export declare const magicShopBookSchema: z.ZodObject<{
732
732
  fontSize?: number | undefined;
733
733
  fontColor?: string | undefined;
734
734
  frame?: string | undefined;
735
- }>, "many">;
735
+ }>, "many">>;
736
736
  }, "strip", z.ZodTypeAny, {
737
737
  backgroundId: string | null;
738
- assets: {
738
+ assets?: {
739
739
  type: string;
740
740
  position: {
741
741
  x: number;
@@ -758,10 +758,10 @@ export declare const magicShopBookSchema: z.ZodObject<{
758
758
  fontSize?: number | undefined;
759
759
  fontColor?: string | undefined;
760
760
  frame?: string | undefined;
761
- }[];
761
+ }[] | undefined;
762
762
  }, {
763
763
  backgroundId: string | null;
764
- assets: {
764
+ assets?: {
765
765
  type: string;
766
766
  position: {
767
767
  x: number;
@@ -784,14 +784,14 @@ export declare const magicShopBookSchema: z.ZodObject<{
784
784
  fontSize?: number | undefined;
785
785
  fontColor?: string | undefined;
786
786
  frame?: string | undefined;
787
- }[];
787
+ }[] | undefined;
788
788
  }>;
789
789
  }, "strip", z.ZodTypeAny, {
790
790
  type: string;
791
791
  pageNum: number;
792
792
  canvas: {
793
793
  backgroundId: string | null;
794
- assets: {
794
+ assets?: {
795
795
  type: string;
796
796
  position: {
797
797
  x: number;
@@ -814,14 +814,14 @@ export declare const magicShopBookSchema: z.ZodObject<{
814
814
  fontSize?: number | undefined;
815
815
  fontColor?: string | undefined;
816
816
  frame?: string | undefined;
817
- }[];
817
+ }[] | undefined;
818
818
  };
819
819
  }, {
820
820
  type: string;
821
821
  pageNum: number;
822
822
  canvas: {
823
823
  backgroundId: string | null;
824
- assets: {
824
+ assets?: {
825
825
  type: string;
826
826
  position: {
827
827
  x: number;
@@ -844,7 +844,7 @@ export declare const magicShopBookSchema: z.ZodObject<{
844
844
  fontSize?: number | undefined;
845
845
  fontColor?: string | undefined;
846
846
  frame?: string | undefined;
847
- }[];
847
+ }[] | undefined;
848
848
  };
849
849
  }>, "many">;
850
850
  photoStrip: z.ZodArray<z.ZodObject<{
@@ -942,7 +942,7 @@ export declare const magicShopBookSchema: z.ZodObject<{
942
942
  pageNum: number;
943
943
  canvas: {
944
944
  backgroundId: string | null;
945
- assets: {
945
+ assets?: {
946
946
  type: string;
947
947
  position: {
948
948
  x: number;
@@ -965,7 +965,7 @@ export declare const magicShopBookSchema: z.ZodObject<{
965
965
  fontSize?: number | undefined;
966
966
  fontColor?: string | undefined;
967
967
  frame?: string | undefined;
968
- }[];
968
+ }[] | undefined;
969
969
  };
970
970
  }[];
971
971
  photoStrip: {
@@ -995,7 +995,7 @@ export declare const magicShopBookSchema: z.ZodObject<{
995
995
  pageNum: number;
996
996
  canvas: {
997
997
  backgroundId: string | null;
998
- assets: {
998
+ assets?: {
999
999
  type: string;
1000
1000
  position: {
1001
1001
  x: number;
@@ -1018,7 +1018,7 @@ export declare const magicShopBookSchema: z.ZodObject<{
1018
1018
  fontSize?: number | undefined;
1019
1019
  fontColor?: string | undefined;
1020
1020
  frame?: string | undefined;
1021
- }[];
1021
+ }[] | undefined;
1022
1022
  };
1023
1023
  }[];
1024
1024
  photoStrip: {
@@ -1055,7 +1055,7 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1055
1055
  type: z.ZodString;
1056
1056
  canvas: z.ZodObject<{
1057
1057
  backgroundId: z.ZodNullable<z.ZodString>;
1058
- assets: z.ZodArray<z.ZodObject<{
1058
+ assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
1059
1059
  type: z.ZodString;
1060
1060
  imageAssignment: z.ZodOptional<z.ZodObject<{
1061
1061
  photoRefId: z.ZodString;
@@ -1142,10 +1142,10 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1142
1142
  fontSize?: number | undefined;
1143
1143
  fontColor?: string | undefined;
1144
1144
  frame?: string | undefined;
1145
- }>, "many">;
1145
+ }>, "many">>;
1146
1146
  }, "strip", z.ZodTypeAny, {
1147
1147
  backgroundId: string | null;
1148
- assets: {
1148
+ assets?: {
1149
1149
  type: string;
1150
1150
  position: {
1151
1151
  x: number;
@@ -1168,10 +1168,10 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1168
1168
  fontSize?: number | undefined;
1169
1169
  fontColor?: string | undefined;
1170
1170
  frame?: string | undefined;
1171
- }[];
1171
+ }[] | undefined;
1172
1172
  }, {
1173
1173
  backgroundId: string | null;
1174
- assets: {
1174
+ assets?: {
1175
1175
  type: string;
1176
1176
  position: {
1177
1177
  x: number;
@@ -1194,14 +1194,14 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1194
1194
  fontSize?: number | undefined;
1195
1195
  fontColor?: string | undefined;
1196
1196
  frame?: string | undefined;
1197
- }[];
1197
+ }[] | undefined;
1198
1198
  }>;
1199
1199
  }, "strip", z.ZodTypeAny, {
1200
1200
  type: string;
1201
1201
  pageNum: number;
1202
1202
  canvas: {
1203
1203
  backgroundId: string | null;
1204
- assets: {
1204
+ assets?: {
1205
1205
  type: string;
1206
1206
  position: {
1207
1207
  x: number;
@@ -1224,14 +1224,14 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1224
1224
  fontSize?: number | undefined;
1225
1225
  fontColor?: string | undefined;
1226
1226
  frame?: string | undefined;
1227
- }[];
1227
+ }[] | undefined;
1228
1228
  };
1229
1229
  }, {
1230
1230
  type: string;
1231
1231
  pageNum: number;
1232
1232
  canvas: {
1233
1233
  backgroundId: string | null;
1234
- assets: {
1234
+ assets?: {
1235
1235
  type: string;
1236
1236
  position: {
1237
1237
  x: number;
@@ -1254,7 +1254,7 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1254
1254
  fontSize?: number | undefined;
1255
1255
  fontColor?: string | undefined;
1256
1256
  frame?: string | undefined;
1257
- }[];
1257
+ }[] | undefined;
1258
1258
  };
1259
1259
  }>, "many">;
1260
1260
  photoStrip: z.ZodArray<z.ZodObject<{
@@ -1352,7 +1352,7 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1352
1352
  pageNum: number;
1353
1353
  canvas: {
1354
1354
  backgroundId: string | null;
1355
- assets: {
1355
+ assets?: {
1356
1356
  type: string;
1357
1357
  position: {
1358
1358
  x: number;
@@ -1375,7 +1375,7 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1375
1375
  fontSize?: number | undefined;
1376
1376
  fontColor?: string | undefined;
1377
1377
  frame?: string | undefined;
1378
- }[];
1378
+ }[] | undefined;
1379
1379
  };
1380
1380
  }[];
1381
1381
  photoStrip: {
@@ -1405,7 +1405,7 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1405
1405
  pageNum: number;
1406
1406
  canvas: {
1407
1407
  backgroundId: string | null;
1408
- assets: {
1408
+ assets?: {
1409
1409
  type: string;
1410
1410
  position: {
1411
1411
  x: number;
@@ -1428,7 +1428,7 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1428
1428
  fontSize?: number | undefined;
1429
1429
  fontColor?: string | undefined;
1430
1430
  frame?: string | undefined;
1431
- }[];
1431
+ }[] | undefined;
1432
1432
  };
1433
1433
  }[];
1434
1434
  photoStrip: {
@@ -1486,7 +1486,7 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1486
1486
  pageNum: number;
1487
1487
  canvas: {
1488
1488
  backgroundId: string | null;
1489
- assets: {
1489
+ assets?: {
1490
1490
  type: string;
1491
1491
  position: {
1492
1492
  x: number;
@@ -1509,7 +1509,7 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1509
1509
  fontSize?: number | undefined;
1510
1510
  fontColor?: string | undefined;
1511
1511
  frame?: string | undefined;
1512
- }[];
1512
+ }[] | undefined;
1513
1513
  };
1514
1514
  }[];
1515
1515
  photoStrip: {
@@ -1551,7 +1551,7 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1551
1551
  pageNum: number;
1552
1552
  canvas: {
1553
1553
  backgroundId: string | null;
1554
- assets: {
1554
+ assets?: {
1555
1555
  type: string;
1556
1556
  position: {
1557
1557
  x: number;
@@ -1574,7 +1574,7 @@ export declare const bookCreationRequestSchema: z.ZodObject<{
1574
1574
  fontSize?: number | undefined;
1575
1575
  fontColor?: string | undefined;
1576
1576
  frame?: string | undefined;
1577
- }[];
1577
+ }[] | undefined;
1578
1578
  };
1579
1579
  }[];
1580
1580
  photoStrip: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@magiclabs.ai/magicbook-client",
3
3
  "private": false,
4
- "version": "0.5.1",
4
+ "version": "0.5.5",
5
5
  "description": "TypeScript package to create photo books with the Magicbook API.",
6
6
  "type": "module",
7
7
  "main": "./magicbook-client.umd.cjs",
@@ -1,8 +1,9 @@
1
1
  import { Book } from '../../models/book';
2
- export declare function createBook(apiKey: string, payload?: Book): Promise<Book>;
3
- export declare function retrieveBook(apiKey: string, bookId: string): Promise<Book>;
4
- export declare function updateBook(apiKey: string, payload: Partial<Book>): Promise<Book>;
5
- export declare function retrieveGalleon(apiKey: string, bookId: string): Promise<{
2
+ import { MagicBookClient } from '../../models/client';
3
+ export declare function createBook({ apiHost, apiKey }: MagicBookClient, payload?: Book): Promise<Book>;
4
+ export declare function retrieveBook({ apiHost, apiKey }: MagicBookClient, bookId: string): Promise<Book>;
5
+ export declare function updateBook({ apiHost, apiKey }: MagicBookClient, payload: Partial<Book>): Promise<Book>;
6
+ export declare function retrieveGalleon({ apiHost, apiKey }: MagicBookClient, bookId: string): Promise<{
6
7
  title: string;
7
8
  coverSpecId: string;
8
9
  styleId: number;
@@ -13,7 +14,7 @@ export declare function retrieveGalleon(apiKey: string, bookId: string): Promise
13
14
  pageNum: number;
14
15
  canvas: {
15
16
  backgroundId: string | null;
16
- assets: {
17
+ assets?: {
17
18
  type: string;
18
19
  position: {
19
20
  x: number;
@@ -36,7 +37,7 @@ export declare function retrieveGalleon(apiKey: string, bookId: string): Promise
36
37
  fontSize?: number | undefined;
37
38
  fontColor?: string | undefined;
38
39
  frame?: string | undefined;
39
- }[];
40
+ }[] | undefined;
40
41
  };
41
42
  }[];
42
43
  photoStrip: {
@@ -1,5 +1,6 @@
1
1
  import { BookSize } from '../../models/design-request';
2
- export declare function getDesignOptions(apiKey: string, bookSize: BookSize, imageCount: number): Promise<{
2
+ import { MagicBookClient } from '../../models/client';
3
+ export declare function getDesignOptions({ apiKey, apiHost }: MagicBookClient, bookSize: BookSize, imageCount: number): Promise<{
3
4
  densities: {
4
5
  low: {
5
6
  maxPageCount: number;
@@ -1,2 +1,13 @@
1
1
  import { ImageServer } from '../../models/design-request/image';
2
- export declare function addImageInBook(apiKey: string, bookId: string, payload: ImageServer): Promise<ImageServer>;
2
+ import { MagicBookClient } from '../../models/client';
3
+ export declare function addImageInBook({ apiKey, apiHost }: MagicBookClient, bookId: string, payload: ImageServer): Promise<{
4
+ url: string;
5
+ width: number;
6
+ height: number;
7
+ handle: string;
8
+ orientation: number;
9
+ taken_at: string;
10
+ filename: string;
11
+ camera_make?: string | undefined;
12
+ camera?: string | undefined;
13
+ }>;