pocketcasts-api 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Madison Rickert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,158 @@
1
+ # pocketcasts-api
2
+
3
+ [![npm version](https://img.shields.io/npm/v/pocketcasts-api.svg)](https://www.npmjs.com/package/pocketcasts-api)
4
+ [![CI](https://github.com/madisonrickert/pocketcasts-api/actions/workflows/ci.yml/badge.svg)](https://github.com/madisonrickert/pocketcasts-api/actions/workflows/ci.yml)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
6
+
7
+ Unofficial TypeScript client for the Pocket Casts API.
8
+
9
+ > **Note:** This is an unofficial client. Not affiliated with Pocket Casts or Automattic.
10
+
11
+ ## Requirements
12
+
13
+ - Node.js 18 or later
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install pocketcasts-api
19
+ ```
20
+
21
+ ## Quick Start
22
+
23
+ ```typescript
24
+ import { PocketCasts } from 'pocketcasts-api';
25
+
26
+ const client = new PocketCasts();
27
+
28
+ // Authenticate
29
+ await client.login('you@example.com', 'yourpassword');
30
+
31
+ // Read your subscriptions
32
+ const { podcasts } = await client.getSubscriptions();
33
+ console.log(podcasts.map((p) => p.title));
34
+
35
+ // Star an episode
36
+ const { episodes } = await client.getInProgress();
37
+ const episode = episodes[0];
38
+ await client.starEpisode(episode.podcastUuid, episode.uuid);
39
+ ```
40
+
41
+ ## API Reference
42
+
43
+ ### Authentication
44
+
45
+ | Method | Description |
46
+ | ------------------------ | ------------------------------------------------------------------------------------------- |
47
+ | `login(email, password)` | Authenticate and store the session token. Must be called before any authenticated endpoint. |
48
+
49
+ ### Read Operations (require login)
50
+
51
+ | Method | Returns | Description |
52
+ | ----------------------- | ------------------------------ | ------------------------------------------------------------------- |
53
+ | `getSubscriptions()` | `{ podcasts: Podcast[] }` | List all subscribed podcasts. |
54
+ | `getNewReleases()` | `{ episodes: Episode[] }` | Episodes from subscribed podcasts released recently. |
55
+ | `getInProgress()` | `{ episodes: Episode[] }` | Episodes currently in progress (partially played). |
56
+ | `getStarred()` | `{ episodes: Episode[] }` | All starred episodes. |
57
+ | `getHistory()` | `{ episodes: Episode[] }` | Listening history. |
58
+ | `getStats()` | `ListeningStats` | Aggregate listening statistics (total time, silence removal, etc.). |
59
+ | `getPodcast(uuid)` | `Podcast` | Details for a single podcast by UUID. |
60
+ | `getEpisode(uuid)` | `Episode` | Details for a single episode by UUID. |
61
+ | `getEpisodeNotes(uuid)` | `string` | HTML show notes for an episode. |
62
+ | `search(term)` | `{ podcasts: SearchResult[] }` | Search the Pocket Casts directory. |
63
+
64
+ ### Write Operations (require login)
65
+
66
+ | Method | Description |
67
+ | ---------------------------------------------------------------------- | ------------------------------------------------------------- |
68
+ | `subscribe(podcastUuid)` | Subscribe to a podcast. |
69
+ | `unsubscribe(podcastUuid)` | Unsubscribe from a podcast. |
70
+ | `starEpisode(podcastUuid, episodeUuid)` | Star an episode. |
71
+ | `unstarEpisode(podcastUuid, episodeUuid)` | Remove a star from an episode. |
72
+ | `updatePlayingStatus(podcastUuid, episodeUuid, status)` | Set playing status: `'unplayed'`, `'playing'`, or `'played'`. |
73
+ | `updatePlaybackPosition(podcastUuid, episodeUuid, position, duration)` | Update the playback position (seconds) for an episode. |
74
+
75
+ ### Discovery Operations (no login required)
76
+
77
+ | Method | Returns | Description |
78
+ | --------------- | ------------------------------ | ------------------------------ |
79
+ | `getTrending()` | `{ podcasts: SearchResult[] }` | Currently trending podcasts. |
80
+ | `getPopular()` | `{ podcasts: SearchResult[] }` | Most popular podcasts. |
81
+ | `getFeatured()` | `{ podcasts: SearchResult[] }` | Editorially featured podcasts. |
82
+
83
+ ## Error Handling
84
+
85
+ ```typescript
86
+ import {
87
+ PocketCasts,
88
+ PocketCastsAuthError,
89
+ PocketCastsAPIError,
90
+ } from 'pocketcasts-api';
91
+
92
+ const client = new PocketCasts();
93
+
94
+ try {
95
+ await client.login('you@example.com', 'wrongpassword');
96
+ } catch (e) {
97
+ if (e instanceof PocketCastsAuthError) {
98
+ console.error('Authentication failed:', e.message);
99
+ }
100
+ }
101
+
102
+ try {
103
+ await client.getPodcast('invalid-uuid');
104
+ } catch (e) {
105
+ if (e instanceof PocketCastsAPIError) {
106
+ console.error(`API error ${e.statusCode}:`, e.message);
107
+ }
108
+ }
109
+ ```
110
+
111
+ ### Error Classes
112
+
113
+ | Class | Extends | Description |
114
+ | ---------------------- | ------------------ | ------------------------------------------------------------------------------------ |
115
+ | `PocketCastsError` | `Error` | Base class for all errors from this library. |
116
+ | `PocketCastsAuthError` | `PocketCastsError` | Thrown when authentication fails or a request is made before calling `login()`. |
117
+ | `PocketCastsAPIError` | `PocketCastsError` | Thrown when the API returns a non-2xx response. Has a `statusCode: number` property. |
118
+
119
+ ## Limitations
120
+
121
+ - **No automatic retries or backoff.** Each method makes a single `fetch` call. If you need resilience against transient failures or rate limiting, supply your own `fetch` via the constructor option and handle retries there:
122
+
123
+ ```typescript
124
+ import { PocketCasts } from 'pocketcasts-api';
125
+
126
+ const retryingFetch: typeof fetch = async (input, init) => {
127
+ // your retry/backoff logic wrapping globalThis.fetch
128
+ };
129
+
130
+ const client = new PocketCasts({ fetch: retryingFetch });
131
+ ```
132
+
133
+ - **Unofficial and unstable.** Endpoints are reverse-engineered from the Pocket Casts web player and may change without notice.
134
+
135
+ ## Contributing
136
+
137
+ Issues and pull requests are welcome. To work on the library:
138
+
139
+ ```bash
140
+ npm install
141
+ npm test # unit tests (mocked, no network)
142
+ npm run lint # eslint + type check
143
+ npm run format # prettier
144
+ ```
145
+
146
+ Integration tests hit the real API and are skipped unless you opt in with credentials:
147
+
148
+ ```bash
149
+ POCKETCASTS_EMAIL=you@example.com POCKETCASTS_PASSWORD=secret npm run test:integration
150
+ ```
151
+
152
+ ## Security
153
+
154
+ See [SECURITY.md](./SECURITY.md) for how to report a vulnerability.
155
+
156
+ ## License
157
+
158
+ MIT
@@ -0,0 +1,52 @@
1
+ import { type Podcast, type Episode, type SearchResult, type ListeningStats, type PlayingStatus } from './types.js';
2
+ type FetchFn = typeof globalThis.fetch;
3
+ export interface PocketCastsOptions {
4
+ fetch?: FetchFn;
5
+ }
6
+ export declare class PocketCasts {
7
+ private token;
8
+ private fetch;
9
+ constructor(options?: PocketCastsOptions);
10
+ login(email: string, password: string): Promise<void>;
11
+ private postAuth;
12
+ private getPublic;
13
+ getSubscriptions(): Promise<{
14
+ podcasts: Podcast[];
15
+ }>;
16
+ getNewReleases(): Promise<{
17
+ episodes: Episode[];
18
+ }>;
19
+ getInProgress(): Promise<{
20
+ episodes: Episode[];
21
+ }>;
22
+ getStarred(): Promise<{
23
+ episodes: Episode[];
24
+ }>;
25
+ getHistory(): Promise<{
26
+ episodes: Episode[];
27
+ }>;
28
+ getStats(): Promise<ListeningStats>;
29
+ getPodcast(uuid: string): Promise<Podcast>;
30
+ getEpisode(uuid: string): Promise<Episode>;
31
+ getEpisodeNotes(uuid: string): Promise<string>;
32
+ search(term: string): Promise<{
33
+ podcasts: SearchResult[];
34
+ }>;
35
+ getTrending(): Promise<{
36
+ podcasts: SearchResult[];
37
+ }>;
38
+ getPopular(): Promise<{
39
+ podcasts: SearchResult[];
40
+ }>;
41
+ getFeatured(): Promise<{
42
+ podcasts: SearchResult[];
43
+ }>;
44
+ subscribe(podcastUuid: string): Promise<void>;
45
+ unsubscribe(podcastUuid: string): Promise<void>;
46
+ starEpisode(podcastUuid: string, episodeUuid: string): Promise<void>;
47
+ unstarEpisode(podcastUuid: string, episodeUuid: string): Promise<void>;
48
+ updatePlayingStatus(podcastUuid: string, episodeUuid: string, status: PlayingStatus): Promise<void>;
49
+ updatePlaybackPosition(podcastUuid: string, episodeUuid: string, position: number, duration: number): Promise<void>;
50
+ }
51
+ export {};
52
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAMpB,KAAK,OAAO,GAAG,OAAO,UAAU,CAAC,KAAK,CAAC;AAEvC,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,KAAK,CAAU;gBAEX,OAAO,GAAE,kBAAuB;IAItC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAgB7C,QAAQ;YAyBR,SAAS;IAcjB,gBAAgB,IAAI,OAAO,CA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AM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAStE,mBAAmB,CACvB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,IAAI,CAAC;IAcV,sBAAsB,CAC1B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;CAQjB"}
package/dist/client.js ADDED
@@ -0,0 +1,151 @@
1
+ import { PocketCastsAuthError, PocketCastsAPIError } from './errors.js';
2
+ import { LoginResponseSchema, PodcastSchema, EpisodeSchema, SearchResultSchema, ListeningStatsSchema, } from './types.js';
3
+ import { z } from 'zod';
4
+ const API_BASE = 'https://api.pocketcasts.com';
5
+ const LISTS_BASE = 'https://lists.pocketcasts.com';
6
+ export class PocketCasts {
7
+ token = null;
8
+ fetch;
9
+ constructor(options = {}) {
10
+ this.fetch = options.fetch ?? globalThis.fetch;
11
+ }
12
+ async login(email, password) {
13
+ const res = await this.fetch(`${API_BASE}/user/login`, {
14
+ method: 'POST',
15
+ headers: { 'Content-Type': 'application/json' },
16
+ body: JSON.stringify({ email, password, scope: 'webplayer' }),
17
+ });
18
+ if (!res.ok) {
19
+ const text = await res.text();
20
+ throw new PocketCastsAuthError(`Login failed (${res.status}): ${text}`);
21
+ }
22
+ const data = LoginResponseSchema.parse(await res.json());
23
+ this.token = data.token;
24
+ }
25
+ async postAuth(path, body = {}) {
26
+ if (!this.token) {
27
+ throw new PocketCastsAuthError('Not logged in. Call login() first.');
28
+ }
29
+ const res = await this.fetch(`${API_BASE}${path}`, {
30
+ method: 'POST',
31
+ headers: {
32
+ 'Content-Type': 'application/json',
33
+ Authorization: `Bearer ${this.token}`,
34
+ },
35
+ body: JSON.stringify(body),
36
+ });
37
+ if (!res.ok) {
38
+ const text = await res.text();
39
+ throw new PocketCastsAPIError(`API error (${res.status}): ${text}`, res.status);
40
+ }
41
+ return (await res.json());
42
+ }
43
+ async getPublic(path) {
44
+ const res = await this.fetch(`${LISTS_BASE}${path}`);
45
+ if (!res.ok) {
46
+ const text = await res.text();
47
+ throw new PocketCastsAPIError(`API error (${res.status}): ${text}`, res.status);
48
+ }
49
+ return (await res.json());
50
+ }
51
+ async getSubscriptions() {
52
+ const data = await this.postAuth('/user/podcast/list');
53
+ return { podcasts: z.array(PodcastSchema).parse(data.podcasts) };
54
+ }
55
+ async getNewReleases() {
56
+ const data = await this.postAuth('/user/new_releases');
57
+ return { episodes: z.array(EpisodeSchema).parse(data.episodes) };
58
+ }
59
+ async getInProgress() {
60
+ const data = await this.postAuth('/user/in_progress');
61
+ return { episodes: z.array(EpisodeSchema).parse(data.episodes) };
62
+ }
63
+ async getStarred() {
64
+ const data = await this.postAuth('/user/starred');
65
+ return { episodes: z.array(EpisodeSchema).parse(data.episodes) };
66
+ }
67
+ async getHistory() {
68
+ const data = await this.postAuth('/user/history');
69
+ return { episodes: z.array(EpisodeSchema).parse(data.episodes) };
70
+ }
71
+ async getStats() {
72
+ const data = await this.postAuth('/user/stats/summary');
73
+ return ListeningStatsSchema.parse(data);
74
+ }
75
+ async getPodcast(uuid) {
76
+ const data = await this.postAuth('/podcasts/podcast', { uuid });
77
+ return PodcastSchema.parse(data);
78
+ }
79
+ async getEpisode(uuid) {
80
+ const data = await this.postAuth('/episodes/episode', { uuid });
81
+ return EpisodeSchema.parse(data);
82
+ }
83
+ async getEpisodeNotes(uuid) {
84
+ const data = await this.postAuth('/episodes/show_notes', { uuid });
85
+ return data.show_notes;
86
+ }
87
+ async search(term) {
88
+ const data = await this.postAuth('/discover/search', { term });
89
+ return { podcasts: z.array(SearchResultSchema).parse(data.podcasts) };
90
+ }
91
+ async getTrending() {
92
+ const data = await this.getPublic('/trending.json');
93
+ return { podcasts: z.array(SearchResultSchema).parse(data.podcasts) };
94
+ }
95
+ async getPopular() {
96
+ const data = await this.getPublic('/popular.json');
97
+ return { podcasts: z.array(SearchResultSchema).parse(data.podcasts) };
98
+ }
99
+ async getFeatured() {
100
+ const data = await this.getPublic('/featured.json');
101
+ return { podcasts: z.array(SearchResultSchema).parse(data.podcasts) };
102
+ }
103
+ async subscribe(podcastUuid) {
104
+ await this.postAuth('/user/podcast/subscribe', { uuid: podcastUuid });
105
+ }
106
+ async unsubscribe(podcastUuid) {
107
+ await this.postAuth('/user/podcast/unsubscribe', { uuid: podcastUuid });
108
+ }
109
+ // Episode mutations use /sync/update_episode.
110
+ // The endpoint expects: uuid, podcast, and either status (1-4) or position/duration.
111
+ // Status values: 1=unplayed, 2=playing, 3=played, 4=? (validation says 1..4)
112
+ async starEpisode(podcastUuid, episodeUuid) {
113
+ // /sync/update_episode requires status or position alongside star
114
+ await this.postAuth('/sync/update_episode', {
115
+ uuid: episodeUuid,
116
+ podcast: podcastUuid,
117
+ star: 1,
118
+ status: 1, // required by validation, 1=unplayed (preserves current state)
119
+ });
120
+ }
121
+ async unstarEpisode(podcastUuid, episodeUuid) {
122
+ await this.postAuth('/sync/update_episode', {
123
+ uuid: episodeUuid,
124
+ podcast: podcastUuid,
125
+ star: 0,
126
+ status: 1,
127
+ });
128
+ }
129
+ async updatePlayingStatus(podcastUuid, episodeUuid, status) {
130
+ // The sync endpoint uses 1-based status: 1=unplayed, 2=playing, 3=played
131
+ const SYNC_STATUS_MAP = {
132
+ unplayed: 1,
133
+ playing: 2,
134
+ played: 3,
135
+ };
136
+ await this.postAuth('/sync/update_episode', {
137
+ uuid: episodeUuid,
138
+ podcast: podcastUuid,
139
+ status: SYNC_STATUS_MAP[status],
140
+ });
141
+ }
142
+ async updatePlaybackPosition(podcastUuid, episodeUuid, position, duration) {
143
+ await this.postAuth('/sync/update_episode', {
144
+ uuid: episodeUuid,
145
+ podcast: podcastUuid,
146
+ position,
147
+ duration,
148
+ });
149
+ }
150
+ }
151
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","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ACnB,WAAmB,EACnB,MAAqB;QAErB,yEAAyE;QACzE,MAAM,eAAe,GAAkC;YACrD,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,CAAC;YACV,MAAM,EAAE,CAAC;SACV,CAAC;QACF,MAAM,IAAI,CAAC,QAAQ,CAAC,sBAAsB,EAAE;YAC1C,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,WAAW;YACpB,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;SAChC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,sBAAsB,CAC1B,WAAmB,EACnB,WAAmB,EACnB,QAAgB,EAChB,QAAgB;QAEhB,MAAM,IAAI,CAAC,QAAQ,CAAC,sBAAsB,EAAE;YAC1C,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,WAAW;YACpB,QAAQ;YACR,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ export declare class PocketCastsError extends Error {
2
+ constructor(message: string);
3
+ }
4
+ export declare class PocketCastsAuthError extends PocketCastsError {
5
+ constructor(message: string);
6
+ }
7
+ export declare class PocketCastsAPIError extends PocketCastsError {
8
+ statusCode: number;
9
+ constructor(message: string, statusCode: number);
10
+ }
11
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,oBAAqB,SAAQ,gBAAgB;gBAC5C,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,mBAAoB,SAAQ,gBAAgB;IACvD,UAAU,EAAE,MAAM,CAAC;gBAEP,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAKhD"}
package/dist/errors.js ADDED
@@ -0,0 +1,21 @@
1
+ export class PocketCastsError extends Error {
2
+ constructor(message) {
3
+ super(message);
4
+ this.name = 'PocketCastsError';
5
+ }
6
+ }
7
+ export class PocketCastsAuthError extends PocketCastsError {
8
+ constructor(message) {
9
+ super(message);
10
+ this.name = 'PocketCastsAuthError';
11
+ }
12
+ }
13
+ export class PocketCastsAPIError extends PocketCastsError {
14
+ statusCode;
15
+ constructor(message, statusCode) {
16
+ super(message);
17
+ this.name = 'PocketCastsAPIError';
18
+ this.statusCode = statusCode;
19
+ }
20
+ }
21
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,gBAAgB;IACxD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,gBAAgB;IACvD,UAAU,CAAS;IAEnB,YAAY,OAAe,EAAE,UAAkB;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ export { PocketCasts, type PocketCastsOptions } from './client.js';
2
+ export { PocketCastsError, PocketCastsAuthError, PocketCastsAPIError, } from './errors.js';
3
+ export type { Podcast, Episode, SearchResult, ListeningStats, PlayingStatus, } from './types.js';
4
+ export { PLAYING_STATUS_TO_API } from './types.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,OAAO,EACP,OAAO,EACP,YAAY,EACZ,cAAc,EACd,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { PocketCasts } from './client.js';
2
+ export { PocketCastsError, PocketCastsAuthError, PocketCastsAPIError, } from './errors.js';
3
+ export { PLAYING_STATUS_TO_API } from './types.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA2B,MAAM,aAAa,CAAC;AACnE,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAQrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC"}