export type CreateQuestionnaireCommentRequest = {author_email_address: string, private?: boolean | undefined, question_id?: string | undefined, questionnaire_id: number, reply_to_comment_id?: number | undefined, text: string}; export type CreateApiVendorQuestionnaireCommentsAddArgs = {body: CreateQuestionnaireCommentRequest}; export type CreateApiVendorQuestionnaireCommentsAddOptions = {baseUrl?: string | undefined, APIKeyInHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a comment on a questionnaire * * POST /vendor/questionnaire/comments/add */ export const createApiVendorQuestionnaireCommentsAdd = async (args: CreateApiVendorQuestionnaireCommentsAddArgs, options?: CreateApiVendorQuestionnaireCommentsAddOptions) => { const {baseUrl = "https://cyber-risk.upguard.com/api/public", fetch: fetchFn = fetch, APIKeyInHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (APIKeyInHeader !== undefined) headers.set("Authorization", APIKeyInHeader) const url = `${baseUrl.replace(/\/+$/, '')}/vendor/questionnaire/comments/add${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 };