export type StickySessionSettings = {enabled?: boolean | undefined, sessionHeaders: Array, cookieName?: string | undefined}; export type Protocol = 'tcp' | 'udp' | 'sctp'; export type ContainerPortMappingRequest = {containerPort: number, exposedPort?: (number | null) | undefined, protocols?: Array | undefined}; export type CdnEndpointRequest = {isSslEnabled?: boolean | undefined, stickySessions?: StickySessionSettings | undefined, pullZoneId?: (number | null) | undefined, portMappings?: Array | undefined}; export type AnycastIpProtocolVersion = 'iPv4'; export type AnycastEndpointRequest = {type: AnycastIpProtocolVersion, portMappings: Array}; export type EndpointRequest = {displayName: string, cdn?: CdnEndpointRequest | undefined, anycast?: AnycastEndpointRequest | undefined}; export type UpdateApiAppsAppIdEndpointsEndpointIdArgs = {appId: string, endpointId: string, body: EndpointRequest}; export type UpdateApiAppsAppIdEndpointsEndpointIdOptions = {baseUrl?: string | undefined, AccessKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Application Endpoint * * PUT /apps/{appId}/endpoints/{endpointId} */ export const updateApiAppsAppIdEndpointsEndpointId = async (args: UpdateApiAppsAppIdEndpointsEndpointIdArgs, options?: UpdateApiAppsAppIdEndpointsEndpointIdOptions) => { 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))}/endpoints/${encodeURIComponent(String(args.endpointId))}${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 };