-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from calluswhatyouwant/v0.6.x
Upgrade to v0.6.0
- Loading branch information
Showing
18 changed files
with
339 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { getAxiosSpotifyInstance } from './driver'; | ||
import { Episode } from './models'; | ||
|
||
export const getSeveralEpisodes = async ( | ||
ids: string[], | ||
params?: { market?: string } | ||
) => { | ||
const response = await getAxiosSpotifyInstance().get('/episodes', { | ||
params: { ids: ids.join(','), ...params }, | ||
}); | ||
return response.data.episodes.map( | ||
(episodeJson: any) => new Episode(episodeJson) | ||
); | ||
}; | ||
|
||
export const getEpisode = async (id: string, params?: { market?: string }) => { | ||
const response = await getAxiosSpotifyInstance().get(`/episodes/${id}`, { | ||
params, | ||
}); | ||
return new Episode(response.data); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import Image from '../common/image'; | ||
|
||
class EpisodeSimplified { | ||
audioPreviewUrl: string; | ||
|
||
description: string; | ||
|
||
durationMs: number; | ||
|
||
explicit: boolean; | ||
|
||
externalUrls: any; | ||
|
||
href: string; | ||
|
||
id: string; | ||
|
||
images: Image[]; | ||
|
||
isExternallyHosted: boolean | null; | ||
|
||
isPlayable: boolean; | ||
|
||
languages: string[]; | ||
|
||
name: string; | ||
|
||
releaseDate: string; | ||
|
||
releaseDatePrecision: 'year' | 'month' | 'day'; | ||
|
||
resumePoint?: ResumePoint; | ||
|
||
type: 'episode'; | ||
|
||
uri: string; | ||
|
||
constructor(json: any) { | ||
this.audioPreviewUrl = json.audio_preview_url; | ||
this.description = json.description; | ||
this.durationMs = json.duration_ms; | ||
this.explicit = json.explicit; | ||
this.externalUrls = json.external_urls; | ||
this.href = json.href; | ||
this.id = json.id; | ||
this.images = json.images.map((imageJson: any) => new Image(imageJson)); | ||
this.isExternallyHosted = json.is_externally_hosted; | ||
this.isPlayable = json.is_playable; | ||
this.languages = json.languages; | ||
this.name = json.name; | ||
this.releaseDate = json.release_date; | ||
this.releaseDatePrecision = json.release_date_precision; | ||
if (json.resume_point) { | ||
this.resumePoint = new ResumePoint(json.resume_point); | ||
} | ||
this.type = json.type; | ||
this.uri = json.uri; | ||
} | ||
} | ||
|
||
class ResumePoint { | ||
fullyPlayed: boolean; | ||
resumePositionMs: number; | ||
|
||
constructor(json: any) { | ||
this.fullyPlayed = json.fully_played; | ||
this.resumePositionMs = json.resume_position_ms; | ||
} | ||
} | ||
|
||
export default EpisodeSimplified; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import EpisodeSimplified from './episode-simplified'; | ||
import ShowSimplified from '../show/show-simplified'; | ||
|
||
class Episode extends EpisodeSimplified { | ||
show: ShowSimplified; | ||
|
||
constructor(json: any) { | ||
super(json); | ||
this.show = new ShowSimplified(json.show); | ||
} | ||
} | ||
|
||
export default Episode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import ShowSimplified from '../show/show-simplified'; | ||
|
||
class SavedShow { | ||
addedAt: string; | ||
|
||
show: ShowSimplified; | ||
|
||
constructor(json: any) { | ||
this.addedAt = json.added_at; | ||
this.show = new ShowSimplified(json.show); | ||
} | ||
} | ||
|
||
export default SavedShow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import Copyright from '../common/copyright'; | ||
import Image from '../common/image'; | ||
|
||
class ShowSimplified { | ||
availableMarkets: string[]; | ||
|
||
copyrights: Copyright[]; | ||
|
||
description: string; | ||
|
||
explicit: boolean; | ||
|
||
externalUrls: any; | ||
|
||
href: string; | ||
|
||
id: string; | ||
|
||
images: Image[]; | ||
|
||
isExternallyHosted: boolean | null; | ||
|
||
languages: string[]; | ||
|
||
mediaType: string; | ||
|
||
name: string; | ||
|
||
publisher: string; | ||
|
||
type: 'show'; | ||
|
||
uri: string; | ||
|
||
constructor(json: any) { | ||
this.availableMarkets = json.available_markets; | ||
this.copyrights = json.copyrights.map( | ||
(copyrightJson: any) => new Copyright(copyrightJson) | ||
); | ||
this.description = json.description; | ||
this.explicit = json.explicit; | ||
this.externalUrls = json.external_urls; | ||
this.href = json.href; | ||
this.id = json.id; | ||
this.images = json.images.map((imageJson: any) => new Image(imageJson)); | ||
this.isExternallyHosted = json.is_externally_hosted; | ||
this.languages = json.languages; | ||
this.mediaType = json.media_type; | ||
this.name = json.name; | ||
this.publisher = json.publisher; | ||
this.type = json.type; | ||
this.uri = json.uri; | ||
} | ||
} | ||
|
||
export default ShowSimplified; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import EpisodeSimplified from '../episode/episode-simplified'; | ||
import Page from '../paging/page'; | ||
import ShowSimplified from './show-simplified'; | ||
|
||
class Show extends ShowSimplified { | ||
episodes: Page<EpisodeSimplified>; | ||
|
||
constructor(json: any) { | ||
super(json); | ||
this.episodes = new Page<EpisodeSimplified>( | ||
json.episodes, | ||
EpisodeSimplified | ||
); | ||
} | ||
} | ||
|
||
export default Show; |
Oops, something went wrong.