Socket
Socket
Sign inDemoInstall

@musicorum/lastfm

Package Overview
Dependencies
0
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@musicorum/lastfm

Fully typed [Last.fm](https://last.fm) api client library written and made for Typescript!


Version published
Maintainers
2
0

Weekly downloads

Readme

Source

@musicorum/lastfm

Fully typed Last.fm api client library written and made for Typescript!

Warning This library is still in alpha and on heavy development. Expect incomplete stuff and future changes.

Basic usage

import { LastClient } from '@musicorum/lastfm'

const client = new LastClient('e8077692fe0485f6b474fdab331793c')

async function main() {
  // Original response from API (with types)
  const user1 = await client.request('user.getInfo', { user: 'metye' })

  // Formated response for better experience
  const user2 = await client.user.getInfo('metye')

  console.log(
    user1.user.playcount,
    user2.playCount
  )

  // Pagination
  const recentTracks = await client.user.getRecentTracksPaginated('metye')
  console.log(`${recentTracks.totalResults} results in ${recentTracks.totalPages} pages`)

  const page1 = recentTracks.getPage(1)
  const page2 = await recentTracks.fetchPage(2)

  console.log('Last scrobble:', page1[0].name, page1[0].nowPlaying ? ' - Now playing' : '')
}
main()

Keywords

FAQs

Last updated on 04 Mar 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc