podcast-index-api
Advanced tools
Comparing version 1.1.9 to 1.1.10
28
index.js
@@ -12,2 +12,3 @@ const got = require('got') | ||
const PATH_SEARCH_BY_TERM = 'search/byterm' | ||
const PATH_SEARCH_BY_TITLE = 'search/bytitle' | ||
const PATH_SEARCH_EPISODE_BY_PERSON = 'search/byperson' | ||
@@ -24,2 +25,3 @@ const PATH_ADD_BY_FEED_URL = 'add/byfeedurl' | ||
const PATH_PODCASTS_BY_ITUNES_ID = 'podcasts/byitunesid' | ||
const PATH_PODCASTS_BY_GUID = 'podcasts/byguid' | ||
const PATH_PODCASTS_BY_TAG = 'podcasts/bytag' | ||
@@ -34,3 +36,2 @@ const PATH_PODCASTS_TRENDING = 'podcasts/trending' | ||
const PATH_VALUE_BY_FEED_URL = 'value/byfeedurl' | ||
const PATH_STATS_CURRENT = 'stats/current' | ||
const PATH_CATEGORIES_LIST = 'categories/list' | ||
@@ -109,2 +110,11 @@ const PATH_HUB_PUBNOTIFIY = 'hub/pubnotify' | ||
}, | ||
searchByTitle: async (q, val = '', clean = false, fullText = false) => { | ||
let queries = { | ||
q: q, | ||
} | ||
if (val !== '') queries['val'] = val | ||
if (clean) queries['clean'] = '' | ||
if (fullText) queries['fullText'] = '' | ||
return custom(PATH_SEARCH_BY_TITLE, queries) | ||
}, | ||
searchEpisodesByPerson: async (q, fullText = false) => { | ||
@@ -127,2 +137,5 @@ let queries = { | ||
}, | ||
podcastsByGUID: async (guid) => { | ||
return custom(PATH_PODCASTS_BY_GUID, { guid: guid }) | ||
}, | ||
podcastsByTag: async () => { | ||
@@ -279,6 +292,2 @@ return custom(PATH_PODCASTS_BY_TAG, { 'podcast-value': '' }) | ||
statsCurrent: async () => { | ||
return custom(PATH_STATS_CURRENT) | ||
}, | ||
categoriesList: async () => { | ||
@@ -288,10 +297,15 @@ return custom(PATH_CATEGORIES_LIST) | ||
hubPubNotify: async (feedId, update = true) => { | ||
hubPubNotifyById: async (feedId) => { | ||
let queries = { | ||
id: feedId, | ||
} | ||
if (update) queries['update'] = '' | ||
return custom(PATH_HUB_PUBNOTIFIY, queries) | ||
}, | ||
hubPubNotifyByUrl: async (feedUrl) => { | ||
let queries = { | ||
url: feedUrl, | ||
} | ||
return custom(PATH_HUB_PUBNOTIFIY, queries) | ||
}, | ||
} | ||
} |
{ | ||
"name": "podcast-index-api", | ||
"version": "1.1.9", | ||
"version": "1.1.10", | ||
"description": "JS lib for the Podcast Index API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -47,2 +47,3 @@ # Podcast Index API Javascript library | ||
- `searchByTerm(q: String, val: String, clean: Boolean, fullText: Boolean)` | ||
- `searchByTitle(q: String, val: String, clean: Boolean, fullText: Boolean)` | ||
- `searchEpisodesByPerson(q: String, fullText: Boolean)` | ||
@@ -53,2 +54,3 @@ - Podcasts | ||
- `podcastsByFeedItunesId(itunesId: Number)` | ||
- `podcastsByGUID(guid: Number)` | ||
- `podcastsByTag()` | ||
@@ -71,10 +73,9 @@ - `podcastsTrending(max: Number, since: Number, lang: String, cat: String, notcat: String)` | ||
- `valueByFeedId(feedId: Number)` | ||
- Stats | ||
- `statsCurrent()` | ||
- Categories | ||
- `categoriesList()` | ||
- Notify Hub | ||
- `hubPubNotify(feedId: Number, update: Boolean)` | ||
- `hubPubNotifyById(feedId: Number)` | ||
- `hubPubNotifyByUrl(feedUrl: string)` | ||
- Add | ||
- `addByFeedUrl(feedUrl: String, chash: String, itunesId: Number)` | ||
- `addByItunesId(itunesId: Number)` |
@@ -10,3 +10,3 @@ jest.setTimeout(10000) | ||
const SEARCH_TERM = 'Joe Rogan Experience' | ||
const SEARCH_TERM = 'The Joe Rogan Experience' | ||
const SEARCH_PERSON = 'Joe Rogan' | ||
@@ -24,2 +24,3 @@ const FEED_ID = 550168 | ||
const RECENT_EPISODES_EXCLUDE = 'news' | ||
const FEED_GUID = '9d783600-a77f-5c77-9042-0d9f3280465e' | ||
@@ -78,2 +79,13 @@ it('Requires API credentials', () => { | ||
it('Search by title', async () => { | ||
expect.assertions(6) | ||
const results = await api.searchByTitle(FEED_TITLE) | ||
expect(results.status).toEqual('true') | ||
expect(results.feeds.length).toBeGreaterThan(0) | ||
expect(results).toHaveProperty('query', FEED_TITLE) | ||
expect(results).toHaveProperty('feeds') | ||
expect(results.feeds[0].id).toEqual(FEED_ID) | ||
expect(results.feeds[0].title).toEqual(FEED_TITLE) | ||
}) | ||
it('Search episodes by person', async () => { | ||
@@ -174,2 +186,10 @@ expect.assertions(4) | ||
it('Podcasts By GUID', async () => { | ||
expect.assertions(3) | ||
const results = await api.podcastsByGUID(FEED_GUID) | ||
expect(results).toHaveProperty('query.id', FEED_ID) | ||
expect(results.feed.id).toEqual(FEED_ID) | ||
expect(results.feed.itunesId).toEqual(FEED_ITUNES_ID) | ||
}) | ||
it('Podcasts By tag', async () => { | ||
@@ -274,9 +294,2 @@ expect.assertions(3) | ||
it('Stats Current', async () => { | ||
expect.assertions(2) | ||
const results = await api.statsCurrent() | ||
expect(results).toHaveProperty('status', 'true') | ||
expect(results.stats).toHaveProperty('feedCountTotal') | ||
}) | ||
it('Categories list', async () => { | ||
@@ -283,0 +296,0 @@ expect.assertions(5) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33283
701
79