export type UpdateRegionSettingsRequest = {allowedRegionIds?: (Array | null) | undefined, requiredRegionIds?: (Array | null) | undefined, maxAllowedRegions?: (number | null) | undefined, nodeSelectors?: ({[key: string]: string} | null) | undefined}; export type UpdateApiAppsAppIdRegionSettingsArgs = {appId: string, body: UpdateRegionSettingsRequest}; export type UpdateApiAppsAppIdRegionSettingsOptions = {baseUrl?: string | undefined, AccessKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Application Region Settings * * PUT /apps/{appId}/region-settings */ export const updateApiAppsAppIdRegionSettings = async (args: UpdateApiAppsAppIdRegionSettingsArgs, options?: UpdateApiAppsAppIdRegionSettingsOptions) => { const {baseUrl = "https://api.bunny.net/mc", fetch: fetchFn = fetch, AccessKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (AccessKey !== undefined) headers.set("AccessKey", AccessKey) const url = `${baseUrl.replace(/\/+$/, '')}/apps/${encodeURIComponent(String(args.appId))}/region-settings${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };