export type KeyValuePairDTO = {key: string, value: string}; export type OpenapiPodExposePortRequest = {port: number, protocol?: ('HTTP' | 'TCP') | undefined}; export type PodV2VolumeRequest = {id: string, mountPath: string}; export type PodV2CreateRequest = {regions?: Array | undefined, name: string, image: string, containerRegistryAuthId?: number | undefined, imageRegistry?: string | undefined, imagePublicType?: ('PUBLIC' | 'PRIVATE') | undefined, resourceType?: ('GPU' | 'CPU') | undefined, gpuType: string, gpuCount: number, isSpot?: boolean | undefined, maxPrice?: number | undefined, shmInGb?: number | undefined, minSingleCardRamInGb?: number | undefined, minSingleCardVramInGb?: number | undefined, minSingleCardVcpu?: number | undefined, containerVolumeInGb?: number | undefined, initializationCommand?: string | undefined, environmentVars?: Array | undefined, expose?: Array | undefined, volumes?: Array | undefined, callbackUrl?: string | undefined}; export type CreateApiV2PodsArgs = {body: PodV2CreateRequest}; export type CreateApiV2PodsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Create Pod * * POST /v2/pods */ export const createApiV2Pods = async (args: CreateApiV2PodsArgs, options: CreateApiV2PodsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/v2/pods${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 res.blob() };