ym-api-meowed
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -237,8 +237,3 @@ export type RequestHeaders = { | ||
}; | ||
type Region = "RUSSIA_PREMIUM" | "RUSSIA" | string; | ||
type AlbumType = "compilation" | string; | ||
type TrackPosition = { | ||
volume: number; | ||
index: number; | ||
}; | ||
type Label = { | ||
@@ -249,2 +244,7 @@ id: number; | ||
export type AlbumVolume = Array<Track>; | ||
type AlbumCustomWave = { | ||
title: string; | ||
animationUrl: string; | ||
header: string; | ||
}; | ||
export type Album = { | ||
@@ -264,3 +264,2 @@ id: number; | ||
recent?: boolean; | ||
storageDir?: string; | ||
veryImportant: boolean; | ||
@@ -276,16 +275,7 @@ artists: Array<Artist>; | ||
bests: Array<number>; | ||
duplicates: Array<Album>; | ||
customWave?: { | ||
title: string; | ||
animationUrl: string; | ||
header: string; | ||
}; | ||
duplicates?: Array<Album>; | ||
customWave?: AlbumCustomWave; | ||
sortOrder?: string; | ||
volumes?: Array<AlbumVolume>; | ||
trackPosition: TrackPosition; | ||
availableRegions?: Array<Region>; | ||
originalReleaseYear?: number; | ||
likesCount?: number; | ||
regions?: Array<Region>; | ||
pager: Pager; | ||
pager?: Pager; | ||
}; | ||
@@ -297,6 +287,17 @@ export type AlbumWithTracks = Required<Album>; | ||
}; | ||
type TrackNormalization = { | ||
gain: number; | ||
peak: number; | ||
type TrackContentWarning = "explicit" | string; | ||
type TrackR128 = { | ||
i: number; | ||
tp: number; | ||
}; | ||
type TrackFade = { | ||
inStart: number; | ||
inStop: number; | ||
outStart: number; | ||
outStop: number; | ||
}; | ||
type TrackLyricsInfo = { | ||
hasAvailableSyncLyrics: boolean; | ||
hasAvailableTextLyrics: boolean; | ||
}; | ||
export type Track = { | ||
@@ -306,4 +307,4 @@ id: number; | ||
title: string; | ||
contentWarning?: TrackContentWarning; | ||
version: string; | ||
trackSource: string; | ||
major?: TrackMajor; | ||
@@ -318,12 +319,4 @@ available: boolean; | ||
fileSize?: number; | ||
r128: { | ||
i: number; | ||
tp: number; | ||
}; | ||
fade: { | ||
inStart: number; | ||
inStop: number; | ||
outStart: number; | ||
outStop: number; | ||
}; | ||
r128: TrackR128; | ||
fade: TrackFade; | ||
previewDurationMs?: number; | ||
@@ -333,10 +326,21 @@ artists: Array<Artist>; | ||
lyricsAvailable: boolean; | ||
coverUri: string; | ||
ogImage: string; | ||
rememberPosition: boolean; | ||
coverUri: string; | ||
explicit: boolean; | ||
regions: Array<Region>; | ||
normalization?: TrackNormalization; | ||
type?: string; | ||
ogImage?: string; | ||
type: string; | ||
trackSharingFlag?: string; | ||
lyricsInfo: TrackLyricsInfo; | ||
trackSource: string; | ||
}; | ||
type ArtistRatings = { | ||
week: number; | ||
month: number; | ||
day: number; | ||
}; | ||
type ArtistLink = { | ||
title: string; | ||
href: string; | ||
type: string; | ||
socialNetwork: string; | ||
}; | ||
export type Artist = { | ||
@@ -347,14 +351,17 @@ id: number; | ||
composer: boolean; | ||
ticketsAvailable?: boolean; | ||
cover: ArtistCover; | ||
genres: Array<Genre>; | ||
disclaimers: Array<any>; | ||
ogImage?: string; | ||
noPicturesFromSearch?: boolean; | ||
counts?: ArtistCounts; | ||
genres: Array<Genre>; | ||
popularTracks?: Array<Track>; | ||
regions?: Array<Region>; | ||
albums?: Array<Album>; | ||
alsoAlbums?: Array<Album>; | ||
similarArtists?: Array<Artist>; | ||
available?: boolean; | ||
ratings?: ArtistRatings; | ||
links?: Array<ArtistLink>; | ||
ticketsAvailable?: boolean; | ||
likesCount: number; | ||
dbAliases: Array<string>; | ||
}; | ||
export type FilledArtist = { | ||
artist: Artist; | ||
artist: Required<Artist>; | ||
albums: Array<Album>; | ||
@@ -405,3 +412,3 @@ alsoAlbums: Array<Album>; | ||
export type Language = "en" | "ru" | string; | ||
type Lirics = { | ||
type Lyrics = { | ||
id: number; | ||
@@ -425,3 +432,3 @@ lyrics: string; | ||
id: number; | ||
lyrics: Lirics; | ||
lyrics: Lyrics; | ||
videos: Array<Video>; | ||
@@ -513,3 +520,3 @@ }; | ||
}; | ||
export type DisOrLikedTracks = { | ||
export type DisOrLikedTracksResponse = { | ||
library: { | ||
@@ -539,2 +546,80 @@ revision: number; | ||
}; | ||
type StationId = { | ||
type: string; | ||
tag: string; | ||
}; | ||
type StationSettings = { | ||
language: string; | ||
mood?: number; | ||
energy?: number; | ||
moodEnergy?: string; | ||
diversity: string; | ||
}; | ||
type StationAdParams = { | ||
partnerId: string; | ||
categoryId: string; | ||
pageRef: string; | ||
targetRef: string; | ||
otherParams: string; | ||
adVolume: number; | ||
}; | ||
type StationRestrictionsValue = { | ||
value: number; | ||
name: string; | ||
imageUrl?: string; | ||
unspecified?: boolean; | ||
serializedSeed?: string; | ||
}; | ||
type StationRestrictionsOption = { | ||
type: string; | ||
name: string; | ||
possibleValues?: Array<Required<StationRestrictionsValue>>; | ||
min?: StationRestrictionsValue; | ||
max?: StationRestrictionsValue; | ||
}; | ||
type StationRestrictions = { | ||
diversity: Required<Omit<Omit<StationRestrictionsOption, "min">, "max">>; | ||
language: Required<Omit<Omit<StationRestrictionsOption, "min">, "max">>; | ||
mood?: Required<Omit<StationRestrictionsOption, "possibleValues">>; | ||
energy?: Required<Omit<StationRestrictionsOption, "possibleValues">>; | ||
moodEnergy?: Required<Omit<Omit<StationRestrictionsOption, "min">, "max">>; | ||
}; | ||
type StationData = { | ||
artists: Array<Artist>; | ||
title?: string; | ||
description?: string; | ||
imageUri?: string; | ||
}; | ||
type StationInfo = { | ||
station: { | ||
id: StationId; | ||
parentId?: StationId; | ||
name: string; | ||
icon: RadioIcon; | ||
mtsIcon: RadioIcon; | ||
fullImageUrl: string; | ||
mtsFullImageUrl?: string; | ||
idForFrom: string; | ||
restrictions: Required<Omit<StationRestrictions, "moodEnergy">>; | ||
restrictions2: Required<Omit<Omit<StationRestrictions, "mood">, "energy">>; | ||
listeners?: number; | ||
visibility?: string; | ||
login?: string; | ||
displayName?: string; | ||
fullName?: string; | ||
}; | ||
data?: StationData; | ||
settings: Required<Omit<StationInfo, "moodEnergy">>; | ||
settings2: Required<Omit<Omit<StationSettings, "mood">, "energy">>; | ||
adParams: StationAdParams; | ||
rupTitle: string; | ||
rupDescription: string; | ||
}; | ||
export type StationInfoResponse = Array<StationInfo>; | ||
export type AllStationsListResponse = Array<StationInfo>; | ||
export type RecomendedStationsListResponse = { | ||
dashboardId: string; | ||
stations: Array<StationInfo>; | ||
pumpkin: boolean; | ||
}; | ||
export type ChartTracksResponse = { | ||
@@ -541,0 +626,0 @@ id: string; |
@@ -1,2 +0,2 @@ | ||
import { ApiConfig, ApiInitConfig, InitResponse, GetGenresResponse, SearchResponse, Playlist, GetTrackResponse, Language, GetTrackSupplementResponse, GetTrackDownloadInfoResponse, GetFeedResponse, GetAccountStatusResponse, Track, TrackId, HttpClientInterface, SearchOptions, ConcreteSearchOptions, SearchAllResponse, SearchArtistsResponse, SearchTracksResponse, SearchAlbumsResponse, AlbumId, Album, AlbumWithTracks, FilledArtist, Artist, ArtistId, ArtistTracksResponse, DisOrLikedTracks, ChartType, ChartTracksResponse, NewReleasesResponse, NewPlaylistsResponse, PodcastsResponse, StationTracksResponse, SimmilarTracksResponse } from "./types"; | ||
import { ApiConfig, ApiInitConfig, InitResponse, GetGenresResponse, SearchResponse, Playlist, GetTrackResponse, Language, GetTrackSupplementResponse, GetTrackDownloadInfoResponse, GetFeedResponse, GetAccountStatusResponse, Track, TrackId, HttpClientInterface, SearchOptions, ConcreteSearchOptions, SearchAllResponse, SearchArtistsResponse, SearchTracksResponse, SearchAlbumsResponse, AlbumId, Album, AlbumWithTracks, FilledArtist, Artist, ArtistId, ArtistTracksResponse, DisOrLikedTracksResponse, ChartType, ChartTracksResponse, NewReleasesResponse, NewPlaylistsResponse, PodcastsResponse, SimmilarTracksResponse, StationTracksResponse, StationInfoResponse, AllStationsListResponse, RecomendedStationsListResponse } from "./types"; | ||
export default class YMApi { | ||
@@ -200,4 +200,4 @@ private httpClient; | ||
*/ | ||
getLikedTracks(userId?: number | string | null): Promise<DisOrLikedTracks>; | ||
getDislikedTracks(userId?: number | string | null): Promise<DisOrLikedTracks>; | ||
getLikedTracks(userId?: number | string | null): Promise<DisOrLikedTracksResponse>; | ||
getDislikedTracks(userId?: number | string | null): Promise<DisOrLikedTracksResponse>; | ||
/** | ||
@@ -208,3 +208,3 @@ * @param language Language of station list | ||
*/ | ||
getAllStationsList(language: Language): Promise<any>; | ||
getAllStationsList(language?: Language): Promise<AllStationsListResponse>; | ||
/** | ||
@@ -215,3 +215,3 @@ * GET: /rotor/stations/dashboard | ||
*/ | ||
getRecomendedStationsList(): Promise<any>; | ||
getRecomendedStationsList(): Promise<RecomendedStationsListResponse>; | ||
/** | ||
@@ -230,3 +230,3 @@ * @param stationId Id of station. Example: user:onyourwave | ||
*/ | ||
getStationInfo(stationId: string): Promise<any>; | ||
getStationInfo(stationId: string): Promise<StationInfoResponse>; | ||
} |
@@ -505,3 +505,3 @@ "use strict"; | ||
.addHeaders(this.getAuthHeader()) | ||
.setQuery({ language }); | ||
.setQuery(language ? { language } : {}); | ||
return this.httpClient.get(request); | ||
@@ -508,0 +508,0 @@ } |
{ | ||
"name": "ym-api-meowed", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "A Node.js wrapper for the Yandex.Music API (Unofficial) http://music.yandex.ru", | ||
@@ -17,3 +17,3 @@ "main": "dist/index.js", | ||
"type": "git", | ||
"url": "https://github.com/kontsevoye/ym-api.git" | ||
"url": "https://github.com/kotisoff/ym-api-meowed.git" | ||
}, | ||
@@ -20,0 +20,0 @@ "keywords": [ |
169
src/types.ts
@@ -276,8 +276,7 @@ export type RequestHeaders = { [key: string]: string }; | ||
}; | ||
type Region = "RUSSIA_PREMIUM" | "RUSSIA" | string; | ||
type AlbumType = "compilation" | string; | ||
type TrackPosition = { volume: number; index: number }; | ||
type Label = { id: number; name: string } | string; | ||
export type AlbumVolume = Array<Track>; | ||
type AlbumCustomWave = { title: string; animationUrl: string; header: string }; | ||
export type Album = { | ||
@@ -297,3 +296,3 @@ id: number; | ||
recent?: boolean; | ||
storageDir?: string; | ||
// storageDir?: string; | ||
veryImportant: boolean; | ||
@@ -309,12 +308,12 @@ artists: Array<Artist>; | ||
bests: Array<number>; | ||
duplicates: Array<Album>; | ||
customWave?: { title: string; animationUrl: string; header: string }; | ||
duplicates?: Array<Album>; | ||
customWave?: AlbumCustomWave; | ||
sortOrder?: string; | ||
volumes?: Array<AlbumVolume>; | ||
trackPosition: TrackPosition; | ||
availableRegions?: Array<Region>; | ||
originalReleaseYear?: number; | ||
likesCount?: number; | ||
regions?: Array<Region>; | ||
pager: Pager; | ||
// trackPosition?: TrackPosition; | ||
// availableRegions?: Array<Region>; | ||
// originalReleaseYear?: number; | ||
// likesCount?: number; | ||
// regions?: Array<Region>; | ||
pager?: Pager; | ||
}; | ||
@@ -324,3 +323,14 @@ export type AlbumWithTracks = Required<Album>; | ||
type TrackMajor = { id: number; name: string }; | ||
type TrackNormalization = { gain: number; peak: number }; | ||
type TrackContentWarning = "explicit" | string; | ||
type TrackR128 = { i: number; tp: number }; | ||
type TrackFade = { | ||
inStart: number; | ||
inStop: number; | ||
outStart: number; | ||
outStop: number; | ||
}; | ||
type TrackLyricsInfo = { | ||
hasAvailableSyncLyrics: boolean; | ||
hasAvailableTextLyrics: boolean; | ||
}; | ||
export type Track = { | ||
@@ -330,4 +340,4 @@ id: number; | ||
title: string; | ||
contentWarning?: TrackContentWarning; | ||
version: string; | ||
trackSource: string; | ||
major?: TrackMajor; | ||
@@ -342,4 +352,4 @@ available: boolean; | ||
fileSize?: number; | ||
r128: { i: number; tp: number }; | ||
fade: { inStart: number; inStop: number; outStart: number; outStop: number }; | ||
r128: TrackR128; | ||
fade: TrackFade; | ||
previewDurationMs?: number; | ||
@@ -349,11 +359,18 @@ artists: Array<Artist>; | ||
lyricsAvailable: boolean; | ||
coverUri: string; | ||
ogImage: string; | ||
rememberPosition: boolean; | ||
coverUri: string; | ||
explicit: boolean; | ||
regions: Array<Region>; | ||
normalization?: TrackNormalization; | ||
type?: string; | ||
ogImage?: string; | ||
type: string; | ||
trackSharingFlag?: string; | ||
lyricsInfo: TrackLyricsInfo; | ||
trackSource: string; | ||
}; | ||
type ArtistRatings = { week: number; month: number; day: number }; | ||
type ArtistLink = { | ||
title: string; | ||
href: string; | ||
type: string; | ||
socialNetwork: string; | ||
}; | ||
export type Artist = { | ||
@@ -364,14 +381,22 @@ id: number; | ||
composer: boolean; | ||
ticketsAvailable?: boolean; | ||
cover: ArtistCover; | ||
genres: Array<Genre>; | ||
disclaimers: Array<any>; | ||
ogImage?: string; | ||
noPicturesFromSearch?: boolean; | ||
counts?: ArtistCounts; | ||
genres: Array<Genre>; | ||
popularTracks?: Array<Track>; | ||
regions?: Array<Region>; | ||
albums?: Array<Album>; | ||
alsoAlbums?: Array<Album>; | ||
similarArtists?: Array<Artist>; | ||
available?: boolean; | ||
ratings?: ArtistRatings; | ||
links?: Array<ArtistLink>; | ||
ticketsAvailable?: boolean; | ||
likesCount: number; | ||
dbAliases: Array<string>; | ||
// popularTracks?: Array<Track>; | ||
// regions?: Array<Region>; | ||
// albums?: Array<Album>; | ||
// alsoAlbums?: Array<Album>; | ||
// similarArtists?: Array<Artist>; | ||
}; | ||
export type FilledArtist = { | ||
artist: Artist; | ||
artist: Required<Artist>; | ||
albums: Array<Album>; | ||
@@ -433,3 +458,3 @@ alsoAlbums: Array<Album>; | ||
export type Language = "en" | "ru" | string; | ||
type Lirics = { | ||
type Lyrics = { | ||
id: number; | ||
@@ -453,3 +478,3 @@ lyrics: string; | ||
id: number; | ||
lyrics: Lirics; | ||
lyrics: Lyrics; | ||
videos: Array<Video>; | ||
@@ -556,3 +581,3 @@ }; | ||
export type DisOrLikedTracks = { | ||
export type DisOrLikedTracksResponse = { | ||
library: { | ||
@@ -582,2 +607,82 @@ revision: number; | ||
type StationId = { type: string; tag: string }; | ||
type StationSettings = { | ||
language: string; | ||
mood?: number; | ||
energy?: number; | ||
moodEnergy?: string; | ||
diversity: string; | ||
}; | ||
type StationAdParams = { | ||
partnerId: string; | ||
categoryId: string; | ||
pageRef: string; | ||
targetRef: string; | ||
otherParams: string; | ||
adVolume: number; | ||
}; | ||
type StationRestrictionsValue = { | ||
value: number; | ||
name: string; | ||
imageUrl?: string; | ||
unspecified?: boolean; | ||
serializedSeed?: string; | ||
}; | ||
type StationRestrictionsOption = { | ||
type: string; | ||
name: string; | ||
possibleValues?: Array<Required<StationRestrictionsValue>>; | ||
min?: StationRestrictionsValue; | ||
max?: StationRestrictionsValue; | ||
}; | ||
type StationRestrictions = { | ||
diversity: Required<Omit<Omit<StationRestrictionsOption, "min">, "max">>; | ||
language: Required<Omit<Omit<StationRestrictionsOption, "min">, "max">>; | ||
mood?: Required<Omit<StationRestrictionsOption, "possibleValues">>; | ||
energy?: Required<Omit<StationRestrictionsOption, "possibleValues">>; | ||
moodEnergy?: Required<Omit<Omit<StationRestrictionsOption, "min">, "max">>; | ||
}; | ||
type StationData = { | ||
artists: Array<Artist>; | ||
title?: string; | ||
description?: string; | ||
imageUri?: string; | ||
}; | ||
type StationInfo = { | ||
station: { | ||
id: StationId; | ||
parentId?: StationId; | ||
name: string; | ||
icon: RadioIcon; | ||
mtsIcon: RadioIcon; | ||
fullImageUrl: string; | ||
mtsFullImageUrl?: string; | ||
idForFrom: string; | ||
restrictions: Required<Omit<StationRestrictions, "moodEnergy">>; | ||
restrictions2: Required<Omit<Omit<StationRestrictions, "mood">, "energy">>; | ||
listeners?: number; | ||
visibility?: string; | ||
login?: string; | ||
displayName?: string; | ||
fullName?: string; | ||
}; | ||
data?: StationData; | ||
settings: Required<Omit<StationInfo, "moodEnergy">>; | ||
settings2: Required<Omit<Omit<StationSettings, "mood">, "energy">>; | ||
adParams: StationAdParams; | ||
rupTitle: string; | ||
rupDescription: string; | ||
}; | ||
export type StationInfoResponse = Array<StationInfo>; | ||
export type AllStationsListResponse = Array<StationInfo>; | ||
export type RecomendedStationsListResponse = { | ||
dashboardId: string; | ||
stations: Array<StationInfo>; | ||
pumpkin: boolean; | ||
}; | ||
export type ChartTracksResponse = { | ||
@@ -584,0 +689,0 @@ id: string; |
@@ -37,3 +37,3 @@ import { authRequest, apiRequest, directLinkRequest } from "./PreparedRequest"; | ||
ArtistTracksResponse, | ||
DisOrLikedTracks, | ||
DisOrLikedTracksResponse, | ||
ChartType, | ||
@@ -44,4 +44,7 @@ ChartTracksResponse, | ||
PodcastsResponse, | ||
SimmilarTracksResponse, | ||
StationTracksResponse, | ||
SimmilarTracksResponse, | ||
StationInfoResponse, | ||
AllStationsListResponse, | ||
RecomendedStationsListResponse, | ||
} from "./types"; | ||
@@ -623,3 +626,3 @@ | ||
userId: number | string | null = null | ||
): Promise<DisOrLikedTracks> { | ||
): Promise<DisOrLikedTracksResponse> { | ||
const uid = [null, 0, ""].includes(userId) ? this.user.uid : userId; | ||
@@ -630,3 +633,3 @@ const request = apiRequest() | ||
return this.httpClient.get(request) as Promise<DisOrLikedTracks>; | ||
return this.httpClient.get(request) as Promise<DisOrLikedTracksResponse>; | ||
} | ||
@@ -636,3 +639,3 @@ | ||
userId: number | string | null = null | ||
): Promise<DisOrLikedTracks> { | ||
): Promise<DisOrLikedTracksResponse> { | ||
const uid = [null, 0, ""].includes(userId) ? this.user.uid : userId; | ||
@@ -643,3 +646,3 @@ const request = apiRequest() | ||
return this.httpClient.get(request) as Promise<DisOrLikedTracks>; | ||
return this.httpClient.get(request) as Promise<DisOrLikedTracksResponse>; | ||
} | ||
@@ -652,9 +655,9 @@ | ||
*/ | ||
getAllStationsList(language: Language): Promise<any> { | ||
getAllStationsList(language?: Language): Promise<AllStationsListResponse> { | ||
const request = apiRequest() | ||
.setPath(`/rotor/stations/list`) | ||
.addHeaders(this.getAuthHeader()) | ||
.setQuery({ language }); | ||
.setQuery(language ? { language } : {}); | ||
return this.httpClient.get(request) as Promise<any>; | ||
return this.httpClient.get(request) as Promise<AllStationsListResponse>; | ||
} | ||
@@ -667,3 +670,3 @@ | ||
*/ | ||
getRecomendedStationsList(): Promise<any> { | ||
getRecomendedStationsList(): Promise<RecomendedStationsListResponse> { | ||
const request = apiRequest() | ||
@@ -673,3 +676,5 @@ .setPath("/rotor/stations/dashboard") | ||
return this.httpClient.get(request) as Promise<any>; | ||
return this.httpClient.get( | ||
request | ||
) as Promise<RecomendedStationsListResponse>; | ||
} | ||
@@ -700,3 +705,3 @@ | ||
*/ | ||
getStationInfo(stationId: string): Promise<any> { | ||
getStationInfo(stationId: string): Promise<StationInfoResponse> { | ||
const request = apiRequest() | ||
@@ -706,4 +711,4 @@ .setPath(`/rotor/station/${stationId}/info`) | ||
return this.httpClient.get(request) as Promise<any>; | ||
return this.httpClient.get(request) as Promise<StationInfoResponse>; | ||
} | ||
} |
124166
3952