export type CreateApiInquiriesInquiryIdCommentsArgs = {inquiry_id: string, body: {comment: string, is_private?: boolean | undefined}}; export type CreateApiInquiriesInquiryIdCommentsOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create Inquiry Comment * * POST /inquiries/{inquiry_id}/comments */ export const createApiInquiriesInquiryIdComments = async (args: CreateApiInquiriesInquiryIdCommentsArgs, options?: CreateApiInquiriesInquiryIdCommentsOptions) => { const {baseUrl = "https://api.roapp.io/v2", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set('authorization', `Bearer ${apiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/inquiries/${encodeURIComponent(String(args.inquiry_id))}/comments${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 undefined };