@gyldendalas/gyldendal-divine-api 0.3.0 → 0.3.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/dist/index.cjs CHANGED
@@ -94,7 +94,14 @@ var BaseService = class {
94
94
  timeout
95
95
  }) {
96
96
  const method = "GET";
97
- return await this.callAsync({ url, body: null, method, headers, addAuthHeaders, timeout });
97
+ return await this.callAsync({
98
+ url,
99
+ body: null,
100
+ method,
101
+ headers,
102
+ addAuthHeaders,
103
+ timeout
104
+ });
98
105
  }
99
106
  async putAsync({
100
107
  url,
@@ -104,7 +111,14 @@ var BaseService = class {
104
111
  timeout
105
112
  }) {
106
113
  const method = "PUT";
107
- return await this.callAsync({ url, body, method, headers, addAuthHeaders, timeout });
114
+ return await this.callAsync({
115
+ url,
116
+ body,
117
+ method,
118
+ headers,
119
+ addAuthHeaders,
120
+ timeout
121
+ });
108
122
  }
109
123
  async postAsync({
110
124
  url,
@@ -114,7 +128,14 @@ var BaseService = class {
114
128
  timeout
115
129
  }) {
116
130
  const method = "POST";
117
- return await this.callAsync({ url, body, method, headers, addAuthHeaders, timeout });
131
+ return await this.callAsync({
132
+ url,
133
+ body,
134
+ method,
135
+ headers,
136
+ addAuthHeaders,
137
+ timeout
138
+ });
118
139
  }
119
140
  async deleteAsync({
120
141
  url,
@@ -123,7 +144,14 @@ var BaseService = class {
123
144
  timeout
124
145
  }) {
125
146
  const method = "DELETE";
126
- return await this.callAsync({ url, body: null, method, headers, addAuthHeaders, timeout });
147
+ return await this.callAsync({
148
+ url,
149
+ body: null,
150
+ method,
151
+ headers,
152
+ addAuthHeaders,
153
+ timeout
154
+ });
127
155
  }
128
156
  async patchAsync({
129
157
  url,
@@ -133,7 +161,14 @@ var BaseService = class {
133
161
  timeout
134
162
  }) {
135
163
  const method = "PATCH";
136
- return await this.callAsync({ url, body, method, headers, addAuthHeaders, timeout });
164
+ return await this.callAsync({
165
+ url,
166
+ body,
167
+ method,
168
+ headers,
169
+ addAuthHeaders,
170
+ timeout
171
+ });
137
172
  }
138
173
  async callAsync({
139
174
  url,
@@ -156,7 +191,10 @@ var BaseService = class {
156
191
  signal: AbortSignal.timeout(timeout)
157
192
  });
158
193
  if (!response.ok) {
159
- throw new HTTPError(`Got ${response.status} while calling ${response.url}`, response);
194
+ throw new HTTPError(
195
+ `Got ${response.status} while calling ${response.url}`,
196
+ response
197
+ );
160
198
  }
161
199
  return response;
162
200
  }
@@ -210,7 +248,12 @@ var TaggingService = class extends base_service_default {
210
248
  const url = `${this.getUrlPrefix()}/tags`;
211
249
  const headers = new Headers();
212
250
  headers.append("Content-Type", "application/json");
213
- const response = await this.postAsync({ url, headers, body: JSON.stringify(tag), timeout });
251
+ const response = await this.postAsync({
252
+ url,
253
+ headers,
254
+ body: JSON.stringify(tag),
255
+ timeout
256
+ });
214
257
  return await response.json();
215
258
  }
216
259
  async updateTag({
@@ -220,7 +263,12 @@ var TaggingService = class extends base_service_default {
220
263
  const url = `${this.getUrlPrefix()}/tags`;
221
264
  const headers = new Headers();
222
265
  headers.append("Content-Type", "application/json");
223
- const response = await this.putAsync({ url, headers, body: JSON.stringify(tag), timeout });
266
+ const response = await this.putAsync({
267
+ url,
268
+ headers,
269
+ body: JSON.stringify(tag),
270
+ timeout
271
+ });
224
272
  return await response.json();
225
273
  }
226
274
  async deleteTag({
@@ -270,7 +318,12 @@ var PollyService = class extends base_service_default {
270
318
  const url = `${this.getUrlPrefix()}/synthesizeSpeech`;
271
319
  const headers = new Headers();
272
320
  headers.append("Content-Type", "application/json");
273
- const response = await this.postAsync({ url, headers, body: JSON.stringify(body), timeout });
321
+ const response = await this.postAsync({
322
+ url,
323
+ headers,
324
+ body: JSON.stringify(body),
325
+ timeout
326
+ });
274
327
  return response.json();
275
328
  }
276
329
  };
@@ -298,7 +351,13 @@ var CookieConsentLog = class extends base_service_default {
298
351
  const url = `${this.getUrlPrefix()}/log`;
299
352
  const headers = new Headers();
300
353
  headers.append("Content-Type", "application/json");
301
- const response = await this.postAsync({ url, headers, body: JSON.stringify(body), addAuthHeaders: false, timeout });
354
+ const response = await this.postAsync({
355
+ url,
356
+ headers,
357
+ body: JSON.stringify(body),
358
+ addAuthHeaders: false,
359
+ timeout
360
+ });
302
361
  return response.text();
303
362
  }
304
363
  };
@@ -331,7 +390,12 @@ var HighlightService = class extends base_service_default {
331
390
  const url = `${this.getUrlPrefix()}/v2/search`;
332
391
  const headers = new Headers();
333
392
  headers.append("Content-Type", "application/json");
334
- const response = await this.postAsync({ url, headers, body: JSON.stringify(search), timeout });
393
+ const response = await this.postAsync({
394
+ url,
395
+ headers,
396
+ body: JSON.stringify(search),
397
+ timeout
398
+ });
335
399
  return response.json();
336
400
  }
337
401
  async deleteHighlightOrNote({
@@ -387,7 +451,12 @@ var HighlightService = class extends base_service_default {
387
451
  const url = `${this.getUrlPrefix()}/v2/isbn/${isbn}/pid/${pid}/key/${key}`;
388
452
  const headers = new Headers();
389
453
  headers.set("Content-Type", "application/json");
390
- const response = await this.putAsync({ url, headers, body: JSON.stringify(payload), timeout });
454
+ const response = await this.putAsync({
455
+ url,
456
+ headers,
457
+ body: JSON.stringify(payload),
458
+ timeout
459
+ });
391
460
  return response.json();
392
461
  }
393
462
  async addHighlightOrNote({
@@ -399,7 +468,12 @@ var HighlightService = class extends base_service_default {
399
468
  const url = `${this.getUrlPrefix()}/v2/isbn/${isbn}/pid/${pid}`;
400
469
  const headers = new Headers();
401
470
  headers.set("Content-Type", "application/json");
402
- const response = await this.postAsync({ url, headers, body: JSON.stringify(payload), timeout });
471
+ const response = await this.postAsync({
472
+ url,
473
+ headers,
474
+ body: JSON.stringify(payload),
475
+ timeout
476
+ });
403
477
  return response.json();
404
478
  }
405
479
  };
@@ -451,7 +525,12 @@ var UserSettingsClientSettings = class extends user_settings_base_default {
451
525
  const url = `${this.getUrlPrefix()}/clientsettings/isbn/${isbn}`;
452
526
  const headers = new Headers();
453
527
  headers.set("Content-Type", "application/json");
454
- const response = await this.putAsync({ url, headers, body: JSON.stringify(settings), timeout });
528
+ const response = await this.putAsync({
529
+ url,
530
+ headers,
531
+ body: JSON.stringify(settings),
532
+ timeout
533
+ });
455
534
  return response.json();
456
535
  }
457
536
  async deleteSettings({
@@ -479,7 +558,12 @@ var UserSettingsBookmarks = class extends user_settings_base_default {
479
558
  headers.set("external-user-id", externalUserId);
480
559
  }
481
560
  headers.set("Content-Type", "application/json");
482
- const response = await this.putAsync({ url, headers, body: JSON.stringify(bookmark), timeout });
561
+ const response = await this.putAsync({
562
+ url,
563
+ headers,
564
+ body: JSON.stringify(bookmark),
565
+ timeout
566
+ });
483
567
  return response.json();
484
568
  }
485
569
  async deleteBookmark({
@@ -540,7 +624,12 @@ var UserSettingsContinue = class extends user_settings_base_default {
540
624
  headers.set("external-user-id", externalUserId);
541
625
  }
542
626
  headers.set("Content-Type", "application/json");
543
- const response = await this.putAsync({ url, headers, body: JSON.stringify(continueBody), timeout });
627
+ const response = await this.putAsync({
628
+ url,
629
+ headers,
630
+ body: JSON.stringify(continueBody),
631
+ timeout
632
+ });
544
633
  return response.json();
545
634
  }
546
635
  async deleteContinue({
@@ -584,20 +673,21 @@ var UserSettingsMRU = class extends user_settings_base_default {
584
673
  headers.set("external-user-id", externalUserId);
585
674
  }
586
675
  headers.set("Content-Type", "application/json");
587
- const response = await this.postAsync({ url, headers, body: JSON.stringify(mru), timeout });
676
+ const response = await this.postAsync({
677
+ url,
678
+ headers,
679
+ body: JSON.stringify(mru),
680
+ timeout
681
+ });
588
682
  return response.json();
589
683
  }
590
- async clearMRU({
591
- timeout = 5e3
592
- }) {
684
+ async clearMRU({ timeout = 5e3 }) {
593
685
  const url = `${this.getUrlPrefix()}/mru`;
594
686
  const headers = new Headers();
595
687
  await this.deleteAsync({ url, headers, timeout });
596
688
  return;
597
689
  }
598
- async getMRU({
599
- timeout = 5e3
600
- }) {
690
+ async getMRU({ timeout = 5e3 }) {
601
691
  let url = `${this.getUrlPrefix()}/mru`;
602
692
  const headers = new Headers();
603
693
  const response = await this.getAsync({ url, headers, timeout });
@@ -628,7 +718,12 @@ var PdfGeneratorService = class extends base_service_default {
628
718
  const url = `${this.getUrlPrefix()}/sitemap`;
629
719
  const headers = new Headers();
630
720
  headers.append("Content-Type", "application/json");
631
- const response = await this.postAsync({ url, headers, body: JSON.stringify(body), timeout });
721
+ const response = await this.postAsync({
722
+ url,
723
+ headers,
724
+ body: JSON.stringify(body),
725
+ timeout
726
+ });
632
727
  return response.json();
633
728
  }
634
729
  async pdfFromWritingTask({
@@ -638,7 +733,12 @@ var PdfGeneratorService = class extends base_service_default {
638
733
  const url = `${this.getUrlPrefix()}/writingTask`;
639
734
  const headers = new Headers();
640
735
  headers.append("Content-Type", "application/json");
641
- const response = await this.postAsync({ url, headers, body: JSON.stringify(body), timeout });
736
+ const response = await this.postAsync({
737
+ url,
738
+ headers,
739
+ body: JSON.stringify(body),
740
+ timeout
741
+ });
642
742
  return response.json();
643
743
  }
644
744
  async pdfFromNotes({
@@ -648,7 +748,12 @@ var PdfGeneratorService = class extends base_service_default {
648
748
  const url = `${this.getUrlPrefix()}/notes`;
649
749
  const headers = new Headers();
650
750
  headers.append("Content-Type", "application/json");
651
- const response = await this.postAsync({ url, headers, body: JSON.stringify(body), timeout });
751
+ const response = await this.postAsync({
752
+ url,
753
+ headers,
754
+ body: JSON.stringify(body),
755
+ timeout
756
+ });
652
757
  return response.json();
653
758
  }
654
759
  };
@@ -668,114 +773,126 @@ var UserFolders = class extends tagging_service_default {
668
773
  const payloadObject = JSON.parse(payload);
669
774
  return `user_${payloadObject.authns}_${payloadObject.user}`;
670
775
  }
671
- throw new Error("The UserFolders service must be invoked with a valid bearer token");
776
+ throw new Error(
777
+ "The UserFolders service must be invoked with a valid bearer token"
778
+ );
672
779
  }
673
780
  /**
674
- * Create a folder.
675
- * @param folder_name The name of the folder.
676
- * @param parent_folder_uuid The UUID of the parent folder. If no parent folder is provided, the folder is created at the root level.
677
- * @param color The color of the folder.
678
- * @param timeout The timeout for the request in milliseconds.
679
- *
680
- * @return Folder
681
- **/
781
+ * Create a folder.
782
+ * @param folder_name The name of the folder.
783
+ * @param parent_folder_uuid The UUID of the parent folder. If no parent folder is provided, the folder is created at the root level.
784
+ * @param color The color of the folder.
785
+ * @param timeout The timeout for the request in milliseconds.
786
+ *
787
+ * @return Folder
788
+ **/
682
789
  async createFolder({
683
790
  folder_name,
684
791
  parent_folder_uuid,
685
792
  color,
686
793
  timeout = 3e3
687
794
  }) {
688
- const folder_payload = JSON.stringify({ "folder": folder_name, "color": color });
689
- const tag = await this.createTag(
690
- {
691
- tag: {
692
- identity: await this.getIdentity(),
693
- resource_type: "myaccount_user_folder",
694
- resource_name: (0, import_uuid.v4)(),
695
- tag_name: parent_folder_uuid ?? this.hasNoParent,
696
- tag_value: Buffer.from(folder_payload).toString("base64")
697
- },
698
- timeout
699
- }
700
- );
701
- return { name: folder_name, uuid: tag["resource_name"], parent: parent_folder_uuid, created_at: tag["created_at"] };
795
+ const folder_payload = JSON.stringify({
796
+ folder: folder_name,
797
+ color
798
+ });
799
+ const tag = await this.createTag({
800
+ tag: {
801
+ identity: await this.getIdentity(),
802
+ resource_type: "myaccount_user_folder",
803
+ resource_name: (0, import_uuid.v4)(),
804
+ tag_name: parent_folder_uuid ?? this.hasNoParent,
805
+ tag_value: Buffer.from(folder_payload).toString("base64")
806
+ },
807
+ timeout
808
+ });
809
+ return {
810
+ name: folder_name,
811
+ uuid: tag["resource_name"],
812
+ parent: parent_folder_uuid,
813
+ created_at: tag["created_at"]
814
+ };
702
815
  }
703
816
  /**
704
- * Update a folder. Only name and color can be changed.
705
- *
706
- * @param folder_uuid The UUID of the folder.
707
- * @param folder_name The new name of the folder.
708
- * @param color The new color of the folder.
709
- * @param timeout The timeout for the request in milliseconds.
710
- *
711
- * @return Folder
712
- **/
817
+ * Update a folder. Only name and color can be changed.
818
+ *
819
+ * @param folder_uuid The UUID of the folder.
820
+ * @param folder_name The new name of the folder.
821
+ * @param color The new color of the folder.
822
+ * @param timeout The timeout for the request in milliseconds.
823
+ *
824
+ * @return Folder
825
+ **/
713
826
  async updateFolder({
714
827
  folder_uuid,
715
828
  folder_name,
716
829
  color,
717
830
  timeout = 3e3
718
831
  }) {
719
- const tags = await this.getTagsByResource(
720
- {
721
- identity: await this.getIdentity(),
722
- resource_type: "myaccount_user_folder",
723
- resource_name: folder_uuid,
724
- timeout
725
- }
726
- );
832
+ const tags = await this.getTagsByResource({
833
+ identity: await this.getIdentity(),
834
+ resource_type: "myaccount_user_folder",
835
+ resource_name: folder_uuid,
836
+ timeout
837
+ });
727
838
  if (tags.length === 0) {
728
839
  throw new Error(`Folder with UUID ${folder_uuid} not found`);
729
840
  }
730
841
  const tag = tags[0];
731
- const folder_payload = JSON.parse(Buffer.from(tag["tag_value"], "base64").toString());
842
+ const folder_payload = JSON.parse(
843
+ Buffer.from(tag["tag_value"], "base64").toString()
844
+ );
732
845
  const new_folder_name = folder_name ?? folder_payload["folder"];
733
846
  const new_color = color ?? folder_payload["color"];
734
- const new_folder_payload = JSON.stringify({ "folder": new_folder_name, "color": new_color });
735
- const updatedTag = await this.updateTag(
736
- {
737
- tag: {
738
- identity: await this.getIdentity(),
739
- resource_type: "myaccount_user_folder",
740
- resource_name: folder_uuid,
741
- tag_name: tag["tag_name"],
742
- tag_value: Buffer.from(new_folder_payload).toString("base64")
743
- },
744
- timeout
745
- }
746
- );
847
+ const new_folder_payload = JSON.stringify({
848
+ folder: new_folder_name,
849
+ color: new_color
850
+ });
851
+ const updatedTag = await this.updateTag({
852
+ tag: {
853
+ identity: await this.getIdentity(),
854
+ resource_type: "myaccount_user_folder",
855
+ resource_name: folder_uuid,
856
+ tag_name: tag["tag_name"],
857
+ tag_value: Buffer.from(new_folder_payload).toString("base64")
858
+ },
859
+ timeout
860
+ });
747
861
  const parent = tag["tag_name"] === this.hasNoParent ? void 0 : tag["tag_name"];
748
- return { name: new_folder_name, uuid: folder_uuid, parent, created_at: updatedTag["created_at"] };
862
+ return {
863
+ name: new_folder_name,
864
+ uuid: folder_uuid,
865
+ parent,
866
+ created_at: updatedTag["created_at"]
867
+ };
749
868
  }
750
869
  /**
751
- * List all folders in the user's account.
752
- *
753
- * @param timeout The timeout for the request in milliseconds.
754
- *
755
- * @return Folder[]
756
- **/
870
+ * List all folders in the user's account.
871
+ *
872
+ * @param timeout The timeout for the request in milliseconds.
873
+ *
874
+ * @return Folder[]
875
+ **/
757
876
  async listAllFolders({
758
877
  timeout = 3e3
759
878
  }) {
760
- const tags = await this.getTagsByResource(
761
- {
762
- identity: await this.getIdentity(),
763
- resource_type: "myaccount_user_folder",
764
- timeout
765
- }
766
- );
879
+ const tags = await this.getTagsByResource({
880
+ identity: await this.getIdentity(),
881
+ resource_type: "myaccount_user_folder",
882
+ timeout
883
+ });
767
884
  let folders = [];
768
885
  for (const tag of tags) {
769
- const folder_payload = JSON.parse(Buffer.from(tag["tag_value"], "base64").toString());
770
- folders.push(
771
- {
772
- name: folder_payload["folder"],
773
- color: folder_payload["color"],
774
- uuid: tag["resource_name"],
775
- parent: tag["tag_name"] === this.hasNoParent ? void 0 : tag["tag_name"],
776
- created_at: tag["created_at"]
777
- }
886
+ const folder_payload = JSON.parse(
887
+ Buffer.from(tag["tag_value"], "base64").toString()
778
888
  );
889
+ folders.push({
890
+ name: folder_payload["folder"],
891
+ color: folder_payload["color"],
892
+ uuid: tag["resource_name"],
893
+ parent: tag["tag_name"] === this.hasNoParent ? void 0 : tag["tag_name"],
894
+ created_at: tag["created_at"]
895
+ });
779
896
  }
780
897
  return folders;
781
898
  }
@@ -786,7 +903,7 @@ var UserFolders = class extends tagging_service_default {
786
903
  * @param timeout The timeout for the request in milliseconds.
787
904
  *
788
905
  * @return Folder[]
789
- **/
906
+ **/
790
907
  async listNextFolderLevel({
791
908
  parent_folder_uuid,
792
909
  timeout = 3e3
@@ -795,52 +912,50 @@ var UserFolders = class extends tagging_service_default {
795
912
  if (!parent_folder_uuid) {
796
913
  parent_folder_uuid = this.hasNoParent;
797
914
  }
798
- tags = await this.getTagsByName(
799
- {
800
- identity: await this.getIdentity(),
801
- resource_type: "myaccount_user_folder",
802
- tag_name: parent_folder_uuid,
803
- timeout
804
- }
805
- );
915
+ tags = await this.getTagsByName({
916
+ identity: await this.getIdentity(),
917
+ resource_type: "myaccount_user_folder",
918
+ tag_name: parent_folder_uuid,
919
+ timeout
920
+ });
806
921
  let folders = [];
807
922
  for (const tag of tags) {
808
- const folder_payload = JSON.parse(Buffer.from(tag["tag_value"], "base64").toString());
809
- folders.push(
810
- {
811
- name: folder_payload["folder"],
812
- color: folder_payload["color"],
813
- uuid: tag["resource_name"],
814
- parent: tag["tag_name"] === this.hasNoParent ? void 0 : tag["tag_name"],
815
- created_at: tag["created_at"]
816
- }
923
+ const folder_payload = JSON.parse(
924
+ Buffer.from(tag["tag_value"], "base64").toString()
817
925
  );
926
+ folders.push({
927
+ name: folder_payload["folder"],
928
+ color: folder_payload["color"],
929
+ uuid: tag["resource_name"],
930
+ parent: tag["tag_name"] === this.hasNoParent ? void 0 : tag["tag_name"],
931
+ created_at: tag["created_at"]
932
+ });
818
933
  }
819
934
  return folders;
820
935
  }
821
936
  /**
822
- * List the content of a folder.
823
- *
824
- * @param folder_uuid The UUID of the folder.
825
- * @param timeout The timeout for the request in milliseconds.
826
- *
827
- * @return (Folder | FolderContent)[]
828
- **/
937
+ * List the content of a folder.
938
+ *
939
+ * @param folder_uuid The UUID of the folder.
940
+ * @param timeout The timeout for the request in milliseconds.
941
+ *
942
+ * @return (Folder | FolderContent)[]
943
+ **/
829
944
  async getFolderContent({
830
945
  folder_uuid,
831
946
  timeout = 3e3
832
947
  }) {
833
- let tags = await this.getTagsByName(
834
- {
835
- identity: await this.getIdentity(),
836
- tag_name: folder_uuid,
837
- timeout
838
- }
839
- );
948
+ let tags = await this.getTagsByName({
949
+ identity: await this.getIdentity(),
950
+ tag_name: folder_uuid,
951
+ timeout
952
+ });
840
953
  let content = [];
841
954
  for (const tag of tags) {
842
955
  if (tag["resource_type"] === "myaccount_user_folder") {
843
- const folder_payload = JSON.parse(Buffer.from(tag["tag_value"], "base64").toString());
956
+ const folder_payload = JSON.parse(
957
+ Buffer.from(tag["tag_value"], "base64").toString()
958
+ );
844
959
  content.push({
845
960
  name: folder_payload["folder"],
846
961
  color: folder_payload["color"],
@@ -849,14 +964,12 @@ var UserFolders = class extends tagging_service_default {
849
964
  created_at: tag["created_at"]
850
965
  });
851
966
  } else {
852
- content.push(
853
- {
854
- type: tag["resource_type"],
855
- identifier: tag["resource_name"],
856
- folder_uuid: tag["tag_name"],
857
- created_at: tag["created_at"]
858
- }
859
- );
967
+ content.push({
968
+ type: tag["resource_type"],
969
+ identifier: tag["resource_name"],
970
+ folder_uuid: tag["tag_name"],
971
+ created_at: tag["created_at"]
972
+ });
860
973
  }
861
974
  }
862
975
  return content;
@@ -869,20 +982,18 @@ var UserFolders = class extends tagging_service_default {
869
982
  * @param timeout The timeout for the request in milliseconds.
870
983
  *
871
984
  * @return FolderContent
872
- **/
985
+ **/
873
986
  async addInternetbookToFolder({
874
987
  folder_uuid,
875
988
  isbn,
876
989
  timeout = 3e3
877
990
  }) {
878
- return await this.addContentToFolder(
879
- {
880
- folder_uuid,
881
- resource_type: "internetbook",
882
- resource_name: isbn,
883
- timeout
884
- }
885
- );
991
+ return await this.addContentToFolder({
992
+ folder_uuid,
993
+ resource_type: "internetbook",
994
+ resource_name: isbn,
995
+ timeout
996
+ });
886
997
  }
887
998
  /**
888
999
  * Remove a book from a folder.
@@ -892,20 +1003,18 @@ var UserFolders = class extends tagging_service_default {
892
1003
  * @param timeout The timeout for the request in milliseconds.
893
1004
  *
894
1005
  * @return void
895
- **/
1006
+ **/
896
1007
  async removeInternetbookFromFolder({
897
1008
  folder_uuid,
898
1009
  isbn,
899
1010
  timeout = 3e3
900
1011
  }) {
901
- await this.removeContentFromFolder(
902
- {
903
- folder_uuid,
904
- resource_type: "internetbook",
905
- resource_name: isbn,
906
- timeout
907
- }
908
- );
1012
+ await this.removeContentFromFolder({
1013
+ folder_uuid,
1014
+ resource_type: "internetbook",
1015
+ resource_name: isbn,
1016
+ timeout
1017
+ });
909
1018
  }
910
1019
  /**
911
1020
  * Create a new folder content element.
@@ -916,26 +1025,29 @@ var UserFolders = class extends tagging_service_default {
916
1025
  * @param timeout The timeout for the request in milliseconds.
917
1026
  *
918
1027
  * @return FolderContent
919
- **/
1028
+ **/
920
1029
  async addContentToFolder({
921
1030
  folder_uuid,
922
1031
  resource_type,
923
1032
  resource_name,
924
1033
  timeout = 3e3
925
1034
  }) {
926
- const tag = await this.createTag(
927
- {
928
- tag: {
929
- identity: await this.getIdentity(),
930
- resource_type,
931
- resource_name,
932
- tag_name: folder_uuid,
933
- tag_value: "MYACCOUNT_USER_FOLDER"
934
- },
935
- timeout
936
- }
937
- );
938
- return { type: resource_type, identifier: resource_name, folder_uuid, created_at: tag["created_at"] };
1035
+ const tag = await this.createTag({
1036
+ tag: {
1037
+ identity: await this.getIdentity(),
1038
+ resource_type,
1039
+ resource_name,
1040
+ tag_name: folder_uuid,
1041
+ tag_value: "MYACCOUNT_USER_FOLDER"
1042
+ },
1043
+ timeout
1044
+ });
1045
+ return {
1046
+ type: resource_type,
1047
+ identifier: resource_name,
1048
+ folder_uuid,
1049
+ created_at: tag["created_at"]
1050
+ };
939
1051
  }
940
1052
  /**
941
1053
  * Remove a folder content element.
@@ -946,22 +1058,20 @@ var UserFolders = class extends tagging_service_default {
946
1058
  * @param timeout The timeout for the request in milliseconds.
947
1059
  *
948
1060
  * @return void
949
- **/
1061
+ **/
950
1062
  async removeContentFromFolder({
951
1063
  folder_uuid,
952
1064
  resource_name,
953
1065
  resource_type,
954
1066
  timeout = 3e3
955
1067
  }) {
956
- await this.deleteTag(
957
- {
958
- identity: await this.getIdentity(),
959
- resource_type,
960
- resource_name,
961
- tag_name: folder_uuid,
962
- timeout
963
- }
964
- );
1068
+ await this.deleteTag({
1069
+ identity: await this.getIdentity(),
1070
+ resource_type,
1071
+ resource_name,
1072
+ tag_name: folder_uuid,
1073
+ timeout
1074
+ });
965
1075
  }
966
1076
  /**
967
1077
  * Delete a folder.
@@ -970,19 +1080,17 @@ var UserFolders = class extends tagging_service_default {
970
1080
  * @param timeout The timeout for the request in milliseconds.
971
1081
  *
972
1082
  * @return void
973
- **/
1083
+ **/
974
1084
  async deleteFolder({
975
1085
  folder_uuid,
976
1086
  timeout = 3e3
977
1087
  }) {
978
- await this.deleteTag(
979
- {
980
- identity: await this.getIdentity(),
981
- resource_type: "myaccount_user_folder",
982
- resource_name: folder_uuid,
983
- timeout
984
- }
985
- );
1088
+ await this.deleteTag({
1089
+ identity: await this.getIdentity(),
1090
+ resource_type: "myaccount_user_folder",
1091
+ resource_name: folder_uuid,
1092
+ timeout
1093
+ });
986
1094
  }
987
1095
  /**
988
1096
  * Delete all folders. Note, this will not delete the content of the folders.
@@ -990,17 +1098,15 @@ var UserFolders = class extends tagging_service_default {
990
1098
  * @param timeout The timeout for the request in milliseconds.
991
1099
  *
992
1100
  * @return void
993
- **/
1101
+ **/
994
1102
  async deleteAllFolders({
995
1103
  timeout = 3e3
996
1104
  }) {
997
- await this.deleteTag(
998
- {
999
- identity: await this.getIdentity(),
1000
- resource_type: "myaccount_user_folder",
1001
- timeout
1002
- }
1003
- );
1105
+ await this.deleteTag({
1106
+ identity: await this.getIdentity(),
1107
+ resource_type: "myaccount_user_folder",
1108
+ timeout
1109
+ });
1004
1110
  }
1005
1111
  };
1006
1112
 
@@ -1049,10 +1155,19 @@ var AIBotService = class extends base_service_default {
1049
1155
  body,
1050
1156
  timeout = 1e4
1051
1157
  }) {
1052
- const url = await this.constructChatUrl({ interactivityId, isbn, stream: false });
1158
+ const url = await this.constructChatUrl({
1159
+ interactivityId,
1160
+ isbn,
1161
+ stream: false
1162
+ });
1053
1163
  const headers = new Headers();
1054
1164
  headers.append("Content-Type", "application/json");
1055
- const response = await this.postAsync({ url, headers, body: JSON.stringify(body), timeout });
1165
+ const response = await this.postAsync({
1166
+ url,
1167
+ headers,
1168
+ body: JSON.stringify(body),
1169
+ timeout
1170
+ });
1056
1171
  return response.json();
1057
1172
  }
1058
1173
  async streamingChat({
@@ -1061,10 +1176,19 @@ var AIBotService = class extends base_service_default {
1061
1176
  body,
1062
1177
  timeout = 1e4
1063
1178
  }) {
1064
- const url = await this.constructChatUrl({ interactivityId, isbn, stream: true });
1179
+ const url = await this.constructChatUrl({
1180
+ interactivityId,
1181
+ isbn,
1182
+ stream: true
1183
+ });
1065
1184
  const headers = new Headers();
1066
1185
  headers.append("Content-Type", "application/json");
1067
- const response = await this.postAsync({ url, headers, body: JSON.stringify(body), timeout });
1186
+ const response = await this.postAsync({
1187
+ url,
1188
+ headers,
1189
+ body: JSON.stringify(body),
1190
+ timeout
1191
+ });
1068
1192
  const responseBody = response.body;
1069
1193
  if (!responseBody) {
1070
1194
  throw new Error("Response body is null");
@@ -1319,7 +1443,7 @@ var QuizService = class extends base_service_default {
1319
1443
  const url = `${this.getUrlPrefix()}/shared/quiz/${quizSessionId}`;
1320
1444
  const method = archive ? "DELETE" : "PATCH";
1321
1445
  const headers = this.makeHeaders(extraHeaders);
1322
- const res = method === "DELETE" ? await this.deleteAsync({ url, headers, timeout }) : await this.postAsync({
1446
+ const res = method === "DELETE" ? await this.deleteAsync({ url, headers, timeout }) : await this.patchAsync({
1323
1447
  url,
1324
1448
  headers,
1325
1449
  body: null,