export type CreatedAt = string; export type AdminCreator = {username?: string | undefined}; export type UpdatedAt = string; export type AdminUpdater = {username?: string | undefined}; export type WebsiteBackend = {id?: string | undefined, frontend_host?: string | undefined, backend_protocol?: ('http' | 'https') | undefined, server_host?: string | undefined, server_port?: number | undefined, created_at?: CreatedAt | undefined, creator?: AdminCreator | undefined, updated_at?: UpdatedAt | undefined, updater?: AdminUpdater | undefined}; export type CreateApiApiUmbrellaV1WebsiteBackendsArgs = {body: {website_backend?: WebsiteBackend | undefined}}; export type CreateApiApiUmbrellaV1WebsiteBackendsOptions = {baseUrl: string, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a new website backend. * * POST /api-umbrella/v1/website_backends * * Also accepts auth: admin_auth_token */ export const createApiApiUmbrellaV1WebsiteBackends = async (args: CreateApiApiUmbrellaV1WebsiteBackendsArgs, options: CreateApiApiUmbrellaV1WebsiteBackendsOptions) => { const {baseUrl, fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("X-Api-Key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api-umbrella/v1/website_backends${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 };