isbnlab 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -3
- package/dist/index.d.mts +100 -2
- package/dist/index.d.ts +100 -2
- package/dist/index.js +75 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,9 +28,7 @@ console.log(book.title); // The Gathering Storm
|
|
|
28
28
|
console.log(book.authors?.[0]?.name); // Robert Jordan
|
|
29
29
|
console.log(book.publishDate?.getUTCFullYear());
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
console.log(edition.isbn13, edition.title);
|
|
33
|
-
}
|
|
31
|
+
console.log(book.otherEditionsCount, 'other editions');
|
|
34
32
|
```
|
|
35
33
|
|
|
36
34
|
Many fields are empty for some books, so every field is optional and may be `null`.
|
|
@@ -47,6 +45,34 @@ if (authorId != null) {
|
|
|
47
45
|
}
|
|
48
46
|
```
|
|
49
47
|
|
|
48
|
+
## Fields that depend on your plan
|
|
49
|
+
|
|
50
|
+
A book lookup lists the other editions (`otherEditions`, `previousEdition`, `nextEdition`) on the Pro plan. On the Free and Standard plans those fields are empty, `otherEditionsCount` still gives the number of other editions, and two response headers name what was left out: `X-Plan-Restricted-Fields` lists the fields and `X-Plan-Upgrade` links to the plans. `restrictedFields()` and `upgradeUrl()` read them from a `...Raw()` call:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { restrictedFields, upgradeUrl } from 'isbnlab';
|
|
54
|
+
|
|
55
|
+
const response = await books.getBookByIsbnRaw({ isbn: '9780765302304' });
|
|
56
|
+
const full = await response.value();
|
|
57
|
+
|
|
58
|
+
if (restrictedFields(response).includes('otherEditions')) {
|
|
59
|
+
console.log(full.otherEditionsCount, 'other editions; see', upgradeUrl(response));
|
|
60
|
+
} else {
|
|
61
|
+
for (const edition of full.otherEditions ?? []) {
|
|
62
|
+
console.log(edition.isbn13, edition.title);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`restrictedFields(response)` returns every field that was left out, for example `['otherEditions', 'previousEdition', 'nextEdition']`, or `[]` when the response is complete. It also accepts a fetch `Response` or `Headers`.
|
|
68
|
+
|
|
69
|
+
A cover lookup (Standard or Pro) gives each cover image's URL in `covers`, and in `sizes` the same image 200, 400 and 800 pixels wide (`w200`, `w400`, `w800`); a width is empty when that size is not available.
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
const cover = await books.getBookCoverByIsbn('9780765302304');
|
|
73
|
+
console.log(cover.sizes?.[0]?.w400); // https://covers.isbnlab.com/w400/9780765302304.jpg
|
|
74
|
+
```
|
|
75
|
+
|
|
50
76
|
## Errors
|
|
51
77
|
|
|
52
78
|
Any response other than 2xx rejects with `ResponseError`. Its `response` is the fetch `Response`, and the body's `detail` explains the reason:
|
package/dist/index.d.mts
CHANGED
|
@@ -1420,6 +1420,12 @@ interface Book {
|
|
|
1420
1420
|
* @memberof Book
|
|
1421
1421
|
*/
|
|
1422
1422
|
isbnModel?: IsbnDetails | null;
|
|
1423
|
+
/**
|
|
1424
|
+
*
|
|
1425
|
+
* @type {number}
|
|
1426
|
+
* @memberof Book
|
|
1427
|
+
*/
|
|
1428
|
+
readonly otherEditionsCount?: number | null;
|
|
1423
1429
|
}
|
|
1424
1430
|
/**
|
|
1425
1431
|
* @export
|
|
@@ -1438,7 +1444,7 @@ declare function instanceOfBook(value: object): value is Book;
|
|
|
1438
1444
|
declare function BookFromJSON(json: any): Book;
|
|
1439
1445
|
declare function BookFromJSONTyped(json: any, ignoreDiscriminator: boolean): Book;
|
|
1440
1446
|
declare function BookToJSON(json: any): Book;
|
|
1441
|
-
declare function BookToJSONTyped(value?: Omit<Book, 'id'> | null, ignoreDiscriminator?: boolean): any;
|
|
1447
|
+
declare function BookToJSONTyped(value?: Omit<Book, 'id' | 'otherEditionsCount'> | null, ignoreDiscriminator?: boolean): any;
|
|
1442
1448
|
|
|
1443
1449
|
/**
|
|
1444
1450
|
* ISBNLab API
|
|
@@ -1451,6 +1457,58 @@ declare function BookToJSONTyped(value?: Omit<Book, 'id'> | null, ignoreDiscrimi
|
|
|
1451
1457
|
* https://openapi-generator.tech
|
|
1452
1458
|
* Do not edit the class manually.
|
|
1453
1459
|
*/
|
|
1460
|
+
/**
|
|
1461
|
+
*
|
|
1462
|
+
* @export
|
|
1463
|
+
* @interface CoverSize
|
|
1464
|
+
*/
|
|
1465
|
+
interface CoverSize {
|
|
1466
|
+
/**
|
|
1467
|
+
*
|
|
1468
|
+
* @type {string}
|
|
1469
|
+
* @memberof CoverSize
|
|
1470
|
+
*/
|
|
1471
|
+
url?: string | null;
|
|
1472
|
+
/**
|
|
1473
|
+
*
|
|
1474
|
+
* @type {string}
|
|
1475
|
+
* @memberof CoverSize
|
|
1476
|
+
*/
|
|
1477
|
+
w200?: string | null;
|
|
1478
|
+
/**
|
|
1479
|
+
*
|
|
1480
|
+
* @type {string}
|
|
1481
|
+
* @memberof CoverSize
|
|
1482
|
+
*/
|
|
1483
|
+
w400?: string | null;
|
|
1484
|
+
/**
|
|
1485
|
+
*
|
|
1486
|
+
* @type {string}
|
|
1487
|
+
* @memberof CoverSize
|
|
1488
|
+
*/
|
|
1489
|
+
w800?: string | null;
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* Check if a given object implements the CoverSize interface.
|
|
1493
|
+
*/
|
|
1494
|
+
declare function instanceOfCoverSize(value: object): value is CoverSize;
|
|
1495
|
+
declare function CoverSizeFromJSON(json: any): CoverSize;
|
|
1496
|
+
declare function CoverSizeFromJSONTyped(json: any, ignoreDiscriminator: boolean): CoverSize;
|
|
1497
|
+
declare function CoverSizeToJSON(json: any): CoverSize;
|
|
1498
|
+
declare function CoverSizeToJSONTyped(value?: CoverSize | null, ignoreDiscriminator?: boolean): any;
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* ISBNLab API
|
|
1502
|
+
* Book metadata by ISBN: books, editions, covers, authors, publishers, subjects, BISAC genres, and ISBN validation and conversion.
|
|
1503
|
+
*
|
|
1504
|
+
* The version of the OpenAPI document: 1.0.0
|
|
1505
|
+
* Contact: hello@isbnlab.com
|
|
1506
|
+
*
|
|
1507
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
1508
|
+
* https://openapi-generator.tech
|
|
1509
|
+
* Do not edit the class manually.
|
|
1510
|
+
*/
|
|
1511
|
+
|
|
1454
1512
|
/**
|
|
1455
1513
|
*
|
|
1456
1514
|
* @export
|
|
@@ -1469,6 +1527,12 @@ interface BookCover {
|
|
|
1469
1527
|
* @memberof BookCover
|
|
1470
1528
|
*/
|
|
1471
1529
|
covers?: Array<string> | null;
|
|
1530
|
+
/**
|
|
1531
|
+
*
|
|
1532
|
+
* @type {Array<CoverSize>}
|
|
1533
|
+
* @memberof BookCover
|
|
1534
|
+
*/
|
|
1535
|
+
sizes?: Array<CoverSize> | null;
|
|
1472
1536
|
}
|
|
1473
1537
|
/**
|
|
1474
1538
|
* Check if a given object implements the BookCover interface.
|
|
@@ -2072,4 +2136,38 @@ declare class SubjectsApi extends BaseAPI {
|
|
|
2072
2136
|
getSubject(id: string, initOverrides?: RequestInit | InitOverrideFunction): Promise<Subject>;
|
|
2073
2137
|
}
|
|
2074
2138
|
|
|
2075
|
-
|
|
2139
|
+
/**
|
|
2140
|
+
* Reads the headers the API adds when a response leaves out fields that need a
|
|
2141
|
+
* higher plan. A book lookup on a Free or Standard plan, for example, returns
|
|
2142
|
+
* otherEditions, previousEdition and nextEdition as null and names them here.
|
|
2143
|
+
*
|
|
2144
|
+
* Pass the response from a ...Raw() call, a fetch Response, or its Headers:
|
|
2145
|
+
*
|
|
2146
|
+
* const response = await books.getBookByIsbnRaw({ isbn: '9780765302304' });
|
|
2147
|
+
* const book = await response.value();
|
|
2148
|
+
*
|
|
2149
|
+
* restrictedFields(response); // ['otherEditions', 'previousEdition', 'nextEdition']
|
|
2150
|
+
* upgradeUrl(response); // 'https://www.isbnlab.com/pricing'
|
|
2151
|
+
*/
|
|
2152
|
+
declare const PLAN_RESTRICTED_FIELDS_HEADER = "X-Plan-Restricted-Fields";
|
|
2153
|
+
declare const PLAN_UPGRADE_HEADER = "X-Plan-Upgrade";
|
|
2154
|
+
/** Anything that carries response headers: an ApiResponse from a ...Raw() call, a Response, or Headers. */
|
|
2155
|
+
type PlanHeadersSource = {
|
|
2156
|
+
raw: {
|
|
2157
|
+
headers: {
|
|
2158
|
+
get(name: string): string | null;
|
|
2159
|
+
};
|
|
2160
|
+
};
|
|
2161
|
+
} | {
|
|
2162
|
+
headers: {
|
|
2163
|
+
get(name: string): string | null;
|
|
2164
|
+
};
|
|
2165
|
+
} | {
|
|
2166
|
+
get(name: string): string | null;
|
|
2167
|
+
};
|
|
2168
|
+
/** The fields your plan left empty in this response, by their API names, or [] when nothing was left out. */
|
|
2169
|
+
declare function restrictedFields(source: PlanHeadersSource): string[];
|
|
2170
|
+
/** The page that lists the plans which include the left-out fields, or null when nothing was left out. */
|
|
2171
|
+
declare function upgradeUrl(source: PlanHeadersSource): string | null;
|
|
2172
|
+
|
|
2173
|
+
export { type ApiResponse, type AsinToIsbnRequest, type Author, AuthorFromJSON, AuthorFromJSONTyped, type AuthorPhoto, AuthorPhotoFromJSON, AuthorPhotoFromJSONTyped, AuthorPhotoToJSON, AuthorPhotoToJSONTyped, AuthorToJSON, AuthorToJSONTyped, AuthorsApi, BASE_PATH, BaseAPI, BlobApiResponse, type Book, type BookCover, BookCoverFromJSON, BookCoverFromJSONTyped, BookCoverToJSON, BookCoverToJSONTyped, type BookEditions, BookEditionsFromJSON, BookEditionsFromJSONTyped, BookEditionsToJSON, BookEditionsToJSONTyped, BookFromJSON, BookFromJSONTyped, BookPublishDatePrecisionEnum, BookToJSON, BookToJSONTyped, BooksApi, COLLECTION_FORMATS, type Category, CategoryFromJSON, CategoryFromJSONTyped, CategoryToJSON, CategoryToJSONTyped, Configuration, type ConfigurationParameters, type Consume, type Contributor, ContributorFromJSON, ContributorFromJSONTyped, ContributorRoleEnum, ContributorToJSON, ContributorToJSONTyped, type CoverSize, CoverSizeFromJSON, CoverSizeFromJSONTyped, CoverSizeToJSON, CoverSizeToJSONTyped, DefaultConfig, type EanToIsbnRequest, type EditionRef, EditionRefFromJSON, EditionRefFromJSONTyped, EditionRefToJSON, EditionRefToJSONTyped, type EntityRef, EntityRefFromJSON, EntityRefFromJSONTyped, EntityRefToJSON, EntityRefToJSONTyped, type ErrorContext, type FetchAPI, FetchError, type FetchParams, type FindAuthorRequest, type FindGenreRequest, type FindPublisherRequest, type FindSubjectRequest, type Genre, GenreFromJSON, GenreFromJSONTyped, GenreToJSON, GenreToJSONTyped, GenresApi, type GetAuthorRequest, type GetBookByAsinRequest, type GetBookByIdRequest, type GetBookByIsbnRequest, type GetBookCoverByAsinRequest, type GetBookCoverByIsbnRequest, type GetEditionsByAsinRequest, type GetEditionsByIsbnRequest, type GetGenreRequest, type GetPublisherRequest, type GetPublishersByPrefixRequest, type GetSubjectRequest, type HTTPBody, type HTTPHeaders, type HTTPMethod, type HTTPQuery, type HTTPRequestInit, type InitOverrideFunction, type Isbn10ToIsbn13Request, type Isbn13ToIsbn10Request, IsbnApi, type IsbnDetails, IsbnDetailsFromJSON, IsbnDetailsFromJSONTyped, IsbnDetailsToJSON, IsbnDetailsToJSONTyped, type IsbnToAsinRequest, type IsbnToEanRequest, JSONApiResponse, type Json, type Middleware, type ModelPropertyNaming, type OtherSeries, OtherSeriesFromJSON, OtherSeriesFromJSONTyped, OtherSeriesKindEnum, OtherSeriesToJSON, OtherSeriesToJSONTyped, PLAN_RESTRICTED_FIELDS_HEADER, PLAN_UPGRADE_HEADER, type ParseIsbnRequest, type PlanHeadersSource, type Publisher, PublisherFromJSON, PublisherFromJSONTyped, PublisherToJSON, PublisherToJSONTyped, PublishersApi, type RatingCounts, RatingCountsFromJSON, RatingCountsFromJSONTyped, RatingCountsToJSON, RatingCountsToJSONTyped, type RatingSummary, RatingSummaryFromJSON, RatingSummaryFromJSONTyped, RatingSummaryToJSON, RatingSummaryToJSONTyped, type Ratings, RatingsFromJSON, RatingsFromJSONTyped, RatingsToJSON, RatingsToJSONTyped, type RequestContext, type RequestOpts, RequiredError, type ResponseContext, ResponseError, type ResponseTransformer, type RetailLink, RetailLinkFromJSON, RetailLinkFromJSONTyped, RetailLinkToJSON, RetailLinkToJSONTyped, type SearchBooksRequest, type Series, type SeriesBook, SeriesBookFromJSON, SeriesBookFromJSONTyped, SeriesBookToJSON, SeriesBookToJSONTyped, SeriesFromJSON, SeriesFromJSONTyped, SeriesKindEnum, type SeriesParent, SeriesParentFromJSON, SeriesParentFromJSONTyped, SeriesParentToJSON, SeriesParentToJSONTyped, SeriesToJSON, SeriesToJSONTyped, type Subject, SubjectFromJSON, SubjectFromJSONTyped, type SubjectRef, SubjectRefFromJSON, SubjectRefFromJSONTyped, SubjectRefToJSON, SubjectRefToJSONTyped, SubjectToJSON, SubjectToJSONTyped, SubjectsApi, TextApiResponse, VoidApiResponse, canConsumeForm, exists, instanceOfAuthor, instanceOfAuthorPhoto, instanceOfBook, instanceOfBookCover, instanceOfBookEditions, instanceOfCategory, instanceOfContributor, instanceOfCoverSize, instanceOfEditionRef, instanceOfEntityRef, instanceOfGenre, instanceOfIsbnDetails, instanceOfOtherSeries, instanceOfPublisher, instanceOfRatingCounts, instanceOfRatingSummary, instanceOfRatings, instanceOfRetailLink, instanceOfSeries, instanceOfSeriesBook, instanceOfSeriesParent, instanceOfSubject, instanceOfSubjectRef, mapValues, querystring, restrictedFields, upgradeUrl };
|
package/dist/index.d.ts
CHANGED
|
@@ -1420,6 +1420,12 @@ interface Book {
|
|
|
1420
1420
|
* @memberof Book
|
|
1421
1421
|
*/
|
|
1422
1422
|
isbnModel?: IsbnDetails | null;
|
|
1423
|
+
/**
|
|
1424
|
+
*
|
|
1425
|
+
* @type {number}
|
|
1426
|
+
* @memberof Book
|
|
1427
|
+
*/
|
|
1428
|
+
readonly otherEditionsCount?: number | null;
|
|
1423
1429
|
}
|
|
1424
1430
|
/**
|
|
1425
1431
|
* @export
|
|
@@ -1438,7 +1444,7 @@ declare function instanceOfBook(value: object): value is Book;
|
|
|
1438
1444
|
declare function BookFromJSON(json: any): Book;
|
|
1439
1445
|
declare function BookFromJSONTyped(json: any, ignoreDiscriminator: boolean): Book;
|
|
1440
1446
|
declare function BookToJSON(json: any): Book;
|
|
1441
|
-
declare function BookToJSONTyped(value?: Omit<Book, 'id'> | null, ignoreDiscriminator?: boolean): any;
|
|
1447
|
+
declare function BookToJSONTyped(value?: Omit<Book, 'id' | 'otherEditionsCount'> | null, ignoreDiscriminator?: boolean): any;
|
|
1442
1448
|
|
|
1443
1449
|
/**
|
|
1444
1450
|
* ISBNLab API
|
|
@@ -1451,6 +1457,58 @@ declare function BookToJSONTyped(value?: Omit<Book, 'id'> | null, ignoreDiscrimi
|
|
|
1451
1457
|
* https://openapi-generator.tech
|
|
1452
1458
|
* Do not edit the class manually.
|
|
1453
1459
|
*/
|
|
1460
|
+
/**
|
|
1461
|
+
*
|
|
1462
|
+
* @export
|
|
1463
|
+
* @interface CoverSize
|
|
1464
|
+
*/
|
|
1465
|
+
interface CoverSize {
|
|
1466
|
+
/**
|
|
1467
|
+
*
|
|
1468
|
+
* @type {string}
|
|
1469
|
+
* @memberof CoverSize
|
|
1470
|
+
*/
|
|
1471
|
+
url?: string | null;
|
|
1472
|
+
/**
|
|
1473
|
+
*
|
|
1474
|
+
* @type {string}
|
|
1475
|
+
* @memberof CoverSize
|
|
1476
|
+
*/
|
|
1477
|
+
w200?: string | null;
|
|
1478
|
+
/**
|
|
1479
|
+
*
|
|
1480
|
+
* @type {string}
|
|
1481
|
+
* @memberof CoverSize
|
|
1482
|
+
*/
|
|
1483
|
+
w400?: string | null;
|
|
1484
|
+
/**
|
|
1485
|
+
*
|
|
1486
|
+
* @type {string}
|
|
1487
|
+
* @memberof CoverSize
|
|
1488
|
+
*/
|
|
1489
|
+
w800?: string | null;
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* Check if a given object implements the CoverSize interface.
|
|
1493
|
+
*/
|
|
1494
|
+
declare function instanceOfCoverSize(value: object): value is CoverSize;
|
|
1495
|
+
declare function CoverSizeFromJSON(json: any): CoverSize;
|
|
1496
|
+
declare function CoverSizeFromJSONTyped(json: any, ignoreDiscriminator: boolean): CoverSize;
|
|
1497
|
+
declare function CoverSizeToJSON(json: any): CoverSize;
|
|
1498
|
+
declare function CoverSizeToJSONTyped(value?: CoverSize | null, ignoreDiscriminator?: boolean): any;
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* ISBNLab API
|
|
1502
|
+
* Book metadata by ISBN: books, editions, covers, authors, publishers, subjects, BISAC genres, and ISBN validation and conversion.
|
|
1503
|
+
*
|
|
1504
|
+
* The version of the OpenAPI document: 1.0.0
|
|
1505
|
+
* Contact: hello@isbnlab.com
|
|
1506
|
+
*
|
|
1507
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
1508
|
+
* https://openapi-generator.tech
|
|
1509
|
+
* Do not edit the class manually.
|
|
1510
|
+
*/
|
|
1511
|
+
|
|
1454
1512
|
/**
|
|
1455
1513
|
*
|
|
1456
1514
|
* @export
|
|
@@ -1469,6 +1527,12 @@ interface BookCover {
|
|
|
1469
1527
|
* @memberof BookCover
|
|
1470
1528
|
*/
|
|
1471
1529
|
covers?: Array<string> | null;
|
|
1530
|
+
/**
|
|
1531
|
+
*
|
|
1532
|
+
* @type {Array<CoverSize>}
|
|
1533
|
+
* @memberof BookCover
|
|
1534
|
+
*/
|
|
1535
|
+
sizes?: Array<CoverSize> | null;
|
|
1472
1536
|
}
|
|
1473
1537
|
/**
|
|
1474
1538
|
* Check if a given object implements the BookCover interface.
|
|
@@ -2072,4 +2136,38 @@ declare class SubjectsApi extends BaseAPI {
|
|
|
2072
2136
|
getSubject(id: string, initOverrides?: RequestInit | InitOverrideFunction): Promise<Subject>;
|
|
2073
2137
|
}
|
|
2074
2138
|
|
|
2075
|
-
|
|
2139
|
+
/**
|
|
2140
|
+
* Reads the headers the API adds when a response leaves out fields that need a
|
|
2141
|
+
* higher plan. A book lookup on a Free or Standard plan, for example, returns
|
|
2142
|
+
* otherEditions, previousEdition and nextEdition as null and names them here.
|
|
2143
|
+
*
|
|
2144
|
+
* Pass the response from a ...Raw() call, a fetch Response, or its Headers:
|
|
2145
|
+
*
|
|
2146
|
+
* const response = await books.getBookByIsbnRaw({ isbn: '9780765302304' });
|
|
2147
|
+
* const book = await response.value();
|
|
2148
|
+
*
|
|
2149
|
+
* restrictedFields(response); // ['otherEditions', 'previousEdition', 'nextEdition']
|
|
2150
|
+
* upgradeUrl(response); // 'https://www.isbnlab.com/pricing'
|
|
2151
|
+
*/
|
|
2152
|
+
declare const PLAN_RESTRICTED_FIELDS_HEADER = "X-Plan-Restricted-Fields";
|
|
2153
|
+
declare const PLAN_UPGRADE_HEADER = "X-Plan-Upgrade";
|
|
2154
|
+
/** Anything that carries response headers: an ApiResponse from a ...Raw() call, a Response, or Headers. */
|
|
2155
|
+
type PlanHeadersSource = {
|
|
2156
|
+
raw: {
|
|
2157
|
+
headers: {
|
|
2158
|
+
get(name: string): string | null;
|
|
2159
|
+
};
|
|
2160
|
+
};
|
|
2161
|
+
} | {
|
|
2162
|
+
headers: {
|
|
2163
|
+
get(name: string): string | null;
|
|
2164
|
+
};
|
|
2165
|
+
} | {
|
|
2166
|
+
get(name: string): string | null;
|
|
2167
|
+
};
|
|
2168
|
+
/** The fields your plan left empty in this response, by their API names, or [] when nothing was left out. */
|
|
2169
|
+
declare function restrictedFields(source: PlanHeadersSource): string[];
|
|
2170
|
+
/** The page that lists the plans which include the left-out fields, or null when nothing was left out. */
|
|
2171
|
+
declare function upgradeUrl(source: PlanHeadersSource): string | null;
|
|
2172
|
+
|
|
2173
|
+
export { type ApiResponse, type AsinToIsbnRequest, type Author, AuthorFromJSON, AuthorFromJSONTyped, type AuthorPhoto, AuthorPhotoFromJSON, AuthorPhotoFromJSONTyped, AuthorPhotoToJSON, AuthorPhotoToJSONTyped, AuthorToJSON, AuthorToJSONTyped, AuthorsApi, BASE_PATH, BaseAPI, BlobApiResponse, type Book, type BookCover, BookCoverFromJSON, BookCoverFromJSONTyped, BookCoverToJSON, BookCoverToJSONTyped, type BookEditions, BookEditionsFromJSON, BookEditionsFromJSONTyped, BookEditionsToJSON, BookEditionsToJSONTyped, BookFromJSON, BookFromJSONTyped, BookPublishDatePrecisionEnum, BookToJSON, BookToJSONTyped, BooksApi, COLLECTION_FORMATS, type Category, CategoryFromJSON, CategoryFromJSONTyped, CategoryToJSON, CategoryToJSONTyped, Configuration, type ConfigurationParameters, type Consume, type Contributor, ContributorFromJSON, ContributorFromJSONTyped, ContributorRoleEnum, ContributorToJSON, ContributorToJSONTyped, type CoverSize, CoverSizeFromJSON, CoverSizeFromJSONTyped, CoverSizeToJSON, CoverSizeToJSONTyped, DefaultConfig, type EanToIsbnRequest, type EditionRef, EditionRefFromJSON, EditionRefFromJSONTyped, EditionRefToJSON, EditionRefToJSONTyped, type EntityRef, EntityRefFromJSON, EntityRefFromJSONTyped, EntityRefToJSON, EntityRefToJSONTyped, type ErrorContext, type FetchAPI, FetchError, type FetchParams, type FindAuthorRequest, type FindGenreRequest, type FindPublisherRequest, type FindSubjectRequest, type Genre, GenreFromJSON, GenreFromJSONTyped, GenreToJSON, GenreToJSONTyped, GenresApi, type GetAuthorRequest, type GetBookByAsinRequest, type GetBookByIdRequest, type GetBookByIsbnRequest, type GetBookCoverByAsinRequest, type GetBookCoverByIsbnRequest, type GetEditionsByAsinRequest, type GetEditionsByIsbnRequest, type GetGenreRequest, type GetPublisherRequest, type GetPublishersByPrefixRequest, type GetSubjectRequest, type HTTPBody, type HTTPHeaders, type HTTPMethod, type HTTPQuery, type HTTPRequestInit, type InitOverrideFunction, type Isbn10ToIsbn13Request, type Isbn13ToIsbn10Request, IsbnApi, type IsbnDetails, IsbnDetailsFromJSON, IsbnDetailsFromJSONTyped, IsbnDetailsToJSON, IsbnDetailsToJSONTyped, type IsbnToAsinRequest, type IsbnToEanRequest, JSONApiResponse, type Json, type Middleware, type ModelPropertyNaming, type OtherSeries, OtherSeriesFromJSON, OtherSeriesFromJSONTyped, OtherSeriesKindEnum, OtherSeriesToJSON, OtherSeriesToJSONTyped, PLAN_RESTRICTED_FIELDS_HEADER, PLAN_UPGRADE_HEADER, type ParseIsbnRequest, type PlanHeadersSource, type Publisher, PublisherFromJSON, PublisherFromJSONTyped, PublisherToJSON, PublisherToJSONTyped, PublishersApi, type RatingCounts, RatingCountsFromJSON, RatingCountsFromJSONTyped, RatingCountsToJSON, RatingCountsToJSONTyped, type RatingSummary, RatingSummaryFromJSON, RatingSummaryFromJSONTyped, RatingSummaryToJSON, RatingSummaryToJSONTyped, type Ratings, RatingsFromJSON, RatingsFromJSONTyped, RatingsToJSON, RatingsToJSONTyped, type RequestContext, type RequestOpts, RequiredError, type ResponseContext, ResponseError, type ResponseTransformer, type RetailLink, RetailLinkFromJSON, RetailLinkFromJSONTyped, RetailLinkToJSON, RetailLinkToJSONTyped, type SearchBooksRequest, type Series, type SeriesBook, SeriesBookFromJSON, SeriesBookFromJSONTyped, SeriesBookToJSON, SeriesBookToJSONTyped, SeriesFromJSON, SeriesFromJSONTyped, SeriesKindEnum, type SeriesParent, SeriesParentFromJSON, SeriesParentFromJSONTyped, SeriesParentToJSON, SeriesParentToJSONTyped, SeriesToJSON, SeriesToJSONTyped, type Subject, SubjectFromJSON, SubjectFromJSONTyped, type SubjectRef, SubjectRefFromJSON, SubjectRefFromJSONTyped, SubjectRefToJSON, SubjectRefToJSONTyped, SubjectToJSON, SubjectToJSONTyped, SubjectsApi, TextApiResponse, VoidApiResponse, canConsumeForm, exists, instanceOfAuthor, instanceOfAuthorPhoto, instanceOfBook, instanceOfBookCover, instanceOfBookEditions, instanceOfCategory, instanceOfContributor, instanceOfCoverSize, instanceOfEditionRef, instanceOfEntityRef, instanceOfGenre, instanceOfIsbnDetails, instanceOfOtherSeries, instanceOfPublisher, instanceOfRatingCounts, instanceOfRatingSummary, instanceOfRatings, instanceOfRetailLink, instanceOfSeries, instanceOfSeriesBook, instanceOfSeriesParent, instanceOfSubject, instanceOfSubjectRef, mapValues, querystring, restrictedFields, upgradeUrl };
|
package/dist/index.js
CHANGED
|
@@ -57,6 +57,10 @@ __export(index_exports, {
|
|
|
57
57
|
ContributorRoleEnum: () => ContributorRoleEnum,
|
|
58
58
|
ContributorToJSON: () => ContributorToJSON,
|
|
59
59
|
ContributorToJSONTyped: () => ContributorToJSONTyped,
|
|
60
|
+
CoverSizeFromJSON: () => CoverSizeFromJSON,
|
|
61
|
+
CoverSizeFromJSONTyped: () => CoverSizeFromJSONTyped,
|
|
62
|
+
CoverSizeToJSON: () => CoverSizeToJSON,
|
|
63
|
+
CoverSizeToJSONTyped: () => CoverSizeToJSONTyped,
|
|
60
64
|
DefaultConfig: () => DefaultConfig,
|
|
61
65
|
EditionRefFromJSON: () => EditionRefFromJSON,
|
|
62
66
|
EditionRefFromJSONTyped: () => EditionRefFromJSONTyped,
|
|
@@ -83,6 +87,8 @@ __export(index_exports, {
|
|
|
83
87
|
OtherSeriesKindEnum: () => OtherSeriesKindEnum,
|
|
84
88
|
OtherSeriesToJSON: () => OtherSeriesToJSON,
|
|
85
89
|
OtherSeriesToJSONTyped: () => OtherSeriesToJSONTyped,
|
|
90
|
+
PLAN_RESTRICTED_FIELDS_HEADER: () => PLAN_RESTRICTED_FIELDS_HEADER,
|
|
91
|
+
PLAN_UPGRADE_HEADER: () => PLAN_UPGRADE_HEADER,
|
|
86
92
|
PublisherFromJSON: () => PublisherFromJSON,
|
|
87
93
|
PublisherFromJSONTyped: () => PublisherFromJSONTyped,
|
|
88
94
|
PublisherToJSON: () => PublisherToJSON,
|
|
@@ -139,6 +145,7 @@ __export(index_exports, {
|
|
|
139
145
|
instanceOfBookEditions: () => instanceOfBookEditions,
|
|
140
146
|
instanceOfCategory: () => instanceOfCategory,
|
|
141
147
|
instanceOfContributor: () => instanceOfContributor,
|
|
148
|
+
instanceOfCoverSize: () => instanceOfCoverSize,
|
|
142
149
|
instanceOfEditionRef: () => instanceOfEditionRef,
|
|
143
150
|
instanceOfEntityRef: () => instanceOfEntityRef,
|
|
144
151
|
instanceOfGenre: () => instanceOfGenre,
|
|
@@ -155,7 +162,9 @@ __export(index_exports, {
|
|
|
155
162
|
instanceOfSubject: () => instanceOfSubject,
|
|
156
163
|
instanceOfSubjectRef: () => instanceOfSubjectRef,
|
|
157
164
|
mapValues: () => mapValues,
|
|
158
|
-
querystring: () => querystring
|
|
165
|
+
querystring: () => querystring,
|
|
166
|
+
restrictedFields: () => restrictedFields,
|
|
167
|
+
upgradeUrl: () => upgradeUrl
|
|
159
168
|
});
|
|
160
169
|
module.exports = __toCommonJS(index_exports);
|
|
161
170
|
|
|
@@ -1101,7 +1110,8 @@ function BookFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
1101
1110
|
"estimatedReadTime": json["estimatedReadTime"] == null ? void 0 : json["estimatedReadTime"],
|
|
1102
1111
|
"languagesCount": json["languagesCount"] == null ? void 0 : json["languagesCount"],
|
|
1103
1112
|
"link": json["link"] == null ? void 0 : json["link"],
|
|
1104
|
-
"isbnModel": json["isbnModel"] == null ? void 0 : IsbnDetailsFromJSON(json["isbnModel"])
|
|
1113
|
+
"isbnModel": json["isbnModel"] == null ? void 0 : IsbnDetailsFromJSON(json["isbnModel"]),
|
|
1114
|
+
"otherEditionsCount": json["otherEditionsCount"] == null ? void 0 : json["otherEditionsCount"]
|
|
1105
1115
|
};
|
|
1106
1116
|
}
|
|
1107
1117
|
function BookToJSON(json) {
|
|
@@ -1151,6 +1161,39 @@ function BookToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
1151
1161
|
};
|
|
1152
1162
|
}
|
|
1153
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
|
+
|
|
1154
1197
|
// src/models/BookCover.ts
|
|
1155
1198
|
function instanceOfBookCover(value) {
|
|
1156
1199
|
return true;
|
|
@@ -1164,7 +1207,8 @@ function BookCoverFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
1164
1207
|
}
|
|
1165
1208
|
return {
|
|
1166
1209
|
"isbn13": json["isbn13"] == null ? void 0 : json["isbn13"],
|
|
1167
|
-
"covers": json["covers"] == null ? void 0 : json["covers"]
|
|
1210
|
+
"covers": json["covers"] == null ? void 0 : json["covers"],
|
|
1211
|
+
"sizes": json["sizes"] == null ? void 0 : json["sizes"].map(CoverSizeFromJSON)
|
|
1168
1212
|
};
|
|
1169
1213
|
}
|
|
1170
1214
|
function BookCoverToJSON(json) {
|
|
@@ -1176,7 +1220,8 @@ function BookCoverToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
1176
1220
|
}
|
|
1177
1221
|
return {
|
|
1178
1222
|
"isbn13": value["isbn13"],
|
|
1179
|
-
"covers": value["covers"]
|
|
1223
|
+
"covers": value["covers"],
|
|
1224
|
+
"sizes": value["sizes"] == null ? void 0 : value["sizes"].map(CoverSizeToJSON)
|
|
1180
1225
|
};
|
|
1181
1226
|
}
|
|
1182
1227
|
|
|
@@ -2287,4 +2332,30 @@ var SubjectsApi = class extends BaseAPI {
|
|
|
2287
2332
|
return await response.value();
|
|
2288
2333
|
}
|
|
2289
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
|
+
}
|
|
2290
2361
|
//# sourceMappingURL=index.js.map
|