import type { RawAxiosRequestHeaders } from 'axios'; import type { CollectionProp, GetCommentParams, QueryParams } from '../../common-types'; import type { CommentProps, CreateCommentParams, CreateCommentProps, DeleteCommentParams, GetManyCommentsParams, PlainTextBodyFormat, RichTextBodyFormat, RichTextCommentBodyPayload, RichTextCommentProps, UpdateCommentParams, UpdateCommentProps } from '../../entities/comment'; import type { OptionalDefaults } from '../wrappers/wrap'; export type CommentPlainClientAPI = { /** Fetches a plain text comment * * @param params Space ID, Comment ID, Entry ID, Environment ID * @returns the plain text comment * @throws if the request fails, or the comment is not found * @example * ```javascript * const comment = await client.comment.get({ * spaceId: '', * commentId: '', * entryId: '', * environmentId: '', * bodyFormat: 'plain-text', * }); * ``` * */ get(params: OptionalDefaults & PlainTextBodyFormat): Promise; /** Fetches a rich text comment * * @param params Space ID, Comment ID, Entry ID, Environment ID * @returns the rich text comment * @throws if the request fails, or the comment is not found * @example * ```javascript * const comment = await client.comment.get({ * spaceId: '', * commentId: '', * entryId: '', * environmentId: '', * bodyFormat: 'rich-text', * }); * ``` * */ get(params: OptionalDefaults & RichTextBodyFormat): Promise; /** Fetches all plain text comments on an entry * * @param params Space ID, Entry ID, Environment ID, and query parameters * @returns a collection of plain text comments * @throws if the request fails or the comments are not found * @example * ```javascript * const comments = await client.comment.getMany({ * spaceId: '', * entryId: '', * environmentId: '', * bodyFormat: 'plain-text', * query: { * limit: 100, * } * }); * ``` * */ getMany(params: OptionalDefaults): Promise>; /** Fetches all rich text comments on an entry * * @param params Space ID, Entry ID, Environment ID, and query parameters * @returns a collection of rich text comments * @throws if the request fails or the comments are not found * @example * ```javascript * const comments = await client.comment.getMany({ * spaceId: '', * entryId: '', * environmentId: '', * bodyFormat: 'rich-text', * query: { * limit: 100, * } * }); * ``` * */ getMany(params: OptionalDefaults): Promise>; /** Creates a plain text comment * * @param params * @returns a plain text comment * @throws if the request fails, the entry is not found, or the payload is malformed * @example * ```javascript * const comment = await client.comment.create( * { * spaceId: '', * entryId: '', * environmentId: '', * bodyFormat: 'plain-text', * }, * { * body: 'Looks good to me!', * status: 'active', * } * ); * ``` */ create(params: OptionalDefaults, rawData: CreateCommentProps, headers?: RawAxiosRequestHeaders): Promise; /** Creates a rich text comment * * @param params * @returns a rich text comment * @throws if the request fails, the entry is not found, or the payload is malformed * @example * ```javascript * const comment = await client.comment.create( * { * spaceId: '', * entryId: '', * environmentId: '', * bodyFormat: 'rich-text', * }, * { * body: 'Looks good to me!', * status: 'active', * } * ); * ``` */ create(params: OptionalDefaults, rawData: RichTextCommentBodyPayload, headers?: RawAxiosRequestHeaders): Promise; /** Updates a plain text comment * * @param params * @returns a plain text comment * @throws if the request fails, the comment is not found, or the payload is malformed * @example * ```javascript * let comment = await client.comment.get({ * spaceId: '', * commentId: '', * entryId: '', * environmentId: '', * bodyFormat: 'plain-text', * }); * * comment = await client.comment.update( * { * spaceId: '', * commentId: '', * entryId: '', * environmentId: '', * }, * { * ...comment, * text: 'This is a new comment.', * } * ); * ``` */ update(params: OptionalDefaults, rawData: UpdateCommentProps, headers?: RawAxiosRequestHeaders): Promise; /** Updates a plain text comment * * @param params * @returns a rich text comment * @throws if the request fails, the comment is not found, or the payload is malformed * @example * ```javascript * let comment = await client.comment.get({ * spaceId: '', * commentId: '', * entryId: '', * environmentId: '', * bodyFormat: 'rich-text', * }); * * comment = await client.comment.update( * { * spaceId: '', * commentId: '', * entryId: '', * environmentId: '', * }, * { * ...comment, * text: 'This is a new comment.', * } * ); * ``` */ update(params: OptionalDefaults, rawData: Omit & RichTextCommentBodyPayload, headers?: RawAxiosRequestHeaders): Promise; /** Deletes a comment * * @param params * @returns void * @throws if the request fails, or the comment is not found * @example * ```javascript * await client.comment.delete({ * spaceId: '', * commentId: '', * entryId: '', * environmentId: '', * }); * ``` */ delete(params: OptionalDefaults): Promise; };