comments
Creates, updates, deletes, gets or lists a comments
resource.
Overview
Name | comments |
Type | Resource |
Id | googleworkspace.drivev2.comments |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Name | Datatype | Description |
---|---|---|
anchor | string | A region of the document represented as a JSON string. For details on defining anchor properties, refer to Manage comments and replies. |
author | object | Information about a Drive user. (id: User) |
commentId | string | The ID of the comment. |
content | string | The plain text content used to create this comment. This is not HTML safe and should only be used as a starting point to make edits to a comment's content. |
context | object | Context of a file which is being commented on. |
createdDate | string (date-time) | The date when this comment was first created. |
deleted | boolean | Whether this comment has been deleted. If a comment has been deleted the content will be cleared and this will only represent a comment that once existed. |
fileId | string | The file which this comment is addressing. |
fileTitle | string | The title of the file which this comment is addressing. |
genoaAuthor | object | The user who wrote this comment as a GenoaUser. (id: GenoaUser) |
htmlContent | string | HTML formatted content for this comment. |
kind | string | This is always drive#comment. (default: drive#comment) |
modifiedDate | string (date-time) | The date when this comment or any of its replies were last modified. |
replies | array | Replies to this post. |
resolved | boolean | Output only. Whether the comment has been resolved by one of its replies. |
selfLink | string | A link back to this comment. |
status | string | The status of this comment. Status can be changed by posting a reply to a comment with the desired status. Possible values are: * open - The comment is still open. * resolved - The comment has been resolved by one of its replies. |
Name | Datatype | Description |
---|---|---|
anchor | string | A region of the document represented as a JSON string. For details on defining anchor properties, refer to Manage comments and replies. |
author | object | Information about a Drive user. (id: User) |
commentId | string | The ID of the comment. |
content | string | The plain text content used to create this comment. This is not HTML safe and should only be used as a starting point to make edits to a comment's content. |
context | object | Context of a file which is being commented on. |
createdDate | string (date-time) | The date when this comment was first created. |
deleted | boolean | Whether this comment has been deleted. If a comment has been deleted the content will be cleared and this will only represent a comment that once existed. |
fileId | string | The file which this comment is addressing. |
fileTitle | string | The title of the file which this comment is addressing. |
genoaAuthor | object | The user who wrote this comment as a GenoaUser. (id: GenoaUser) |
htmlContent | string | HTML formatted content for this comment. |
kind | string | This is always drive#comment. (default: drive#comment) |
modifiedDate | string (date-time) | The date when this comment or any of its replies were last modified. |
replies | array | Replies to this post. |
resolved | boolean | Output only. Whether the comment has been resolved by one of its replies. |
selfLink | string | A link back to this comment. |
status | string | The status of this comment. Status can be changed by posting a reply to a comment with the desired status. Possible values are: * open - The comment is still open. * resolved - The comment has been resolved by one of its replies. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | fileId , commentId | includeDeleted | Gets a comment by ID. |
list | select | fileId | includeDeleted , maxResults , pageToken , updatedMin | Lists a file's comments. |
insert | insert | fileId | Creates a new comment on the given file. | |
patch | update | fileId , commentId | Updates an existing comment. | |
update | replace | fileId , commentId | Updates an existing comment. | |
delete | delete | fileId , commentId | Deletes a comment. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
commentId | string | |
fileId | string | |
includeDeleted | boolean | |
maxResults | integer (int32) | |
pageToken | string | |
updatedMin | string |
SELECT
examples
- get
- list
Gets a comment by ID.
SELECT
anchor,
author,
commentId,
content,
context,
createdDate,
deleted,
fileId,
fileTitle,
genoaAuthor,
htmlContent,
kind,
modifiedDate,
replies,
resolved,
selfLink,
status
FROM googleworkspace.drivev2.comments
WHERE fileId = '{{ fileId }}' -- required
AND commentId = '{{ commentId }}' -- required
AND includeDeleted = '{{ includeDeleted }}'
;
Lists a file's comments.
SELECT
anchor,
author,
commentId,
content,
context,
createdDate,
deleted,
fileId,
fileTitle,
genoaAuthor,
htmlContent,
kind,
modifiedDate,
replies,
resolved,
selfLink,
status
FROM googleworkspace.drivev2.comments
WHERE fileId = '{{ fileId }}' -- required
AND includeDeleted = '{{ includeDeleted }}'
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
AND updatedMin = '{{ updatedMin }}'
;
INSERT
examples
- insert
- Manifest
Creates a new comment on the given file.
INSERT INTO googleworkspace.drivev2.comments (
data__commentId,
data__kind,
data__createdDate,
data__modifiedDate,
data__fileId,
data__fileTitle,
data__status,
data__anchor,
data__replies,
data__author,
data__deleted,
data__selfLink,
data__htmlContent,
data__content,
data__context,
data__resolved,
data__genoaAuthor,
fileId
)
SELECT
'{{ commentId }}',
'{{ kind }}',
'{{ createdDate }}',
'{{ modifiedDate }}',
'{{ fileId }}',
'{{ fileTitle }}',
'{{ status }}',
'{{ anchor }}',
'{{ replies }}',
'{{ author }}',
{{ deleted }},
'{{ selfLink }}',
'{{ htmlContent }}',
'{{ content }}',
'{{ context }}',
{{ resolved }},
'{{ genoaAuthor }}',
'{{ fileId }}'
RETURNING
anchor,
author,
commentId,
content,
context,
createdDate,
deleted,
fileId,
fileTitle,
genoaAuthor,
htmlContent,
kind,
modifiedDate,
replies,
resolved,
selfLink,
status
;
# Description fields are for documentation purposes
- name: comments
props:
- name: fileId
value: string
description: Required parameter for the comments resource.
- name: commentId
value: string
description: >
The ID of the comment.
- name: kind
value: string
description: >
This is always drive#comment.
default: drive#comment
- name: createdDate
value: string
description: >
The date when this comment was first created.
- name: modifiedDate
value: string
description: >
The date when this comment or any of its replies were last modified.
- name: fileId
value: string
description: >
The file which this comment is addressing.
- name: fileTitle
value: string
description: >
The title of the file which this comment is addressing.
- name: status
value: string
description: >
The status of this comment. Status can be changed by posting a reply to a comment with the desired status. Possible values are: * `open` - The comment is still open. * `resolved` - The comment has been resolved by one of its replies.
- name: anchor
value: string
description: >
A region of the document represented as a JSON string. For details on defining anchor properties, refer to [Manage comments and replies](https://developers.google.com/workspace/drive/api/v3/manage-comments).
- name: replies
value: array
description: >
Replies to this post.
- name: author
value: object
description: >
Information about a Drive user.
- name: deleted
value: boolean
description: >
Whether this comment has been deleted. If a comment has been deleted the content will be cleared and this will only represent a comment that once existed.
- name: selfLink
value: string
description: >
A link back to this comment.
- name: htmlContent
value: string
description: >
HTML formatted content for this comment.
- name: content
value: string
description: >
The plain text content used to create this comment. This is not HTML safe and should only be used as a starting point to make edits to a comment's content.
- name: context
value: object
description: >
Context of a file which is being commented on.
- name: resolved
value: boolean
description: >
Output only. Whether the comment has been resolved by one of its replies.
- name: genoaAuthor
value: object
description: >
The user who wrote this comment as a GenoaUser.
UPDATE
examples
- patch
Updates an existing comment.
UPDATE googleworkspace.drivev2.comments
SET
data__commentId = '{{ commentId }}',
data__kind = '{{ kind }}',
data__createdDate = '{{ createdDate }}',
data__modifiedDate = '{{ modifiedDate }}',
data__fileId = '{{ fileId }}',
data__fileTitle = '{{ fileTitle }}',
data__status = '{{ status }}',
data__anchor = '{{ anchor }}',
data__replies = '{{ replies }}',
data__author = '{{ author }}',
data__deleted = {{ deleted }},
data__selfLink = '{{ selfLink }}',
data__htmlContent = '{{ htmlContent }}',
data__content = '{{ content }}',
data__context = '{{ context }}',
data__resolved = {{ resolved }},
data__genoaAuthor = '{{ genoaAuthor }}'
WHERE
fileId = '{{ fileId }}' --required
AND commentId = '{{ commentId }}' --required
RETURNING
anchor,
author,
commentId,
content,
context,
createdDate,
deleted,
fileId,
fileTitle,
genoaAuthor,
htmlContent,
kind,
modifiedDate,
replies,
resolved,
selfLink,
status;
REPLACE
examples
- update
Updates an existing comment.
REPLACE googleworkspace.drivev2.comments
SET
data__commentId = '{{ commentId }}',
data__kind = '{{ kind }}',
data__createdDate = '{{ createdDate }}',
data__modifiedDate = '{{ modifiedDate }}',
data__fileId = '{{ fileId }}',
data__fileTitle = '{{ fileTitle }}',
data__status = '{{ status }}',
data__anchor = '{{ anchor }}',
data__replies = '{{ replies }}',
data__author = '{{ author }}',
data__deleted = {{ deleted }},
data__selfLink = '{{ selfLink }}',
data__htmlContent = '{{ htmlContent }}',
data__content = '{{ content }}',
data__context = '{{ context }}',
data__resolved = {{ resolved }},
data__genoaAuthor = '{{ genoaAuthor }}'
WHERE
fileId = '{{ fileId }}' --required
AND commentId = '{{ commentId }}' --required
RETURNING
anchor,
author,
commentId,
content,
context,
createdDate,
deleted,
fileId,
fileTitle,
genoaAuthor,
htmlContent,
kind,
modifiedDate,
replies,
resolved,
selfLink,
status;
DELETE
examples
- delete
Deletes a comment.
DELETE FROM googleworkspace.drivev2.comments
WHERE fileId = '{{ fileId }}' --required
AND commentId = '{{ commentId }}' --required
;