isbnlab 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,2361 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ AuthorFromJSON: () => AuthorFromJSON,
24
+ AuthorFromJSONTyped: () => AuthorFromJSONTyped,
25
+ AuthorPhotoFromJSON: () => AuthorPhotoFromJSON,
26
+ AuthorPhotoFromJSONTyped: () => AuthorPhotoFromJSONTyped,
27
+ AuthorPhotoToJSON: () => AuthorPhotoToJSON,
28
+ AuthorPhotoToJSONTyped: () => AuthorPhotoToJSONTyped,
29
+ AuthorToJSON: () => AuthorToJSON,
30
+ AuthorToJSONTyped: () => AuthorToJSONTyped,
31
+ AuthorsApi: () => AuthorsApi,
32
+ BASE_PATH: () => BASE_PATH,
33
+ BaseAPI: () => BaseAPI,
34
+ BlobApiResponse: () => BlobApiResponse,
35
+ BookCoverFromJSON: () => BookCoverFromJSON,
36
+ BookCoverFromJSONTyped: () => BookCoverFromJSONTyped,
37
+ BookCoverToJSON: () => BookCoverToJSON,
38
+ BookCoverToJSONTyped: () => BookCoverToJSONTyped,
39
+ BookEditionsFromJSON: () => BookEditionsFromJSON,
40
+ BookEditionsFromJSONTyped: () => BookEditionsFromJSONTyped,
41
+ BookEditionsToJSON: () => BookEditionsToJSON,
42
+ BookEditionsToJSONTyped: () => BookEditionsToJSONTyped,
43
+ BookFromJSON: () => BookFromJSON,
44
+ BookFromJSONTyped: () => BookFromJSONTyped,
45
+ BookPublishDatePrecisionEnum: () => BookPublishDatePrecisionEnum,
46
+ BookToJSON: () => BookToJSON,
47
+ BookToJSONTyped: () => BookToJSONTyped,
48
+ BooksApi: () => BooksApi,
49
+ COLLECTION_FORMATS: () => COLLECTION_FORMATS,
50
+ CategoryFromJSON: () => CategoryFromJSON,
51
+ CategoryFromJSONTyped: () => CategoryFromJSONTyped,
52
+ CategoryToJSON: () => CategoryToJSON,
53
+ CategoryToJSONTyped: () => CategoryToJSONTyped,
54
+ Configuration: () => Configuration,
55
+ ContributorFromJSON: () => ContributorFromJSON,
56
+ ContributorFromJSONTyped: () => ContributorFromJSONTyped,
57
+ ContributorRoleEnum: () => ContributorRoleEnum,
58
+ ContributorToJSON: () => ContributorToJSON,
59
+ ContributorToJSONTyped: () => ContributorToJSONTyped,
60
+ CoverSizeFromJSON: () => CoverSizeFromJSON,
61
+ CoverSizeFromJSONTyped: () => CoverSizeFromJSONTyped,
62
+ CoverSizeToJSON: () => CoverSizeToJSON,
63
+ CoverSizeToJSONTyped: () => CoverSizeToJSONTyped,
64
+ DefaultConfig: () => DefaultConfig,
65
+ EditionRefFromJSON: () => EditionRefFromJSON,
66
+ EditionRefFromJSONTyped: () => EditionRefFromJSONTyped,
67
+ EditionRefToJSON: () => EditionRefToJSON,
68
+ EditionRefToJSONTyped: () => EditionRefToJSONTyped,
69
+ EntityRefFromJSON: () => EntityRefFromJSON,
70
+ EntityRefFromJSONTyped: () => EntityRefFromJSONTyped,
71
+ EntityRefToJSON: () => EntityRefToJSON,
72
+ EntityRefToJSONTyped: () => EntityRefToJSONTyped,
73
+ FetchError: () => FetchError,
74
+ GenreFromJSON: () => GenreFromJSON,
75
+ GenreFromJSONTyped: () => GenreFromJSONTyped,
76
+ GenreToJSON: () => GenreToJSON,
77
+ GenreToJSONTyped: () => GenreToJSONTyped,
78
+ GenresApi: () => GenresApi,
79
+ IsbnApi: () => IsbnApi,
80
+ IsbnDetailsFromJSON: () => IsbnDetailsFromJSON,
81
+ IsbnDetailsFromJSONTyped: () => IsbnDetailsFromJSONTyped,
82
+ IsbnDetailsToJSON: () => IsbnDetailsToJSON,
83
+ IsbnDetailsToJSONTyped: () => IsbnDetailsToJSONTyped,
84
+ JSONApiResponse: () => JSONApiResponse,
85
+ OtherSeriesFromJSON: () => OtherSeriesFromJSON,
86
+ OtherSeriesFromJSONTyped: () => OtherSeriesFromJSONTyped,
87
+ OtherSeriesKindEnum: () => OtherSeriesKindEnum,
88
+ OtherSeriesToJSON: () => OtherSeriesToJSON,
89
+ OtherSeriesToJSONTyped: () => OtherSeriesToJSONTyped,
90
+ PLAN_RESTRICTED_FIELDS_HEADER: () => PLAN_RESTRICTED_FIELDS_HEADER,
91
+ PLAN_UPGRADE_HEADER: () => PLAN_UPGRADE_HEADER,
92
+ PublisherFromJSON: () => PublisherFromJSON,
93
+ PublisherFromJSONTyped: () => PublisherFromJSONTyped,
94
+ PublisherToJSON: () => PublisherToJSON,
95
+ PublisherToJSONTyped: () => PublisherToJSONTyped,
96
+ PublishersApi: () => PublishersApi,
97
+ RatingCountsFromJSON: () => RatingCountsFromJSON,
98
+ RatingCountsFromJSONTyped: () => RatingCountsFromJSONTyped,
99
+ RatingCountsToJSON: () => RatingCountsToJSON,
100
+ RatingCountsToJSONTyped: () => RatingCountsToJSONTyped,
101
+ RatingSummaryFromJSON: () => RatingSummaryFromJSON,
102
+ RatingSummaryFromJSONTyped: () => RatingSummaryFromJSONTyped,
103
+ RatingSummaryToJSON: () => RatingSummaryToJSON,
104
+ RatingSummaryToJSONTyped: () => RatingSummaryToJSONTyped,
105
+ RatingsFromJSON: () => RatingsFromJSON,
106
+ RatingsFromJSONTyped: () => RatingsFromJSONTyped,
107
+ RatingsToJSON: () => RatingsToJSON,
108
+ RatingsToJSONTyped: () => RatingsToJSONTyped,
109
+ RequiredError: () => RequiredError,
110
+ ResponseError: () => ResponseError,
111
+ RetailLinkFromJSON: () => RetailLinkFromJSON,
112
+ RetailLinkFromJSONTyped: () => RetailLinkFromJSONTyped,
113
+ RetailLinkToJSON: () => RetailLinkToJSON,
114
+ RetailLinkToJSONTyped: () => RetailLinkToJSONTyped,
115
+ SeriesBookFromJSON: () => SeriesBookFromJSON,
116
+ SeriesBookFromJSONTyped: () => SeriesBookFromJSONTyped,
117
+ SeriesBookToJSON: () => SeriesBookToJSON,
118
+ SeriesBookToJSONTyped: () => SeriesBookToJSONTyped,
119
+ SeriesFromJSON: () => SeriesFromJSON,
120
+ SeriesFromJSONTyped: () => SeriesFromJSONTyped,
121
+ SeriesKindEnum: () => SeriesKindEnum,
122
+ SeriesParentFromJSON: () => SeriesParentFromJSON,
123
+ SeriesParentFromJSONTyped: () => SeriesParentFromJSONTyped,
124
+ SeriesParentToJSON: () => SeriesParentToJSON,
125
+ SeriesParentToJSONTyped: () => SeriesParentToJSONTyped,
126
+ SeriesToJSON: () => SeriesToJSON,
127
+ SeriesToJSONTyped: () => SeriesToJSONTyped,
128
+ SubjectFromJSON: () => SubjectFromJSON,
129
+ SubjectFromJSONTyped: () => SubjectFromJSONTyped,
130
+ SubjectRefFromJSON: () => SubjectRefFromJSON,
131
+ SubjectRefFromJSONTyped: () => SubjectRefFromJSONTyped,
132
+ SubjectRefToJSON: () => SubjectRefToJSON,
133
+ SubjectRefToJSONTyped: () => SubjectRefToJSONTyped,
134
+ SubjectToJSON: () => SubjectToJSON,
135
+ SubjectToJSONTyped: () => SubjectToJSONTyped,
136
+ SubjectsApi: () => SubjectsApi,
137
+ TextApiResponse: () => TextApiResponse,
138
+ VoidApiResponse: () => VoidApiResponse,
139
+ canConsumeForm: () => canConsumeForm,
140
+ exists: () => exists,
141
+ instanceOfAuthor: () => instanceOfAuthor,
142
+ instanceOfAuthorPhoto: () => instanceOfAuthorPhoto,
143
+ instanceOfBook: () => instanceOfBook,
144
+ instanceOfBookCover: () => instanceOfBookCover,
145
+ instanceOfBookEditions: () => instanceOfBookEditions,
146
+ instanceOfCategory: () => instanceOfCategory,
147
+ instanceOfContributor: () => instanceOfContributor,
148
+ instanceOfCoverSize: () => instanceOfCoverSize,
149
+ instanceOfEditionRef: () => instanceOfEditionRef,
150
+ instanceOfEntityRef: () => instanceOfEntityRef,
151
+ instanceOfGenre: () => instanceOfGenre,
152
+ instanceOfIsbnDetails: () => instanceOfIsbnDetails,
153
+ instanceOfOtherSeries: () => instanceOfOtherSeries,
154
+ instanceOfPublisher: () => instanceOfPublisher,
155
+ instanceOfRatingCounts: () => instanceOfRatingCounts,
156
+ instanceOfRatingSummary: () => instanceOfRatingSummary,
157
+ instanceOfRatings: () => instanceOfRatings,
158
+ instanceOfRetailLink: () => instanceOfRetailLink,
159
+ instanceOfSeries: () => instanceOfSeries,
160
+ instanceOfSeriesBook: () => instanceOfSeriesBook,
161
+ instanceOfSeriesParent: () => instanceOfSeriesParent,
162
+ instanceOfSubject: () => instanceOfSubject,
163
+ instanceOfSubjectRef: () => instanceOfSubjectRef,
164
+ mapValues: () => mapValues,
165
+ querystring: () => querystring,
166
+ restrictedFields: () => restrictedFields,
167
+ upgradeUrl: () => upgradeUrl
168
+ });
169
+ module.exports = __toCommonJS(index_exports);
170
+
171
+ // src/runtime.ts
172
+ var BASE_PATH = "https://www.isbnlab.com".replace(/\/+$/, "");
173
+ var Configuration = class {
174
+ constructor(configuration = {}) {
175
+ this.configuration = configuration;
176
+ }
177
+ set config(configuration) {
178
+ this.configuration = configuration;
179
+ }
180
+ get basePath() {
181
+ return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
182
+ }
183
+ get fetchApi() {
184
+ return this.configuration.fetchApi;
185
+ }
186
+ get middleware() {
187
+ return this.configuration.middleware || [];
188
+ }
189
+ get queryParamsStringify() {
190
+ return this.configuration.queryParamsStringify || querystring;
191
+ }
192
+ get username() {
193
+ return this.configuration.username;
194
+ }
195
+ get password() {
196
+ return this.configuration.password;
197
+ }
198
+ get apiKey() {
199
+ const apiKey = this.configuration.apiKey;
200
+ if (apiKey) {
201
+ return typeof apiKey === "function" ? apiKey : () => apiKey;
202
+ }
203
+ return void 0;
204
+ }
205
+ get accessToken() {
206
+ const accessToken = this.configuration.accessToken;
207
+ if (accessToken) {
208
+ return typeof accessToken === "function" ? accessToken : async () => accessToken;
209
+ }
210
+ return void 0;
211
+ }
212
+ get headers() {
213
+ return this.configuration.headers;
214
+ }
215
+ get credentials() {
216
+ return this.configuration.credentials;
217
+ }
218
+ };
219
+ var DefaultConfig = new Configuration();
220
+ var _BaseAPI = class _BaseAPI {
221
+ constructor(configuration = DefaultConfig) {
222
+ this.configuration = configuration;
223
+ this.fetchApi = async (url, init) => {
224
+ let fetchParams = { url, init };
225
+ for (const middleware of this.middleware) {
226
+ if (middleware.pre) {
227
+ fetchParams = await middleware.pre({
228
+ fetch: this.fetchApi,
229
+ ...fetchParams
230
+ }) || fetchParams;
231
+ }
232
+ }
233
+ let response = void 0;
234
+ try {
235
+ response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
236
+ } catch (e) {
237
+ for (const middleware of this.middleware) {
238
+ if (middleware.onError) {
239
+ response = await middleware.onError({
240
+ fetch: this.fetchApi,
241
+ url: fetchParams.url,
242
+ init: fetchParams.init,
243
+ error: e,
244
+ response: response ? response.clone() : void 0
245
+ }) || response;
246
+ }
247
+ }
248
+ if (response === void 0) {
249
+ if (e instanceof Error) {
250
+ throw new FetchError(e, "The request failed and the interceptors did not return an alternative response");
251
+ } else {
252
+ throw e;
253
+ }
254
+ }
255
+ }
256
+ for (const middleware of this.middleware) {
257
+ if (middleware.post) {
258
+ response = await middleware.post({
259
+ fetch: this.fetchApi,
260
+ url: fetchParams.url,
261
+ init: fetchParams.init,
262
+ response: response.clone()
263
+ }) || response;
264
+ }
265
+ }
266
+ return response;
267
+ };
268
+ this.middleware = configuration.middleware;
269
+ }
270
+ withMiddleware(...middlewares) {
271
+ const next = this.clone();
272
+ next.middleware = next.middleware.concat(...middlewares);
273
+ return next;
274
+ }
275
+ withPreMiddleware(...preMiddlewares) {
276
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
277
+ return this.withMiddleware(...middlewares);
278
+ }
279
+ withPostMiddleware(...postMiddlewares) {
280
+ const middlewares = postMiddlewares.map((post) => ({ post }));
281
+ return this.withMiddleware(...middlewares);
282
+ }
283
+ /**
284
+ * Check if the given MIME is a JSON MIME.
285
+ * JSON MIME examples:
286
+ * application/json
287
+ * application/json; charset=UTF8
288
+ * APPLICATION/JSON
289
+ * application/vnd.company+json
290
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
291
+ * @return True if the given MIME is JSON, false otherwise.
292
+ */
293
+ isJsonMime(mime) {
294
+ if (!mime) {
295
+ return false;
296
+ }
297
+ return _BaseAPI.jsonRegex.test(mime);
298
+ }
299
+ async request(context, initOverrides) {
300
+ const { url, init } = await this.createFetchParams(context, initOverrides);
301
+ const response = await this.fetchApi(url, init);
302
+ if (response && (response.status >= 200 && response.status < 300)) {
303
+ return response;
304
+ }
305
+ throw new ResponseError(response, "Response returned an error code");
306
+ }
307
+ async createFetchParams(context, initOverrides) {
308
+ let url = this.configuration.basePath + context.path;
309
+ if (context.query !== void 0 && Object.keys(context.query).length !== 0) {
310
+ url += "?" + this.configuration.queryParamsStringify(context.query);
311
+ }
312
+ const headers = Object.assign({ Accept: "application/json" }, this.configuration.headers, context.headers);
313
+ Object.keys(headers).forEach((key) => headers[key] === void 0 ? delete headers[key] : {});
314
+ const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
315
+ const initParams = {
316
+ method: context.method,
317
+ headers,
318
+ body: context.body,
319
+ credentials: this.configuration.credentials
320
+ };
321
+ const overriddenInit = {
322
+ ...initParams,
323
+ ...await initOverrideFn({
324
+ init: initParams,
325
+ context
326
+ })
327
+ };
328
+ let body;
329
+ if (isFormData(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob(overriddenInit.body)) {
330
+ body = overriddenInit.body;
331
+ } else if (this.isJsonMime(headers["Content-Type"])) {
332
+ body = JSON.stringify(overriddenInit.body);
333
+ } else {
334
+ body = overriddenInit.body;
335
+ }
336
+ const init = {
337
+ ...overriddenInit,
338
+ body
339
+ };
340
+ return { url, init };
341
+ }
342
+ /**
343
+ * Create a shallow clone of `this` by constructing a new instance
344
+ * and then shallow cloning data members.
345
+ */
346
+ clone() {
347
+ const constructor = this.constructor;
348
+ const next = new constructor(this.configuration);
349
+ next.middleware = this.middleware.slice();
350
+ return next;
351
+ }
352
+ };
353
+ _BaseAPI.jsonRegex = new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$", "i");
354
+ var BaseAPI = _BaseAPI;
355
+ function isBlob(value) {
356
+ return typeof Blob !== "undefined" && value instanceof Blob;
357
+ }
358
+ function isFormData(value) {
359
+ return typeof FormData !== "undefined" && value instanceof FormData;
360
+ }
361
+ var ResponseError = class extends Error {
362
+ constructor(response, msg) {
363
+ super(msg);
364
+ this.response = response;
365
+ this.name = "ResponseError";
366
+ }
367
+ };
368
+ var FetchError = class extends Error {
369
+ constructor(cause, msg) {
370
+ super(msg);
371
+ this.cause = cause;
372
+ this.name = "FetchError";
373
+ }
374
+ };
375
+ var RequiredError = class extends Error {
376
+ constructor(field, msg) {
377
+ super(msg);
378
+ this.field = field;
379
+ this.name = "RequiredError";
380
+ }
381
+ };
382
+ var COLLECTION_FORMATS = {
383
+ csv: ",",
384
+ ssv: " ",
385
+ tsv: " ",
386
+ pipes: "|"
387
+ };
388
+ function querystring(params, prefix = "") {
389
+ return Object.keys(params).map((key) => querystringSingleKey(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
390
+ }
391
+ function querystringSingleKey(key, value, keyPrefix = "") {
392
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
393
+ if (value instanceof Array) {
394
+ const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
395
+ return `${encodeURIComponent(fullKey)}=${multiValue}`;
396
+ }
397
+ if (value instanceof Set) {
398
+ const valueAsArray = Array.from(value);
399
+ return querystringSingleKey(key, valueAsArray, keyPrefix);
400
+ }
401
+ if (value instanceof Date) {
402
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
403
+ }
404
+ if (value instanceof Object) {
405
+ return querystring(value, fullKey);
406
+ }
407
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
408
+ }
409
+ function exists(json, key) {
410
+ const value = json[key];
411
+ return value !== null && value !== void 0;
412
+ }
413
+ function mapValues(data, fn) {
414
+ const result = {};
415
+ for (const key of Object.keys(data)) {
416
+ result[key] = fn(data[key]);
417
+ }
418
+ return result;
419
+ }
420
+ function canConsumeForm(consumes) {
421
+ for (const consume of consumes) {
422
+ if ("multipart/form-data" === consume.contentType) {
423
+ return true;
424
+ }
425
+ }
426
+ return false;
427
+ }
428
+ var JSONApiResponse = class {
429
+ constructor(raw, transformer = (jsonValue) => jsonValue) {
430
+ this.raw = raw;
431
+ this.transformer = transformer;
432
+ }
433
+ async value() {
434
+ return this.transformer(await this.raw.json());
435
+ }
436
+ };
437
+ var VoidApiResponse = class {
438
+ constructor(raw) {
439
+ this.raw = raw;
440
+ }
441
+ async value() {
442
+ return void 0;
443
+ }
444
+ };
445
+ var BlobApiResponse = class {
446
+ constructor(raw) {
447
+ this.raw = raw;
448
+ }
449
+ async value() {
450
+ return await this.raw.blob();
451
+ }
452
+ };
453
+ var TextApiResponse = class {
454
+ constructor(raw) {
455
+ this.raw = raw;
456
+ }
457
+ async value() {
458
+ return await this.raw.text();
459
+ }
460
+ };
461
+
462
+ // src/models/AuthorPhoto.ts
463
+ function instanceOfAuthorPhoto(value) {
464
+ return true;
465
+ }
466
+ function AuthorPhotoFromJSON(json) {
467
+ return AuthorPhotoFromJSONTyped(json, false);
468
+ }
469
+ function AuthorPhotoFromJSONTyped(json, ignoreDiscriminator) {
470
+ if (json == null) {
471
+ return json;
472
+ }
473
+ return {
474
+ "url": json["url"] == null ? void 0 : json["url"],
475
+ "width": json["width"] == null ? void 0 : json["width"],
476
+ "height": json["height"] == null ? void 0 : json["height"],
477
+ "credit": json["credit"] == null ? void 0 : json["credit"],
478
+ "license": json["license"] == null ? void 0 : json["license"],
479
+ "licenseUrl": json["license_url"] == null ? void 0 : json["license_url"]
480
+ };
481
+ }
482
+ function AuthorPhotoToJSON(json) {
483
+ return AuthorPhotoToJSONTyped(json, false);
484
+ }
485
+ function AuthorPhotoToJSONTyped(value, ignoreDiscriminator = false) {
486
+ if (value == null) {
487
+ return value;
488
+ }
489
+ return {
490
+ "url": value["url"],
491
+ "width": value["width"],
492
+ "height": value["height"],
493
+ "credit": value["credit"],
494
+ "license": value["license"],
495
+ "license_url": value["licenseUrl"]
496
+ };
497
+ }
498
+
499
+ // src/models/Author.ts
500
+ function instanceOfAuthor(value) {
501
+ return true;
502
+ }
503
+ function AuthorFromJSON(json) {
504
+ return AuthorFromJSONTyped(json, false);
505
+ }
506
+ function AuthorFromJSONTyped(json, ignoreDiscriminator) {
507
+ if (json == null) {
508
+ return json;
509
+ }
510
+ return {
511
+ "name": json["name"] == null ? void 0 : json["name"],
512
+ "slug": json["slug"] == null ? void 0 : json["slug"],
513
+ "alternativeNames": json["alternativeNames"] == null ? void 0 : json["alternativeNames"],
514
+ "deathDate": json["deathDate"] == null ? void 0 : new Date(json["deathDate"]),
515
+ "birthDate": json["birthDate"] == null ? void 0 : new Date(json["birthDate"]),
516
+ "bio": json["bio"] == null ? void 0 : json["bio"],
517
+ "photos": json["photos"] == null ? void 0 : json["photos"].map(AuthorPhotoFromJSON)
518
+ };
519
+ }
520
+ function AuthorToJSON(json) {
521
+ return AuthorToJSONTyped(json, false);
522
+ }
523
+ function AuthorToJSONTyped(value, ignoreDiscriminator = false) {
524
+ if (value == null) {
525
+ return value;
526
+ }
527
+ return {
528
+ "name": value["name"],
529
+ "slug": value["slug"],
530
+ "alternativeNames": value["alternativeNames"],
531
+ "deathDate": value["deathDate"] === null ? null : value["deathDate"]?.toISOString(),
532
+ "birthDate": value["birthDate"] === null ? null : value["birthDate"]?.toISOString(),
533
+ "bio": value["bio"],
534
+ "photos": value["photos"] == null ? void 0 : value["photos"].map(AuthorPhotoToJSON)
535
+ };
536
+ }
537
+
538
+ // src/models/RetailLink.ts
539
+ function instanceOfRetailLink(value) {
540
+ return true;
541
+ }
542
+ function RetailLinkFromJSON(json) {
543
+ return RetailLinkFromJSONTyped(json, false);
544
+ }
545
+ function RetailLinkFromJSONTyped(json, ignoreDiscriminator) {
546
+ if (json == null) {
547
+ return json;
548
+ }
549
+ return {
550
+ "retailer": json["retailer"] == null ? void 0 : json["retailer"],
551
+ "url": json["url"] == null ? void 0 : json["url"]
552
+ };
553
+ }
554
+ function RetailLinkToJSON(json) {
555
+ return RetailLinkToJSONTyped(json, false);
556
+ }
557
+ function RetailLinkToJSONTyped(value, ignoreDiscriminator = false) {
558
+ if (value == null) {
559
+ return value;
560
+ }
561
+ return {
562
+ "retailer": value["retailer"],
563
+ "url": value["url"]
564
+ };
565
+ }
566
+
567
+ // src/models/SeriesBook.ts
568
+ function instanceOfSeriesBook(value) {
569
+ return true;
570
+ }
571
+ function SeriesBookFromJSON(json) {
572
+ return SeriesBookFromJSONTyped(json, false);
573
+ }
574
+ function SeriesBookFromJSONTyped(json, ignoreDiscriminator) {
575
+ if (json == null) {
576
+ return json;
577
+ }
578
+ return {
579
+ "isbn10": json["isbn10"] == null ? void 0 : json["isbn10"],
580
+ "isbn13": json["isbn13"] == null ? void 0 : json["isbn13"],
581
+ "title": json["title"] == null ? void 0 : json["title"],
582
+ "slug": json["slug"] == null ? void 0 : json["slug"],
583
+ "number": json["number"] == null ? void 0 : json["number"],
584
+ "workId": json["workId"] == null ? void 0 : json["workId"],
585
+ "workSlug": json["workSlug"] == null ? void 0 : json["workSlug"]
586
+ };
587
+ }
588
+ function SeriesBookToJSON(json) {
589
+ return SeriesBookToJSONTyped(json, false);
590
+ }
591
+ function SeriesBookToJSONTyped(value, ignoreDiscriminator = false) {
592
+ if (value == null) {
593
+ return value;
594
+ }
595
+ return {
596
+ "isbn10": value["isbn10"],
597
+ "isbn13": value["isbn13"],
598
+ "title": value["title"],
599
+ "slug": value["slug"],
600
+ "number": value["number"],
601
+ "workId": value["workId"],
602
+ "workSlug": value["workSlug"]
603
+ };
604
+ }
605
+
606
+ // src/models/SeriesParent.ts
607
+ function instanceOfSeriesParent(value) {
608
+ return true;
609
+ }
610
+ function SeriesParentFromJSON(json) {
611
+ return SeriesParentFromJSONTyped(json, false);
612
+ }
613
+ function SeriesParentFromJSONTyped(json, ignoreDiscriminator) {
614
+ if (json == null) {
615
+ return json;
616
+ }
617
+ return {
618
+ "id": json["id"] == null ? void 0 : json["id"],
619
+ "slug": json["slug"] == null ? void 0 : json["slug"],
620
+ "name": json["name"] == null ? void 0 : json["name"]
621
+ };
622
+ }
623
+ function SeriesParentToJSON(json) {
624
+ return SeriesParentToJSONTyped(json, false);
625
+ }
626
+ function SeriesParentToJSONTyped(value, ignoreDiscriminator = false) {
627
+ if (value == null) {
628
+ return value;
629
+ }
630
+ return {
631
+ "id": value["id"],
632
+ "slug": value["slug"],
633
+ "name": value["name"]
634
+ };
635
+ }
636
+
637
+ // src/models/OtherSeries.ts
638
+ var OtherSeriesKindEnum = {
639
+ Story: "story",
640
+ Collection: "collection",
641
+ Unknown: "unknown",
642
+ UnknownDefaultOpenApi: "11184809"
643
+ };
644
+ function instanceOfOtherSeries(value) {
645
+ return true;
646
+ }
647
+ function OtherSeriesFromJSON(json) {
648
+ return OtherSeriesFromJSONTyped(json, false);
649
+ }
650
+ function OtherSeriesFromJSONTyped(json, ignoreDiscriminator) {
651
+ if (json == null) {
652
+ return json;
653
+ }
654
+ return {
655
+ "id": json["id"] == null ? void 0 : json["id"],
656
+ "identifier": json["identifier"] == null ? void 0 : json["identifier"],
657
+ "slug": json["slug"] == null ? void 0 : json["slug"],
658
+ "name": json["name"] == null ? void 0 : json["name"],
659
+ "number": json["number"] == null ? void 0 : json["number"],
660
+ "kind": json["kind"] == null ? void 0 : json["kind"],
661
+ "parent": json["parent"] == null ? void 0 : SeriesParentFromJSON(json["parent"])
662
+ };
663
+ }
664
+ function OtherSeriesToJSON(json) {
665
+ return OtherSeriesToJSONTyped(json, false);
666
+ }
667
+ function OtherSeriesToJSONTyped(value, ignoreDiscriminator = false) {
668
+ if (value == null) {
669
+ return value;
670
+ }
671
+ return {
672
+ "id": value["id"],
673
+ "identifier": value["identifier"],
674
+ "slug": value["slug"],
675
+ "name": value["name"],
676
+ "number": value["number"],
677
+ "kind": value["kind"],
678
+ "parent": SeriesParentToJSON(value["parent"])
679
+ };
680
+ }
681
+
682
+ // src/models/Series.ts
683
+ var SeriesKindEnum = {
684
+ Story: "story",
685
+ Collection: "collection",
686
+ Unknown: "unknown",
687
+ UnknownDefaultOpenApi: "11184809"
688
+ };
689
+ function instanceOfSeries(value) {
690
+ return true;
691
+ }
692
+ function SeriesFromJSON(json) {
693
+ return SeriesFromJSONTyped(json, false);
694
+ }
695
+ function SeriesFromJSONTyped(json, ignoreDiscriminator) {
696
+ if (json == null) {
697
+ return json;
698
+ }
699
+ return {
700
+ "id": json["id"] == null ? void 0 : json["id"],
701
+ "identifier": json["identifier"] == null ? void 0 : json["identifier"],
702
+ "slug": json["slug"] == null ? void 0 : json["slug"],
703
+ "name": json["name"] == null ? void 0 : json["name"],
704
+ "number": json["number"] == null ? void 0 : json["number"],
705
+ "kind": json["kind"] == null ? void 0 : json["kind"],
706
+ "parent": json["parent"] == null ? void 0 : SeriesParentFromJSON(json["parent"]),
707
+ "otherSeries": json["otherSeries"] == null ? void 0 : json["otherSeries"].map(OtherSeriesFromJSON),
708
+ "previousBook": json["previousBook"] == null ? void 0 : SeriesBookFromJSON(json["previousBook"]),
709
+ "nextBook": json["nextBook"] == null ? void 0 : SeriesBookFromJSON(json["nextBook"])
710
+ };
711
+ }
712
+ function SeriesToJSON(json) {
713
+ return SeriesToJSONTyped(json, false);
714
+ }
715
+ function SeriesToJSONTyped(value, ignoreDiscriminator = false) {
716
+ if (value == null) {
717
+ return value;
718
+ }
719
+ return {
720
+ "id": value["id"],
721
+ "identifier": value["identifier"],
722
+ "slug": value["slug"],
723
+ "name": value["name"],
724
+ "number": value["number"],
725
+ "kind": value["kind"],
726
+ "parent": SeriesParentToJSON(value["parent"]),
727
+ "otherSeries": value["otherSeries"] == null ? void 0 : value["otherSeries"].map(OtherSeriesToJSON),
728
+ "previousBook": SeriesBookToJSON(value["previousBook"]),
729
+ "nextBook": SeriesBookToJSON(value["nextBook"])
730
+ };
731
+ }
732
+
733
+ // src/models/Category.ts
734
+ function instanceOfCategory(value) {
735
+ return true;
736
+ }
737
+ function CategoryFromJSON(json) {
738
+ return CategoryFromJSONTyped(json, false);
739
+ }
740
+ function CategoryFromJSONTyped(json, ignoreDiscriminator) {
741
+ if (json == null) {
742
+ return json;
743
+ }
744
+ return {
745
+ "id": json["id"] == null ? void 0 : json["id"],
746
+ "name": json["name"] == null ? void 0 : json["name"],
747
+ "uri": json["uri"] == null ? void 0 : json["uri"]
748
+ };
749
+ }
750
+ function CategoryToJSON(json) {
751
+ return CategoryToJSONTyped(json, false);
752
+ }
753
+ function CategoryToJSONTyped(value, ignoreDiscriminator = false) {
754
+ if (value == null) {
755
+ return value;
756
+ }
757
+ return {
758
+ "id": value["id"],
759
+ "name": value["name"],
760
+ "uri": value["uri"]
761
+ };
762
+ }
763
+
764
+ // src/models/EditionRef.ts
765
+ function instanceOfEditionRef(value) {
766
+ return true;
767
+ }
768
+ function EditionRefFromJSON(json) {
769
+ return EditionRefFromJSONTyped(json, false);
770
+ }
771
+ function EditionRefFromJSONTyped(json, ignoreDiscriminator) {
772
+ if (json == null) {
773
+ return json;
774
+ }
775
+ return {
776
+ "isbn10": json["isbn10"] == null ? void 0 : json["isbn10"],
777
+ "isbn13": json["isbn13"] == null ? void 0 : json["isbn13"],
778
+ "title": json["title"] == null ? void 0 : json["title"],
779
+ "slug": json["slug"] == null ? void 0 : json["slug"],
780
+ "published": json["published"] == null ? void 0 : json["published"],
781
+ "physicalFormat": json["physicalFormat"] == null ? void 0 : json["physicalFormat"],
782
+ "pages": json["pages"] == null ? void 0 : json["pages"],
783
+ "imprint": json["imprint"] == null ? void 0 : json["imprint"]
784
+ };
785
+ }
786
+ function EditionRefToJSON(json) {
787
+ return EditionRefToJSONTyped(json, false);
788
+ }
789
+ function EditionRefToJSONTyped(value, ignoreDiscriminator = false) {
790
+ if (value == null) {
791
+ return value;
792
+ }
793
+ return {
794
+ "isbn10": value["isbn10"],
795
+ "isbn13": value["isbn13"],
796
+ "title": value["title"],
797
+ "slug": value["slug"],
798
+ "published": value["published"],
799
+ "physicalFormat": value["physicalFormat"],
800
+ "pages": value["pages"],
801
+ "imprint": value["imprint"]
802
+ };
803
+ }
804
+
805
+ // src/models/IsbnDetails.ts
806
+ function instanceOfIsbnDetails(value) {
807
+ return true;
808
+ }
809
+ function IsbnDetailsFromJSON(json) {
810
+ return IsbnDetailsFromJSONTyped(json, false);
811
+ }
812
+ function IsbnDetailsFromJSONTyped(json, ignoreDiscriminator) {
813
+ if (json == null) {
814
+ return json;
815
+ }
816
+ return {
817
+ "id": json["id"] == null ? void 0 : json["id"],
818
+ "isbn10": json["isbn10"] == null ? void 0 : json["isbn10"],
819
+ "isbn10Formatted": json["isbn10Formatted"] == null ? void 0 : json["isbn10Formatted"],
820
+ "isbn13": json["isbn13"] == null ? void 0 : json["isbn13"],
821
+ "isbn13Formatted": json["isbn13Formatted"] == null ? void 0 : json["isbn13Formatted"],
822
+ "ean": json["ean"] == null ? void 0 : json["ean"],
823
+ "asin": json["asin"] == null ? void 0 : json["asin"],
824
+ "prefix": json["prefix"] == null ? void 0 : json["prefix"],
825
+ "registrationGroup": json["registrationGroup"] == null ? void 0 : json["registrationGroup"],
826
+ "registrationGroupName": json["registrationGroupName"] == null ? void 0 : json["registrationGroupName"],
827
+ "groupIdentifier": json["groupIdentifier"] == null ? void 0 : json["groupIdentifier"],
828
+ "registrant": json["registrant"] == null ? void 0 : json["registrant"],
829
+ "publication": json["publication"] == null ? void 0 : json["publication"],
830
+ "checkDigit": json["checkDigit"] == null ? void 0 : json["checkDigit"]
831
+ };
832
+ }
833
+ function IsbnDetailsToJSON(json) {
834
+ return IsbnDetailsToJSONTyped(json, false);
835
+ }
836
+ function IsbnDetailsToJSONTyped(value, ignoreDiscriminator = false) {
837
+ if (value == null) {
838
+ return value;
839
+ }
840
+ return {
841
+ "id": value["id"],
842
+ "isbn10": value["isbn10"],
843
+ "isbn10Formatted": value["isbn10Formatted"],
844
+ "isbn13": value["isbn13"],
845
+ "isbn13Formatted": value["isbn13Formatted"],
846
+ "ean": value["ean"],
847
+ "asin": value["asin"],
848
+ "prefix": value["prefix"],
849
+ "registrationGroup": value["registrationGroup"],
850
+ "registrationGroupName": value["registrationGroupName"],
851
+ "groupIdentifier": value["groupIdentifier"],
852
+ "registrant": value["registrant"],
853
+ "publication": value["publication"],
854
+ "checkDigit": value["checkDigit"]
855
+ };
856
+ }
857
+
858
+ // src/models/SubjectRef.ts
859
+ function instanceOfSubjectRef(value) {
860
+ return true;
861
+ }
862
+ function SubjectRefFromJSON(json) {
863
+ return SubjectRefFromJSONTyped(json, false);
864
+ }
865
+ function SubjectRefFromJSONTyped(json, ignoreDiscriminator) {
866
+ if (json == null) {
867
+ return json;
868
+ }
869
+ return {
870
+ "id": json["id"] == null ? void 0 : json["id"],
871
+ "slug": json["slug"] == null ? void 0 : json["slug"],
872
+ "name": json["name"] == null ? void 0 : json["name"],
873
+ "inherited": json["inherited"] == null ? void 0 : json["inherited"]
874
+ };
875
+ }
876
+ function SubjectRefToJSON(json) {
877
+ return SubjectRefToJSONTyped(json, false);
878
+ }
879
+ function SubjectRefToJSONTyped(value, ignoreDiscriminator = false) {
880
+ if (value == null) {
881
+ return value;
882
+ }
883
+ return {
884
+ "id": value["id"],
885
+ "slug": value["slug"],
886
+ "name": value["name"],
887
+ "inherited": value["inherited"]
888
+ };
889
+ }
890
+
891
+ // src/models/Contributor.ts
892
+ var ContributorRoleEnum = {
893
+ Translator: "translator",
894
+ Illustrator: "illustrator",
895
+ Editor: "editor",
896
+ Narrator: "narrator",
897
+ Introduction: "introduction",
898
+ Photographer: "photographer",
899
+ UnknownDefaultOpenApi: "11184809"
900
+ };
901
+ function instanceOfContributor(value) {
902
+ return true;
903
+ }
904
+ function ContributorFromJSON(json) {
905
+ return ContributorFromJSONTyped(json, false);
906
+ }
907
+ function ContributorFromJSONTyped(json, ignoreDiscriminator) {
908
+ if (json == null) {
909
+ return json;
910
+ }
911
+ return {
912
+ "id": json["id"] == null ? void 0 : json["id"],
913
+ "slug": json["slug"] == null ? void 0 : json["slug"],
914
+ "name": json["name"] == null ? void 0 : json["name"],
915
+ "role": json["role"] == null ? void 0 : json["role"]
916
+ };
917
+ }
918
+ function ContributorToJSON(json) {
919
+ return ContributorToJSONTyped(json, false);
920
+ }
921
+ function ContributorToJSONTyped(value, ignoreDiscriminator = false) {
922
+ if (value == null) {
923
+ return value;
924
+ }
925
+ return {
926
+ "id": value["id"],
927
+ "slug": value["slug"],
928
+ "name": value["name"],
929
+ "role": value["role"]
930
+ };
931
+ }
932
+
933
+ // src/models/EntityRef.ts
934
+ function instanceOfEntityRef(value) {
935
+ return true;
936
+ }
937
+ function EntityRefFromJSON(json) {
938
+ return EntityRefFromJSONTyped(json, false);
939
+ }
940
+ function EntityRefFromJSONTyped(json, ignoreDiscriminator) {
941
+ if (json == null) {
942
+ return json;
943
+ }
944
+ return {
945
+ "id": json["id"] == null ? void 0 : json["id"],
946
+ "slug": json["slug"] == null ? void 0 : json["slug"],
947
+ "name": json["name"] == null ? void 0 : json["name"]
948
+ };
949
+ }
950
+ function EntityRefToJSON(json) {
951
+ return EntityRefToJSONTyped(json, false);
952
+ }
953
+ function EntityRefToJSONTyped(value, ignoreDiscriminator = false) {
954
+ if (value == null) {
955
+ return value;
956
+ }
957
+ return {
958
+ "id": value["id"],
959
+ "slug": value["slug"],
960
+ "name": value["name"]
961
+ };
962
+ }
963
+
964
+ // src/models/RatingSummary.ts
965
+ function instanceOfRatingSummary(value) {
966
+ return true;
967
+ }
968
+ function RatingSummaryFromJSON(json) {
969
+ return RatingSummaryFromJSONTyped(json, false);
970
+ }
971
+ function RatingSummaryFromJSONTyped(json, ignoreDiscriminator) {
972
+ if (json == null) {
973
+ return json;
974
+ }
975
+ return {
976
+ "average": json["average"] == null ? void 0 : json["average"],
977
+ "count": json["count"] == null ? void 0 : json["count"],
978
+ "sum": json["sum"] == null ? void 0 : json["sum"]
979
+ };
980
+ }
981
+ function RatingSummaryToJSON(json) {
982
+ return RatingSummaryToJSONTyped(json, false);
983
+ }
984
+ function RatingSummaryToJSONTyped(value, ignoreDiscriminator = false) {
985
+ if (value == null) {
986
+ return value;
987
+ }
988
+ return {
989
+ "average": value["average"],
990
+ "count": value["count"],
991
+ "sum": value["sum"]
992
+ };
993
+ }
994
+
995
+ // src/models/RatingCounts.ts
996
+ function instanceOfRatingCounts(value) {
997
+ return true;
998
+ }
999
+ function RatingCountsFromJSON(json) {
1000
+ return RatingCountsFromJSONTyped(json, false);
1001
+ }
1002
+ function RatingCountsFromJSONTyped(json, ignoreDiscriminator) {
1003
+ if (json == null) {
1004
+ return json;
1005
+ }
1006
+ return {
1007
+ "_1": json["1"] == null ? void 0 : json["1"],
1008
+ "_2": json["2"] == null ? void 0 : json["2"],
1009
+ "_3": json["3"] == null ? void 0 : json["3"],
1010
+ "_4": json["4"] == null ? void 0 : json["4"],
1011
+ "_5": json["5"] == null ? void 0 : json["5"]
1012
+ };
1013
+ }
1014
+ function RatingCountsToJSON(json) {
1015
+ return RatingCountsToJSONTyped(json, false);
1016
+ }
1017
+ function RatingCountsToJSONTyped(value, ignoreDiscriminator = false) {
1018
+ if (value == null) {
1019
+ return value;
1020
+ }
1021
+ return {
1022
+ "1": value["_1"],
1023
+ "2": value["_2"],
1024
+ "3": value["_3"],
1025
+ "4": value["_4"],
1026
+ "5": value["_5"]
1027
+ };
1028
+ }
1029
+
1030
+ // src/models/Ratings.ts
1031
+ function instanceOfRatings(value) {
1032
+ return true;
1033
+ }
1034
+ function RatingsFromJSON(json) {
1035
+ return RatingsFromJSONTyped(json, false);
1036
+ }
1037
+ function RatingsFromJSONTyped(json, ignoreDiscriminator) {
1038
+ if (json == null) {
1039
+ return json;
1040
+ }
1041
+ return {
1042
+ "summary": json["summary"] == null ? void 0 : RatingSummaryFromJSON(json["summary"]),
1043
+ "counts": json["counts"] == null ? void 0 : RatingCountsFromJSON(json["counts"])
1044
+ };
1045
+ }
1046
+ function RatingsToJSON(json) {
1047
+ return RatingsToJSONTyped(json, false);
1048
+ }
1049
+ function RatingsToJSONTyped(value, ignoreDiscriminator = false) {
1050
+ if (value == null) {
1051
+ return value;
1052
+ }
1053
+ return {
1054
+ "summary": RatingSummaryToJSON(value["summary"]),
1055
+ "counts": RatingCountsToJSON(value["counts"])
1056
+ };
1057
+ }
1058
+
1059
+ // src/models/Book.ts
1060
+ var BookPublishDatePrecisionEnum = {
1061
+ Year: "year",
1062
+ Month: "month",
1063
+ Day: "day",
1064
+ UnknownDefaultOpenApi: "11184809"
1065
+ };
1066
+ function instanceOfBook(value) {
1067
+ return true;
1068
+ }
1069
+ function BookFromJSON(json) {
1070
+ return BookFromJSONTyped(json, false);
1071
+ }
1072
+ function BookFromJSONTyped(json, ignoreDiscriminator) {
1073
+ if (json == null) {
1074
+ return json;
1075
+ }
1076
+ return {
1077
+ "id": json["id"] == null ? void 0 : json["id"],
1078
+ "isbn10": json["isbn10"] == null ? void 0 : json["isbn10"],
1079
+ "isbn13": json["isbn13"] == null ? void 0 : json["isbn13"],
1080
+ "workId": json["workId"] == null ? void 0 : json["workId"],
1081
+ "title": json["title"] == null ? void 0 : json["title"],
1082
+ "subtitle": json["subtitle"] == null ? void 0 : json["subtitle"],
1083
+ "numberOfPages": json["numberOfPages"] == null ? void 0 : json["numberOfPages"],
1084
+ "description": json["description"] == null ? void 0 : json["description"],
1085
+ "publishers": json["publishers"] == null ? void 0 : json["publishers"].map(EntityRefFromJSON),
1086
+ "imprint": json["imprint"] == null ? void 0 : json["imprint"].map(EntityRefFromJSON),
1087
+ "publishDate": json["publishDate"] == null ? void 0 : new Date(json["publishDate"]),
1088
+ "physicalFormat": json["physicalFormat"] == null ? void 0 : json["physicalFormat"],
1089
+ "covers": json["covers"] == null ? void 0 : json["covers"],
1090
+ "authors": json["authors"] == null ? void 0 : json["authors"].map(EntityRefFromJSON),
1091
+ "contributors": json["contributors"] == null ? void 0 : json["contributors"].map(ContributorFromJSON),
1092
+ "subjects": json["subjects"] == null ? void 0 : json["subjects"].map(SubjectRefFromJSON),
1093
+ "series": json["series"] == null ? void 0 : SeriesFromJSON(json["series"]),
1094
+ "genres": json["genres"] == null ? void 0 : json["genres"].map(EntityRefFromJSON),
1095
+ "otherEditions": json["otherEditions"] == null ? void 0 : json["otherEditions"].map(EditionRefFromJSON),
1096
+ "previousEdition": json["previousEdition"] == null ? void 0 : EditionRefFromJSON(json["previousEdition"]),
1097
+ "nextEdition": json["nextEdition"] == null ? void 0 : EditionRefFromJSON(json["nextEdition"]),
1098
+ "physicalDimensions": json["physicalDimensions"] == null ? void 0 : json["physicalDimensions"],
1099
+ "ratings": json["ratings"] == null ? void 0 : RatingsFromJSON(json["ratings"]),
1100
+ "language": json["language"] == null ? void 0 : json["language"],
1101
+ "saleStatus": json["saleStatus"] == null ? void 0 : json["saleStatus"],
1102
+ "excerpt": json["excerpt"] == null ? void 0 : json["excerpt"],
1103
+ "reviewQuotes": json["reviewQuotes"] == null ? void 0 : json["reviewQuotes"],
1104
+ "retailLinks": json["retailLinks"] == null ? void 0 : json["retailLinks"].map(RetailLinkFromJSON),
1105
+ "categories": json["categories"] == null ? void 0 : json["categories"].map(CategoryFromJSON),
1106
+ "aiSummary": json["aiSummary"] == null ? void 0 : json["aiSummary"],
1107
+ "canonicalEditionId": json["canonicalEditionId"] == null ? void 0 : json["canonicalEditionId"],
1108
+ "languageCode": json["languageCode"] == null ? void 0 : json["languageCode"],
1109
+ "publishDatePrecision": json["publishDatePrecision"] == null ? void 0 : json["publishDatePrecision"],
1110
+ "estimatedReadTime": json["estimatedReadTime"] == null ? void 0 : json["estimatedReadTime"],
1111
+ "languagesCount": json["languagesCount"] == null ? void 0 : json["languagesCount"],
1112
+ "link": json["link"] == null ? void 0 : json["link"],
1113
+ "isbnModel": json["isbnModel"] == null ? void 0 : IsbnDetailsFromJSON(json["isbnModel"]),
1114
+ "otherEditionsCount": json["otherEditionsCount"] == null ? void 0 : json["otherEditionsCount"]
1115
+ };
1116
+ }
1117
+ function BookToJSON(json) {
1118
+ return BookToJSONTyped(json, false);
1119
+ }
1120
+ function BookToJSONTyped(value, ignoreDiscriminator = false) {
1121
+ if (value == null) {
1122
+ return value;
1123
+ }
1124
+ return {
1125
+ "isbn10": value["isbn10"],
1126
+ "isbn13": value["isbn13"],
1127
+ "workId": value["workId"],
1128
+ "title": value["title"],
1129
+ "subtitle": value["subtitle"],
1130
+ "numberOfPages": value["numberOfPages"],
1131
+ "description": value["description"],
1132
+ "publishers": value["publishers"] == null ? void 0 : value["publishers"].map(EntityRefToJSON),
1133
+ "imprint": value["imprint"] == null ? void 0 : value["imprint"].map(EntityRefToJSON),
1134
+ "publishDate": value["publishDate"] === null ? null : value["publishDate"]?.toISOString(),
1135
+ "physicalFormat": value["physicalFormat"],
1136
+ "covers": value["covers"],
1137
+ "authors": value["authors"] == null ? void 0 : value["authors"].map(EntityRefToJSON),
1138
+ "contributors": value["contributors"] == null ? void 0 : value["contributors"].map(ContributorToJSON),
1139
+ "subjects": value["subjects"] == null ? void 0 : value["subjects"].map(SubjectRefToJSON),
1140
+ "series": SeriesToJSON(value["series"]),
1141
+ "genres": value["genres"] == null ? void 0 : value["genres"].map(EntityRefToJSON),
1142
+ "otherEditions": value["otherEditions"] == null ? void 0 : value["otherEditions"].map(EditionRefToJSON),
1143
+ "previousEdition": EditionRefToJSON(value["previousEdition"]),
1144
+ "nextEdition": EditionRefToJSON(value["nextEdition"]),
1145
+ "physicalDimensions": value["physicalDimensions"],
1146
+ "ratings": RatingsToJSON(value["ratings"]),
1147
+ "language": value["language"],
1148
+ "saleStatus": value["saleStatus"],
1149
+ "excerpt": value["excerpt"],
1150
+ "reviewQuotes": value["reviewQuotes"],
1151
+ "retailLinks": value["retailLinks"] == null ? void 0 : value["retailLinks"].map(RetailLinkToJSON),
1152
+ "categories": value["categories"] == null ? void 0 : value["categories"].map(CategoryToJSON),
1153
+ "aiSummary": value["aiSummary"],
1154
+ "canonicalEditionId": value["canonicalEditionId"],
1155
+ "languageCode": value["languageCode"],
1156
+ "publishDatePrecision": value["publishDatePrecision"],
1157
+ "estimatedReadTime": value["estimatedReadTime"],
1158
+ "languagesCount": value["languagesCount"],
1159
+ "link": value["link"],
1160
+ "isbnModel": IsbnDetailsToJSON(value["isbnModel"])
1161
+ };
1162
+ }
1163
+
1164
+ // src/models/CoverSize.ts
1165
+ function instanceOfCoverSize(value) {
1166
+ return true;
1167
+ }
1168
+ function CoverSizeFromJSON(json) {
1169
+ return CoverSizeFromJSONTyped(json, false);
1170
+ }
1171
+ function CoverSizeFromJSONTyped(json, ignoreDiscriminator) {
1172
+ if (json == null) {
1173
+ return json;
1174
+ }
1175
+ return {
1176
+ "url": json["url"] == null ? void 0 : json["url"],
1177
+ "w200": json["w200"] == null ? void 0 : json["w200"],
1178
+ "w400": json["w400"] == null ? void 0 : json["w400"],
1179
+ "w800": json["w800"] == null ? void 0 : json["w800"]
1180
+ };
1181
+ }
1182
+ function CoverSizeToJSON(json) {
1183
+ return CoverSizeToJSONTyped(json, false);
1184
+ }
1185
+ function CoverSizeToJSONTyped(value, ignoreDiscriminator = false) {
1186
+ if (value == null) {
1187
+ return value;
1188
+ }
1189
+ return {
1190
+ "url": value["url"],
1191
+ "w200": value["w200"],
1192
+ "w400": value["w400"],
1193
+ "w800": value["w800"]
1194
+ };
1195
+ }
1196
+
1197
+ // src/models/BookCover.ts
1198
+ function instanceOfBookCover(value) {
1199
+ return true;
1200
+ }
1201
+ function BookCoverFromJSON(json) {
1202
+ return BookCoverFromJSONTyped(json, false);
1203
+ }
1204
+ function BookCoverFromJSONTyped(json, ignoreDiscriminator) {
1205
+ if (json == null) {
1206
+ return json;
1207
+ }
1208
+ return {
1209
+ "isbn13": json["isbn13"] == null ? void 0 : json["isbn13"],
1210
+ "covers": json["covers"] == null ? void 0 : json["covers"],
1211
+ "sizes": json["sizes"] == null ? void 0 : json["sizes"].map(CoverSizeFromJSON)
1212
+ };
1213
+ }
1214
+ function BookCoverToJSON(json) {
1215
+ return BookCoverToJSONTyped(json, false);
1216
+ }
1217
+ function BookCoverToJSONTyped(value, ignoreDiscriminator = false) {
1218
+ if (value == null) {
1219
+ return value;
1220
+ }
1221
+ return {
1222
+ "isbn13": value["isbn13"],
1223
+ "covers": value["covers"],
1224
+ "sizes": value["sizes"] == null ? void 0 : value["sizes"].map(CoverSizeToJSON)
1225
+ };
1226
+ }
1227
+
1228
+ // src/models/BookEditions.ts
1229
+ function instanceOfBookEditions(value) {
1230
+ return true;
1231
+ }
1232
+ function BookEditionsFromJSON(json) {
1233
+ return BookEditionsFromJSONTyped(json, false);
1234
+ }
1235
+ function BookEditionsFromJSONTyped(json, ignoreDiscriminator) {
1236
+ if (json == null) {
1237
+ return json;
1238
+ }
1239
+ return {
1240
+ "isbn13": json["isbn13"] == null ? void 0 : json["isbn13"],
1241
+ "otherEditions": json["otherEditions"] == null ? void 0 : json["otherEditions"].map(EditionRefFromJSON),
1242
+ "previousEdition": json["previousEdition"] == null ? void 0 : EditionRefFromJSON(json["previousEdition"]),
1243
+ "nextEdition": json["nextEdition"] == null ? void 0 : EditionRefFromJSON(json["nextEdition"])
1244
+ };
1245
+ }
1246
+ function BookEditionsToJSON(json) {
1247
+ return BookEditionsToJSONTyped(json, false);
1248
+ }
1249
+ function BookEditionsToJSONTyped(value, ignoreDiscriminator = false) {
1250
+ if (value == null) {
1251
+ return value;
1252
+ }
1253
+ return {
1254
+ "isbn13": value["isbn13"],
1255
+ "otherEditions": value["otherEditions"] == null ? void 0 : value["otherEditions"].map(EditionRefToJSON),
1256
+ "previousEdition": EditionRefToJSON(value["previousEdition"]),
1257
+ "nextEdition": EditionRefToJSON(value["nextEdition"])
1258
+ };
1259
+ }
1260
+
1261
+ // src/models/Genre.ts
1262
+ function instanceOfGenre(value) {
1263
+ return true;
1264
+ }
1265
+ function GenreFromJSON(json) {
1266
+ return GenreFromJSONTyped(json, false);
1267
+ }
1268
+ function GenreFromJSONTyped(json, ignoreDiscriminator) {
1269
+ if (json == null) {
1270
+ return json;
1271
+ }
1272
+ return {
1273
+ "bisacCode": json["bisacCode"] == null ? void 0 : json["bisacCode"],
1274
+ "name": json["name"] == null ? void 0 : json["name"],
1275
+ "editionCount": json["editionCount"] == null ? void 0 : json["editionCount"]
1276
+ };
1277
+ }
1278
+ function GenreToJSON(json) {
1279
+ return GenreToJSONTyped(json, false);
1280
+ }
1281
+ function GenreToJSONTyped(value, ignoreDiscriminator = false) {
1282
+ if (value == null) {
1283
+ return value;
1284
+ }
1285
+ return {
1286
+ "bisacCode": value["bisacCode"],
1287
+ "name": value["name"],
1288
+ "editionCount": value["editionCount"]
1289
+ };
1290
+ }
1291
+
1292
+ // src/models/Publisher.ts
1293
+ function instanceOfPublisher(value) {
1294
+ return true;
1295
+ }
1296
+ function PublisherFromJSON(json) {
1297
+ return PublisherFromJSONTyped(json, false);
1298
+ }
1299
+ function PublisherFromJSONTyped(json, ignoreDiscriminator) {
1300
+ if (json == null) {
1301
+ return json;
1302
+ }
1303
+ return {
1304
+ "name": json["name"] == null ? void 0 : json["name"],
1305
+ "prefix": json["prefix"] == null ? void 0 : json["prefix"],
1306
+ "country": json["country"] == null ? void 0 : json["country"],
1307
+ "url": json["url"] == null ? void 0 : json["url"],
1308
+ "slug": json["slug"] == null ? void 0 : json["slug"],
1309
+ "editionCount": json["editionCount"] == null ? void 0 : json["editionCount"]
1310
+ };
1311
+ }
1312
+ function PublisherToJSON(json) {
1313
+ return PublisherToJSONTyped(json, false);
1314
+ }
1315
+ function PublisherToJSONTyped(value, ignoreDiscriminator = false) {
1316
+ if (value == null) {
1317
+ return value;
1318
+ }
1319
+ return {
1320
+ "name": value["name"],
1321
+ "prefix": value["prefix"],
1322
+ "country": value["country"],
1323
+ "url": value["url"],
1324
+ "slug": value["slug"],
1325
+ "editionCount": value["editionCount"]
1326
+ };
1327
+ }
1328
+
1329
+ // src/models/Subject.ts
1330
+ function instanceOfSubject(value) {
1331
+ return true;
1332
+ }
1333
+ function SubjectFromJSON(json) {
1334
+ return SubjectFromJSONTyped(json, false);
1335
+ }
1336
+ function SubjectFromJSONTyped(json, ignoreDiscriminator) {
1337
+ if (json == null) {
1338
+ return json;
1339
+ }
1340
+ return {
1341
+ "name": json["name"] == null ? void 0 : json["name"],
1342
+ "identifier": json["identifier"] == null ? void 0 : json["identifier"],
1343
+ "slug": json["slug"] == null ? void 0 : json["slug"],
1344
+ "firstChar": json["firstChar"] == null ? void 0 : json["firstChar"],
1345
+ "editionCount": json["editionCount"] == null ? void 0 : json["editionCount"]
1346
+ };
1347
+ }
1348
+ function SubjectToJSON(json) {
1349
+ return SubjectToJSONTyped(json, false);
1350
+ }
1351
+ function SubjectToJSONTyped(value, ignoreDiscriminator = false) {
1352
+ if (value == null) {
1353
+ return value;
1354
+ }
1355
+ return {
1356
+ "name": value["name"],
1357
+ "identifier": value["identifier"],
1358
+ "slug": value["slug"],
1359
+ "firstChar": value["firstChar"],
1360
+ "editionCount": value["editionCount"]
1361
+ };
1362
+ }
1363
+
1364
+ // src/apis/AuthorsApi.ts
1365
+ var AuthorsApi = class extends BaseAPI {
1366
+ /**
1367
+ * Find an author by name.
1368
+ */
1369
+ async findAuthorRaw(requestParameters, initOverrides) {
1370
+ if (requestParameters["search"] == null) {
1371
+ throw new RequiredError(
1372
+ "search",
1373
+ 'Required parameter "search" was null or undefined when calling findAuthor().'
1374
+ );
1375
+ }
1376
+ const queryParameters = {};
1377
+ const headerParameters = {};
1378
+ if (this.configuration && this.configuration.apiKey) {
1379
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1380
+ }
1381
+ if (this.configuration && this.configuration.accessToken) {
1382
+ const token = this.configuration.accessToken;
1383
+ const tokenString = await token("Token", []);
1384
+ if (tokenString) {
1385
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1386
+ }
1387
+ }
1388
+ let urlPath = `/api/author/search/{search}`;
1389
+ urlPath = urlPath.replace(`{${"search"}}`, encodeURIComponent(String(requestParameters["search"])));
1390
+ const response = await this.request({
1391
+ path: urlPath,
1392
+ method: "GET",
1393
+ headers: headerParameters,
1394
+ query: queryParameters
1395
+ }, initOverrides);
1396
+ return new JSONApiResponse(response, (jsonValue) => AuthorFromJSON(jsonValue));
1397
+ }
1398
+ /**
1399
+ * Find an author by name.
1400
+ */
1401
+ async findAuthor(search, initOverrides) {
1402
+ const response = await this.findAuthorRaw({ search }, initOverrides);
1403
+ return await response.value();
1404
+ }
1405
+ /**
1406
+ * Look up an author by id.
1407
+ */
1408
+ async getAuthorRaw(requestParameters, initOverrides) {
1409
+ if (requestParameters["id"] == null) {
1410
+ throw new RequiredError(
1411
+ "id",
1412
+ 'Required parameter "id" was null or undefined when calling getAuthor().'
1413
+ );
1414
+ }
1415
+ const queryParameters = {};
1416
+ const headerParameters = {};
1417
+ if (this.configuration && this.configuration.apiKey) {
1418
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1419
+ }
1420
+ if (this.configuration && this.configuration.accessToken) {
1421
+ const token = this.configuration.accessToken;
1422
+ const tokenString = await token("Token", []);
1423
+ if (tokenString) {
1424
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1425
+ }
1426
+ }
1427
+ let urlPath = `/api/author/{id}`;
1428
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"])));
1429
+ const response = await this.request({
1430
+ path: urlPath,
1431
+ method: "GET",
1432
+ headers: headerParameters,
1433
+ query: queryParameters
1434
+ }, initOverrides);
1435
+ return new JSONApiResponse(response, (jsonValue) => AuthorFromJSON(jsonValue));
1436
+ }
1437
+ /**
1438
+ * Look up an author by id.
1439
+ */
1440
+ async getAuthor(id, initOverrides) {
1441
+ const response = await this.getAuthorRaw({ id }, initOverrides);
1442
+ return await response.value();
1443
+ }
1444
+ };
1445
+
1446
+ // src/apis/BooksApi.ts
1447
+ var BooksApi = class extends BaseAPI {
1448
+ /**
1449
+ * Look up a book by Amazon ASIN.
1450
+ */
1451
+ async getBookByAsinRaw(requestParameters, initOverrides) {
1452
+ if (requestParameters["asin"] == null) {
1453
+ throw new RequiredError(
1454
+ "asin",
1455
+ 'Required parameter "asin" was null or undefined when calling getBookByAsin().'
1456
+ );
1457
+ }
1458
+ const queryParameters = {};
1459
+ const headerParameters = {};
1460
+ if (this.configuration && this.configuration.apiKey) {
1461
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1462
+ }
1463
+ if (this.configuration && this.configuration.accessToken) {
1464
+ const token = this.configuration.accessToken;
1465
+ const tokenString = await token("Token", []);
1466
+ if (tokenString) {
1467
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1468
+ }
1469
+ }
1470
+ let urlPath = `/api/book/asin/{asin}`;
1471
+ urlPath = urlPath.replace(`{${"asin"}}`, encodeURIComponent(String(requestParameters["asin"])));
1472
+ const response = await this.request({
1473
+ path: urlPath,
1474
+ method: "GET",
1475
+ headers: headerParameters,
1476
+ query: queryParameters
1477
+ }, initOverrides);
1478
+ return new JSONApiResponse(response, (jsonValue) => BookFromJSON(jsonValue));
1479
+ }
1480
+ /**
1481
+ * Look up a book by Amazon ASIN.
1482
+ */
1483
+ async getBookByAsin(asin, initOverrides) {
1484
+ const response = await this.getBookByAsinRaw({ asin }, initOverrides);
1485
+ return await response.value();
1486
+ }
1487
+ /**
1488
+ * Look up a book by ISBNLab book id.
1489
+ */
1490
+ async getBookByIdRaw(requestParameters, initOverrides) {
1491
+ if (requestParameters["id"] == null) {
1492
+ throw new RequiredError(
1493
+ "id",
1494
+ 'Required parameter "id" was null or undefined when calling getBookById().'
1495
+ );
1496
+ }
1497
+ const queryParameters = {};
1498
+ const headerParameters = {};
1499
+ if (this.configuration && this.configuration.apiKey) {
1500
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1501
+ }
1502
+ if (this.configuration && this.configuration.accessToken) {
1503
+ const token = this.configuration.accessToken;
1504
+ const tokenString = await token("Token", []);
1505
+ if (tokenString) {
1506
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1507
+ }
1508
+ }
1509
+ let urlPath = `/api/book/{id}`;
1510
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"])));
1511
+ const response = await this.request({
1512
+ path: urlPath,
1513
+ method: "GET",
1514
+ headers: headerParameters,
1515
+ query: queryParameters
1516
+ }, initOverrides);
1517
+ return new JSONApiResponse(response, (jsonValue) => BookFromJSON(jsonValue));
1518
+ }
1519
+ /**
1520
+ * Look up a book by ISBNLab book id.
1521
+ */
1522
+ async getBookById(id, initOverrides) {
1523
+ const response = await this.getBookByIdRaw({ id }, initOverrides);
1524
+ return await response.value();
1525
+ }
1526
+ /**
1527
+ * Look up a book by ISBN-10 or ISBN-13.
1528
+ */
1529
+ async getBookByIsbnRaw(requestParameters, initOverrides) {
1530
+ if (requestParameters["isbn"] == null) {
1531
+ throw new RequiredError(
1532
+ "isbn",
1533
+ 'Required parameter "isbn" was null or undefined when calling getBookByIsbn().'
1534
+ );
1535
+ }
1536
+ const queryParameters = {};
1537
+ const headerParameters = {};
1538
+ if (this.configuration && this.configuration.apiKey) {
1539
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1540
+ }
1541
+ if (this.configuration && this.configuration.accessToken) {
1542
+ const token = this.configuration.accessToken;
1543
+ const tokenString = await token("Token", []);
1544
+ if (tokenString) {
1545
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1546
+ }
1547
+ }
1548
+ let urlPath = `/api/book/isbn/{isbn}`;
1549
+ urlPath = urlPath.replace(`{${"isbn"}}`, encodeURIComponent(String(requestParameters["isbn"])));
1550
+ const response = await this.request({
1551
+ path: urlPath,
1552
+ method: "GET",
1553
+ headers: headerParameters,
1554
+ query: queryParameters
1555
+ }, initOverrides);
1556
+ return new JSONApiResponse(response, (jsonValue) => BookFromJSON(jsonValue));
1557
+ }
1558
+ /**
1559
+ * Look up a book by ISBN-10 or ISBN-13.
1560
+ */
1561
+ async getBookByIsbn(isbn, initOverrides) {
1562
+ const response = await this.getBookByIsbnRaw({ isbn }, initOverrides);
1563
+ return await response.value();
1564
+ }
1565
+ /**
1566
+ * Get the cover image URLs for a book by ASIN.
1567
+ */
1568
+ async getBookCoverByAsinRaw(requestParameters, initOverrides) {
1569
+ if (requestParameters["asin"] == null) {
1570
+ throw new RequiredError(
1571
+ "asin",
1572
+ 'Required parameter "asin" was null or undefined when calling getBookCoverByAsin().'
1573
+ );
1574
+ }
1575
+ const queryParameters = {};
1576
+ const headerParameters = {};
1577
+ if (this.configuration && this.configuration.apiKey) {
1578
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1579
+ }
1580
+ if (this.configuration && this.configuration.accessToken) {
1581
+ const token = this.configuration.accessToken;
1582
+ const tokenString = await token("Token", []);
1583
+ if (tokenString) {
1584
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1585
+ }
1586
+ }
1587
+ let urlPath = `/api/book/cover/asin/{asin}`;
1588
+ urlPath = urlPath.replace(`{${"asin"}}`, encodeURIComponent(String(requestParameters["asin"])));
1589
+ const response = await this.request({
1590
+ path: urlPath,
1591
+ method: "GET",
1592
+ headers: headerParameters,
1593
+ query: queryParameters
1594
+ }, initOverrides);
1595
+ return new JSONApiResponse(response, (jsonValue) => BookCoverFromJSON(jsonValue));
1596
+ }
1597
+ /**
1598
+ * Get the cover image URLs for a book by ASIN.
1599
+ */
1600
+ async getBookCoverByAsin(asin, initOverrides) {
1601
+ const response = await this.getBookCoverByAsinRaw({ asin }, initOverrides);
1602
+ return await response.value();
1603
+ }
1604
+ /**
1605
+ * Get the cover image URLs for a book by ISBN.
1606
+ */
1607
+ async getBookCoverByIsbnRaw(requestParameters, initOverrides) {
1608
+ if (requestParameters["isbn"] == null) {
1609
+ throw new RequiredError(
1610
+ "isbn",
1611
+ 'Required parameter "isbn" was null or undefined when calling getBookCoverByIsbn().'
1612
+ );
1613
+ }
1614
+ const queryParameters = {};
1615
+ const headerParameters = {};
1616
+ if (this.configuration && this.configuration.apiKey) {
1617
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1618
+ }
1619
+ if (this.configuration && this.configuration.accessToken) {
1620
+ const token = this.configuration.accessToken;
1621
+ const tokenString = await token("Token", []);
1622
+ if (tokenString) {
1623
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1624
+ }
1625
+ }
1626
+ let urlPath = `/api/book/cover/isbn/{isbn}`;
1627
+ urlPath = urlPath.replace(`{${"isbn"}}`, encodeURIComponent(String(requestParameters["isbn"])));
1628
+ const response = await this.request({
1629
+ path: urlPath,
1630
+ method: "GET",
1631
+ headers: headerParameters,
1632
+ query: queryParameters
1633
+ }, initOverrides);
1634
+ return new JSONApiResponse(response, (jsonValue) => BookCoverFromJSON(jsonValue));
1635
+ }
1636
+ /**
1637
+ * Get the cover image URLs for a book by ISBN.
1638
+ */
1639
+ async getBookCoverByIsbn(isbn, initOverrides) {
1640
+ const response = await this.getBookCoverByIsbnRaw({ isbn }, initOverrides);
1641
+ return await response.value();
1642
+ }
1643
+ /**
1644
+ * Get every other edition of a book by ASIN.
1645
+ */
1646
+ async getEditionsByAsinRaw(requestParameters, initOverrides) {
1647
+ if (requestParameters["asin"] == null) {
1648
+ throw new RequiredError(
1649
+ "asin",
1650
+ 'Required parameter "asin" was null or undefined when calling getEditionsByAsin().'
1651
+ );
1652
+ }
1653
+ const queryParameters = {};
1654
+ const headerParameters = {};
1655
+ if (this.configuration && this.configuration.apiKey) {
1656
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1657
+ }
1658
+ if (this.configuration && this.configuration.accessToken) {
1659
+ const token = this.configuration.accessToken;
1660
+ const tokenString = await token("Token", []);
1661
+ if (tokenString) {
1662
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1663
+ }
1664
+ }
1665
+ let urlPath = `/api/editions/asin/{asin}`;
1666
+ urlPath = urlPath.replace(`{${"asin"}}`, encodeURIComponent(String(requestParameters["asin"])));
1667
+ const response = await this.request({
1668
+ path: urlPath,
1669
+ method: "GET",
1670
+ headers: headerParameters,
1671
+ query: queryParameters
1672
+ }, initOverrides);
1673
+ return new JSONApiResponse(response, (jsonValue) => BookEditionsFromJSON(jsonValue));
1674
+ }
1675
+ /**
1676
+ * Get every other edition of a book by ASIN.
1677
+ */
1678
+ async getEditionsByAsin(asin, initOverrides) {
1679
+ const response = await this.getEditionsByAsinRaw({ asin }, initOverrides);
1680
+ return await response.value();
1681
+ }
1682
+ /**
1683
+ * Get every other edition of a book by ISBN.
1684
+ */
1685
+ async getEditionsByIsbnRaw(requestParameters, initOverrides) {
1686
+ if (requestParameters["isbn"] == null) {
1687
+ throw new RequiredError(
1688
+ "isbn",
1689
+ 'Required parameter "isbn" was null or undefined when calling getEditionsByIsbn().'
1690
+ );
1691
+ }
1692
+ const queryParameters = {};
1693
+ const headerParameters = {};
1694
+ if (this.configuration && this.configuration.apiKey) {
1695
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1696
+ }
1697
+ if (this.configuration && this.configuration.accessToken) {
1698
+ const token = this.configuration.accessToken;
1699
+ const tokenString = await token("Token", []);
1700
+ if (tokenString) {
1701
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1702
+ }
1703
+ }
1704
+ let urlPath = `/api/editions/isbn/{isbn}`;
1705
+ urlPath = urlPath.replace(`{${"isbn"}}`, encodeURIComponent(String(requestParameters["isbn"])));
1706
+ const response = await this.request({
1707
+ path: urlPath,
1708
+ method: "GET",
1709
+ headers: headerParameters,
1710
+ query: queryParameters
1711
+ }, initOverrides);
1712
+ return new JSONApiResponse(response, (jsonValue) => BookEditionsFromJSON(jsonValue));
1713
+ }
1714
+ /**
1715
+ * Get every other edition of a book by ISBN.
1716
+ */
1717
+ async getEditionsByIsbn(isbn, initOverrides) {
1718
+ const response = await this.getEditionsByIsbnRaw({ isbn }, initOverrides);
1719
+ return await response.value();
1720
+ }
1721
+ /**
1722
+ * Search books by title, subtitle, author or ISBN.
1723
+ */
1724
+ async searchBooksRaw(requestParameters, initOverrides) {
1725
+ if (requestParameters["query"] == null) {
1726
+ throw new RequiredError(
1727
+ "query",
1728
+ 'Required parameter "query" was null or undefined when calling searchBooks().'
1729
+ );
1730
+ }
1731
+ const queryParameters = {};
1732
+ if (requestParameters["limit"] != null) {
1733
+ queryParameters["limit"] = requestParameters["limit"];
1734
+ }
1735
+ if (requestParameters["page"] != null) {
1736
+ queryParameters["page"] = requestParameters["page"];
1737
+ }
1738
+ if (requestParameters["maxResults"] != null) {
1739
+ queryParameters["max_results"] = requestParameters["maxResults"];
1740
+ }
1741
+ const headerParameters = {};
1742
+ if (this.configuration && this.configuration.apiKey) {
1743
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1744
+ }
1745
+ if (this.configuration && this.configuration.accessToken) {
1746
+ const token = this.configuration.accessToken;
1747
+ const tokenString = await token("Token", []);
1748
+ if (tokenString) {
1749
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1750
+ }
1751
+ }
1752
+ let urlPath = `/api/search/book/{query}`;
1753
+ urlPath = urlPath.replace(`{${"query"}}`, encodeURIComponent(String(requestParameters["query"])));
1754
+ const response = await this.request({
1755
+ path: urlPath,
1756
+ method: "GET",
1757
+ headers: headerParameters,
1758
+ query: queryParameters
1759
+ }, initOverrides);
1760
+ return new JSONApiResponse(response, (jsonValue) => jsonValue.map(BookFromJSON));
1761
+ }
1762
+ /**
1763
+ * Search books by title, subtitle, author or ISBN.
1764
+ */
1765
+ async searchBooks(query, limit, page, maxResults, initOverrides) {
1766
+ const response = await this.searchBooksRaw({ query, limit, page, maxResults }, initOverrides);
1767
+ return await response.value();
1768
+ }
1769
+ };
1770
+
1771
+ // src/apis/GenresApi.ts
1772
+ var GenresApi = class extends BaseAPI {
1773
+ /**
1774
+ * Find a BISAC genre by name or BISAC code.
1775
+ */
1776
+ async findGenreRaw(requestParameters, initOverrides) {
1777
+ if (requestParameters["search"] == null) {
1778
+ throw new RequiredError(
1779
+ "search",
1780
+ 'Required parameter "search" was null or undefined when calling findGenre().'
1781
+ );
1782
+ }
1783
+ const queryParameters = {};
1784
+ const headerParameters = {};
1785
+ if (this.configuration && this.configuration.apiKey) {
1786
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1787
+ }
1788
+ if (this.configuration && this.configuration.accessToken) {
1789
+ const token = this.configuration.accessToken;
1790
+ const tokenString = await token("Token", []);
1791
+ if (tokenString) {
1792
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1793
+ }
1794
+ }
1795
+ let urlPath = `/api/genre/search/{search}`;
1796
+ urlPath = urlPath.replace(`{${"search"}}`, encodeURIComponent(String(requestParameters["search"])));
1797
+ const response = await this.request({
1798
+ path: urlPath,
1799
+ method: "GET",
1800
+ headers: headerParameters,
1801
+ query: queryParameters
1802
+ }, initOverrides);
1803
+ return new JSONApiResponse(response, (jsonValue) => GenreFromJSON(jsonValue));
1804
+ }
1805
+ /**
1806
+ * Find a BISAC genre by name or BISAC code.
1807
+ */
1808
+ async findGenre(search, initOverrides) {
1809
+ const response = await this.findGenreRaw({ search }, initOverrides);
1810
+ return await response.value();
1811
+ }
1812
+ /**
1813
+ * Look up a BISAC genre by id.
1814
+ */
1815
+ async getGenreRaw(requestParameters, initOverrides) {
1816
+ if (requestParameters["id"] == null) {
1817
+ throw new RequiredError(
1818
+ "id",
1819
+ 'Required parameter "id" was null or undefined when calling getGenre().'
1820
+ );
1821
+ }
1822
+ const queryParameters = {};
1823
+ const headerParameters = {};
1824
+ if (this.configuration && this.configuration.apiKey) {
1825
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1826
+ }
1827
+ if (this.configuration && this.configuration.accessToken) {
1828
+ const token = this.configuration.accessToken;
1829
+ const tokenString = await token("Token", []);
1830
+ if (tokenString) {
1831
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1832
+ }
1833
+ }
1834
+ let urlPath = `/api/genre/{id}`;
1835
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"])));
1836
+ const response = await this.request({
1837
+ path: urlPath,
1838
+ method: "GET",
1839
+ headers: headerParameters,
1840
+ query: queryParameters
1841
+ }, initOverrides);
1842
+ return new JSONApiResponse(response, (jsonValue) => GenreFromJSON(jsonValue));
1843
+ }
1844
+ /**
1845
+ * Look up a BISAC genre by id.
1846
+ */
1847
+ async getGenre(id, initOverrides) {
1848
+ const response = await this.getGenreRaw({ id }, initOverrides);
1849
+ return await response.value();
1850
+ }
1851
+ };
1852
+
1853
+ // src/apis/IsbnApi.ts
1854
+ var IsbnApi = class extends BaseAPI {
1855
+ /**
1856
+ * Convert an Amazon ASIN to ISBN.
1857
+ */
1858
+ async asinToIsbnRaw(requestParameters, initOverrides) {
1859
+ if (requestParameters["asin"] == null) {
1860
+ throw new RequiredError(
1861
+ "asin",
1862
+ 'Required parameter "asin" was null or undefined when calling asinToIsbn().'
1863
+ );
1864
+ }
1865
+ const queryParameters = {};
1866
+ const headerParameters = {};
1867
+ if (this.configuration && this.configuration.apiKey) {
1868
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1869
+ }
1870
+ if (this.configuration && this.configuration.accessToken) {
1871
+ const token = this.configuration.accessToken;
1872
+ const tokenString = await token("Token", []);
1873
+ if (tokenString) {
1874
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1875
+ }
1876
+ }
1877
+ let urlPath = `/api/isbn/asin-to-isbn/{asin}`;
1878
+ urlPath = urlPath.replace(`{${"asin"}}`, encodeURIComponent(String(requestParameters["asin"])));
1879
+ const response = await this.request({
1880
+ path: urlPath,
1881
+ method: "GET",
1882
+ headers: headerParameters,
1883
+ query: queryParameters
1884
+ }, initOverrides);
1885
+ return new JSONApiResponse(response, (jsonValue) => IsbnDetailsFromJSON(jsonValue));
1886
+ }
1887
+ /**
1888
+ * Convert an Amazon ASIN to ISBN.
1889
+ */
1890
+ async asinToIsbn(asin, initOverrides) {
1891
+ const response = await this.asinToIsbnRaw({ asin }, initOverrides);
1892
+ return await response.value();
1893
+ }
1894
+ /**
1895
+ * Convert an EAN to ISBN.
1896
+ */
1897
+ async eanToIsbnRaw(requestParameters, initOverrides) {
1898
+ if (requestParameters["ean"] == null) {
1899
+ throw new RequiredError(
1900
+ "ean",
1901
+ 'Required parameter "ean" was null or undefined when calling eanToIsbn().'
1902
+ );
1903
+ }
1904
+ const queryParameters = {};
1905
+ const headerParameters = {};
1906
+ if (this.configuration && this.configuration.apiKey) {
1907
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1908
+ }
1909
+ if (this.configuration && this.configuration.accessToken) {
1910
+ const token = this.configuration.accessToken;
1911
+ const tokenString = await token("Token", []);
1912
+ if (tokenString) {
1913
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1914
+ }
1915
+ }
1916
+ let urlPath = `/api/isbn/ean-to-isbn/{ean}`;
1917
+ urlPath = urlPath.replace(`{${"ean"}}`, encodeURIComponent(String(requestParameters["ean"])));
1918
+ const response = await this.request({
1919
+ path: urlPath,
1920
+ method: "GET",
1921
+ headers: headerParameters,
1922
+ query: queryParameters
1923
+ }, initOverrides);
1924
+ return new JSONApiResponse(response, (jsonValue) => IsbnDetailsFromJSON(jsonValue));
1925
+ }
1926
+ /**
1927
+ * Convert an EAN to ISBN.
1928
+ */
1929
+ async eanToIsbn(ean, initOverrides) {
1930
+ const response = await this.eanToIsbnRaw({ ean }, initOverrides);
1931
+ return await response.value();
1932
+ }
1933
+ /**
1934
+ * Convert an ISBN-10 to ISBN-13.
1935
+ */
1936
+ async isbn10ToIsbn13Raw(requestParameters, initOverrides) {
1937
+ if (requestParameters["isbn10"] == null) {
1938
+ throw new RequiredError(
1939
+ "isbn10",
1940
+ 'Required parameter "isbn10" was null or undefined when calling isbn10ToIsbn13().'
1941
+ );
1942
+ }
1943
+ const queryParameters = {};
1944
+ const headerParameters = {};
1945
+ if (this.configuration && this.configuration.apiKey) {
1946
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1947
+ }
1948
+ if (this.configuration && this.configuration.accessToken) {
1949
+ const token = this.configuration.accessToken;
1950
+ const tokenString = await token("Token", []);
1951
+ if (tokenString) {
1952
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1953
+ }
1954
+ }
1955
+ let urlPath = `/api/isbn/isbn10-to-isbn13/{isbn10}`;
1956
+ urlPath = urlPath.replace(`{${"isbn10"}}`, encodeURIComponent(String(requestParameters["isbn10"])));
1957
+ const response = await this.request({
1958
+ path: urlPath,
1959
+ method: "GET",
1960
+ headers: headerParameters,
1961
+ query: queryParameters
1962
+ }, initOverrides);
1963
+ return new JSONApiResponse(response, (jsonValue) => IsbnDetailsFromJSON(jsonValue));
1964
+ }
1965
+ /**
1966
+ * Convert an ISBN-10 to ISBN-13.
1967
+ */
1968
+ async isbn10ToIsbn13(isbn10, initOverrides) {
1969
+ const response = await this.isbn10ToIsbn13Raw({ isbn10 }, initOverrides);
1970
+ return await response.value();
1971
+ }
1972
+ /**
1973
+ * Convert an ISBN-13 to ISBN-10.
1974
+ */
1975
+ async isbn13ToIsbn10Raw(requestParameters, initOverrides) {
1976
+ if (requestParameters["isbn13"] == null) {
1977
+ throw new RequiredError(
1978
+ "isbn13",
1979
+ 'Required parameter "isbn13" was null or undefined when calling isbn13ToIsbn10().'
1980
+ );
1981
+ }
1982
+ const queryParameters = {};
1983
+ const headerParameters = {};
1984
+ if (this.configuration && this.configuration.apiKey) {
1985
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
1986
+ }
1987
+ if (this.configuration && this.configuration.accessToken) {
1988
+ const token = this.configuration.accessToken;
1989
+ const tokenString = await token("Token", []);
1990
+ if (tokenString) {
1991
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1992
+ }
1993
+ }
1994
+ let urlPath = `/api/isbn/isbn13-to-isbn10/{isbn13}`;
1995
+ urlPath = urlPath.replace(`{${"isbn13"}}`, encodeURIComponent(String(requestParameters["isbn13"])));
1996
+ const response = await this.request({
1997
+ path: urlPath,
1998
+ method: "GET",
1999
+ headers: headerParameters,
2000
+ query: queryParameters
2001
+ }, initOverrides);
2002
+ return new JSONApiResponse(response, (jsonValue) => IsbnDetailsFromJSON(jsonValue));
2003
+ }
2004
+ /**
2005
+ * Convert an ISBN-13 to ISBN-10.
2006
+ */
2007
+ async isbn13ToIsbn10(isbn13, initOverrides) {
2008
+ const response = await this.isbn13ToIsbn10Raw({ isbn13 }, initOverrides);
2009
+ return await response.value();
2010
+ }
2011
+ /**
2012
+ * Convert an ISBN to Amazon ASIN.
2013
+ */
2014
+ async isbnToAsinRaw(requestParameters, initOverrides) {
2015
+ if (requestParameters["isbn"] == null) {
2016
+ throw new RequiredError(
2017
+ "isbn",
2018
+ 'Required parameter "isbn" was null or undefined when calling isbnToAsin().'
2019
+ );
2020
+ }
2021
+ const queryParameters = {};
2022
+ const headerParameters = {};
2023
+ if (this.configuration && this.configuration.apiKey) {
2024
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
2025
+ }
2026
+ if (this.configuration && this.configuration.accessToken) {
2027
+ const token = this.configuration.accessToken;
2028
+ const tokenString = await token("Token", []);
2029
+ if (tokenString) {
2030
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
2031
+ }
2032
+ }
2033
+ let urlPath = `/api/isbn/isbn-to-asin/{isbn}`;
2034
+ urlPath = urlPath.replace(`{${"isbn"}}`, encodeURIComponent(String(requestParameters["isbn"])));
2035
+ const response = await this.request({
2036
+ path: urlPath,
2037
+ method: "GET",
2038
+ headers: headerParameters,
2039
+ query: queryParameters
2040
+ }, initOverrides);
2041
+ return new JSONApiResponse(response, (jsonValue) => IsbnDetailsFromJSON(jsonValue));
2042
+ }
2043
+ /**
2044
+ * Convert an ISBN to Amazon ASIN.
2045
+ */
2046
+ async isbnToAsin(isbn, initOverrides) {
2047
+ const response = await this.isbnToAsinRaw({ isbn }, initOverrides);
2048
+ return await response.value();
2049
+ }
2050
+ /**
2051
+ * Convert an ISBN to EAN.
2052
+ */
2053
+ async isbnToEanRaw(requestParameters, initOverrides) {
2054
+ if (requestParameters["isbn"] == null) {
2055
+ throw new RequiredError(
2056
+ "isbn",
2057
+ 'Required parameter "isbn" was null or undefined when calling isbnToEan().'
2058
+ );
2059
+ }
2060
+ const queryParameters = {};
2061
+ const headerParameters = {};
2062
+ if (this.configuration && this.configuration.apiKey) {
2063
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
2064
+ }
2065
+ if (this.configuration && this.configuration.accessToken) {
2066
+ const token = this.configuration.accessToken;
2067
+ const tokenString = await token("Token", []);
2068
+ if (tokenString) {
2069
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
2070
+ }
2071
+ }
2072
+ let urlPath = `/api/isbn/isbn-to-ean/{isbn}`;
2073
+ urlPath = urlPath.replace(`{${"isbn"}}`, encodeURIComponent(String(requestParameters["isbn"])));
2074
+ const response = await this.request({
2075
+ path: urlPath,
2076
+ method: "GET",
2077
+ headers: headerParameters,
2078
+ query: queryParameters
2079
+ }, initOverrides);
2080
+ return new JSONApiResponse(response, (jsonValue) => IsbnDetailsFromJSON(jsonValue));
2081
+ }
2082
+ /**
2083
+ * Convert an ISBN to EAN.
2084
+ */
2085
+ async isbnToEan(isbn, initOverrides) {
2086
+ const response = await this.isbnToEanRaw({ isbn }, initOverrides);
2087
+ return await response.value();
2088
+ }
2089
+ /**
2090
+ * Validate an ISBN and split it into its parts.
2091
+ */
2092
+ async parseIsbnRaw(requestParameters, initOverrides) {
2093
+ if (requestParameters["isbn"] == null) {
2094
+ throw new RequiredError(
2095
+ "isbn",
2096
+ 'Required parameter "isbn" was null or undefined when calling parseIsbn().'
2097
+ );
2098
+ }
2099
+ const queryParameters = {};
2100
+ const headerParameters = {};
2101
+ if (this.configuration && this.configuration.apiKey) {
2102
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
2103
+ }
2104
+ if (this.configuration && this.configuration.accessToken) {
2105
+ const token = this.configuration.accessToken;
2106
+ const tokenString = await token("Token", []);
2107
+ if (tokenString) {
2108
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
2109
+ }
2110
+ }
2111
+ let urlPath = `/api/isbn/isbn-lookup/{isbn}`;
2112
+ urlPath = urlPath.replace(`{${"isbn"}}`, encodeURIComponent(String(requestParameters["isbn"])));
2113
+ const response = await this.request({
2114
+ path: urlPath,
2115
+ method: "GET",
2116
+ headers: headerParameters,
2117
+ query: queryParameters
2118
+ }, initOverrides);
2119
+ return new JSONApiResponse(response, (jsonValue) => IsbnDetailsFromJSON(jsonValue));
2120
+ }
2121
+ /**
2122
+ * Validate an ISBN and split it into its parts.
2123
+ */
2124
+ async parseIsbn(isbn, initOverrides) {
2125
+ const response = await this.parseIsbnRaw({ isbn }, initOverrides);
2126
+ return await response.value();
2127
+ }
2128
+ };
2129
+
2130
+ // src/apis/PublishersApi.ts
2131
+ var PublishersApi = class extends BaseAPI {
2132
+ /**
2133
+ * Find a publisher by name.
2134
+ */
2135
+ async findPublisherRaw(requestParameters, initOverrides) {
2136
+ if (requestParameters["search"] == null) {
2137
+ throw new RequiredError(
2138
+ "search",
2139
+ 'Required parameter "search" was null or undefined when calling findPublisher().'
2140
+ );
2141
+ }
2142
+ const queryParameters = {};
2143
+ const headerParameters = {};
2144
+ if (this.configuration && this.configuration.apiKey) {
2145
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
2146
+ }
2147
+ if (this.configuration && this.configuration.accessToken) {
2148
+ const token = this.configuration.accessToken;
2149
+ const tokenString = await token("Token", []);
2150
+ if (tokenString) {
2151
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
2152
+ }
2153
+ }
2154
+ let urlPath = `/api/publisher/search/{search}`;
2155
+ urlPath = urlPath.replace(`{${"search"}}`, encodeURIComponent(String(requestParameters["search"])));
2156
+ const response = await this.request({
2157
+ path: urlPath,
2158
+ method: "GET",
2159
+ headers: headerParameters,
2160
+ query: queryParameters
2161
+ }, initOverrides);
2162
+ return new JSONApiResponse(response, (jsonValue) => PublisherFromJSON(jsonValue));
2163
+ }
2164
+ /**
2165
+ * Find a publisher by name.
2166
+ */
2167
+ async findPublisher(search, initOverrides) {
2168
+ const response = await this.findPublisherRaw({ search }, initOverrides);
2169
+ return await response.value();
2170
+ }
2171
+ /**
2172
+ * Look up a publisher by id.
2173
+ */
2174
+ async getPublisherRaw(requestParameters, initOverrides) {
2175
+ if (requestParameters["id"] == null) {
2176
+ throw new RequiredError(
2177
+ "id",
2178
+ 'Required parameter "id" was null or undefined when calling getPublisher().'
2179
+ );
2180
+ }
2181
+ const queryParameters = {};
2182
+ const headerParameters = {};
2183
+ if (this.configuration && this.configuration.apiKey) {
2184
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
2185
+ }
2186
+ if (this.configuration && this.configuration.accessToken) {
2187
+ const token = this.configuration.accessToken;
2188
+ const tokenString = await token("Token", []);
2189
+ if (tokenString) {
2190
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
2191
+ }
2192
+ }
2193
+ let urlPath = `/api/publisher/{id}`;
2194
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"])));
2195
+ const response = await this.request({
2196
+ path: urlPath,
2197
+ method: "GET",
2198
+ headers: headerParameters,
2199
+ query: queryParameters
2200
+ }, initOverrides);
2201
+ return new JSONApiResponse(response, (jsonValue) => PublisherFromJSON(jsonValue));
2202
+ }
2203
+ /**
2204
+ * Look up a publisher by id.
2205
+ */
2206
+ async getPublisher(id, initOverrides) {
2207
+ const response = await this.getPublisherRaw({ id }, initOverrides);
2208
+ return await response.value();
2209
+ }
2210
+ /**
2211
+ * List the publishers that use an ISBN registrant prefix.
2212
+ */
2213
+ async getPublishersByPrefixRaw(requestParameters, initOverrides) {
2214
+ if (requestParameters["prefix"] == null) {
2215
+ throw new RequiredError(
2216
+ "prefix",
2217
+ 'Required parameter "prefix" was null or undefined when calling getPublishersByPrefix().'
2218
+ );
2219
+ }
2220
+ const queryParameters = {};
2221
+ if (requestParameters["page"] != null) {
2222
+ queryParameters["page"] = requestParameters["page"];
2223
+ }
2224
+ const headerParameters = {};
2225
+ if (this.configuration && this.configuration.apiKey) {
2226
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
2227
+ }
2228
+ if (this.configuration && this.configuration.accessToken) {
2229
+ const token = this.configuration.accessToken;
2230
+ const tokenString = await token("Token", []);
2231
+ if (tokenString) {
2232
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
2233
+ }
2234
+ }
2235
+ let urlPath = `/api/publisher/prefix/{prefix}`;
2236
+ urlPath = urlPath.replace(`{${"prefix"}}`, encodeURIComponent(String(requestParameters["prefix"])));
2237
+ const response = await this.request({
2238
+ path: urlPath,
2239
+ method: "GET",
2240
+ headers: headerParameters,
2241
+ query: queryParameters
2242
+ }, initOverrides);
2243
+ return new JSONApiResponse(response, (jsonValue) => jsonValue.map(PublisherFromJSON));
2244
+ }
2245
+ /**
2246
+ * List the publishers that use an ISBN registrant prefix.
2247
+ */
2248
+ async getPublishersByPrefix(prefix, page, initOverrides) {
2249
+ const response = await this.getPublishersByPrefixRaw({ prefix, page }, initOverrides);
2250
+ return await response.value();
2251
+ }
2252
+ };
2253
+
2254
+ // src/apis/SubjectsApi.ts
2255
+ var SubjectsApi = class extends BaseAPI {
2256
+ /**
2257
+ * Find a subject by name.
2258
+ */
2259
+ async findSubjectRaw(requestParameters, initOverrides) {
2260
+ if (requestParameters["search"] == null) {
2261
+ throw new RequiredError(
2262
+ "search",
2263
+ 'Required parameter "search" was null or undefined when calling findSubject().'
2264
+ );
2265
+ }
2266
+ const queryParameters = {};
2267
+ const headerParameters = {};
2268
+ if (this.configuration && this.configuration.apiKey) {
2269
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
2270
+ }
2271
+ if (this.configuration && this.configuration.accessToken) {
2272
+ const token = this.configuration.accessToken;
2273
+ const tokenString = await token("Token", []);
2274
+ if (tokenString) {
2275
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
2276
+ }
2277
+ }
2278
+ let urlPath = `/api/subject/search/{search}`;
2279
+ urlPath = urlPath.replace(`{${"search"}}`, encodeURIComponent(String(requestParameters["search"])));
2280
+ const response = await this.request({
2281
+ path: urlPath,
2282
+ method: "GET",
2283
+ headers: headerParameters,
2284
+ query: queryParameters
2285
+ }, initOverrides);
2286
+ return new JSONApiResponse(response, (jsonValue) => SubjectFromJSON(jsonValue));
2287
+ }
2288
+ /**
2289
+ * Find a subject by name.
2290
+ */
2291
+ async findSubject(search, initOverrides) {
2292
+ const response = await this.findSubjectRaw({ search }, initOverrides);
2293
+ return await response.value();
2294
+ }
2295
+ /**
2296
+ * Look up a subject by id.
2297
+ */
2298
+ async getSubjectRaw(requestParameters, initOverrides) {
2299
+ if (requestParameters["id"] == null) {
2300
+ throw new RequiredError(
2301
+ "id",
2302
+ 'Required parameter "id" was null or undefined when calling getSubject().'
2303
+ );
2304
+ }
2305
+ const queryParameters = {};
2306
+ const headerParameters = {};
2307
+ if (this.configuration && this.configuration.apiKey) {
2308
+ queryParameters["access_token"] = await this.configuration.apiKey("access_token");
2309
+ }
2310
+ if (this.configuration && this.configuration.accessToken) {
2311
+ const token = this.configuration.accessToken;
2312
+ const tokenString = await token("Token", []);
2313
+ if (tokenString) {
2314
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
2315
+ }
2316
+ }
2317
+ let urlPath = `/api/subject/{id}`;
2318
+ urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"])));
2319
+ const response = await this.request({
2320
+ path: urlPath,
2321
+ method: "GET",
2322
+ headers: headerParameters,
2323
+ query: queryParameters
2324
+ }, initOverrides);
2325
+ return new JSONApiResponse(response, (jsonValue) => SubjectFromJSON(jsonValue));
2326
+ }
2327
+ /**
2328
+ * Look up a subject by id.
2329
+ */
2330
+ async getSubject(id, initOverrides) {
2331
+ const response = await this.getSubjectRaw({ id }, initOverrides);
2332
+ return await response.value();
2333
+ }
2334
+ };
2335
+
2336
+ // src/plan.ts
2337
+ var PLAN_RESTRICTED_FIELDS_HEADER = "X-Plan-Restricted-Fields";
2338
+ var PLAN_UPGRADE_HEADER = "X-Plan-Upgrade";
2339
+ function header(source, name) {
2340
+ let headers;
2341
+ if ("raw" in source) {
2342
+ headers = source.raw.headers;
2343
+ } else if ("headers" in source) {
2344
+ headers = source.headers;
2345
+ } else {
2346
+ headers = source;
2347
+ }
2348
+ const value = headers.get(name)?.trim();
2349
+ return value ? value : null;
2350
+ }
2351
+ function restrictedFields(source) {
2352
+ const value = header(source, PLAN_RESTRICTED_FIELDS_HEADER);
2353
+ if (value === null) {
2354
+ return [];
2355
+ }
2356
+ return value.split(",").map((field) => field.trim()).filter((field) => field !== "");
2357
+ }
2358
+ function upgradeUrl(source) {
2359
+ return header(source, PLAN_UPGRADE_HEADER);
2360
+ }
2361
+ //# sourceMappingURL=index.js.map