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

@kindlyfire/vrchatapi

v0.0.3

Published

This is a VRChat API wrapper. It uses the API types from [vrchatapi-javascript](https://github.com/vrchatapi/vrchatapi-javascript), and only depends on an up-to-date version of `axios`. It only has wrapper methods for endpoints I make use of, but you c

Downloads

221

Readme

VRChatAPI

This is a VRChat API wrapper. It uses the API types from vrchatapi-javascript, and only depends on an up-to-date version of axios. It only has wrapper methods for endpoints I make use of, but you can make arbitrary requests using the preconfigured Axios instance and the exported types.

It also has a few helper functions.

The project was created to have a nicer-to-use alternative to vrchatapi-javascript.

Installation

Use your preferred package manager:

npm i @kindlyfire/vrchatapi
yarn add @kindlyfire/vrchatapi
pnpm add @kindlyfire/vrchatapi
bun add @kindlyfire/vrchatapi

Disclaimer

Copied from vrchatapi-javascript:

Use of the API using applications other than the approved methods (website, VRChat application) are not officially supported. You may use the API for your own application, but keep these guidelines in mind:

  • We do not provide documentation or support for the API.
  • Do not make queries to the API more than once per 60 seconds.
  • Abuse of the API may result in account termination.
  • Access to API endpoints may break at any given time, with no warning.

Examples

Constructing an instance:

const vrc = new VRChatApi({
	// Make sure to use this format for the user agent, but you must change it
	// to something else.
	userAgent: 'TimmyFriendTracker/1.5.1 [email protected]',
	authToken: '...', // optional
})

// You can make a new instance and update options through `.withOptions()`. The
// below is the same as the above:
const vrc = new VRChatApi({
	userAgent: 'TimmyFriendTracker/1.5.1 [email protected]',
}).withOptions({
	authToken: '...',
})

Authenticating:

// Get token
const vrc = new VRChatApi({
	userAgent: 'TimmyFriendTracker/1.5.1 [email protected]',
})
const authResult = await vrc.auth.login('myuser', 'mypass')
console.log('Token is', authResult.token)
if ('requiresTwoFactorAuth' in authResult.data) {
	console.log('2fa required')
}

// Submit 2fa
const vrc = new VRChatApi({
	userAgent: '...',
	authToken: 'myauthtoken',
})
const result = await vrc.auth.verify2fa('000000')
if (result.data.verified) {
	console.log('2fa succeeded')
}

Once you have a token that is verified, requests can be made:

const vrc = new VRChatApi({
	userAgent: '...',
	authToken: 'myauthtoken',
})
const user = await vrc.user.get()
console.log('Logged in as', user)

List of APIs

The wrapper methods do not cover all API endpoints, but you can easily use the preconfigured Axios instance to make requests to other endpoints.

  • auth.login(username, password)
  • auth.verify2fa(code, kind?)
  • user.get() (returns the logged-in user)
  • user.getFriends(params)
  • user.getNotifications(params)
  • user.acceptNotification(notificationId)
  • user.hideNotification(notificationId)
  • users.get(id)
  • users.search(query)
  • groups.get(groupId, includeRoles)
  • groups.getMember(groupId, userId)
  • groups.getInstances(groupId)
  • groups.kickMember(groupId, userId)
  • groups.banMember(groupId, userId)
  • groups.removeMemberRole(groupId, userId, roleId)
  • groups.addMemberRole(groupId, userId, roleId)
  • instances.get(worldId, instanceId)

An example of making a request to another endpoint (sending a friend request):

import { Notification, VRChatApi } from '@kindlyfire/vrchatapi'

const vrc = new VRChatApi({
	userAgent: '...',
	authToken: 'myauthtoken',
})
const res = await vrc.axios.post<Notification>(`user/usr_000/friendRequest`)

All endpoints can be seen on vrchatapi.github.io.

Utilities

  • Instance method: util.getUserByLinkOrDisplayName(linkOrDisplayName)
  • Exported: getTrustLevelFromTags(tags)
  • Exported: matchUserProfileLink(link)

License

MIT. See LICENSE file.