评论
getByName(name)
commentFinder.getByName(name)
描述
根据 metadata.name
获取评论。
参数
name:string
- 评论的唯一标识metadata.name
。
返回值
示例
<div th:with="comment = ${commentFinder.getByName('comment-foo')}">
<span th:text="${comment.spec.owner.displayName}"></span>
<div th:text="${comment.spec.content}"></div>
</div>
list(ref,page,size)
commentFinder.list(ref,page,size)
描述
根据评论的 metadata.name
和分页参数获取回复列表。
参数
ref:#Ref
- 评论的唯一标识metadata.name
。page:int
- 分页页码,从 1 开始size:int
- 分页条数
返回值
示例
<ul th:with="comments = ${commentFinder.list({ group: 'content.halo.run', version: 'v1alpha1', kind: 'Post', name: 'post-foo' },1,10)}">
<li th:each="comment : ${comments.items}">
<span th:text="${comment.spec.owner.displayName}"></span>
<div th:text="${comment.spec.content}"></div>
</li>
</ul>
listReply(commentName,page,size)
commentFinder.listReply(commentName,page,size)
描述
根据评论的 metadata.name
和分页参数获取回复列表。
参数
commentName:string
- 评论的唯一标识metadata.name
。page:int
- 分页页码,从 1 开始size:int
- 分页条数
返回值
示例
<ul th:with="replies = ${commentFinder.listReply('comment-foo',1,10)}">
<li th:each="reply : ${replies.items}">
<span th:text="${reply.spec.owner.displayName}"></span>
<div th:text="${reply.spec.content}"></div>
</li>
</ul>
类型定义
CommentVo
CommentVo
{
"metadata": {
"name": "string",
"labels": {
"additionalProp1": "string"
},
"annotations": {
"additionalProp1": "string"
},
"creationTimestamp": "2022-11-20T12:16:19.788Z"
},
"spec": {
"raw": "string",
"content": "string",
"owner": {
"kind": "string",
"name": "string",
"displayName": "string",
"annotations": {
"additionalProp1": "string"
}
},
"userAgent": "string",
"ipAddress": "string",
"priority": 0,
"top": false,
"allowNotification": true,
"approved": false,
"hidden": false,
"subjectRef": {
"group": "string",
"version": "string",
"kind": "string",
"name": "string"
},
"lastReadTime": "2022-11-20T12:16:19.788Z"
},
"status": {
"lastReplyTime": "2022-11-20T12:16:19.788Z",
"replyCount": 0,
"unreadReplyCount": 0,
"hasNewReply": true
},
"owner": {
"kind": "string",
"name": "string",
"displayName": "string",
"avatar": "string",
"email": "string"
}
}
ListResult<CommentVo>
ListResult<CommentVo>
{
"page": 0,
"size": 0,
"total": 0,
"items": "List<#CommentVo>",
"first": true,
"last": true,
"hasNext": true,
"hasPrevious": true,
"totalPages": 0
}
ReplyVo
ReplyVo
{
"metadata": {
"name": "string",
"labels": {
"additionalProp1": "string"
},
"annotations": {
"additionalProp1": "string"
},
"creationTimestamp": "2022-11-20T12:25:32.357Z"
},
"spec": {
"raw": "string",
"content": "string",
"owner": {
"kind": "string",
"name": "string",
"displayName": "string",
"annotations": {
"additionalProp1": "string"
}
},
"userAgent": "string",
"ipAddress": "string",
"priority": 0,
"top": false,
"allowNotification": true,
"approved": false,
"hidden": false,
"commentName": "string",
"quoteReply": "string"
},
"owner": {
"kind": "string",
"name": "string",
"displayName": "string",
"avatar": "string",
"email": "string"
}
}
ListResult<ReplyVo>
ListResult<ReplyVo>
{
"page": 0,
"size": 0,
"total": 0,
"items": "List<#ReplyVo>",
"first": true,
"last": true,
"hasNext": true,
"hasPrevious": true,
"totalPages": 0
}
Ref
Ref
{
"group": "string",
"kind": "string",
"version": "string",
"name": "string"
}