@itentialopensource/adapter-microsoft_graph 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CALLS.md +6 -0
- package/CHANGELOG.md +8 -0
- package/adapter.js +89 -0
- package/entities/Mail/action.json +20 -0
- package/entities/Mail/schema.json +1 -0
- package/package.json +1 -1
- package/pronghorn.json +74 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +5 -5
package/CALLS.md
CHANGED
@@ -628,6 +628,12 @@ Specific adapter calls are built based on the API of the Microsoft_graph. The Ad
|
|
628
628
|
<td style="padding:15px">{base_path}/{version}/v1.0/me/sendMail?{query}</td>
|
629
629
|
<td style="padding:15px">Yes</td>
|
630
630
|
</tr>
|
631
|
+
<tr>
|
632
|
+
<td style="padding:15px">sendmailApplication(body, userId, callback)</td>
|
633
|
+
<td style="padding:15px">Send mail with client credentials</td>
|
634
|
+
<td style="padding:15px">{base_path}/{version}/v1.0/users/{pathv1}/sendMail?{query}</td>
|
635
|
+
<td style="padding:15px">Yes</td>
|
636
|
+
</tr>
|
631
637
|
<tr>
|
632
638
|
<td style="padding:15px">getmailboxsettings(callback)</td>
|
633
639
|
<td style="padding:15px">Get mailbox settings</td>
|
package/CHANGELOG.md
CHANGED
package/adapter.js
CHANGED
@@ -7039,6 +7039,95 @@ class MicrosoftGraph extends AdapterBaseCl {
|
|
7039
7039
|
}
|
7040
7040
|
}
|
7041
7041
|
|
7042
|
+
/**
|
7043
|
+
* @function sendmailApplication
|
7044
|
+
* @pronghornType method
|
7045
|
+
* @name sendmailApplication
|
7046
|
+
* @summary Send mail
|
7047
|
+
*
|
7048
|
+
* @param {object} body - body param
|
7049
|
+
* @param {string} userId - user id or userPrincipalName to sendmail from
|
7050
|
+
* @param {getCallback} callback - a callback function to return the result
|
7051
|
+
* @return {object} results - An object containing the response of the action
|
7052
|
+
*
|
7053
|
+
* @route {POST} /sendmailApplication
|
7054
|
+
* @roles admin
|
7055
|
+
* @task true
|
7056
|
+
*/
|
7057
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
7058
|
+
sendmailApplication(body, userId, callback) {
|
7059
|
+
const meth = 'adapter-sendmailApplication';
|
7060
|
+
const origin = `${this.id}-${meth}`;
|
7061
|
+
log.trace(origin);
|
7062
|
+
|
7063
|
+
if (this.suspended && this.suspendMode === 'error') {
|
7064
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
7065
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
7066
|
+
return callback(null, errorObj);
|
7067
|
+
}
|
7068
|
+
|
7069
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
7070
|
+
if (body === undefined || body === null || body === '') {
|
7071
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
7072
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
7073
|
+
return callback(null, errorObj);
|
7074
|
+
}
|
7075
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
7076
|
+
if (userId === undefined || userId === null || userId === '') {
|
7077
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['userId'], null, null, null);
|
7078
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
7079
|
+
return callback(null, errorObj);
|
7080
|
+
}
|
7081
|
+
|
7082
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
7083
|
+
const queryParamsAvailable = {};
|
7084
|
+
const queryParams = {};
|
7085
|
+
const pathVars = [userId];
|
7086
|
+
const bodyVars = body;
|
7087
|
+
|
7088
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
7089
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
7090
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
7091
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
7092
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
7093
|
+
}
|
7094
|
+
});
|
7095
|
+
|
7096
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
7097
|
+
// see adapter code documentation for more information on the request object's fields
|
7098
|
+
const reqObj = {
|
7099
|
+
payload: bodyVars,
|
7100
|
+
uriPathVars: pathVars,
|
7101
|
+
uriQuery: queryParams
|
7102
|
+
};
|
7103
|
+
|
7104
|
+
try {
|
7105
|
+
// Make the call -
|
7106
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
7107
|
+
return this.requestHandlerInst.identifyRequest('Mail', 'sendmailApplication', reqObj, true, (irReturnData, irReturnError) => {
|
7108
|
+
// if we received an error or their is no response on the results
|
7109
|
+
// return an error
|
7110
|
+
if (irReturnError) {
|
7111
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
7112
|
+
return callback(null, irReturnError);
|
7113
|
+
}
|
7114
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
7115
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['sendmail'], null, null, null);
|
7116
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
7117
|
+
return callback(null, errorObj);
|
7118
|
+
}
|
7119
|
+
|
7120
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
7121
|
+
// return the response
|
7122
|
+
return callback(irReturnData, null);
|
7123
|
+
});
|
7124
|
+
} catch (ex) {
|
7125
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
7126
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
7127
|
+
return callback(null, errorObj);
|
7128
|
+
}
|
7129
|
+
}
|
7130
|
+
|
7042
7131
|
/**
|
7043
7132
|
* @function getmailboxsettings
|
7044
7133
|
* @pronghornType method
|
@@ -125,6 +125,26 @@
|
|
125
125
|
}
|
126
126
|
]
|
127
127
|
},
|
128
|
+
{
|
129
|
+
"name": "sendmailApplication",
|
130
|
+
"protocol": "REST",
|
131
|
+
"method": "POST",
|
132
|
+
"entitypath": "{base_path}/{version}/v1.0/users/{pathv1}/sendMail?{query}",
|
133
|
+
"requestSchema": "schema.json",
|
134
|
+
"responseSchema": "schema.json",
|
135
|
+
"timeout": 0,
|
136
|
+
"sendEmpty": false,
|
137
|
+
"requestDatatype": "JSON",
|
138
|
+
"responseDatatype": "JSON",
|
139
|
+
"headers": {},
|
140
|
+
"responseObjects": [
|
141
|
+
{
|
142
|
+
"type": "default",
|
143
|
+
"key": "",
|
144
|
+
"mockFile": ""
|
145
|
+
}
|
146
|
+
]
|
147
|
+
},
|
128
148
|
{
|
129
149
|
"name": "getmailboxsettings",
|
130
150
|
"protocol": "REST",
|
package/package.json
CHANGED
package/pronghorn.json
CHANGED
@@ -3819,6 +3819,80 @@
|
|
3819
3819
|
},
|
3820
3820
|
"task": true
|
3821
3821
|
},
|
3822
|
+
{
|
3823
|
+
"name": "sendmailApplication",
|
3824
|
+
"summary": "Send mail with client credentials",
|
3825
|
+
"description": "Send mail with client credentials",
|
3826
|
+
"input": [
|
3827
|
+
{
|
3828
|
+
"name": "body",
|
3829
|
+
"type": "object",
|
3830
|
+
"info": ": object",
|
3831
|
+
"required": true,
|
3832
|
+
"schema": {
|
3833
|
+
"allOf": [
|
3834
|
+
{
|
3835
|
+
"type": "object"
|
3836
|
+
},
|
3837
|
+
{
|
3838
|
+
"example": {
|
3839
|
+
"message": {
|
3840
|
+
"subject": "Meet for lunch?",
|
3841
|
+
"body": {
|
3842
|
+
"contentType": "Text",
|
3843
|
+
"content": "The new cafeteria is open."
|
3844
|
+
},
|
3845
|
+
"toRecipients": [
|
3846
|
+
{
|
3847
|
+
"emailAddress": {
|
3848
|
+
"address": "{{UserName}}"
|
3849
|
+
}
|
3850
|
+
}
|
3851
|
+
],
|
3852
|
+
"ccRecipients": [
|
3853
|
+
{
|
3854
|
+
"emailAddress": {
|
3855
|
+
"address": "{{UserName}}"
|
3856
|
+
}
|
3857
|
+
}
|
3858
|
+
]
|
3859
|
+
},
|
3860
|
+
"saveToSentItems": "false"
|
3861
|
+
}
|
3862
|
+
}
|
3863
|
+
],
|
3864
|
+
"definitions": {}
|
3865
|
+
}
|
3866
|
+
},
|
3867
|
+
{
|
3868
|
+
"name": "userId",
|
3869
|
+
"type": "string",
|
3870
|
+
"info": ": string",
|
3871
|
+
"required": true,
|
3872
|
+
"schema": {
|
3873
|
+
"title": "userId",
|
3874
|
+
"type": "string"
|
3875
|
+
}
|
3876
|
+
}
|
3877
|
+
],
|
3878
|
+
"output": {
|
3879
|
+
"name": "result",
|
3880
|
+
"type": "object",
|
3881
|
+
"description": "A JSON Object containing status, code and the result",
|
3882
|
+
"schema": {
|
3883
|
+
"title": "result",
|
3884
|
+
"type": "object"
|
3885
|
+
}
|
3886
|
+
},
|
3887
|
+
"roles": [
|
3888
|
+
"admin"
|
3889
|
+
],
|
3890
|
+
"route": {
|
3891
|
+
"verb": "POST",
|
3892
|
+
"path": "/sendmailApplication"
|
3893
|
+
},
|
3894
|
+
"task": true
|
3895
|
+
},
|
3822
3896
|
{
|
3823
3897
|
"name": "getmailboxsettings",
|
3824
3898
|
"summary": "Get mailbox settings",
|
Binary file
|
package/report/adapterInfo.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
|
-
"version": "1.0
|
3
|
-
"configLines":
|
2
|
+
"version": "1.1.0",
|
3
|
+
"configLines": 10902,
|
4
4
|
"scriptLines": 1783,
|
5
|
-
"codeLines":
|
5
|
+
"codeLines": 20170,
|
6
6
|
"testLines": 15130,
|
7
7
|
"testCases": 772,
|
8
|
-
"totalCodeLines":
|
9
|
-
"wfTasks":
|
8
|
+
"totalCodeLines": 37083,
|
9
|
+
"wfTasks": 228
|
10
10
|
}
|