我看过Python和JS的https://www.rubydoc.info/github/google/google-api-ruby-client/Google/Apis/GmailV1/ModifyThreadRequest和示例https://developers.google.com/gmail/api/v1/reference/users/labels/update,但不知道如何在ruby中正确地格式化请求。
我在试着:
service.modify_thread('me',thread_id,{'add_label_ids'=>['UNREAD']})以及对象的各种其他排列,但是除了Google::Apis::ClientError: invalidArgument: No label add or removes specified之外不能得到任何响应。
感谢您的任何帮助
发布于 2019-03-08 22:54:40
根据documentation,modify_thread需要一个Google::Apis::GmailV1::ModifyThreadRequest对象作为第三个参数。
在ModifyThreadRequest的构造函数的source中,您可以看到它在其参数中查找关键的:add_label_ids。
因此,如果modify_thread创建了ModifyThreadRequest对象本身,那么
service.modify_thread('me',thread_id, add_label_ids: ['UNREAD'])应该行得通。如果失败,我会试一试
mtr = Google::Apis::GmailV1::ModifyThreadRequest.new(add_label_ids: ['UNREAD'])
service.modify_thread('me', thread_id, mtr)https://stackoverflow.com/questions/54964271
复制相似问题