npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@buddies/sdk

v2.0.3

Published

Buddies SDK ===

Downloads

19

Readme

Buddies SDK

Accounts Resource

Get current user

const client = new Client({
  accessToken
})
const myself = await client.accounts.getCurrentUser()

console.log(myself)

Get a user

const client = new Client()
const user = await client.accounts.getUser('user-id')

console.log(user)

Update profile of the current user

const client = new Client({
  accessToken
})
const updatedUser = await client.accounts.updateCurrentUser({
  biography: 'New biography 🤪'
})

console.log(updatedUser)

Update profile of a user

const client = new Client({
  accessToken
})
const updatedUser = await client.accounts.updateUser('user-id', {
  biography: 'New biography 🤪'
})

console.log(updatedUser)

Update interests of the current user

const client = new Client({
  accessToken
})
const updatedUser = await client.accounts.updateCurrentUserInterests([
  'interest-id-1', 'interest-id-2'
])

console.log(updatedUser)

Update interests of a user

const client = new Client({
  accessToken
})
const updatedUser = await client.accounts.updateUserInterests('user-id', [
  'interest-id-1', 'interest-id-2'
])

console.log(updatedUser)

Delete current user

const client = new Client({
  accessToken
})

await client.accounts.deleteCurrentUser()

Delete a user

const client = new Client({
  accessToken
})

await client.accounts.deleteUser('user-id')

Auth Resource

Signup with password

const client = new Client()

const { account, accessToken } = await client.auth.signupWithPassword({
  email: '[email protected]',
  password: '123456',
  authTokenName: 'Android app, Login with password',
  nickname: 'John Doe',
  username: 'john',
  biography: 'Hi i\'m John'
})

Login with password

const client = new Client()

const { account, accessToken } = await client.auth.loginWithPassword({
  email: '[email protected]',
  password: '123456',
  authTokenName: 'IOS app, Login with password'
})

Signup with Google code

const client = new Client()

const { account, accessToken } = await client.auth.signupWithGoogleCode({
  code: 'google-code',
  authTokenName: 'Website, Login with Google (Chrome on Mac OS X)'
})

Login with Google code

const client = new Client()

const { account, accessToken } = await client.auth.loginWithGoogleCode({
  code: 'google-code',
  authTokenName: 'Website, Login with Google (Firefox on Windows)'
})

Signup with Google access token

const client = new Client()

const { account, accessToken } = await client.auth.signupWithGoogleAccessToken({
  accessToken: 'google-access-token',
  authTokenName: 'Android app, Login with Google'
})

Login with Google access token

const client = new Client()

const { account, accessToken } = await client.auth.loginWithGoogleAccessToken({
  accessToken: 'google-access-token',
  authTokenName: 'IOS app, Login with Google'
})

Auth Tokens Resource

Get auth tokens of the current user

const client = new Client({ 
  accessToken
})
const authTokens = await client.authTokens.getCurrentUserAuthTokens()

console.log(authTokens)

Delete an auth token

const client = new Client({ 
  accessToken
})

await client.authTokens.deleteAuthToken('auth-token-id')

Hashtags Resource

Get feed from a hashtag

const client = new Client()
const page1 = await client.hashtags.getFeed('sport')

console.log(page1.items)

if (page1.hasNext()) {
  const page2 = await page1.next()
  console.log(page2.items)
}

Interests Resource

Get all interest families with associated interests

const client = new Client()
const families = await client.interests.getInterestFamilies()

for (const family of families) {
  console.log(`--- ${family.name} ---`)

  for (const interest of family.interests) {
    console.log(` -> ${interest.name}`)
  }
}

Lists Resource

Get liked videos of the current user

const client = new Client({ 
  accessToken
})
const page1 = await client.lists.getCurrentUserLikedList()

console.log(page1.items)

if (page1.hasNext()) {
  const page2 = await page1.next()
  console.log(page2.items)
}

Get liked videos of a user

const client = new Client({ 
  accessToken
})
const page1 = await client.lists.getUserLikedList('user-id')

console.log(page1.items)

if (page1.hasNext()) {
  const page2 = await page1.next()
  console.log(page2.items)
}

Videos Resource

Get feed from a video

const client = new Client()
const page1 = await client.videos.getFeed('video-id')

console.log(page1.items)

if (page1.hasNext()) {
  const page2 = await page1.next()
  console.log(page2.items)
}

Like a video

const client = new Client({
  accessToken
})
await client.videos.like('video-id')

Unlike a video

const client = new Client({
  accessToken
})
await client.videos.unlike('video-id')