mirror of
https://github.com/YuzuZensai/VRC-Circle.git
synced 2026-09-13 10:58:59 +00:00
16 lines
557 B
TypeScript
16 lines
557 B
TypeScript
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);
|
||
|
|
},
|
||
|
|
);
|
||
|
|
}
|