We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$subject
The text was updated successfully, but these errors were encountered:
Gmail REST API exposes gmail mailbox operations over the network. This allows programmes to access users data easily for automations.
Currently settings API is not supported.
import ballerina/io; configurable string refreshToken = ?; configurable string clientId = ?; configurable string clientSecret = ?; public function main() returns error? { Client gmailClient = check new Client( config = { auth: { refreshToken: refreshToken, clientId: clientId, clientSecret: clientSecret } } ); ListMessagesResponse messageList = check gmailClient->/users/["me"]/messages(q = "is:unread"); Message[] messages = messageList.messages ?: []; foreach Message message in messages { Message fullMessage = check gmailClient->/users/["me"]/messages/[message.id ?: ""](format = "full"); // Business Logic MessagePartHeader[] payloadHeaders = fullMessage.payload?.headers ?: []; MessagePartHeader[] subjectHeader = payloadHeaders.filter(payloadHeader => payloadHeader.name == "Subject"); if subjectHeader.length() > 0 { string? subject = subjectHeader[0].value; if subject !is () { io:println(subject); } } Message _ = check gmailClient->/users/["me"]/messages/[message.id ?: ""]/modify.post( payload = { removeLabelIds: ["UNREAD"] } ); } }
Sorry, something went wrong.
niveathika
No branches or pull requests
$subject
The text was updated successfully, but these errors were encountered: