audible-api-ts 0.1.0 → 0.3.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 +79 -22
- package/dist/catalog.d.ts +17 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.int.test.d.ts +2 -0
- package/dist/catalog.int.test.d.ts.map +1 -0
- package/dist/categories.d.ts +18 -0
- package/dist/categories.d.ts.map +1 -0
- package/dist/categories.int.test.d.ts +2 -0
- package/dist/categories.int.test.d.ts.map +1 -0
- package/dist/client.d.ts +5 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.int.test.d.ts +2 -0
- package/dist/client.int.test.d.ts.map +1 -0
- package/dist/client.unit.test.d.ts +2 -0
- package/dist/client.unit.test.d.ts.map +1 -0
- package/dist/credentials.d.ts +9 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/fetch.d.ts +22 -0
- package/dist/fetch.d.ts.map +1 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2010 -336
- package/dist/library.d.ts +9 -6
- package/dist/library.d.ts.map +1 -1
- package/dist/library.int.test.d.ts +2 -0
- package/dist/library.int.test.d.ts.map +1 -0
- package/dist/locales.unit.test.d.ts +2 -0
- package/dist/locales.unit.test.d.ts.map +1 -0
- package/dist/schemas.d.ts +581 -2
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.unit.test.d.ts +2 -0
- package/dist/schemas.unit.test.d.ts.map +1 -0
- package/dist/types.d.ts +77 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.unit.test.d.ts +2 -0
- package/dist/utils.unit.test.d.ts.map +1 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
**A fully typed TypeScript client for the Audible API.**
|
|
9
9
|
|
|
10
|
-
Authentication, library, wishlist — all with complete type safety. The first maintained TypeScript alternative to [mkb79/Audible](https://github.com/mkb79/Audible) (Python).
|
|
10
|
+
Authentication, library, wishlist, catalog search — all with complete type safety. The first maintained TypeScript alternative to [mkb79/Audible](https://github.com/mkb79/Audible) (Python).
|
|
11
11
|
|
|
12
12
|
**[Documentation](https://moifort.github.io/audible-api-ts)**
|
|
13
13
|
|
|
@@ -16,9 +16,10 @@ Authentication, library, wishlist — all with complete type safety. The first m
|
|
|
16
16
|
- **Complete PKCE authentication** — Same OAuth flow as the official Audible iOS app
|
|
17
17
|
- **Signed API requests** — RSA SHA256 request signing with device private key
|
|
18
18
|
- **Library & wishlist** — Fetch all audiobooks with automatic pagination
|
|
19
|
+
- **Catalog search** — Browse by category, sort by bestsellers or rating
|
|
20
|
+
- **Full data** — Ratings (overall/performance/story), categories, listening progress, series, cover images, and more
|
|
19
21
|
- **10 locales** — US, UK, France, Germany, Italy, Spain, Canada, Australia, India, Japan
|
|
20
22
|
- **Fully typed** — Every function, response, and credential has TypeScript types
|
|
21
|
-
- **Minimal dependencies** — Only `zod` for response validation
|
|
22
23
|
|
|
23
24
|
## Install
|
|
24
25
|
|
|
@@ -33,36 +34,92 @@ Requires Node.js 18+ (for native `fetch` and `crypto`).
|
|
|
33
34
|
## Quick Start
|
|
34
35
|
|
|
35
36
|
```typescript
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} from 'audible-api-ts'
|
|
41
|
-
|
|
42
|
-
// 1. Generate login URL
|
|
43
|
-
const { loginUrl, session, cookies } = await generateLoginUrl('com')
|
|
37
|
+
import { login, register, library } from 'audible-api-ts'
|
|
38
|
+
|
|
39
|
+
// 1. Authenticate
|
|
40
|
+
const { loginUrl, session, cookies } = await login('com')
|
|
44
41
|
// → Redirect user to loginUrl (set cookies first)
|
|
42
|
+
const credentials = await register(authorizationCode, session)
|
|
43
|
+
|
|
44
|
+
// 2. Fetch library
|
|
45
|
+
const { items } = await library(credentials)
|
|
46
|
+
|
|
47
|
+
items.map((book) => {
|
|
48
|
+
console.log(`${book.title} by ${book.authors.join(', ')}`)
|
|
49
|
+
console.log(` Rating: ${book.rating?.overallDistribution?.averageRating}/5`)
|
|
50
|
+
console.log(` Duration: ${Math.floor(book.durationMinutes / 60)}h${book.durationMinutes % 60}m`)
|
|
51
|
+
if (book.series) console.log(` Series: ${book.series.name} #${book.series.position}`)
|
|
52
|
+
if (book.listeningStatus?.percentComplete) {
|
|
53
|
+
console.log(` Progress: ${book.listeningStatus.percentComplete}%`)
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Output:**
|
|
59
|
+
```
|
|
60
|
+
Primal Hunter by Zogarth
|
|
61
|
+
Rating: 4.8/5
|
|
62
|
+
Duration: 29h30m
|
|
63
|
+
Series: Primal Hunter #4
|
|
64
|
+
Progress: 5%
|
|
65
|
+
Dune by Frank Herbert
|
|
66
|
+
Rating: 4.7/5
|
|
67
|
+
Duration: 18h0m
|
|
68
|
+
```
|
|
45
69
|
|
|
46
|
-
|
|
47
|
-
const credentials = await registerDevice(authorizationCode, session)
|
|
70
|
+
## Catalog Search
|
|
48
71
|
|
|
49
|
-
|
|
50
|
-
const { items } = await fetchLibrary(credentials)
|
|
72
|
+
Use genre names instead of opaque category IDs — the library resolves them per locale:
|
|
51
73
|
|
|
52
|
-
|
|
53
|
-
|
|
74
|
+
```typescript
|
|
75
|
+
import { catalog } from 'audible-api-ts'
|
|
76
|
+
|
|
77
|
+
// Top Science Fiction by relevance (default sort)
|
|
78
|
+
const { items } = await catalog(credentials, {
|
|
79
|
+
category: 'science-fiction', // resolved per locale, no ID needed
|
|
80
|
+
limit: 10,
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
// Or sort by release date, bestsellers, etc.
|
|
84
|
+
const { items: latest } = await catalog(credentials, {
|
|
85
|
+
category: 'science-fiction',
|
|
86
|
+
sortBy: 'ReleaseDate',
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
// ⚠️ MostVoted fetches ALL pages (up to 1000 items) then sorts client-side.
|
|
90
|
+
// Can take 10-60 seconds on large categories.
|
|
91
|
+
const { items: topVoted } = await catalog(credentials, {
|
|
92
|
+
category: 'science-fiction',
|
|
93
|
+
sortBy: 'MostVoted',
|
|
94
|
+
limit: 10,
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
items.map((book) => {
|
|
98
|
+
const r = book.rating?.overallDistribution
|
|
99
|
+
console.log(`${book.title} — ${r?.numRatings} ratings, ${r?.averageRating?.toFixed(1)}/5`)
|
|
100
|
+
})
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Output:**
|
|
54
104
|
```
|
|
105
|
+
L'apprenti assassin — 4453 ratings, 4.8/5
|
|
106
|
+
Dune — 2112 ratings, 4.6/5
|
|
107
|
+
Projet Dernière chance — 832 ratings, 4.7/5
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Available genres: `'science-fiction'`, `'fantasy'`, `'thriller'`, `'romance'`, `'horror'`, `'mystery'`, `'biography'`, `'history'`, `'business'`, `'comedy'`, and [more](https://moifort.github.io/audible-api-ts/reference/types/#audiblegenre). Sub-genres use slash notation: `'science-fiction/space-opera'`, `'fantasy/epic'`, `'thriller/psychological'`, `'romance/historical'`, etc.
|
|
55
111
|
|
|
56
112
|
## API
|
|
57
113
|
|
|
58
114
|
| Function | Description |
|
|
59
115
|
|----------|-------------|
|
|
60
|
-
| `
|
|
61
|
-
| `
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
116
|
+
| `login(locale)` | Generate PKCE login URL + session + cookies |
|
|
117
|
+
| `register(code, session)` | Exchange auth code for credentials |
|
|
118
|
+
| `refresh(credentials)` | Manually refresh an access token (usually not needed — auto-refresh is built-in) |
|
|
119
|
+
| `library(credentials)` | Fetch all library audiobooks |
|
|
120
|
+
| `wishlist(credentials)` | Fetch all wishlist audiobooks |
|
|
121
|
+
| `catalog(credentials, options)` | Search catalog by category with sorting |
|
|
122
|
+
| `verify(credentials)` | Check if credentials are valid |
|
|
66
123
|
|
|
67
124
|
See the **[full documentation](https://moifort.github.io/audible-api-ts)** for guides and API reference.
|
|
68
125
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AudibleCredentials, AudibleItem, CatalogOptions } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Search the Audible catalog by category with optional filters.
|
|
4
|
+
* Credentials are auto-refreshed if expired.
|
|
5
|
+
*
|
|
6
|
+
* - `sortBy: 'MostVoted'` (default) — fetches pages, sorts by votes desc then rating desc.
|
|
7
|
+
* - Any other `sortBy` — single-page fetch using the Audible API sort order.
|
|
8
|
+
*
|
|
9
|
+
* `limit` controls how many items to return (default 50, `'all'` for everything).
|
|
10
|
+
*
|
|
11
|
+
* @returns Catalog items sorted by the chosen criteria and the credentials
|
|
12
|
+
*/
|
|
13
|
+
export declare const catalog: (credentials: AudibleCredentials, options: CatalogOptions) => Promise<{
|
|
14
|
+
items: AudibleItem[];
|
|
15
|
+
credentials: AudibleCredentials;
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAgDjF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO,GAAU,aAAa,kBAAkB,EAAE,SAAS,cAAc;;;EAoDrF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.int.test.d.ts","sourceRoot":"","sources":["../src/catalog.int.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AudibleLocale } from './types.js';
|
|
2
|
+
/** Human-readable genre and sub-genre names for catalog search */
|
|
3
|
+
export type AudibleGenre = 'science-fiction' | 'fantasy' | 'science-fiction-fantasy' | 'mystery-thriller-suspense' | 'thriller' | 'mystery' | 'crime-fiction' | 'horror' | 'romance' | 'historical-fiction' | 'literary-fiction' | 'biography' | 'history' | 'business' | 'self-help' | 'science' | 'children' | 'young-adult' | 'comedy' | 'erotica' | 'religion' | 'sports' | 'travel' | 'lgbtq' | 'science-fiction/adventure' | 'science-fiction/adaptations' | 'science-fiction/cyberpunk' | 'science-fiction/dystopian' | 'science-fiction/first-contact' | 'science-fiction/galactic-empire' | 'science-fiction/genetic-engineering' | 'science-fiction/military' | 'science-fiction/post-apocalyptic' | 'science-fiction/space-exploration' | 'science-fiction/space-opera' | 'fantasy/action-adventure' | 'fantasy/adaptations' | 'fantasy/dragons' | 'fantasy/epic' | 'fantasy/historical' | 'fantasy/sword-sorcery' | 'fantasy/urban-paranormal' | 'thriller/suspense' | 'thriller/psychological' | 'thriller/domestic' | 'thriller/historical' | 'mystery/amateur-sleuth' | 'mystery/cozy' | 'mystery/detective' | 'mystery/hard-boiled' | 'mystery/historical' | 'mystery/noir' | 'mystery/police-procedural' | 'mystery/private-investigator' | 'mystery/traditional' | 'romance/action-adventure' | 'romance/comedy' | 'romance/contemporary' | 'romance/fantasy' | 'romance/historical' | 'romance/paranormal' | 'romance/science-fiction' | 'romance/sports' | 'romance/suspense' | 'literary-fiction/action-adventure' | 'literary-fiction/classics' | 'literary-fiction/coming-of-age' | 'literary-fiction/contemporary' | 'literary-fiction/drama' | 'literary-fiction/family-life' | 'literary-fiction/fiction' | 'literary-fiction/historical' | 'literary-fiction/sagas' | 'literary-fiction/sea-adventures' | 'literary-fiction/world-literature' | 'biography/entertainment' | 'history/europe' | 'children/action-adventure' | 'children/mystery' | 'children/science-fiction-fantasy' | 'children/fantasy' | 'children/science-fiction' | 'young-adult/literary-fiction' | 'young-adult/romance' | 'young-adult/science-fiction-fantasy' | 'young-adult/fantasy' | 'young-adult/science-fiction' | 'young-adult/thriller';
|
|
4
|
+
/**
|
|
5
|
+
* Mapping from genre name to locale-specific Audible category ID.
|
|
6
|
+
*
|
|
7
|
+
* Every id is checked against the live catalogue by `categories.int.test.ts`, which
|
|
8
|
+
* asserts the name Audible gives it. A category can sit under several parents, so
|
|
9
|
+
* the id is the same wherever the store shows it.
|
|
10
|
+
*/
|
|
11
|
+
export declare const GENRE_CATEGORIES: Record<AudibleGenre, Partial<Record<AudibleLocale, string>>>;
|
|
12
|
+
/**
|
|
13
|
+
* Resolve a genre name to a locale-specific Audible category ID.
|
|
14
|
+
*
|
|
15
|
+
* @throws If the genre is not mapped for the given locale
|
|
16
|
+
*/
|
|
17
|
+
export declare const resolveGenreId: (genre: AudibleGenre, locale: AudibleLocale) => string;
|
|
18
|
+
//# sourceMappingURL=categories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categories.d.ts","sourceRoot":"","sources":["../src/categories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,kEAAkE;AAClE,MAAM,MAAM,YAAY,GAEpB,iBAAiB,GACjB,SAAS,GACT,yBAAyB,GACzB,2BAA2B,GAC3B,UAAU,GACV,SAAS,GACT,eAAe,GACf,QAAQ,GACR,SAAS,GACT,oBAAoB,GACpB,kBAAkB,GAClB,WAAW,GACX,SAAS,GACT,UAAU,GACV,WAAW,GACX,SAAS,GACT,UAAU,GACV,aAAa,GACb,QAAQ,GACR,SAAS,GACT,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,OAAO,GAEP,2BAA2B,GAC3B,6BAA6B,GAC7B,2BAA2B,GAC3B,2BAA2B,GAC3B,+BAA+B,GAC/B,iCAAiC,GACjC,qCAAqC,GACrC,0BAA0B,GAC1B,kCAAkC,GAClC,mCAAmC,GACnC,6BAA6B,GAE7B,0BAA0B,GAC1B,qBAAqB,GACrB,iBAAiB,GACjB,cAAc,GACd,oBAAoB,GACpB,uBAAuB,GACvB,0BAA0B,GAE1B,mBAAmB,GACnB,wBAAwB,GACxB,mBAAmB,GACnB,qBAAqB,GAErB,wBAAwB,GACxB,cAAc,GACd,mBAAmB,GACnB,qBAAqB,GACrB,oBAAoB,GACpB,cAAc,GACd,2BAA2B,GAC3B,8BAA8B,GAC9B,qBAAqB,GAErB,0BAA0B,GAC1B,gBAAgB,GAChB,sBAAsB,GACtB,iBAAiB,GACjB,oBAAoB,GACpB,oBAAoB,GACpB,yBAAyB,GACzB,gBAAgB,GAChB,kBAAkB,GAElB,mCAAmC,GACnC,2BAA2B,GAC3B,gCAAgC,GAChC,+BAA+B,GAC/B,wBAAwB,GACxB,8BAA8B,GAC9B,0BAA0B,GAC1B,6BAA6B,GAC7B,wBAAwB,GACxB,iCAAiC,GACjC,mCAAmC,GAEnC,yBAAyB,GAEzB,gBAAgB,GAEhB,2BAA2B,GAC3B,kBAAkB,GAClB,kCAAkC,GAClC,kBAAkB,GAClB,0BAA0B,GAE1B,8BAA8B,GAC9B,qBAAqB,GACrB,qCAAqC,GACrC,qBAAqB,GACrB,6BAA6B,GAC7B,sBAAsB,CAAA;AAE1B;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CA8GzF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,YAAY,EAAE,QAAQ,aAAa,WAQxE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categories.int.test.d.ts","sourceRoot":"","sources":["../src/categories.int.test.ts"],"names":[],"mappings":""}
|
package/dist/client.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import type { AudibleCookie, AudibleCredentials, AudibleLocale, AuthSession } fr
|
|
|
2
2
|
/**
|
|
3
3
|
* Generate a login URL for the Audible PKCE OAuth flow.
|
|
4
4
|
*
|
|
5
|
-
* Returns the URL to redirect the user to, the session to pass back to `
|
|
5
|
+
* Returns the URL to redirect the user to, the session to pass back to `register`,
|
|
6
6
|
* and the cookies to set in the browser before redirecting.
|
|
7
7
|
*/
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const login: (locale: AudibleLocale) => Promise<{
|
|
9
9
|
readonly loginUrl: string;
|
|
10
10
|
readonly session: AuthSession;
|
|
11
11
|
readonly cookies: AudibleCookie[];
|
|
@@ -14,10 +14,10 @@ export declare const generateLoginUrl: (locale: AudibleLocale) => Promise<{
|
|
|
14
14
|
* Complete device registration using the authorization code from the OAuth callback.
|
|
15
15
|
*
|
|
16
16
|
* @param authorizationCode - The code received from the OAuth callback URL
|
|
17
|
-
* @param session - The auth session returned by `
|
|
17
|
+
* @param session - The auth session returned by `login`
|
|
18
18
|
* @returns The credentials to use for all subsequent API calls
|
|
19
19
|
*/
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const register: (authorizationCode: string, session: AuthSession) => Promise<{
|
|
21
21
|
accessToken: string;
|
|
22
22
|
refreshToken: string;
|
|
23
23
|
adpToken: string;
|
|
@@ -31,7 +31,7 @@ export declare const registerDevice: (authorizationCode: string, session: AuthSe
|
|
|
31
31
|
*
|
|
32
32
|
* @returns Updated credentials with the new access token and expiration
|
|
33
33
|
*/
|
|
34
|
-
export declare const
|
|
34
|
+
export declare const refresh: (credentials: AudibleCredentials) => Promise<{
|
|
35
35
|
accessToken: string;
|
|
36
36
|
expiresAt: Date;
|
|
37
37
|
refreshToken: string;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAO/F;;;;;GAKG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAO/F;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAAU,QAAQ,aAAa;;;;EAkEhD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAU,mBAAmB,MAAM,EAAE,SAAS,WAAW;;;;;;;;EA8D7E,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAU,aAAa,kBAAkB;;;;;;;;EA0B5D,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.int.test.d.ts","sourceRoot":"","sources":["../src/client.int.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.unit.test.d.ts","sourceRoot":"","sources":["../src/client.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AudibleCredentials } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Load Audible credentials from the AUDIBLE_CREDENTIALS env var (JSON string)
|
|
4
|
+
* or from a `.credentials.json` file at the project root.
|
|
5
|
+
*
|
|
6
|
+
* @throws If neither source is available or the JSON is invalid
|
|
7
|
+
*/
|
|
8
|
+
export declare const loadCredentials: () => AudibleCredentials;
|
|
9
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,eAAe,QAcrB,kBACN,CAAA"}
|
package/dist/fetch.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { audibleRawItemSchema } from './schemas.js';
|
|
3
|
+
import type { AudibleCredentials, AudibleItem } from './types.js';
|
|
4
|
+
export declare const audibleFetch: <T>(path: string, credentials: AudibleCredentials, query?: Record<string, string>) => Promise<{
|
|
5
|
+
data: T;
|
|
6
|
+
credentials: AudibleCredentials | {
|
|
7
|
+
accessToken: string;
|
|
8
|
+
expiresAt: Date;
|
|
9
|
+
refreshToken: string;
|
|
10
|
+
adpToken: string;
|
|
11
|
+
devicePrivateKey: string;
|
|
12
|
+
serial: string;
|
|
13
|
+
locale: import("./types.js").AudibleLocale;
|
|
14
|
+
};
|
|
15
|
+
}>;
|
|
16
|
+
export declare const toAudibleItem: (item: z.infer<typeof audibleRawItemSchema>) => AudibleItem;
|
|
17
|
+
export declare const parseItems: (items: unknown[]) => AudibleItem[];
|
|
18
|
+
export declare const fetchAllPages: (path: string, credentials: AudibleCredentials, responseGroups: string, accumulated?: AudibleItem[], page?: number) => Promise<{
|
|
19
|
+
items: AudibleItem[];
|
|
20
|
+
credentials: AudibleCredentials;
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAG5B,OAAO,EAA4B,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAE7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAqC,MAAM,YAAY,CAAA;AAUpG,eAAO,MAAM,YAAY,GAAU,CAAC,EAClC,MAAM,MAAM,EACZ,aAAa,kBAAkB,EAC/B,QAAQ,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;UAsBY,CAAC;;;;;;;;;;EAC5C,CAAA;AA2CD,eAAO,MAAM,aAAa,GAAI,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,KAAG,WAwDzE,CAAA;AAEF,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,EAAE,KAAG,WAAW,EACW,CAAA;AAEpE,eAAO,MAAM,aAAa,GACxB,MAAM,MAAM,EACZ,aAAa,kBAAkB,EAC/B,gBAAgB,MAAM,EACtB,cAAa,WAAW,EAAO,EAC/B,aAAQ,KACP,OAAO,CAAC;IAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IAAC,WAAW,EAAE,kBAAkB,CAAA;CAAE,CAiBnE,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { catalog } from './catalog.js';
|
|
2
|
+
export type { AudibleGenre } from './categories.js';
|
|
3
|
+
export { GENRE_CATEGORIES, resolveGenreId } from './categories.js';
|
|
4
|
+
export { login, refresh, register } from './client.js';
|
|
5
|
+
export { library, verify, wishlist } from './library.js';
|
|
3
6
|
export { AUDIBLE_LOCALES } from './locales.js';
|
|
4
|
-
export type { AudibleCookie, AudibleCredentials, AudibleItem, AudibleLocale, AuthSession, LocaleConfig, } from './types.js';
|
|
7
|
+
export type { AudibleCategory, AudibleCookie, AudibleCredentials, AudibleItem, AudibleLocale, AudibleRating, AudibleRelationship, AuthSession, CatalogOptions, CategoryLadder, ListeningStatus, LocaleConfig, RatingDistribution, } from './types.js';
|
|
5
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,YAAY,EACV,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,EACZ,kBAAkB,GACnB,MAAM,YAAY,CAAA"}
|