export type UpdateOrganizationConfigurationRequest = {subdomain: string}; export type UpdateApiV4OrganizationsOrganizationIdConfigurationArgs = {'If-Match'?: string | undefined, body: UpdateOrganizationConfigurationRequest}; export type UpdateApiV4OrganizationsOrganizationIdConfigurationOptions = {baseUrl?: string | undefined, token?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Organization Configuration * * PUT /v4/organizations/{organizationId}/configuration */ export const updateApiV4OrganizationsOrganizationIdConfiguration = async (args: UpdateApiV4OrganizationsOrganizationIdConfigurationArgs, options?: UpdateApiV4OrganizationsOrganizationIdConfigurationOptions) => { const {baseUrl = "https://cloudapi.cloud.couchbase.com", fetch: fetchFn = fetch, token} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['If-Match'] != null) headers.set("If-Match", String(args['If-Match'])) if (token !== undefined) headers.set('authorization', `Bearer ${token}`) const url = `${baseUrl.replace(/\/+$/, '')}/v4/organizations/${encodeURIComponent(String(args.organizationId))}/configuration${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 };