export type CreateApiApiV2InstancesInstanceIDStartOptions = {baseUrl: string, oauth2Authentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Start instance * * POST /api/v2/instances/{instanceID}/start */ export const createApiApiV2InstancesInstanceIDStart = async (options: CreateApiApiV2InstancesInstanceIDStartOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2Authentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (oauth2Authentication !== undefined) headers.set('authorization', `Bearer ${oauth2Authentication}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/instances/${encodeURIComponent(String(args.instanceID))}/start${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };