-
Google Docsのコメントを,コメント位置つきで取得して,それをもとにgithubのissueを作成したかった
-
Manage Comments and Discussions | Drive REST API | Google Developers
# After downloading client_id.json...
$ bundle install --path vendor/bundle
$ bundle exec ruby read_files.rb #{FILE_ID}
-
Webから作ったコメントには,anchorとしてkix IDが割り振られる.GET時に得られる
Comment # anchor
はkix.***********
が入っている.(APIドキュメントと矛盾)- このanchorから,コメントをつけたハイライト箇所の前後の文を取得することができないのが問題.前後の文の手掛かりはcontentしかない.
-
いっぽうで,API経由で作る際に,anchorとしてJSONを入れてcreateする.すると,GET時に得られる
Comment # anchor
は JSONが入っている.定義されていないキーもそのまま見えている.POST https://www.googleapis.com/drive/v3/files/fileId/comments
で,下記のようなリクエストを送ると,コメントは作成されるものの,狙った箇所にハイライトされない:
{
"content": "api content json ver 6",
"anchor": "{\"r\":6,\"a\":[{\"line\":{\"n\":1,\"l\":1, \"ml\": 1, \"description\":\"revision 6 line 1 - 1\"}}]}",
"quotedFileContent": {
"value": "123456789",
"mimeType": "text/html"
}
}
-
なお,Comments update APIは,どちらから作ったコメントに対しても正しく動作する.
-
Rplies create APIも問題ない.
-
https://youtu.be/ZBU52nacbLw?t=5m33s
- "… impossible for you to create comments anchored to text in a document format …"