Prints API (Draft WIP) - lolmaxz/vrc-ts GitHub Wiki

Prints API Documentation

This API allows you to retrieve a list of "prints" associated with a specified user. A "print" can be considered as a captured moment or snapshot in VRChat, including associated metadata such as the world, user information, and timestamps.


Index

  1. Overview
  2. Endpoints
  3. Data Types
  4. Example Usage

1. Overview

The Prints API provides functionality to retrieve a user's prints. These prints are snapshots taken in various worlds, each containing metadata like the author, current owner, timestamps, and associated image files.


2. Endpoints

1. listPrints

listPrints(userId: UserIdType): Promise

Purpose

Retrieve a list of prints associated with a given user.

Parameters

  • userId (UserIdType, required):
    The ID of the user whose prints you want to retrieve.

Returns

  • Promise<Prints[]>: An array of Prints objects, each representing a print associated with the specified user.

Example Usage

import { VRChatAPI } from 'vrc-ts';

async function getUserPrints(userId: string) {
  const api = new VRChatAPI();
  await api.login();

  const prints = await api.printsApi.listPrints(userId);
  console.log(`User ${userId} has ${prints.length} prints.`);
  prints.forEach((print) => {
    console.log(`Print ID: ${print.id}, World: ${print.worldName}, Author: ${print.authorName}`);
  });
}

getUserPrints('usr_abcdef12-3456-7890-abcd-ef1234567890');

3. Data Types

Prints Type

export type Prints = {
  /** The User ID of the author of the print */
  authorId: string;
  /** The VRChat user display name of the author */
  authorName: string;
  /** The timestamp at which the print was created */
  createdAt: string;
  /** Information about the print file */
  files: {
    /** File ID of the image */
    fileId: string;
    /** File location (URL) of the image */
    image: string;
  };
  /** The ID of the Print */
  id: string;
  /** Optional note attached to the print */
  note?: string;
  /** The User ID of the current owner of the print */
  ownerId: string;
  /** The User ID of the user who shared this print */
  sharedBy: string;
  /** Another timestamp associated with the print */
  timestamp: string;
  /** The World ID where the print was taken */
  worldId: string;
  /** The name of the world where the print was taken */
  worldName: string;
};

Key Fields:

  • authorId, authorName: Identify the original creator/author of the print.
  • ownerId: The current owner of the print, possibly different from the author.
  • files: Contains file-related information including the URL of the image.
  • worldId, worldName: Identify the world where the print was taken.
  • note: Optional note that may be attached to the print.

4. Example Usage

import { VRChatAPI } from 'vrc-ts';

async function showUserPrints() {
  const api = new VRChatAPI();
  await api.login();

  const userId = 'usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469';
  const prints = await api.printsApi.listPrints(userId);

  console.log(`User ${userId} has ${prints.length} prints:`);
  for (const print of prints) {
    console.log(`- Print ${print.id} taken in ${print.worldName} by ${print.authorName}`);
    console.log(`  Image URL: ${print.files.image}`);
    if (print.note) {
      console.log(`  Note: ${print.note}`);
    }
  }
}

showUserPrints();

Note: As with other endpoints, ensure you are authenticated before calling listPrints. The VRChat API may evolve over time, so consider checking the repository or community resources for the most up-to-date information.

Happy printing!

⚠️ **GitHub.com Fallback** ⚠️