export type PatchApiV1FrontendServiceServiceIdServicenameArgs = {serviceId: string, body: string}; export type PatchApiV1FrontendServiceServiceIdServicenameOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Update service name of Test and Live (if existent) accounts for service * * PATCH /v1/frontend/service/{serviceId}/servicename */ export const patchApiV1FrontendServiceServiceIdServicename = async (args: PatchApiV1FrontendServiceServiceIdServicenameArgs, options: PatchApiV1FrontendServiceServiceIdServicenameOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/frontend/service/${encodeURIComponent(String(args.serviceId))}/servicename${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };