export type AccountLabel = {name?: string | undefined, labelId?: unknown | undefined, accountId?: unknown | undefined, description?: string | undefined, labelType?: ('LABEL_TYPE_UNSPECIFIED' | 'MANUAL' | 'AUTOMATIC') | undefined}; export type PatchApiAccountsAccountIdLabelsLabelIdArgs = {accountId: string, labelId: string, body: AccountLabel}; export type PatchApiAccountsAccountIdLabelsLabelIdOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates a label. * * PATCH /accounts/{accountId}/labels/{labelId} */ export const patchApiAccountsAccountIdLabelsLabelId = async (args: PatchApiAccountsAccountIdLabelsLabelIdArgs, options?: PatchApiAccountsAccountIdLabelsLabelIdOptions) => { const {baseUrl = "https://shoppingcontent.googleapis.com/content/v2.1", fetch: fetchFn = fetch, Oauth2, Oauth2c} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) if (Oauth2c !== undefined) headers.set('authorization', `Bearer ${Oauth2c}`) const url = `${baseUrl.replace(/\/+$/, '')}/accounts/${encodeURIComponent(String(args.accountId))}/labels/${encodeURIComponent(String(args.labelId))}${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 res.blob() };