I've looked at https://www.rubydoc.info/github/google/google-api-ruby-client/Google/Apis/GmailV1/ModifyThreadRequest and the examples https://developers.google.com/gmail/api/v1/reference/users/labels/update for Python and JS but can't figure out how to format the request properly in ruby.
I'm trying:
service.modify_thread('me',thread_id,{'add_label_ids'=>['UNREAD']})
and various other permutations of the object but can't get anything other than Google::Apis::ClientError: invalidArgument: No label add or removes specified
in response.
Any help appreciated
modify_thread
expects a Google::Apis::GmailV1::ModifyThreadRequest
object as third argument according to the documentation.
In the source of the constructor of ModifyThreadRequest you can see that it looks for a key :add_label_ids
in its arguments.
So if modify_thread
creates the ModifyThreadRequest object itself then
service.modify_thread('me',thread_id, add_label_ids: ['UNREAD'])
should work. If that fails I would try
mtr = Google::Apis::GmailV1::ModifyThreadRequest.new(add_label_ids: ['UNREAD'])
service.modify_thread('me', thread_id, mtr)