Skip to content

Commit 914a8aa

Browse files
committed
Add new endpoint fetchPodcastsByDomain
1 parent d233ba4 commit 914a8aa

File tree

8 files changed

+11211
-8101
lines changed

8 files changed

+11211
-8101
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,4 @@ dist
104104
.tern-port
105105

106106
.idea/
107+
.yarn/

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Listen Notes
3+
Copyright (c) 2023 Listen Notes
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 3721 additions & 2899 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "podcast-api",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "JavaScript bindings for the Listen Notes Podcast API",
55
"main": "src/PodcastApiClient.js",
66
"scripts": {

src/PodcastApiMethods.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ const addApiMethodsToClient = (client) => {
6969
return client.httpClient._get(`/podcasts/${id}/audience`, otherParams);
7070
};
7171

72+
client.fetchPodcastsByDomain = (params) => {
73+
const { domain_name, ...otherParams } = params;
74+
return client.httpClient._get(`/podcasts/domains/${domain_name}`, otherParams);
75+
};
76+
7277
return client;
7378
};
7479

tests/TestsLib.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ const runTests = (Client) => {
337337

338338
test('Test fetchAudienceForPodcast with mock', () => {
339339
const client = Client();
340-
const podcastId = 'abcde';
340+
const podcastId = 'abcdef';
341341
return client.fetchAudienceForPodcast({
342342
id: podcastId,
343343
}).then((response) => {
@@ -348,6 +348,20 @@ const runTests = (Client) => {
348348
fail('Failed!');
349349
});
350350
});
351+
352+
test('Test fetchPodcastsByDomain with mock', () => {
353+
const client = Client();
354+
const domain = 'nytimes.com';
355+
return client.fetchPodcastsByDomain({
356+
domain_name: domain,
357+
}).then((response) => {
358+
expect(response.config.url).toBe(`/podcasts/domains/${domain}`);
359+
expect(response.config.method).toBe('get');
360+
expect(response.data.podcasts.length > 0).toBe(true);
361+
}).catch(() => {
362+
fail('Failed!');
363+
});
364+
});
351365
};
352366

353367
module.exports = {

yarn.lock

Lines changed: 7466 additions & 5199 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)