export type GetApiV1AliasUniverseIdAssetNameArgs = {universeId: string, assetName: string, 'Accept-Encoding': string, 'Roblox-Place-Id': number, AssetType: string, AssetFormat: string, 'Roblox-AssetFormat': string, 'Roblox-Usage-Context'?: string | undefined, skipSigningScripts?: boolean | undefined, clientInsert?: number | undefined, scriptinsert?: number | undefined, modulePlaceId?: number | undefined, serverplaceid?: number | undefined, expectedAssetType?: string | undefined, accessContext?: string | undefined}; export type GetApiV1AliasUniverseIdAssetNameOptions = {baseUrl?: string | undefined, robloxLegacyCookie?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieves an asset by its alias (universeID/name) * * GET /v1/alias/{universeId}/{assetName} */ export const getApiV1AliasUniverseIdAssetName = async (args: GetApiV1AliasUniverseIdAssetNameArgs, options?: GetApiV1AliasUniverseIdAssetNameOptions) => { const {baseUrl = "https://assetdelivery.roblox.com", fetch: fetchFn = fetch, robloxLegacyCookie} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Accept-Encoding'] != null) headers.set("Accept-Encoding", String(args['Accept-Encoding'])) if (args['Roblox-Place-Id'] != null) headers.set("Roblox-Place-Id", String(args['Roblox-Place-Id'])) if (args.AssetType != null) headers.set("AssetType", String(args.AssetType)) if (args.AssetFormat != null) headers.set("AssetFormat", String(args.AssetFormat)) if (args['Roblox-AssetFormat'] != null) headers.set("Roblox-AssetFormat", String(args['Roblox-AssetFormat'])) if (args['Roblox-Usage-Context'] != null) headers.set("Roblox-Usage-Context", String(args['Roblox-Usage-Context'])) if (args.skipSigningScripts != null) query.append("skipSigningScripts", String(args.skipSigningScripts)) if (args.clientInsert != null) query.append("clientInsert", String(args.clientInsert)) if (args.scriptinsert != null) query.append("scriptinsert", String(args.scriptinsert)) if (args.modulePlaceId != null) query.append("modulePlaceId", String(args.modulePlaceId)) if (args.serverplaceid != null) query.append("serverplaceid", String(args.serverplaceid)) if (args.expectedAssetType != null) query.append("expectedAssetType", String(args.expectedAssetType)) if (args.accessContext != null) query.append("accessContext", String(args.accessContext)) if (robloxLegacyCookie !== undefined) cookies.push(".ROBLOSECURITY=" + encodeURIComponent(robloxLegacyCookie)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/alias/${encodeURIComponent(String(args.universeId))}/${encodeURIComponent(String(args.assetName))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };