Ballerina API Documentation

Connectors of org.wso2.ballerina.connectors.gmail package

connector ClientConnector (string userId, string accessToken, string refreshToken, string clientId, string clientSecret)

Gmail client connector

Parameters:

Parameter NameData TypeDescription
userIdstringThe userId of the Gmail account which means the email id
accessTokenstringThe accessToken of the Gmail account to access the gmail REST API
refreshTokenstringThe refreshToken of the Gmail App to access the gmail REST API
clientIdstringThe clientId of the App to access the gmail REST API
clientSecretstringThe clientSecret of the App to access the gmail REST API

Actions:

action createDraft()

Create a draft

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
tostringReceiver mail ID
subjectstringSubject of the message
fromstringSender mail ID
messageBodystringEntire message body
ccstringTo whom sender need to cc the mail
bccstringTo whom sender need to bcc the mail
idstringId of the draft to create
threadIdstringthread Id of the draft to reply

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action createLabel()

Create a new label

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
labelNamestringThe display name of the label
messageListVisibilitystringThe visibility of messages with this label in the message list in the Gmail web interface
labelListVisibilitystringThe visibility of the label in the label list in the Gmail web interface
typesstringThe owner type for the label
messagesTotalstringThe total number of messages with the label
messagesUnreadstringThe number of unread messages with the label
threadsTotalstringThe total number of threads with the label
threadsUnreadstringThe number of unread threads with the label

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action deleteDraft()

Delete a particular draft

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
draftIdstringId of the draft to delete

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action deleteLabel()

Delete a particular label

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
labelIdstringId of the label to delete

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action deleteMail()

Delete a particular message

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
messageIdstringId of the message to delete

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action deleteThread()

Delete a particular thread

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
threadIdstringId of the thread to delete

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action getUserProfile()

Retrieve the user profile

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action listDrafts()

Lists the drafts in the user's mailbox

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
includeSpamTrashstringInclude messages from SPAM and TRASH in the results
maxResultsstringMaximum number of messages to return
pageTokenstringPage token to retrieve a specific page of results in the list
qstringOnly return messages matching the specified query. Supports the same query format as the Gmail search box

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action listHistory()

Lists the history to of all changes to the given mailbox

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
labelIdstringOnly return messages with a label matching the ID
maxResultsstringMaximum number of messages to return
pageTokenstringPage token to retrieve a specific page of results in the list
startHistoryIdstringReturns history records after the specified startHistoryId

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action listLabels()

Lists all labels in the user's mailbox

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action listMails()

Lists the messages in the user's mailbox

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
includeSpamTrashstringInclude messages from SPAM and TRASH in the results
labelIdsstringOnly return messages with labels that match all of the specified label IDs
maxResultsstringMaximum number of messages to return
pageTokenstringPage token to retrieve a specific page of results in the list
qstringOnly return messages matching the specified query. Supports the same query format as the Gmail search box

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action listThreads()

Lists the threads in the user's mailbox

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
includeSpamTrashstringInclude messages from SPAM and TRASH in the results
labelIdsstringOnly return messages with labels that match all of the specified label IDs
maxResultsstringMaximum number of messages to return
pageTokenstringPage token to retrieve a specific page of results in the list
qstringOnly return messages matching the specified query. Supports the same query format as the Gmail search box

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action modifyExistingMessage()

Modifies the labels on the specified message

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
messageIdstringThe ID of the message to modifies the labels
addLabelIdsstringA list of IDs of labels to add to this message
removeLabelIdsstringA list IDs of labels to remove from this message

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action readDraft()

Retrieve a particular draft

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
draftIdstringId of the draft to retrieve
formatstringThe format to return the draft in

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action readLabel()

Retrieve a particular label

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
labelIdstringId of the label to retrieve

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action readMail()

Retrieve a particular Message

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
messageIdstringId of the message to retrieve
formatstringThe format to return the Message in
metaDataHeadersstringWhen given and format is METADATA, only include headers specified

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action readThread()

Retrieve a particular Thread

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
threadIdstringId of the thread to retrieve
formatstringThe format to return the thread in
metaDataHeadersstringWhen given and format is METADATA, only include headers specified

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action sendMail()

