export type GetApiZendeskTicketsTicketIdCommentsArgs = {ticketId: number}; export type GetApiZendeskTicketsTicketIdCommentsOptions = {baseUrl?: string | undefined, accessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get comments for a ticket * * GET /zendesk/tickets/{ticketId}/comments */ export const getApiZendeskTicketsTicketIdComments = async (args: GetApiZendeskTicketsTicketIdCommentsArgs, options?: GetApiZendeskTicketsTicketIdCommentsOptions) => { const {baseUrl = "https://api.findmydocument.net", fetch: fetchFn = fetch, accessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (accessToken !== undefined) headers.set('authorization', `Bearer ${accessToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/zendesk/tickets/${encodeURIComponent(String(args.ticketId))}/comments${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 undefined };