Files
VRC-Circle/src/main/vrchat/instanceService.ts
T

16 lines
557 B
TypeScript
Raw Normal View History

2026-06-28 03:49:20 +07:00
import type { Instance } from "../../shared/types/instance";
import { toInstance } from "./mappers";
import { cachedRead } from "./cachedRead";
import { cacheKeys, policies } from "../cache/policies";
export async function getInstance(worldId: string, instanceId: string): Promise<Instance> {
return cachedRead(
cacheKeys.instance(`${worldId}:${instanceId}`),
policies.instance,
async (vrc) => {
const { data } = await vrc.getInstance({ path: { worldId, instanceId }, throwOnError: true });
return toInstance(data);
},
);
}