export type GetApiV1ParentAnswersArgs = {parent: string, orderBy?: string | undefined, pageSize?: number | undefined, pageToken?: string | undefined}; export type GetApiV1ParentAnswersOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Returns the paginated list of answers for a specified question. * * GET /v1/{+parent}/answers */ export const getApiV1ParentAnswers = async (args: GetApiV1ParentAnswersArgs, options?: GetApiV1ParentAnswersOptions) => { const {baseUrl = "https://mybusinessqanda.googleapis.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.orderBy != null) query.append("orderBy", String(args.orderBy)) if (args.pageSize != null) query.append("pageSize", String(args.pageSize)) if (args.pageToken != null) query.append("pageToken", String(args.pageToken)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/${encodeURIComponent(String(args['+parent']))}/answers${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };