gpt4 book ai didi

ruby - 尝试使用 Gmail 的 Ruby API 修改标签时出现 “Error no label add or removes specified”

转载 作者:数据小太阳 更新时间:2023-10-29 08:42:31 26 4
gpt4 key购买 nike

我看过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适用于 Python 和 JS,但无法弄清楚如何在 ruby​​ 中正确格式化请求。

我正在尝试:

service.modify_thread('me',thread_id,{'add_label_ids'=>['UNREAD']})

以及对象的各种其他排列,但除了 Google::Apis::ClientError: invalidArgument: No label add or removes specified 响应之外,无法得到任何其他内容。

感谢任何帮助

最佳答案

modify_thread 根据 documentation 期望一个 Google::Apis::GmailV1::ModifyThreadRequest 对象作为第三个参数.

source在 ModifyThreadRequest 的构造函数中,您可以看到它在其参数中查找键 :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)

关于ruby - 尝试使用 Gmail 的 Ruby API 修改标签时出现 “Error no label add or removes specified”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54964271/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com