export type PrivateKeyType = 0 | 1; export type PrivateKeyUpdateModel = {Hostname: string, KeyType: PrivateKeyType}; export type CreateApiPullzoneIdUpdatePrivateKeyTypeArgs = {id: number, body: PrivateKeyUpdateModel}; export type CreateApiPullzoneIdUpdatePrivateKeyTypeOptions = {baseUrl?: string | undefined, AccessKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Change hostname private key type * * POST /pullzone/{id}/updatePrivateKeyType */ export const createApiPullzoneIdUpdatePrivateKeyType = async (args: CreateApiPullzoneIdUpdatePrivateKeyTypeArgs, options?: CreateApiPullzoneIdUpdatePrivateKeyTypeOptions) => { const {baseUrl = "https://api.bunny.net", 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(/\/+$/, '')}/pullzone/${encodeURIComponent(String(args.id))}/updatePrivateKeyType${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 };