31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import axiosInstance from '../helpers/axios_client'
|
|
|
|
export default class LastfmService {
|
|
public current = async () => {
|
|
const { data } = await axiosInstance.get(
|
|
`https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=Bravo68web&api_key=${process.env.LASTFM_API_KEY}&format=json&limit=1`
|
|
)
|
|
return data
|
|
}
|
|
public user = async () => {
|
|
const { data } = await axiosInstance.get(
|
|
`https://ws.audioscrobbler.com/2.0/?method=user.getInfo&user=Bravo68web&api_key=${process.env.LASTFM_API_KEY}&format=json&limit=1`
|
|
)
|
|
return data
|
|
}
|
|
|
|
public loved = async () => {
|
|
const { data } = await axiosInstance.get(
|
|
`https://ws.audioscrobbler.com/2.0/?method=user.getLovedTracks&user=Bravo68web&api_key=${process.env.LASTFM_API_KEY}&format=json&limit=1`
|
|
)
|
|
return data
|
|
}
|
|
|
|
public top = async () => {
|
|
const { data } = await axiosInstance.get(
|
|
`https://ws.audioscrobbler.com/2.0/?method=user.getTopTracks&user=Bravo68web&api_key=${process.env.LASTFM_API_KEY}&format=json&limit=1`
|
|
)
|
|
return data
|
|
}
|
|
}
|