export type Author = {profilePhotoUri?: string | undefined, type?: ('AUTHOR_TYPE_UNSPECIFIED' | 'REGULAR_USER' | 'LOCAL_GUIDE' | 'MERCHANT') | undefined, displayName?: string | undefined}; export type Answer = {name?: string | undefined, createTime?: unknown | undefined, upvoteCount?: number | undefined, text?: string | undefined, author?: Author | undefined, updateTime?: unknown | undefined}; export type Question = {totalAnswerCount?: number | undefined, upvoteCount?: number | undefined, name?: string | undefined, topAnswers?: Array | undefined, createTime?: unknown | undefined, text?: string | undefined, author?: Author | undefined, updateTime?: unknown | undefined}; export type PatchApiV1NameArgs = {name: string, updateMask?: string | undefined, body: Question}; export type PatchApiV1NameOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates a specific question written by the current user. * * PATCH /v1/{+name} */ export const patchApiV1Name = async (args: PatchApiV1NameArgs, options?: PatchApiV1NameOptions) => { const {baseUrl = "https://mybusinessqanda.googleapis.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (args.updateMask != null) query.append("updateMask", String(args.updateMask)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/${encodeURIComponent(String(args['+name']))}${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() };