export type PatchApiV1beta1ProjectsProjectFreightFreightNameOrAliasAliasArgs = {project: string, 'freight-name-or-alias': string, newAlias: string}; export type PatchApiV1beta1ProjectsProjectFreightFreightNameOrAliasAliasOptions = {baseUrl: string, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Patch a Freight resource's alias * * PATCH /v1beta1/projects/{project}/freight/{freight-name-or-alias}/alias */ export const patchApiV1beta1ProjectsProjectFreightFreightNameOrAliasAlias = async (args: PatchApiV1beta1ProjectsProjectFreightFreightNameOrAliasAliasArgs, options: PatchApiV1beta1ProjectsProjectFreightFreightNameOrAliasAliasOptions) => { const {baseUrl, fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.newAlias != null) query.append("newAlias", String(args.newAlias)) if (BearerAuth !== undefined) headers.set("Authorization", BearerAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1beta1/projects/${encodeURIComponent(String(args.project))}/freight/${encodeURIComponent(String(args['freight-name-or-alias']))}/alias${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };