export type SiteType = 'laravel' | 'symfony' | 'statamic' | 'wordpress' | 'phpmyadmin' | 'php' | 'nextjs' | 'nuxtjs' | 'static-html' | 'other' | 'custom'; export type PhpVersion = 'php5' | 'php56-old' | 'php56' | 'php70' | 'php71' | 'php72' | 'php73' | 'php74' | 'php80' | 'php81' | 'php82' | 'php83' | 'php84' | 'php85'; export type UpdateSiteRequest = {root_path?: (string | null) | undefined, directory?: (string | null) | undefined, type?: SiteType | undefined, php_version?: PhpVersion | undefined, push_to_deploy?: boolean | undefined, repository_branch?: (string | null) | undefined}; export type UpdateApiOrgsOrganizationServersServerSitesSiteArgs = {organization: string, server: number, site: number, body: UpdateSiteRequest}; export type UpdateApiOrgsOrganizationServersServerSitesSiteOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update site * * PUT /orgs/{organization}/servers/{server}/sites/{site} */ export const updateApiOrgsOrganizationServersServerSitesSite = async (args: UpdateApiOrgsOrganizationServersServerSitesSiteArgs, options?: UpdateApiOrgsOrganizationServersServerSitesSiteOptions) => { const {baseUrl = "https://forge.laravel.com/api", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/orgs/${encodeURIComponent(String(args.organization))}/servers/${encodeURIComponent(String(args.server))}/sites/${encodeURIComponent(String(args.site))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };