vrcapi-client
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

vrcapi-client

Unofficial VRChat API Client library.

Functions for each API endpoint, type information for convenient use in TypeScript are provided.

Created for internal use with VRCFriendCheck. So there are multiple endpoints that are not implemented.

Install

Install with npm:

npm install vrcapi-client

Usage

See type information for details.

import * as vrc from 'vrcapi-client'

// login
const res = await vrc.user.login('username', 'password')

// Check if two-factor authentication is enabled
if ('requiresTwoFactorAuth' in res) {
  // Get authentication code
  const code = getAuthenticationCode()
  const res = await vrc.user.verify2FactorAuth(code)
}

// get friends
const friends = await vrc.user.getFriends()

// and more...

Websocket API

const c = await vrc.webSocketAPI()
// Note: msg is passed as a string type.
c.on('message', (msg) => {
    const data = JSON.parse(msg)
    // message type
    // ex) friend-online, friend-location, etc...
    console.log(data.type);
    // message data
    // This is also a string. Must be parsed if used.
    console.log(data.content)
  })

See Events in unofficial api documentation for message types.

/vrcapi-client/

    Package Sidebar

    Install

    npm i vrcapi-client

    Weekly Downloads

    1

    Version

    0.4.0

    License

    MIT

    Unpacked Size

    62.7 kB

    Total Files

    40

    Last publish

    Collaborators

    • mnao305