-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: PlainClient docs - comment [EXT-4926] (#2183)
* docs: PlainClient docs - comment [EXT-4926] * fixing codeclimate * fixing build
- Loading branch information
1 parent
9c8603f
commit 3f3de67
Showing
5 changed files
with
168 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
import { CollectionProp, GetCommentParams, QueryParams } from '../../common-types' | ||
import { | ||
CommentProps, | ||
CreateCommentParams, | ||
CreateCommentProps, | ||
DeleteCommentParams, | ||
GetManyCommentsParams, | ||
PlainTextBodyFormat, | ||
RichTextBodyFormat, | ||
RichTextCommentBodyPayload, | ||
RichTextCommentProps, | ||
UpdateCommentParams, | ||
UpdateCommentProps, | ||
} from '../../entities/comment' | ||
import { OptionalDefaults } from '../wrappers/wrap' | ||
import { CreateOrUpdate } from './base' | ||
|
||
type GetManyRichText = GetManyCommentsParams & RichTextBodyFormat & QueryParams | ||
type GetManyPlain = GetManyCommentsParams & PlainTextBodyFormat & QueryParams | ||
|
||
export type CommentPlainClientAPI = { | ||
/** Fetches a comment | ||
* | ||
* @param params Space ID, Comment ID, Entry ID, Environment ID | ||
* @returns the comment | ||
* @throws if the request fails, or the comment is not found | ||
* @example | ||
* ```javascript | ||
* const comment = await client.comment.get({ | ||
* spaceId: '<space_id>', | ||
* commentId: '<comment_id>', | ||
* entryId: '<entry_id>', | ||
* environmentId: '<environment_id>', | ||
* bodyFormat: 'plain-text', | ||
* }); | ||
* ``` | ||
* */ | ||
get(params: OptionalDefaults<GetCommentParams> & PlainTextBodyFormat): Promise<CommentProps> | ||
/** Fetches a comment | ||
* | ||
* @param params Space ID, Comment ID, Entry ID, Environment ID | ||
* @returns the comment | ||
* @throws if the request fails, or the comment is not found | ||
* @example | ||
* ```javascript | ||
* const comment = await client.comment.get({ | ||
* spaceId: '<space_id>', | ||
* commentId: '<comment_id>', | ||
* entryId: '<entry_id>', | ||
* environmentId: '<environment_id>', | ||
* bodyFormat: 'rich-text', | ||
* }); | ||
* ``` | ||
* */ | ||
get( | ||
params: OptionalDefaults<GetCommentParams> & RichTextBodyFormat | ||
): Promise<RichTextCommentProps> | ||
/** Fetches all comments | ||
* | ||
* @param params Space ID, Entry ID, Environment ID, and query parameters | ||
* @returns a collection of comments | ||
* @throws if the request fails or the comments are not found | ||
* @example | ||
* ```javascript | ||
* const comments = await client.comment.getMany({ | ||
* spaceId: '<space_id>', | ||
* entryId: '<entry_id>', | ||
* environmentId: '<environment_id>', | ||
* bodyFormat: 'plain-text', | ||
* query: { | ||
* limit: 100, | ||
* } | ||
* }); | ||
* ``` | ||
* */ | ||
getMany( | ||
params: OptionalDefaults<GetManyRichText | GetManyPlain> | ||
): Promise<CollectionProp<CommentProps | RichTextCommentProps>> | ||
/** Creates a comment | ||
* | ||
* @param params | ||
* @returns a 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: '<space_id>', | ||
* entryId: '<entry_id>', | ||
* environmentId: '<environment_id>', | ||
* bodyFormat: 'plain-text' | 'rich-text', | ||
* }, | ||
* { | ||
* body: 'Looks good to me!', | ||
* status: 'active', | ||
* }); | ||
* ``` | ||
*/ | ||
create: CreateOrUpdate< | ||
CreateCommentParams, | ||
CreateCommentProps | RichTextCommentBodyPayload, | ||
CommentProps | ||
> | ||
/** Updates a comment | ||
* | ||
* @param params | ||
* @returns a comment | ||
* @throws if the request fails, the comment is not found, or the payload is malformed | ||
* @example | ||
* ```javascript | ||
* const comment = await client.comment.update({ | ||
* spaceId: '<space_id>', | ||
* commentId: '<comment_id>', | ||
* entryId: '<entry_id>', | ||
* environmentId: '<environment_id>', | ||
* bodyFormat: 'rich-text' | 'plain-text', | ||
* }, | ||
* { | ||
* body: 'Looks good to me!', | ||
* status: 'active', | ||
* }); | ||
* ``` | ||
*/ | ||
update: CreateOrUpdate< | ||
UpdateCommentParams, | ||
UpdateCommentProps | RichTextCommentBodyPayload, | ||
RichTextCommentProps | ||
> | ||
/** Deletes a comment | ||
* | ||
* @param params | ||
* @throws if the request fails, or the comment is not found | ||
* @example | ||
* ```javascript | ||
* await client.comment.delete({ | ||
* spaceId: '<space_id>', | ||
* commentId: '<comment_id>', | ||
* entryId: '<entry_id>', | ||
* environmentId: '<environment_id>', | ||
* }); | ||
* ``` | ||
*/ | ||
delete(params: OptionalDefaults<DeleteCommentParams>): Promise<void> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters