Prints API (Draft WIP) - lolmaxz/vrc-ts GitHub Wiki
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.
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.
listPrints(userId: UserIdType): Promise
Retrieve a list of prints associated with a given user.
-
userId
(UserIdType
, required):
The ID of the user whose prints you want to retrieve.
-
Promise<Prints[]>
: An array ofPrints
objects, each representing a print associated with the specified user.
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');
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.
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!