export type Roblox2AssetdeliveryV3PrewarmPlaceTarget = {placeId?: number | undefined}; export type Roblox2AssetdeliveryV3PrewarmTarget = {place?: Roblox2AssetdeliveryV3PrewarmPlaceTarget | undefined}; export type Roblox2AssetdeliveryV3V3PrewarmRequest = {target: Roblox2AssetdeliveryV3PrewarmTarget}; export type CreateApiV3AssetsPrewarmArgs = {body: Roblox2AssetdeliveryV3V3PrewarmRequest}; export type CreateApiV3AssetsPrewarmOptions = {baseUrl?: string | undefined, robloxLegacyCookie?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /v3/assets/prewarm */ export const createApiV3AssetsPrewarm = async (args: CreateApiV3AssetsPrewarmArgs, options?: CreateApiV3AssetsPrewarmOptions) => { const {baseUrl = "https://assetdelivery.roblox.com", fetch: fetchFn = fetch, robloxLegacyCookie} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (robloxLegacyCookie !== undefined) cookies.push(".ROBLOSECURITY=" + encodeURIComponent(robloxLegacyCookie)) const url = `${baseUrl.replace(/\/+$/, '')}/v3/assets/prewarm${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };