UNPKG

bunny-client

Version:
1 lines 90.6 kB
{"version":3,"sources":["../src/index.ts","../src/api/countries/createCountriesClient.ts","../src/api/countries/getCountryList/getCountryList.ts","../src/utilities/FetchError.ts","../src/api/countries/untypeable.ts","../src/api/region/createRegionClient.ts","../src/api/region/regionList/regionList.ts","../src/api/region/untypeable.ts","../src/api/statistics/createStatisticsClient.ts","../src/api/statistics/getStatistics/getStatistics.ts","../src/api/statistics/untypeable.ts","../src/api/storage-zone/createStorageZoneClient.ts","../src/api/storage-zone/addStorageZone/addStorageZone.ts","../src/api/storage-zone/untypeable.ts","../src/api/storage-zone/checkTheStorageZoneAvailability/checkTheStorageZoneAvailability.ts","../src/api/storage-zone/deleteStorageZone/deleteStorageZone.ts","../src/api/storage-zone/getStorageZone/getStorageZone.ts","../src/api/storage-zone/getStorageZoneStatistics/getStorageZoneStatistics.ts","../src/api/storage-zone/listStorageZones/listStorageZones.ts","../src/api/storage-zone/resetPassword/resetPassword.ts","../src/api/storage-zone/resetReadOnlyPassword/resetReadOnlyPassword.ts","../src/api/storage-zone/updateStorageZone/updateStorageZone.ts","../src/api/support/createSupportClient.ts","../src/api/support/closeTicket/closeTicket.ts","../src/api/support/untypeable.ts","../src/api/support/createTicket/createTicket.ts","../src/api/support/getTicketDetails/getTicketDetails.ts","../src/api/support/getTicketList/getTicketList.ts","../src/api/support/replyTicket/replyTicket.ts","../src/edge-storage-api/browse-files/createBrowseFilesClient.ts","../src/edge-storage-api/browse-files/listFiles/listFiles.ts","../src/edge-storage-api/browse-files/untypeable.ts","../src/edge-storage-api/manage-files/createManageFilesClient.ts","../src/edge-storage-api/manage-files/deleteFile/deleteFile.ts","../src/edge-storage-api/manage-files/untypeable.ts","../src/edge-storage-api/manage-files/downloadFile/downloadFile.ts","../src/edge-storage-api/manage-files/uploadFile/uploadFile.ts"],"sourcesContent":["export type {\n AddStorageZoneRequest,\n AddStorageZoneResponse,\n CheckTheStorageZoneAvailabilityRequest,\n CheckTheStorageZoneAvailabilityResponse,\n CloseTicketRequest,\n CloseTicketResponse,\n CreateTicketRequest,\n CreateTicketResponse,\n DeleteStorageZoneRequest,\n DeleteStorageZoneResponse,\n GetCountryListRequest,\n GetCountryListResponse,\n GetStatisticsRequest,\n GetStatisticsResponse,\n GetStorageZoneRequest,\n GetStorageZoneResponse,\n GetStorageZoneStatisticsRequest,\n GetStorageZoneStatisticsResponse,\n GetTicketDetailsRequest,\n GetTicketDetailsResponse,\n GetTicketListRequest,\n GetTicketListResponse,\n ListStorageZonesRequest,\n ListStorageZonesResponse,\n RegionListRequest,\n RegionListResponse,\n ReplyTicketRequest,\n ReplyTicketResponse,\n ResetPasswordRequest,\n ResetPasswordResponse,\n ResetReadOnlyPasswordRequest,\n ResetReadOnlyPasswordResponse,\n UpdateStorageZoneRequest,\n UpdateStorageZoneResponse,\n} from \"./api\";\nexport {\n createCountriesClient,\n createRegionClient,\n createStatisticsClient,\n createStorageZoneClient,\n createSupportClient,\n} from \"./api\";\nexport type {\n DeleteFileRequest,\n DeleteFileResponse,\n DownloadFileRequest,\n DownloadFileResponse,\n ListFilesRequest,\n ListFilesResponse,\n UploadFileRequest,\n UploadFileResponse,\n} from \"./edge-storage-api\";\nexport {\n createBrowseFilesClient,\n createManageFilesClient,\n} from \"./edge-storage-api\";\nexport { FetchError } from \"./utilities\";\n","import { createTypeLevelClient } from \"untypeable\";\nimport {\n getCountryList,\n getCountryListClient,\n getCountryListEndpoints,\n} from \"./getCountryList\";\nimport { u } from \"./untypeable\";\n\nconst countriesRouter = u.router({\n [getCountryListEndpoints.getCountryList]: getCountryList,\n [getCountryListEndpoints[\"GET /country\"]]: getCountryList,\n});\n\n/**\n * @param defaultRequestInit default fetch parameters for every request\n * @returns countriesClient\n *\n * @example\n * ```ts\n * const countriesClient = createCountriesClient({\n * apiKey: API_ACCESS_KEY,\n * });\n *\n * const response = await countriesClient(\"getCountryList\");\n * ```\n */\nexport function createCountriesClient(\n defaultInput: Record<string, any>,\n defaultRequestInit: RequestInit = {}\n) {\n const countriesClient = createTypeLevelClient<typeof countriesRouter>(\n async (path, input) => {\n const overrideInput = {\n ...defaultInput,\n ...input,\n };\n\n switch (path) {\n case getCountryListEndpoints.getCountryList:\n case getCountryListEndpoints[\"GET /country\"]:\n return getCountryListClient(defaultRequestInit, overrideInput);\n default:\n throw new Error(\n `[${countriesClient.name}]: no endpoint found named \"${path}\"`\n );\n }\n }\n );\n return countriesClient;\n}\n","import { deepmerge } from \"deepmerge-ts\";\nimport { FetchError } from \"../../../utilities\";\nimport { u } from \"../untypeable\";\n\nexport interface Country {\n /**\n * Url of a 512x512 png with a circular country flag with a grey (#e1dfdf) background color\n */\n FlagUrl: string;\n /**\n * Country is part of the [European Union](https://web.archive.org/web/20230427223937/https://en.wikipedia.org/wiki/European_Union)\n * @example false\n */\n IsEU: boolean;\n /**\n * Country two-digit [ISO country code](https://web.archive.org/web/20230427223803/https://www.nationsonline.org/oneworld/country_code_list.htm)\n * @example \"GB\"\n */\n IsoCode: string;\n /**\n * Country name\n * @example \"United Kingdom\"\n */\n Name: string;\n /**\n * Country [Points of Presence](https://web.archive.org/web/20230427225159/https://www.imperva.com/learn/performance/what-is-cdn-how-it-works/) [list](https://web.archive.org/web/20230427225239/https://bunny.net/network/) of abbreviations\n * @example \"NY\"\n */\n PopList: string[];\n /**\n * Country tax rate out of 100 percent\n * in the [European Union](https://web.archive.org/web/20230427223937/https://en.wikipedia.org/wiki/European_Union), this is the VAT tax rate\n * @example 25\n */\n TaxRate: number;\n}\n\nexport interface GetCountryListRequest {\n /**\n * User-specific [API Key](https://dash.bunny.net/account/settings)\n * @example \"cb1a7c68-89a0-462a-9495-13ebd7366cfe\"\n */\n apiKey?: string;\n}\n\nexport type GetCountryListResponse = Country[];\n\nexport const getCountryList = u\n .input<GetCountryListRequest>()\n .output<GetCountryListResponse>();\n\nconst url = \"https://api.bunny.net/country\";\nconst options: RequestInit = {\n headers: {\n accept: \"application/json\",\n },\n method: \"GET\",\n};\n\nexport const getCountryListEndpoints = {\n \"GET /country\": \"GET /country\",\n getCountryList: \"getCountryList\",\n} as const;\n\nexport async function getCountryListClient(\n defaultRequestInit: RequestInit,\n { apiKey }: GetCountryListRequest = {}\n): Promise<GetCountryListResponse> {\n const overrideOptions: RequestInit = {\n headers: {\n ...(apiKey && { AccessKey: apiKey }),\n },\n };\n\n const response = await fetch(\n url,\n deepmerge(defaultRequestInit, options, overrideOptions)\n );\n\n if (!response.ok) {\n throw new FetchError(response.status, response.statusText, response);\n }\n\n const json: GetCountryListResponse = await response.json();\n\n return json;\n}\n","import { CustomError } from \"ts-custom-error\";\n\nexport class FetchError extends CustomError {\n public constructor(\n public code: number,\n public reason: string,\n public response: Response\n ) {\n super(`${code}: ${reason}`);\n }\n}\n","import { initUntypeable } from \"untypeable\";\n\nexport const u = initUntypeable();\n","import { createTypeLevelClient } from \"untypeable\";\nimport {\n regionList,\n regionListClient,\n regionListEndpoints,\n} from \"./regionList\";\nimport { u } from \"./untypeable\";\n\nconst countriesRouter = u.router({\n [regionListEndpoints.regionList]: regionList,\n [regionListEndpoints[\"GET /region\"]]: regionList,\n});\n\n/**\n * @param defaultInput default input parameters for every request\n * @param defaultRequestInit default fetch parameters for every request\n * @returns regionClient\n *\n * @example\n * ```ts\n * const regionClient = createRegionClient({\n * apiKey: API_ACCESS_KEY,\n * });\n *\n * const response = await regionClient(\"regionList\");\n * ```\n */\nexport function createRegionClient(\n defaultInput: Record<string, any> = {},\n defaultRequestInit: RequestInit = {}\n) {\n const regionClient = createTypeLevelClient<typeof countriesRouter>(\n async (path, input) => {\n const overrideInput = {\n ...defaultInput,\n ...input,\n };\n\n switch (path) {\n case regionListEndpoints.regionList:\n case regionListEndpoints[\"GET /region\"]:\n return regionListClient(defaultRequestInit, overrideInput);\n default:\n throw new Error(\n `[${regionClient.name}]: no endpoint found named \"${path}\"`\n );\n }\n }\n );\n return regionClient;\n}\n","import { deepmerge } from \"deepmerge-ts\";\nimport { FetchError } from \"../../../utilities\";\nimport { u } from \"../untypeable\";\n\nexport interface Region {\n /**\n * Allow latency routing\n * @example true\n */\n AllowLatencyRouting: boolean;\n /**\n * Region [continent code](https://web.archive.org/web/20230428180958/https://gist.github.com/alyssaq/3415363a18610d22f0d307bcaac857cd)\n * @example \"OC\"\n */\n ContinentCode: string;\n /**\n * Region [country code](https://web.archive.org/web/20230428180958/https://gist.github.com/alyssaq/3415363a18610d22f0d307bcaac857cd)\n * @example \"AU\"\n */\n CountryCode: string;\n /**\n * Region id\n * @example 15\n */\n Id: number;\n /**\n * Region latitude\n * @example -33.8674869\n */\n Latitude: number;\n /**\n * Region longitude\n * @example 151.20699020000006\n */\n Longitude: number;\n /**\n * Region name, composed of `${ContinentCode}: ${RegionName}, ${RegionCode}`\n * @example \"OC: Sydney, SYD\"\n * @example \"NA: Honolulu, HI\"\n */\n Name: string;\n /**\n * Region price per gigabyte in dollars (USD$)\n * @example 0.03\n */\n PricePerGigabyte: number;\n /**\n * Region code\n * @example \"SYD\"\n */\n RegionCode: string;\n}\n\nexport interface RegionListRequest {\n /**\n * User-specific [API Key](https://dash.bunny.net/account/settings)\n * @example \"cb1a7c68-89a0-462a-9495-13ebd7366cfe\"\n */\n apiKey?: string;\n}\n\nexport type RegionListResponse = Region[];\n\nexport const regionList = u\n .input<RegionListRequest>()\n .output<RegionListResponse>();\n\nconst url = \"https://api.bunny.net/region\";\nconst options: RequestInit = {\n headers: {\n accept: \"application/json\",\n },\n method: \"GET\",\n};\n\nexport const regionListEndpoints = {\n \"GET /region\": \"GET /region\",\n regionList: \"regionList\",\n} as const;\n\nexport async function regionListClient(\n defaultRequestInit: RequestInit,\n { apiKey }: RegionListRequest = {}\n): Promise<RegionListResponse> {\n const overrideOptions: RequestInit = {\n headers: {\n ...(apiKey && { AccessKey: apiKey }),\n },\n };\n\n const response = await fetch(\n url,\n deepmerge(defaultRequestInit, options, overrideOptions)\n );\n\n if (!response.ok) {\n throw new FetchError(response.status, response.statusText, response);\n }\n\n const json: RegionListResponse = await response.json();\n\n return json;\n}\n","import { initUntypeable } from \"untypeable\";\n\nexport const u = initUntypeable();\n","import { createTypeLevelClient } from \"untypeable\";\nimport {\n getStatistics,\n getStatisticsClient,\n getStatisticsEndpoints,\n} from \"./getStatistics\";\nimport { u } from \"./untypeable\";\n\nconst statisticsRouter = u.router({\n [getStatisticsEndpoints.getStatistics]: getStatistics,\n [getStatisticsEndpoints[\"GET /statistics\"]]: getStatistics,\n});\n\n/**\n * @param defaultInput default input parameters for every request\n * @param defaultRequestInit default fetch parameters for every request\n * @returns statisticsClient\n *\n * @example\n * ```ts\n * const statisticsClient = createStatisticsClient({\n * apiKey: API_ACCESS_KEY,\n * });\n *\n * const response = await statisticsClient(\"getStatistics\");\n * ```\n */\nexport function createStatisticsClient(\n defaultInput: Record<string, any> = {},\n defaultRequestInit: RequestInit = {}\n) {\n const statisticsClient = createTypeLevelClient<typeof statisticsRouter>(\n async (path, input) => {\n const overrideInput = {\n ...defaultInput,\n ...input,\n };\n\n switch (path) {\n case getStatisticsEndpoints.getStatistics:\n case getStatisticsEndpoints[\"GET /statistics\"]:\n return getStatisticsClient(defaultRequestInit, overrideInput);\n default:\n throw new Error(\n `[${statisticsClient.name}]: no endpoint found named \"${path}\"`\n );\n }\n }\n );\n return statisticsClient;\n}\n","import { deepmerge } from \"deepmerge-ts\";\nimport { FetchError } from \"../../../utilities\";\nimport { u } from \"../untypeable\";\n\n// TODO: test after traffic\nexport interface Statistics {\n AverageOriginResponseTime: number;\n BandwidthCachedChart: Record<string, number>;\n BandwidthUsedChart: Record<string, number>;\n CacheHitRate: number;\n CacheHitRateChart: Record<string, number>;\n Error3xxChart: Record<string, number>;\n Error4xxChart: Record<string, number>;\n Error5xxChart: Record<string, number>;\n // TODO\n GeoTrafficDistribution: any; // {}\n OriginResponseTimeChart: Record<string, number>;\n OriginShieldBandwidthUsedChart: Record<string, number>;\n OriginShieldInternalBandwidthUsedChart: Record<string, number>;\n OriginTrafficChart: Record<string, number>;\n PullRequestsPulledChart: Record<string, number>;\n RequestsServedChart: Record<string, number>;\n TotalBandwidthUsed: number;\n TotalOriginTraffic: number;\n TotalRequestsServed: number;\n UserBalanceHistoryChart: Record<string, number>;\n}\n\nexport interface GetStatisticsRequest {\n /**\n * User-specific [API Key](https://dash.bunny.net/account/settings)\n * @example \"cb1a7c68-89a0-462a-9495-13ebd7366cfe\"\n */\n apiKey?: string;\n /**\n * The ISO 8601 start date of the statistics. If no value is passed, the last 30 days will be returned.\n * @example \"2023-04-27T00:00:00Z\"\n */\n dateFrom?: string;\n /**\n * The ISO 8601 end date of the statistics. If no value is passed, the last 30 days will be returned.\n * @example \"2023-04-28T00:00:00Z\"\n */\n dateTo?: string;\n /**\n * If true, the statistics data will be returned in hourly grouping.\n * @example false\n */\n hourly?: boolean;\n /**\n * If set, the respose will contain the non-2xx response\n * @example false\n */\n loadErrors?: boolean;\n /**\n * If set, the statistics will be only returned for the given Pull Zone\n */\n pullZone?: number;\n /**\n * If set, the statistics will be only returned for the given region ID\n */\n serverZoneId?: number;\n}\n\nexport type GetStatisticsResponse = Statistics;\n\nexport const getStatistics = u\n .input<GetStatisticsRequest>()\n .output<GetStatisticsResponse>();\n\nconst url = \"https://api.bunny.net/statistics\";\nconst options: RequestInit = {\n headers: {\n accept: \"application/json\",\n },\n method: \"GET\",\n};\n\nexport const getStatisticsEndpoints = {\n \"GET /statistics\": \"GET /statistics\",\n getStatistics: \"getStatistics\",\n} as const;\n\nexport async function getStatisticsClient(\n defaultRequestInit: RequestInit,\n {\n apiKey,\n dateFrom,\n dateTo,\n hourly = false,\n loadErrors = false,\n pullZone = -1,\n serverZoneId = -1,\n }: GetStatisticsRequest = {}\n): Promise<GetStatisticsResponse> {\n const overrideOptions: RequestInit = {\n headers: {\n ...(apiKey && { AccessKey: apiKey }),\n },\n };\n\n const urlSearchParameters = new URLSearchParams({\n ...(dateFrom && { dateFrom }),\n ...(dateTo && { dateTo }),\n hourly: hourly.toString(),\n loadErrors: loadErrors.toString(),\n pullZone: pullZone.toString(),\n serverZoneId: serverZoneId.toString(),\n }).toString();\n\n const overrideUrl = `${url}?${urlSearchParameters}`;\n\n const response = await fetch(\n overrideUrl,\n deepmerge(defaultRequestInit, options, overrideOptions)\n );\n\n if (!response.ok) {\n throw new FetchError(response.status, response.statusText, response);\n }\n\n const json: GetStatisticsResponse = await response.json();\n\n return json;\n}\n","import { initUntypeable } from \"untypeable\";\n\nexport const u = initUntypeable();\n","import { createTypeLevelClient } from \"untypeable\";\nimport {\n addStorageZone,\n addStorageZoneClient,\n addStorageZoneEndpoints,\n} from \"./addStorageZone\";\nimport {\n checkTheStorageZoneAvailability,\n checkTheStorageZoneAvailabilityClient,\n checkTheStorageZoneAvailabilityEndpoints,\n} from \"./checkTheStorageZoneAvailability\";\nimport {\n deleteStorageZone,\n deleteStorageZoneClient,\n deleteStorageZoneEndpoints,\n} from \"./deleteStorageZone\";\nimport {\n getStorageZone,\n getStorageZoneClient,\n getStorageZoneEndpoints,\n} from \"./getStorageZone\";\nimport {\n getStorageZoneStatistics,\n getStorageZoneStatisticsClient,\n getStorageZoneStatisticsEndpoints,\n} from \"./getStorageZoneStatistics\";\nimport {\n listStorageZones,\n listStorageZonesClient,\n listStorageZonesEndpoints,\n} from \"./listStorageZones\";\nimport {\n resetPassword,\n resetPasswordClient,\n resetPasswordEndpoints,\n} from \"./resetPassword\";\nimport {\n resetReadOnlyPassword,\n resetReadOnlyPasswordClient,\n resetReadOnlyPasswordEndpoints,\n} from \"./resetReadOnlyPassword\";\nimport { u } from \"./untypeable\";\nimport {\n updateStorageZone,\n updateStorageZoneClient,\n updateStorageZoneEndpoints,\n} from \"./updateStorageZone\";\n\nconst storageZoneRouter = u.router({\n [addStorageZoneEndpoints.addStorageZone]: addStorageZone,\n [addStorageZoneEndpoints[\"POST /storagezone\"]]: addStorageZone,\n [checkTheStorageZoneAvailabilityEndpoints.checkTheStorageZoneAvailability]:\n checkTheStorageZoneAvailability,\n [checkTheStorageZoneAvailabilityEndpoints[\n \"POST /storagezone/checkavailability\"\n ]]: checkTheStorageZoneAvailability,\n [deleteStorageZoneEndpoints.deleteStorageZone]: deleteStorageZone,\n [deleteStorageZoneEndpoints[\"DELETE /storagezone/:id\"]]: deleteStorageZone,\n [getStorageZoneEndpoints.getStorageZone]: getStorageZone,\n [getStorageZoneEndpoints[\"GET /storagezone/:id\"]]: getStorageZone,\n [getStorageZoneStatisticsEndpoints.getStorageZoneStatistics]:\n getStorageZoneStatistics,\n [getStorageZoneStatisticsEndpoints[\"GET /storagezone/:id/statistics\"]]:\n getStorageZoneStatistics,\n [listStorageZonesEndpoints.listStorageZones]: listStorageZones,\n [listStorageZonesEndpoints[\"GET /storagezone\"]]: listStorageZones,\n [resetPasswordEndpoints.resetPassword]: resetPassword,\n [resetPasswordEndpoints[\"POST /storagezone/:id/resetPassword\"]]:\n resetPassword,\n [resetReadOnlyPasswordEndpoints.resetReadOnlyPassword]: resetReadOnlyPassword,\n [resetReadOnlyPasswordEndpoints[\n \"POST /storagezone/resetReadOnlyPassword?id=:id\"\n ]]: resetReadOnlyPassword,\n [updateStorageZoneEndpoints.updateStorageZone]: updateStorageZone,\n [updateStorageZoneEndpoints[\"POST /storagezone/:id\"]]: updateStorageZone,\n});\n\n/**\n * @param defaultInput default input parameters for every request\n * @param defaultRequestInit default fetch parameters for every request\n * @returns storageZoneClient\n *\n * @example\n * ```ts\n * const storageZoneClient = createStorageZoneClient({\n * apiKey: API_ACCESS_KEY,\n * });\n *\n * const response = await storageZoneClient(\"addStorageZone\", {\n * Name: \"api-example\",\n * Region: \"NY\",\n * ZoneTier: 1,\n * });\n * ```\n */\nexport function createStorageZoneClient(\n defaultInput: Record<string, any> = {},\n defaultRequestInit: RequestInit = {}\n) {\n const storageZoneClient = createTypeLevelClient<typeof storageZoneRouter>(\n async (path, input) => {\n const overrideInput = {\n ...defaultInput,\n ...input,\n };\n\n switch (path) {\n case addStorageZoneEndpoints.addStorageZone:\n case addStorageZoneEndpoints[\"POST /storagezone\"]:\n return addStorageZoneClient(defaultRequestInit, overrideInput);\n case checkTheStorageZoneAvailabilityEndpoints.checkTheStorageZoneAvailability:\n case checkTheStorageZoneAvailabilityEndpoints[\n \"POST /storagezone/checkavailability\"\n ]:\n return checkTheStorageZoneAvailabilityClient(\n defaultRequestInit,\n overrideInput\n );\n case deleteStorageZoneEndpoints.deleteStorageZone:\n case deleteStorageZoneEndpoints[\"DELETE /storagezone/:id\"]:\n return deleteStorageZoneClient(defaultRequestInit, overrideInput);\n case getStorageZoneEndpoints.getStorageZone:\n case getStorageZoneEndpoints[\"GET /storagezone/:id\"]:\n return getStorageZoneClient(defaultRequestInit, overrideInput);\n case getStorageZoneStatisticsEndpoints.getStorageZoneStatistics:\n case getStorageZoneStatisticsEndpoints[\n \"GET /storagezone/:id/statistics\"\n ]:\n return getStorageZoneStatisticsClient(\n defaultRequestInit,\n overrideInput\n );\n case listStorageZonesEndpoints.listStorageZones:\n case listStorageZonesEndpoints[\"GET /storagezone\"]:\n return listStorageZonesClient(defaultRequestInit, overrideInput);\n case resetPasswordEndpoints.resetPassword:\n case resetPasswordEndpoints[\"POST /storagezone/:id/resetPassword\"]:\n return resetPasswordClient(defaultRequestInit, overrideInput);\n case resetReadOnlyPasswordEndpoints.resetReadOnlyPassword:\n case resetReadOnlyPasswordEndpoints[\n \"POST /storagezone/resetReadOnlyPassword?id=:id\"\n ]:\n return resetReadOnlyPasswordClient(defaultRequestInit, overrideInput);\n case updateStorageZoneEndpoints.updateStorageZone:\n case updateStorageZoneEndpoints[\"POST /storagezone/:id\"]:\n return updateStorageZoneClient(defaultRequestInit, overrideInput);\n default:\n throw new Error(\n `[${storageZoneClient.name}]: no endpoint found named \"${path}\"`\n );\n }\n }\n );\n return storageZoneClient;\n}\n","import { deepmerge } from \"deepmerge-ts\";\nimport { FetchError } from \"../../../utilities\";\nimport type { Region, ReplicationRegion, StorageZone } from \"../types\";\nimport { u } from \"../untypeable\";\n\nexport interface AddStorageZoneRequestBase {\n /**\n * User-specific [API Key](https://dash.bunny.net/account/settings)\n * @example \"cb1a7c68-89a0-462a-9495-13ebd7366cfe\"\n */\n apiKey?: string;\n /**\n * The name of the storage zone\n * @example \"mywebsite\"\n */\n Name: string;\n /**\n * The origin URL of the storage zone that will be added\n *\n * The origin URL is a very important part of your Pull Zone. It tells our servers where to fetch files that we don't yet have in cache. In the majority of cases, this will simply be the URL of your website or storage service. Please make sure that if your website is using HTTPS, that you make sure your origin URL is set up with HTTPS as well to keep the connection encrypted throughout the network.\n *\n * @example \"https://mywebsite.com\"\n */\n OriginUrl?: string;\n /**\n * The code of the main storage zone region (Possible values: DE, NY, LA, SG)\n * @example \"NY\"\n */\n Region: Region;\n}\n\nexport interface AddStorageZoneRequestEdgeSsd\n extends AddStorageZoneRequestBase {\n /**\n * The code of the main storage zone region (Possible values: DE, NY, LA, SG, SYD)\n * @example \"DE\"\n */\n ReplicationRegions?: never;\n /**\n * Determines the storage zone tier that will be storing the data\n *\n * 0 - Standard\n *\n * 1 - Edge (SSD)\n *\n * @example 0\n */\n ZoneTier: 1;\n}\n\nexport interface AddStorageZoneRequestReplicationRegion\n extends AddStorageZoneRequestBase {\n /**\n * The code of the main storage zone region (Possible values: DE, NY, LA, SG, SYD)\n * @example \"DE\"\n */\n ReplicationRegions?: ReplicationRegion[];\n /**\n * Determines the storage zone tier that will be storing the data\n * @example 0\n */\n ZoneTier: 0;\n}\n\n// Mutually exclusive options https://effectivetypescript.com/2021/11/11/optional-never/\nexport type AddStorageZoneRequest =\n | AddStorageZoneRequestEdgeSsd\n | AddStorageZoneRequestReplicationRegion;\n\nexport type AddStorageZoneResponse = StorageZone;\n\nexport const addStorageZone = u\n .input<AddStorageZoneRequest>()\n .output<AddStorageZoneResponse>();\n\nconst url = \"https://api.bunny.net/storagezone\";\nconst options: RequestInit = {\n headers: {\n accept: \"application/json\",\n \"content-type\": \"application/json\",\n },\n method: \"POST\",\n};\n\nexport const addStorageZoneEndpoints = {\n addStorageZone: \"addStorageZone\",\n \"POST /storagezone\": \"POST /storagezone\",\n} as const;\n\nexport async function addStorageZoneClient(\n defaultRequestInit: RequestInit,\n { apiKey, ...input }: AddStorageZoneRequest\n): Promise<AddStorageZoneResponse> {\n const overrideOptions: RequestInit = {\n body: JSON.stringify(input),\n headers: {\n ...(apiKey && { AccessKey: apiKey }),\n },\n };\n\n const response = await fetch(\n url,\n deepmerge(defaultRequestInit, options, overrideOptions)\n );\n\n if (!response.ok) {\n throw new FetchError(response.status, response.statusText, response);\n }\n\n const json: AddStorageZoneResponse = await response.json();\n\n return json;\n}\n","import { initUntypeable } from \"untypeable\";\n\nexport const u = initUntypeable();\n","import { deepmerge } from \"deepmerge-ts\";\nimport { FetchError } from \"../../../utilities\";\nimport { u } from \"../untypeable\";\n\nexport interface CheckTheStorageZoneAvailabilityRequest {\n /**\n * User-specific [API Key](https://dash.bunny.net/account/settings)\n * @example \"cb1a7c68-89a0-462a-9495-13ebd7366cfe\"\n */\n apiKey?: string;\n /**\n * Determines the name of the zone that we are checking.\n *\n * The zone can be any in the [Points of Presence](https://web.archive.org/web/20230427225159/https://www.imperva.com/learn/performance/what-is-cdn-how-it-works/) [list](https://web.archive.org/web/20230427225239/https://bunny.net/network/) of abbreviations\n * @example \"NY\"\n */\n Name: string;\n}\n\nexport interface CheckTheStorageZoneAvailabilityResponse {\n Available: boolean;\n}\n\nexport const checkTheStorageZoneAvailability = u\n .input<CheckTheStorageZoneAvailabilityRequest>()\n .output<CheckTheStorageZoneAvailabilityResponse>();\n\nconst url = \"https://api.bunny.net/storagezone/checkavailability\";\nconst options: RequestInit = {\n headers: {\n accept: \"application/json\",\n \"content-type\": \"application/json\",\n },\n method: \"POST\",\n};\n\nexport const checkTheStorageZoneAvailabilityEndpoints = {\n checkTheStorageZoneAvailability: \"checkTheStorageZoneAvailability\",\n \"POST /storagezone/checkavailability\": \"POST /storagezone/checkavailability\",\n} as const;\n\nexport async function checkTheStorageZoneAvailabilityClient(\n defaultRequestInit: RequestInit,\n { apiKey, ...input }: CheckTheStorageZoneAvailabilityRequest\n): Promise<CheckTheStorageZoneAvailabilityResponse> {\n const overrideOptions: RequestInit = {\n body: JSON.stringify(input),\n headers: {\n ...(apiKey && { AccessKey: apiKey }),\n },\n };\n\n const response = await fetch(\n url,\n deepmerge(defaultRequestInit, options, overrideOptions)\n );\n\n if (!response.ok) {\n throw new FetchError(response.status, response.statusText, response);\n }\n\n const json: CheckTheStorageZoneAvailabilityResponse = await response.json();\n\n return json;\n}\n","import { deepmerge } from \"deepmerge-ts\";\nimport { FetchError } from \"../../../utilities\";\nimport { u } from \"../untypeable\";\n\nexport interface DeleteStorageZoneRequest {\n /**\n * User-specific [API Key](https://dash.bunny.net/account/settings)\n * @example \"cb1a7c68-89a0-462a-9495-13ebd7366cfe\"\n */\n apiKey?: string;\n /**\n * IMPORTANT: deleted buckets cannot be re-created with the same name\n *\n * You can list deleted buckets with the `includeDeleted` option when using `listFiles`\n *\n * The Storage Zone ID that should be deleted\n * @example 270299\n */\n id: number;\n}\n\nexport type DeleteStorageZoneResponse = void;\n\nexport const deleteStorageZone = u\n .input<DeleteStorageZoneRequest>()\n .output<DeleteStorageZoneResponse>();\n\nconst url = \"https://api.bunny.net/storagezone\";\nconst options: RequestInit = {\n method: \"DELETE\",\n};\n\nexport const deleteStorageZoneEndpoints = {\n \"DELETE /storagezone/:id\": \"DELETE /storagezone/:id\",\n deleteStorageZone: \"deleteStorageZone\",\n} as const;\n\nexport async function deleteStorageZoneClient(\n defaultRequestInit: RequestInit,\n { apiKey, id }: DeleteStorageZoneRequest\n): Promise<DeleteStorageZoneResponse> {\n const overrideOptions: RequestInit = {\n headers: {\n ...(apiKey && { AccessKey: apiKey }),\n },\n };\n\n const overrideUrl = `${url}/${id}`;\n\n const response = await fetch(\n overrideUrl,\n deepmerge(defaultRequestInit, options, overrideOptions)\n );\n\n if (!response.ok) {\n throw new FetchError(response.status, response.statusText, response);\n }\n}\n","import { deepmerge } from \"deepmerge-ts\";\nimport { FetchError } from \"../../../utilities\";\nimport type { StorageZone } from \"../types\";\nimport { u } from \"../untypeable\";\n\nexport interface GetStorageZoneRequest {\n /**\n * User-specific [API Key](https://dash.bunny.net/account/settings)\n * @example \"cb1a7c68-89a0-462a-9495-13ebd7366cfe\"\n */\n apiKey?: string;\n /**\n * The ID of the Storage Zone that should be returned\n * @example 270299\n */\n id: number;\n}\n\nexport type GetStorageZoneResponse = StorageZone;\n\nexport const getStorageZone = u\n .input<GetStorageZoneRequest>()\n .output<GetStorageZoneResponse>();\n\nconst url = \"https://api.bunny.net/storagezone\";\nconst options: RequestInit = {\n headers: {\n accept: \"application/json\",\n },\n method: \"GET\",\n};\n\nexport const getStorageZoneEndpoints = {\n \"GET /storagezone/:id\": \"GET /storagezone/:id\",\n getStorageZone: \"getStorageZone\",\n} as const;\n\nexport async function getStorageZoneClient(\n defaultRequestInit: RequestInit,\n { apiKey, id }: GetStorageZoneRequest\n): Promise<GetStorageZoneResponse> {\n const overrideOptions: RequestInit = {\n headers: {\n ...(apiKey && { AccessKey: apiKey }),\n },\n };\n\n const overrideUrl = `${url}/${id}`;\n\n const response = await fetch(\n overrideUrl,\n deepmerge(defaultRequestInit, options, overrideOptions)\n );\n\n if (!response.ok) {\n throw new FetchError(response.status, response.statusText, response);\n }\n\n const json: GetStorageZoneResponse = await response.json();\n\n return json;\n}\n","import { deepmerge } from \"deepmerge-ts\";\nimport { FetchError } from \"../../../utilities\";\nimport { u } from \"../untypeable\";\n\nexport interface GetStorageZoneStatisticsRequest {\n /**\n * User-specific [API Key](https://dash.bunny.net/account/settings)\n * @example \"cb1a7c68-89a0-462a-9495-13ebd7366cfe\"\n */\n apiKey?: string;\n /**\n * The ISO 8601 start date of the statistics. If no value is passed, the last 30 days will be returned.\n * @example \"2023-04-15T00:00:00Z\"\n */\n dateFrom?: string;\n /**\n * The ISO 8601 end date of the statistics. If no value is passed, the last 30 days will be returned.\n * @example \"2023-04-17T00:00:00Z\"\n */\n dateTo?: string;\n /**\n * The ID of the storage zone\n * @example 270299\n */\n id: number;\n}\n\nexport interface GetStorageZoneStatisticsResponse {\n /**\n * BUG: may be inaccurate with new or empty buckets\n *\n * key: ISO 8601 date and time\n *\n * value: total file count\n *\n * @example { \"2023-03-29T00:00:00Z\": 191475, }\n */\n FileCountChart: Record<string, number>;\n /**\n * BUG: may be inaccurate with new or empty buckets\n *\n * key: ISO 8601 date and time\n *\n * value: storage used\n *\n * @example { \"2023-03-29T00:00:00Z\": 9274615899, }\n */\n StorageUsedChart: Record<string, number>;\n}\n\nexport const getStorageZoneStatistics = u\n .input<GetStorageZoneStatisticsRequest>()\n .output<GetStorageZoneStatisticsResponse>();\n\nconst url = \"https://api.bunny.net/storagezone\";\nconst options: RequestInit = {\n headers: {\n accept: \"application/json\",\n },\n method: \"GET\",\n};\n\nexport const getStorageZoneStatisticsEndpoints = {\n \"GET /storagezone/:id/statistics\": \"GET /storagezone/:id/statistics\",\n getStorageZoneStatistics: \"getStorageZoneStatistics\",\n} as const;\n\nexport async function getStorageZoneStatisticsClient(\n defaultRequestInit: RequestInit,\n { apiKey, dateFrom, dateTo, id }: GetStorageZoneStatisticsRequest\n): Promise<GetStorageZoneStatisticsResponse> {\n const overrideOptions: RequestInit = {\n headers: {\n ...(apiKey && { AccessKey: apiKey }),\n },\n };\n\n const urlSearchParameters = new URLSearchParams({\n ...(dateFrom && { dateFrom }),\n ...(dateTo && { dateTo }),\n }).toString();\n\n const overrideUrl = `${url}/${id}/statistics?${urlSearchParameters}`;\n\n const response = await fetch(\n overrideUrl,\n deepmerge(defaultRequestInit, options, overrideOptions)\n );\n\n if (!response.ok) {\n throw new FetchError(response.status, response.statusText, response);\n }\n\n const json: GetStorageZoneStatisticsResponse = await response.json();\n\n return json;\n}\n","import { deepmerge } from \"deepmerge-ts\";\nimport { FetchError } from \"../../../utilities\";\nimport type { StorageZone } from \"../types\";\nimport { u } from \"../untypeable\";\n\nexport interface ListStorageZonesRequest {\n /**\n * User-specific [API Key](https://dash.bunny.net/account/settings)\n * @example \"cb1a7c68-89a0-462a-9495-13ebd7366cfe\"\n */\n apiKey?: string;\n /**\n * Should include deleted storage zones\n * @example false\n */\n includeDeleted?: boolean;\n /**\n * Page number between 1 and 2147483647\n * @example 1\n */\n page?: number;\n /**\n * Number of results per page between 5 and 1000\n * @example 1000\n */\n perPage?: number;\n /**\n * The search term that will be used to filter the results\n * @example \"storage-zone-name-substring\"\n */\n search?: string;\n}\n\nexport interface ListStorageZonesResponse {\n /**\n * The current query page number\n * @example 1\n */\n CurrentPage: number;\n /**\n * Whether the query has additional pages of results\n * @example false\n */\n HasMoreItems: boolean;\n /**\n * List of storage zones that match the query\n */\n Items: StorageZone[];\n /**\n * The total number of queried items in all pages\n * @example 5\n */\n TotalItems: number;\n}\n\nexport const listStorageZones = u\n .input<ListStorageZonesRequest>()\n .output<ListStorageZonesResponse>();\n\nconst url = \"https://api.bunny.net/storagezone\";\nconst options: RequestInit = {\n headers: {\n accept: \"application/json\",\n },\n method: \"GET\",\n};\n\nexport const listStorageZonesEndpoints = {\n \"GET /storagezone\": \"GET /storagezone\",\n listStorageZones: \"listStorageZones\",\n} as const;\n\nexport async function listStorageZonesClient(\n defaultRequestInit: RequestInit,\n {\n apiKey,\n includeDeleted,\n page = 1,\n perPage = 1000,\n search,\n }: ListStorageZonesRequest\n): Promise<ListStorageZonesResponse> {\n const overrideOptions: RequestInit = {\n headers: {\n ...(apiKey && { AccessKey: apiKey }),\n },\n };\n\n const urlSearchParameters = new URLSearchParams({\n ...(typeof includeDeleted === \"boolean\" && {\n includeDeleted: includeDeleted.toString(),\n }),\n ...(search && { search }),\n page: page.toString(),\n perPage: perPage.toString(),\n }).toString();\n\n const overrideUrl = `${url}?${urlSearchParameters}`;\n\n const response = await fetch(\n overrideUrl,\n deepmerge(defaultRequestInit, options, overrideOptions)\n );\n\n if (!response.ok) {\n throw new FetchError(response.status, response.statusText, response);\n }\n\n const json: ListStorageZonesResponse = await response.json();\n\n return json;\n}\n","import { deepmerge } from \"deepmerge-ts\";\nimport { FetchError } from \"../../../utilities\";\nimport { u } from \"../untypeable\";\n\nexport interface ResetPasswordRequest {\n /**\n * User-specific [API Key](https://dash.bunny.net/account/settings)\n * @example \"cb1a7c68-89a0-462a-9495-13ebd7366cfe\"\n */\n apiKey?: string;\n /**\n * The ID of the storage zone that should have the password reset\n * @example 270299\n */\n id: number;\n}\n\nexport type ResetPasswordResponse = void;\n\nexport const resetPassword = u\n .input<ResetPasswordRequest>()\n .output<ResetPasswordResponse>();\n\nconst url = \"https://api.bunny.net/storagezone\";\nconst options: RequestInit = {\n method: \"POST\",\n};\n\nexport const resetPasswordEndpoints = {\n \"POST /storagezone/:id/resetPassword\": \"POST /storagezone/:id/resetPassword\",\n resetPassword: \"resetPassword\",\n} as const;\n\nexport async function resetPasswordClient(\n defaultRequestInit: RequestInit,\n { apiKey, id }: ResetPasswordRequest\n): Promise<ResetPasswordResponse> {\n const overrideOptions: RequestInit = {\n headers: {\n ...(apiKey && { AccessKey: apiKey }),\n },\n };\n\n const overrideUrl = `${url}/${id}/resetPassword`;\n\n const response = await fetch(\n overrideUrl,\n deepmerge(defaultRequestInit, options, overrideOptions)\n );\n\n if (!response.ok) {\n throw new FetchError(response.status, response.statusText, response);\n }\n}\n","import { deepmerge } from \"deepmerge-ts\";\nimport { FetchError } from \"../../../utilities\";\nimport { u } from \"../untypeable\";\n\nexport interface ResetReadOnlyPasswordRequest {\n /**\n * User-specific [API Key](https://dash.bunny.net/account/settings)\n * @example \"cb1a7c68-89a0-462a-9495-13ebd7366cfe\"\n */\n apiKey?: string;\n /**\n * The ID of the storage zone that should have the read-only password reset\n * @example 270299\n */\n id: number;\n}\n\nexport type ResetReadOnlyPasswordResponse = void;\n\nexport const resetReadOnlyPassword = u\n .input<ResetReadOnlyPasswordRequest>()\n .output<ResetReadOnlyPasswordResponse>();\n\nconst url = \"https://api.bunny.net/storagezone/resetReadOnlyPassword\";\nconst options: RequestInit = {\n method: \"POST\",\n};\n\nexport const resetReadOnlyPasswordEndpoints = {\n \"POST /storagezone/resetReadOnlyPassword?id=:id\":\n \"POST /storagezone/resetReadOnlyPassword?id=:id\",\n resetReadOnlyPassword: \"resetReadOnlyPassword\",\n} as const;\n\nexport async function resetReadOnlyPasswordClient(\n defaultRequestInit: RequestInit,\n { apiKey, id }: ResetReadOnlyPasswordRequest\n): Promise<ResetReadOnlyPasswordResponse> {\n const overrideOptions: RequestInit = {\n headers: {\n ...(apiKey && { AccessKey: apiKey }),\n },\n };\n\n const urlSearchParameters = new URLSearchParams({\n id: id.toString(),\n }).toString();\n\n const overrideUrl = `${url}?${urlSearchParameters}`;\n\n const response = await fetch(\n overrideUrl,\n deepmerge(defaultRequestInit, options, overrideOptions)\n );\n\n if (!response.ok) {\n throw new FetchError(response.status, response.statusText, response);\n }\n}\n","import { deepmerge } from \"deepmerge-ts\";\nimport { FetchError } from \"../../../utilities\";\nimport type { ReplicationRegion as ReplicationZone } from \"../types\";\nimport { u } from \"../untypeable\";\n\n// TODO\nexport interface UpdateStorageZoneRequest {\n /**\n * User-specific [API Key](https://dash.bunny.net/account/settings)\n * @example \"cb1a7c68-89a0-462a-9495-13ebd7366cfe\"\n */\n apiKey?: string;\n // TODO: confirm path\n /**\n * The path to the custom file that will be returned in a case of 404\n * @example \"/my-partial/url/404.html\"\n */\n Custom404FilePath?: string;\n /**\n * The ID of the storage zone that should be updated\n * @example 270302\n */\n id: number;\n /**\n * The origin URL of the storage zone\n *\n * The origin URL is a very important part of your Pull Zone. It tells our servers where to fetch files that we don't yet have in cache. In the majority of cases, this will simply be the URL of your website or storage service. Please make sure that if your website is using HTTPS, that you make sure your origin URL is set up with HTTPS as well to keep the connection encrypted throughout the network.\n *\n * @example \"https://mywebsite.com\"\n */\n OriginUrl?: string;\n /**\n * The list of replication zones enabled for the storage zone\n * @example \"DE\"\n */\n ReplicationZones?: ReplicationZone[];\n /**\n * Rewrite 404 status code to 200 for URLs without extension\n * @example true\n */\n Rewrite404To200?: boolean;\n}\n\nexport type UpdateStorageZoneResponse = void;\n\nexport const updateStorageZone = u\n .input<UpdateStorageZoneRequest>()\n .output<UpdateStorageZoneResponse>();\n\nconst url = \"https://api.bunny.net/storagezone\";\nconst options: RequestInit = {\n headers: {\n accept: \"application/json\",\n \"content-type\": \"application/json\",\n },\n method: \"POST\",\n};\n\nexport const updateStorageZoneEndpoints = {\n \"POST /storagezone/:id\": \"POST /storagezone/:id\",\n updateStorageZone: \"updateStorageZone\",\n} as const;\n\nexport async function updateStorageZoneClient(\n defaultRequestInit: RequestInit,\n { apiKey, id, ...input }: UpdateStorageZoneRequest\n): Promise<UpdateStorageZoneResponse> {\n const overrideOptions: RequestInit = {\n body: JSON.stringify(input),\n headers: {\n ...(apiKey && { AccessKey: apiKey }),\n },\n };\n\n const overrideUrl = `${url}/${id}`;\n\n const response = await fetch(\n overrideUrl,\n deepmerge(defaultRequestInit, options, overrideOptions)\n );\n\n if (!response.ok) {\n throw new FetchError(response.status, response.statusText, response);\n }\n}\n","import { createTypeLevelClient } from \"untypeable\";\nimport {\n closeTicket,\n closeTicketClient,\n closeTicketEndpoints,\n} from \"./closeTicket\";\nimport {\n createTicket,\n createTicketClient,\n createTicketEndpoints,\n} from \"./createTicket\";\nimport {\n getTicketDetails,\n getTicketDetailsClient,\n getTicketDetailsEndpoints,\n} from \"./getTicketDetails\";\nimport {\n getTicketList,\n getTicketListClient,\n getTicketListEndpoints,\n} from \"./getTicketList\";\nimport {\n replyTicket,\n replyTicketClient,\n replyTicketEndpoints,\n} from \"./replyTicket\";\nimport { u } from \"./untypeable\";\n\nconst statisticsRouter = u.router({\n [closeTicketEndpoints.closeTicket]: closeTicket,\n [closeTicketEndpoints[\"POST /support/ticket/:id/close\"]]: closeTicket,\n [createTicketEndpoints.createTicket]: createTicket,\n [createTicketEndpoints[\"POST /support/ticket/create\"]]: createTicket,\n [getTicketDetailsEndpoints.getTicketDetails]: getTicketDetails,\n [getTicketDetailsEndpoints[\"GET /support/ticket/details/:id\"]]:\n getTicketDetails,\n [getTicketListEndpoints.getTicketList]: getTicketList,\n [getTicketListEndpoints[\"GET /support/ticket/list\"]]: getTicketList,\n [replyTicketEndpoints.replyTicket]: replyTicket,\n [replyTicketEndpoints[\"POST /support/ticket/:id/reply\"]]: replyTicket,\n});\n\n/**\n * @param defaultInput default input parameters for every request\n * @param defaultRequestInit default fetch parameters for every request\n * @returns statisticsClient\n *\n * @example\n * ```ts\n * const supportClient = createSupportClient({\n * apiKey: API_ACCESS_KEY,\n * });\n *\n * const response = await supportClient(\"getTicketList\");\n * ```\n */\nexport function createSupportClient(\n defaultInput: Record<string, any> = {},\n defaultRequestInit: RequestInit = {}\n) {\n const supportClient = createTypeLevelClient<typeof statisticsRouter>(\n async (path, input) => {\n const overrideInput = {\n ...defaultInput,\n ...input,\n };\n\n switch (path) {\n case closeTicketEndpoints.closeTicket:\n case closeTicketEndpoints[\"POST /support/ticket/:id/close\"]:\n return closeTicketClient(defaultRequestInit, overrideInput);\n case createTicketEndpoints.createTicket:\n case createTicketEndpoints[\"POST /support/ticket/create\"]:\n return createTicketClient(defaultRequestInit, overrideInput);\n case getTicketDetailsEndpoints.getTicketDetails:\n case getTicketDetailsEndpoints[\"GET /support/ticket/details/:id\"]:\n return getTicketDetailsClient(defaultRequestInit, overrideInput);\n case getTicketListEndpoints.getTicketList:\n case getTicketListEndpoints[\"GET /support/ticket/list\"]:\n return getTicketListClient(defaultRequestInit, overrideInput);\n case replyTicketEndpoints.replyTicket:\n case replyTicketEndpoints[\"POST /support/ticket/:id/reply\"]:\n return replyTicketClient(defaultRequestInit, overrideInput);\n default:\n throw new Error(\n `[${supportClient.name}]: no endpoint found named \"${path}\"`\n );\n }\n }\n );\n return supportClient;\n}\n","import { deepmerge } from \"deepmerge-ts\";\nimport { FetchError } from \"../../../utilities\";\nimport { u } from \"../untypeable\";\n\nexport interface CloseTicketRequest {\n /**\n * User-specific [API Key](https://dash.bunny.net/account/settings)\n * @example \"cb1a7c68-89a0-462a-9495-13ebd7366cfe\"\n */\n apiKey?: string;\n /**\n * Ticket id\n * @example 196584\n */\n id: number;\n}\n\nexport type CloseTicketResponse = void;\n\nexport const closeTicket = u\n .input<CloseTicketRequest>()\n .output<CloseTicketResponse>();\n\nconst url = \"https://api.bunny.net/support/ticket\";\nconst options: RequestInit = {\n method: \"POST\",\n};\n\nexport const closeTicketEndpoints = {\n closeTicket: \"closeTicket\",\n \"POST /support/ticket/:id/close\": \"POST /support/ticket/:id/close\",\n} as const;\n\nexport async function closeTicketClient(\n defaultRequestInit: RequestInit,\n { apiKey, id }: CloseTicketRequest\n): Promise<CloseTicketResponse> {\n const overrideOptions: RequestInit = {\n headers: {\n ...(apiKey && { AccessKey: apiKey }),\n },\n };\n\n const overrideUrl = `${url}/${id}/close`;\n\n const response = await fetch(\n overrideUrl,\n deepmerge(defaultRequestInit, options, overrideOptions)\n );\n\n if (!response.ok) {\n throw new FetchError(response.status, response.statusText, response);\n }\n}\n","import { initUntypeable } from \"untypeable\";\n\nexport const u = initUntypeable();\n","import { deepmerge } from \"deepmerge-ts\";\nimport { FetchError } from \"../../../utilities\";\nimport type { CreateAttachment, Ticket } from \"../types\";\nimport { u } from \"../untypeable\";\n\n// TODO: fill in all the id examples\nexport interface CreateTicketRequest {\n /**\n * User-specific [API Key](https://dash.bunny.net/account/settings)\n * @example \"cb1a7c68-89a0-462a-9495-13ebd7366cfe\"\n */\n apiKey?: string;\n /**\n * File attachments related to this ticket\n */\n Attachments?: CreateAttachment[];\n /**\n * Dns zone id related to this ticket\n */\n LinkedDnsZone?: number;\n /**\n * Pull zone id related to this ticket\n */\n LinkedPullZone?: number;\n /**\n * Storage zone id related to this ticket\n */\n LinkedStorageZone?: number;\n /**\n * Video library id related to this ticket\n */\n LinkedVideoLibrary?: number;\n /**\n * Ticket message\n * @example \"My videos are buffering\"\n */\n Message: string;\n /**\n * Ticket subject line\n * @example \"Stream\"\n */\n Subject?: string;\n}\n\nexport type CreateTicketResponse = Ticket;\n\nexport const createTicket = u\n .input<CreateTicketRequest>()\n .output<CreateTicketResponse>();\n\nconst url = \"https://api.bunny.net/support/ticket/create\";\nconst options: RequestInit = {\n headers: {\n accept: \"application/json\",\n \"content-type\": \"application/json\",\n },\n method: \"POST\",\n};\n\nexport const createTicketEndpoints = {\n createTicket: \"createTicket\",\n \"POST /support/ticket/create\": \"POST /support/ticket/create\",\n} as const;\n\nexport async function createTicketClient(\n defaultRequestInit: RequestInit,\n { apiKey, ...input }: CreateTicketRequest\n): Promise<CreateTicketResponse> {\n const overrideOptions: RequestInit = {\n body: JSON.stringify(input),\n headers: {\n ...(apiKey && { AccessKey: apiKey }),\n },\n };\n\n const response = await fetch(\n url,\n deepmerge(defaultRequestInit, options, overrideOptions)\n );\n\n if (!response.ok) {\n throw new FetchError(response.status, response.statusText, response);\n }\n\n const json: CreateTicketResponse = await response.json();\n\n return json;\n}\n","import { deepmerge } from \"deepm