Skip to content
New issue

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

Add getAttachment operation to the gmail connector #47

Merged
merged 1 commit into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/resources/messages/component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,9 @@
<file>deleteMessages.xml</file>
<description>delete the message</description>
</component>
<component name="getAttachment">
<file>getAttachment.xml</file>
<description>get the attachment</description>
</component>
</subComponents>
</component>
2 changes: 2 additions & 0 deletions src/main/resources/messages/deleteMessages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<template name="deleteMessages" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="id" description="The ID of the message to delete"/>
<sequence>
<header name="Authorization" expression="fn:concat('Bearer ', $ctx:uri.var.gmail.accessToken)"
scope="transport"/>
<property name="uri.var.id" expression="$func:id"/>
<call>
<endpoint>
Expand Down
40 changes: 40 additions & 0 deletions src/main/resources/messages/getAttachment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<template name="getAttachment" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="id" description="The ID of the message to retrieve"/>
<parameter name="attachmentId" description="The attachment ID of the attachment to download"/>
<sequence>
<header name="Authorization" expression="fn:concat('Bearer ', $ctx:uri.var.gmail.accessToken)"
scope="transport"/>
<property name="uri.var.id" expression="$func:id"/>
<property name="uri.var.attachmentId" expression="$func:attachmentId"/>
<call>
<endpoint name="Attachment">
<http method="get" uri-template="{+uri.var.gmail.apiUrl}/{+uri.var.gmail.apiVersion}/users/{+uri.var.gmail.userId}/messages/{+uri.var.id}/attachments/{+uri.var.attachmentId}">
</http>
</endpoint>
</call>
<!-- Remove response custom header information -->
<header name="x-li-format" scope="transport" action="remove"/>
<header name="X-LI-UUID" scope="transport" action="remove"/>
<header name="X-Li-Pop" scope="transport" action="remove"/>
<header name="X-Li-Fabric" scope="transport" action="remove"/>
<header name="x-li-request-id" scope="transport" action="remove"/>
</sequence>
</template>
2 changes: 2 additions & 0 deletions src/main/resources/messages/listAllMails.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
<parameter name="q"
description="Only return messages matching the specified query. Supports the same query format as the Gmail search box"/>
<sequence>
<header name="Authorization" expression="fn:concat('Bearer ', $ctx:uri.var.gmail.accessToken)"
scope="transport"/>
<property name="uri.var.includeSpamTrash" expression="$func:includeSpamTrash"/>
<property name="uri.var.labelIds" expression="$func:labelIds"/>
<property name="uri.var.maxResults" expression="$func:maxResults"/>
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/messages/modifyExistingMessages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<parameter name="removeLabelIds"
description="A list of IDs of labels to remove from this message"/>
<sequence>
<header name="Authorization" expression="fn:concat('Bearer ', $ctx:uri.var.gmail.accessToken)"
scope="transport"/>
<property name="uri.var.id" expression="$func:id"/>
<property name="uri.var.addLabelIds" expression="$func:addLabelIds"/>
<property name="uri.var.removeLabelIds" expression="$func:removeLabelIds"/>
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/messages/readMail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<parameter name="metadataHeaders"
description="When given and format is METADATA, only include headers specified"/>
<sequence>
<header name="Authorization" expression="fn:concat('Bearer ', $ctx:uri.var.gmail.accessToken)"
scope="transport"/>
<property name="uri.var.id" expression="$func:id"/>
<property name="uri.var.format" expression="$func:format"/>
<property name="uri.var.metadataHeaders" expression="$func:metadataHeaders"/>
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/messages/sendMail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
<parameter name="threadId" description="To whom sender need to bcc the mail"/>
<parameter name="contentType" description="The Content type of the message Body"/>
<sequence>
<header name="Authorization" expression="fn:concat('Bearer ', $ctx:uri.var.gmail.accessToken)"
scope="transport"/>
<property name="uri.var.to" expression="$func:to"/>
<property name="uri.var.subject" expression="$func:subject"/>
<property name="uri.var.from" expression="$func:from"/>
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/messages/sendMailWithAttachment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<parameter name="fileName" description="(Optional) A comma separated list of content IDs(should be same as the file names) of attachments"/>
<parameter name="filePath" description="(Optional) A comma separated list of file paths"/>
<sequence>
<header name="Authorization" expression="fn:concat('Bearer ', $ctx:uri.var.gmail.accessToken)"
scope="transport"/>
<property name="Operator Name" value="Gmail : SendMail"/>
<property name="subject" expression="$func:subject"/>
<property name="toRecipients" expression="$func:to"/>
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/messages/trashMessages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<template name="trashMessages" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="id" description="The ID of the message to retrieve"/>
<sequence>
<header name="Authorization" expression="fn:concat('Bearer ', $ctx:uri.var.gmail.accessToken)"
scope="transport"/>
<property name="uri.var.id" expression="$func:id"/>
<call>
<endpoint>
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/messages/unTrashMessages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<template name="unTrashMessages" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="id" description="The ID of the message to retrieve"/>
<sequence>
<header name="Authorization" expression="fn:concat('Bearer ', $ctx:uri.var.gmail.accessToken)"
scope="transport"/>
<property name="uri.var.id" expression="$func:id"/>
<call>
<endpoint>
Expand Down