Send a mail

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
tostringReceiver mail ID
subjectstringSubject of the message
fromstringSender mail ID
messageBodystringEntire message body
ccstringTo whom sender need to cc the mail
bccstringTo whom sender need to bcc the mail
idstringId of the mail to send
threadIdstringthread Id of the mail to reply

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action trashMail()

Trash a particular message

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
messageIdstringId of the message to Trash

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action trashThread()

Trash a particular thread

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
threadIdstringId of the thread to Trash

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action unTrashMail()

UnTrash a particular message

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
messageIdstringId of the message to unTrash

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action unTrashThread()

UnTrash a particular thread

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
threadIdstringId of the thread to unTrash

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action updateDraft()

Update a draft

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
draftIdstringId of the draft to update
tostringReceiver mail ID
subjectstringSubject of the message
fromstringSender mail ID
messageBodystringEntire message body
ccstringTo whom sender need to cc the mail
bccstringTo whom sender need to bcc the mail
idstringId of the draft to reply
threadIdstringthread Id of the draft to reply

Return Parameters:

Return VariableData TypeDescription
messageresponse object

action updateLabel()

Update a particular label

Parameters:

Parameter NameData TypeDescription
gClientConnectorThe gmail Connector instance
labelIdstringThe Id of the label to update
labelNamestringThe display name of the label
messageListVisibilitystringThe visibility of messages with this label in the message list in the Gmail web interface
labelListVisibilitystringThe visibility of the label in the label list in the Gmail web interface
typesstringThe owner type for the label
messagesTotalstringThe total number of messages with the label
messagesUnreadstringThe number of unread messages with the label
threadsTotalstringThe total number of threads with the label
threadsUnreadstringThe number of unread threads with the label

Return Parameters:

Return VariableData TypeDescription
messageresponse object


Menu

  • Connectors
    • ClientConnector (string userId, string accessToken, string refreshToken, string clientId, string clientSecret)
      • createDraft(ClientConnector g, string to, string subject, string from, string messageBody, string cc, string bcc, string id, string threadId)
      • createLabel(ClientConnector g, string labelName, string messageListVisibility, string labelListVisibility, string types, string messagesTotal, string messagesUnread, string threadsTotal, string threadsUnread)
      • deleteDraft(ClientConnector g, string draftId)
      • deleteLabel(ClientConnector g, string labelId)
      • deleteMail(ClientConnector g, string messageId)
      • deleteThread(ClientConnector g, string threadId)
      • getUserProfile(ClientConnector g)
      • listDrafts(ClientConnector g, string includeSpamTrash, string maxResults, string pageToken, string q)
      • listHistory(ClientConnector g, string labelId, string maxResults, string pageToken, string startHistoryId)
      • listLabels(ClientConnector g)
      • listMails(ClientConnector g, string includeSpamTrash, string labelIds, string maxResults, string pageToken, string q)
      • listThreads(ClientConnector g, string includeSpamTrash, string labelIds, string maxResults, string pageToken, string q)
      • modifyExistingMessage(ClientConnector g, string messageId, string addLabelIds, string removeLabelIds)
      • readDraft(ClientConnector g, string draftId, string format)
      • readLabel(ClientConnector g, string labelId)
      • readMail(ClientConnector g, string messageId, string format, string metaDataHeaders)
      • readThread(ClientConnector g, string threadId, string format, string metaDataHeaders)
      • sendMail(ClientConnector g, string to, string subject, string from, string messageBody, string cc, string bcc, string id, string threadId)
      • trashMail(ClientConnector g, string messageId)
      • trashThread(ClientConnector g, string threadId)
      • unTrashMail(ClientConnector g, string messageId)
      • unTrashThread(ClientConnector g, string threadId)
      • updateDraft(ClientConnector g, string draftId, string to, string subject, string from, string messageBody, string cc, string bcc, string id, string threadId)
      • updateLabel(ClientConnector g, string labelId, string labelName, string messageListVisibility, string labelListVisibility, string types, string messagesTotal, string messagesUnread, string threadsTotal, string threadsUnread)

Copyright 2017 Ballerina API Documentation