@itentialopensource/adapter-microsoft_graph 1.4.0 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- package/CALLS.md +41 -11
- package/CHANGELOG.md +16 -0
- package/TAB2.md +2 -2
- package/adapter.js +538 -0
- package/entities/Applications/action.json +4 -1
- package/entities/Insights/action.json +4 -1
- package/entities/LabelManagement/action.json +20 -5
- package/entities/Mail/action.json +4 -1
- package/entities/Search/action.json +4 -1
- package/entities/Security/action.json +4 -1
- package/entities/Subscriptions/action.json +4 -1
- package/entities/Teams/action.json +104 -0
- package/entities/Teams/schema.json +5 -0
- package/metadata.json +2 -1
- package/package.json +9 -9
- package/pronghorn.json +281 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +7 -7
- package/test/integration/adapterTestIntegration.js +125 -0
- package/test/unit/adapterTestUnit.js +321 -6
package/adapter.js
CHANGED
@@ -4999,6 +4999,111 @@ class MicrosoftGraph extends AdapterBaseCl {
|
|
4999
4999
|
}
|
5000
5000
|
}
|
5001
5001
|
|
5002
|
+
/**
|
5003
|
+
* @function getMessagesWithoutRepliesInChannel
|
5004
|
+
* @pronghornType method
|
5005
|
+
* @name getMessagesWithoutRepliesInChannel
|
5006
|
+
* @summary Get messages (without replies) in a channel
|
5007
|
+
*
|
5008
|
+
* @param {string} teamId - teamId param
|
5009
|
+
* @param {string} channelId - channelId param
|
5010
|
+
* @param {getCallback} callback - a callback function to return the result
|
5011
|
+
* @return {object} results - An object containing the response of the action
|
5012
|
+
*
|
5013
|
+
* @route {POST} /getMessagesWithoutRepliesInChannel
|
5014
|
+
* @roles admin
|
5015
|
+
* @task true
|
5016
|
+
*/
|
5017
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
5018
|
+
getMessagesWithoutRepliesInChannel(teamId, channelId, callback) {
|
5019
|
+
const meth = 'adapter-getMessagesWithoutRepliesInChannel';
|
5020
|
+
const origin = `${this.id}-${meth}`;
|
5021
|
+
log.trace(origin);
|
5022
|
+
|
5023
|
+
if (this.suspended && this.suspendMode === 'error') {
|
5024
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
5025
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5026
|
+
return callback(null, errorObj);
|
5027
|
+
}
|
5028
|
+
|
5029
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
5030
|
+
if (teamId === undefined || teamId === null || teamId === '') {
|
5031
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['teamId'], null, null, null);
|
5032
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5033
|
+
return callback(null, errorObj);
|
5034
|
+
}
|
5035
|
+
if (channelId === undefined || channelId === null || channelId === '') {
|
5036
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['channelId'], null, null, null);
|
5037
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5038
|
+
return callback(null, errorObj);
|
5039
|
+
}
|
5040
|
+
|
5041
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
5042
|
+
const queryParamsAvailable = {};
|
5043
|
+
const queryParams = {};
|
5044
|
+
const pathVars = [teamId, channelId];
|
5045
|
+
const bodyVars = {};
|
5046
|
+
|
5047
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
5048
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
5049
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
5050
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
5051
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
5052
|
+
}
|
5053
|
+
});
|
5054
|
+
|
5055
|
+
// if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
|
5056
|
+
let thisHeaderData = null;
|
5057
|
+
// if the additional headers was passed in as a string parse the json into an object
|
5058
|
+
if (thisHeaderData !== null && thisHeaderData.constructor === String) {
|
5059
|
+
try {
|
5060
|
+
// parse the additional headers object that was passed in
|
5061
|
+
thisHeaderData = JSON.parse(thisHeaderData);
|
5062
|
+
} catch (err) {
|
5063
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
|
5064
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5065
|
+
return callback(null, errorObj);
|
5066
|
+
}
|
5067
|
+
} else if (thisHeaderData === null) {
|
5068
|
+
thisHeaderData = { contentType: '' };
|
5069
|
+
}
|
5070
|
+
|
5071
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
5072
|
+
// see adapter code documentation for more information on the request object's fields
|
5073
|
+
const reqObj = {
|
5074
|
+
payload: bodyVars,
|
5075
|
+
uriPathVars: pathVars,
|
5076
|
+
uriQuery: queryParams,
|
5077
|
+
addlHeaders: thisHeaderData
|
5078
|
+
};
|
5079
|
+
|
5080
|
+
try {
|
5081
|
+
// Make the call -
|
5082
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
5083
|
+
return this.requestHandlerInst.identifyRequest('Teams', 'getMessagesWithoutRepliesInChannel', reqObj, true, (irReturnData, irReturnError) => {
|
5084
|
+
// if we received an error or their is no response on the results
|
5085
|
+
// return an error
|
5086
|
+
if (irReturnError) {
|
5087
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
5088
|
+
return callback(null, irReturnError);
|
5089
|
+
}
|
5090
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
5091
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getMessagesWithoutRepliesInChannel'], null, null, null);
|
5092
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5093
|
+
return callback(null, errorObj);
|
5094
|
+
}
|
5095
|
+
|
5096
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
5097
|
+
// return the response
|
5098
|
+
return callback(irReturnData, null);
|
5099
|
+
});
|
5100
|
+
} catch (ex) {
|
5101
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
5102
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5103
|
+
return callback(null, errorObj);
|
5104
|
+
}
|
5105
|
+
}
|
5106
|
+
|
5002
5107
|
/**
|
5003
5108
|
* @function createaplaintextchatthreadBeta
|
5004
5109
|
* @pronghornType method
|
@@ -5093,6 +5198,100 @@ class MicrosoftGraph extends AdapterBaseCl {
|
|
5093
5198
|
}
|
5094
5199
|
}
|
5095
5200
|
|
5201
|
+
/**
|
5202
|
+
* @function sendChannelMessage
|
5203
|
+
* @pronghornType method
|
5204
|
+
* @name sendChannelMessage
|
5205
|
+
* @summary Send a new chat message in the specified channel or a chat.
|
5206
|
+
*
|
5207
|
+
* @param {string} teamId - teamId param
|
5208
|
+
* @param {string} channelId - channelId param
|
5209
|
+
* @param {object} body - body param
|
5210
|
+
* @param {getCallback} callback - a callback function to return the result
|
5211
|
+
* @return {object} results - An object containing the response of the action
|
5212
|
+
*
|
5213
|
+
* @route {POST} /sendChannelMessage
|
5214
|
+
* @roles admin
|
5215
|
+
* @task true
|
5216
|
+
*/
|
5217
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
5218
|
+
sendChannelMessage(teamId, channelId, body, callback) {
|
5219
|
+
const meth = 'adapter-sendChannelMessage';
|
5220
|
+
const origin = `${this.id}-${meth}`;
|
5221
|
+
log.trace(origin);
|
5222
|
+
|
5223
|
+
if (this.suspended && this.suspendMode === 'error') {
|
5224
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
5225
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5226
|
+
return callback(null, errorObj);
|
5227
|
+
}
|
5228
|
+
|
5229
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
5230
|
+
if (teamId === undefined || teamId === null || teamId === '') {
|
5231
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['teamId'], null, null, null);
|
5232
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5233
|
+
return callback(null, errorObj);
|
5234
|
+
}
|
5235
|
+
if (channelId === undefined || channelId === null || channelId === '') {
|
5236
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['channelId'], null, null, null);
|
5237
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5238
|
+
return callback(null, errorObj);
|
5239
|
+
}
|
5240
|
+
if (body === undefined || body === null || body === '') {
|
5241
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
5242
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5243
|
+
return callback(null, errorObj);
|
5244
|
+
}
|
5245
|
+
|
5246
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
5247
|
+
const queryParamsAvailable = {};
|
5248
|
+
const queryParams = {};
|
5249
|
+
const pathVars = [teamId, channelId];
|
5250
|
+
const bodyVars = body;
|
5251
|
+
|
5252
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
5253
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
5254
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
5255
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
5256
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
5257
|
+
}
|
5258
|
+
});
|
5259
|
+
|
5260
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
5261
|
+
// see adapter code documentation for more information on the request object's fields
|
5262
|
+
const reqObj = {
|
5263
|
+
payload: bodyVars,
|
5264
|
+
uriPathVars: pathVars,
|
5265
|
+
uriQuery: queryParams
|
5266
|
+
};
|
5267
|
+
|
5268
|
+
try {
|
5269
|
+
// Make the call -
|
5270
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
5271
|
+
return this.requestHandlerInst.identifyRequest('Teams', 'sendChannelMessage', reqObj, true, (irReturnData, irReturnError) => {
|
5272
|
+
// if we received an error or their is no response on the results
|
5273
|
+
// return an error
|
5274
|
+
if (irReturnError) {
|
5275
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
5276
|
+
return callback(null, irReturnError);
|
5277
|
+
}
|
5278
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
5279
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['sendChannelMessage'], null, null, null);
|
5280
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5281
|
+
return callback(null, errorObj);
|
5282
|
+
}
|
5283
|
+
|
5284
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
5285
|
+
// return the response
|
5286
|
+
return callback(irReturnData, null);
|
5287
|
+
});
|
5288
|
+
} catch (ex) {
|
5289
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
5290
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5291
|
+
return callback(null, errorObj);
|
5292
|
+
}
|
5293
|
+
}
|
5294
|
+
|
5096
5295
|
/**
|
5097
5296
|
* @function getamessageinachannelBeta
|
5098
5297
|
* @pronghornType method
|
@@ -5204,6 +5403,117 @@ class MicrosoftGraph extends AdapterBaseCl {
|
|
5204
5403
|
}
|
5205
5404
|
}
|
5206
5405
|
|
5406
|
+
/**
|
5407
|
+
* @function getSingleMessageInChannel
|
5408
|
+
* @pronghornType method
|
5409
|
+
* @name getSingleMessageInChannel
|
5410
|
+
* @summary Get a message in a channel
|
5411
|
+
*
|
5412
|
+
* @param {string} teamId - teamId param
|
5413
|
+
* @param {string} channelId - channelId param
|
5414
|
+
* @param {string} messageId - messageId param
|
5415
|
+
* @param {getCallback} callback - a callback function to return the result
|
5416
|
+
* @return {object} results - An object containing the response of the action
|
5417
|
+
*
|
5418
|
+
* @route {POST} /getSingleMessageInChannel
|
5419
|
+
* @roles admin
|
5420
|
+
* @task true
|
5421
|
+
*/
|
5422
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
5423
|
+
getSingleMessageInChannel(teamId, channelId, messageId, callback) {
|
5424
|
+
const meth = 'adapter-getSingleMessageInChannel';
|
5425
|
+
const origin = `${this.id}-${meth}`;
|
5426
|
+
log.trace(origin);
|
5427
|
+
|
5428
|
+
if (this.suspended && this.suspendMode === 'error') {
|
5429
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
5430
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5431
|
+
return callback(null, errorObj);
|
5432
|
+
}
|
5433
|
+
|
5434
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
5435
|
+
if (teamId === undefined || teamId === null || teamId === '') {
|
5436
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['teamId'], null, null, null);
|
5437
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5438
|
+
return callback(null, errorObj);
|
5439
|
+
}
|
5440
|
+
if (channelId === undefined || channelId === null || channelId === '') {
|
5441
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['channelId'], null, null, null);
|
5442
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5443
|
+
return callback(null, errorObj);
|
5444
|
+
}
|
5445
|
+
if (messageId === undefined || messageId === null || messageId === '') {
|
5446
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['messageId'], null, null, null);
|
5447
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5448
|
+
return callback(null, errorObj);
|
5449
|
+
}
|
5450
|
+
|
5451
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
5452
|
+
const queryParamsAvailable = {};
|
5453
|
+
const queryParams = {};
|
5454
|
+
const pathVars = [teamId, channelId, messageId];
|
5455
|
+
const bodyVars = {};
|
5456
|
+
|
5457
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
5458
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
5459
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
5460
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
5461
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
5462
|
+
}
|
5463
|
+
});
|
5464
|
+
|
5465
|
+
// if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
|
5466
|
+
let thisHeaderData = null;
|
5467
|
+
// if the additional headers was passed in as a string parse the json into an object
|
5468
|
+
if (thisHeaderData !== null && thisHeaderData.constructor === String) {
|
5469
|
+
try {
|
5470
|
+
// parse the additional headers object that was passed in
|
5471
|
+
thisHeaderData = JSON.parse(thisHeaderData);
|
5472
|
+
} catch (err) {
|
5473
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
|
5474
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5475
|
+
return callback(null, errorObj);
|
5476
|
+
}
|
5477
|
+
} else if (thisHeaderData === null) {
|
5478
|
+
thisHeaderData = { contentType: '' };
|
5479
|
+
}
|
5480
|
+
|
5481
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
5482
|
+
// see adapter code documentation for more information on the request object's fields
|
5483
|
+
const reqObj = {
|
5484
|
+
payload: bodyVars,
|
5485
|
+
uriPathVars: pathVars,
|
5486
|
+
uriQuery: queryParams,
|
5487
|
+
addlHeaders: thisHeaderData
|
5488
|
+
};
|
5489
|
+
|
5490
|
+
try {
|
5491
|
+
// Make the call -
|
5492
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
5493
|
+
return this.requestHandlerInst.identifyRequest('Teams', 'getSingleMessageInChannel', reqObj, true, (irReturnData, irReturnError) => {
|
5494
|
+
// if we received an error or their is no response on the results
|
5495
|
+
// return an error
|
5496
|
+
if (irReturnError) {
|
5497
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
5498
|
+
return callback(null, irReturnError);
|
5499
|
+
}
|
5500
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
5501
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getSingleMessageInChannel'], null, null, null);
|
5502
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5503
|
+
return callback(null, errorObj);
|
5504
|
+
}
|
5505
|
+
|
5506
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
5507
|
+
// return the response
|
5508
|
+
return callback(irReturnData, null);
|
5509
|
+
});
|
5510
|
+
} catch (ex) {
|
5511
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
5512
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5513
|
+
return callback(null, errorObj);
|
5514
|
+
}
|
5515
|
+
}
|
5516
|
+
|
5207
5517
|
/**
|
5208
5518
|
* @function getrepliestoamessageinachannelBeta
|
5209
5519
|
* @pronghornType method
|
@@ -5315,6 +5625,117 @@ class MicrosoftGraph extends AdapterBaseCl {
|
|
5315
5625
|
}
|
5316
5626
|
}
|
5317
5627
|
|
5628
|
+
/**
|
5629
|
+
* @function getRepliesToMessageInChannel
|
5630
|
+
* @pronghornType method
|
5631
|
+
* @name getRepliesToMessageInChannel
|
5632
|
+
* @summary Get replies to a message in a channel
|
5633
|
+
*
|
5634
|
+
* @param {string} teamId - teamId param
|
5635
|
+
* @param {string} channelId - channelId param
|
5636
|
+
* @param {string} messageId - messageId param
|
5637
|
+
* @param {getCallback} callback - a callback function to return the result
|
5638
|
+
* @return {object} results - An object containing the response of the action
|
5639
|
+
*
|
5640
|
+
* @route {POST} /getRepliesToMessageInChannel
|
5641
|
+
* @roles admin
|
5642
|
+
* @task true
|
5643
|
+
*/
|
5644
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
5645
|
+
getRepliesToMessageInChannel(teamId, channelId, messageId, callback) {
|
5646
|
+
const meth = 'adapter-getRepliesToMessageInChannel';
|
5647
|
+
const origin = `${this.id}-${meth}`;
|
5648
|
+
log.trace(origin);
|
5649
|
+
|
5650
|
+
if (this.suspended && this.suspendMode === 'error') {
|
5651
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
5652
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5653
|
+
return callback(null, errorObj);
|
5654
|
+
}
|
5655
|
+
|
5656
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
5657
|
+
if (teamId === undefined || teamId === null || teamId === '') {
|
5658
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['teamId'], null, null, null);
|
5659
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5660
|
+
return callback(null, errorObj);
|
5661
|
+
}
|
5662
|
+
if (channelId === undefined || channelId === null || channelId === '') {
|
5663
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['channelId'], null, null, null);
|
5664
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5665
|
+
return callback(null, errorObj);
|
5666
|
+
}
|
5667
|
+
if (messageId === undefined || messageId === null || messageId === '') {
|
5668
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['messageId'], null, null, null);
|
5669
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5670
|
+
return callback(null, errorObj);
|
5671
|
+
}
|
5672
|
+
|
5673
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
5674
|
+
const queryParamsAvailable = {};
|
5675
|
+
const queryParams = {};
|
5676
|
+
const pathVars = [teamId, channelId, messageId];
|
5677
|
+
const bodyVars = {};
|
5678
|
+
|
5679
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
5680
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
5681
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
5682
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
5683
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
5684
|
+
}
|
5685
|
+
});
|
5686
|
+
|
5687
|
+
// if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
|
5688
|
+
let thisHeaderData = null;
|
5689
|
+
// if the additional headers was passed in as a string parse the json into an object
|
5690
|
+
if (thisHeaderData !== null && thisHeaderData.constructor === String) {
|
5691
|
+
try {
|
5692
|
+
// parse the additional headers object that was passed in
|
5693
|
+
thisHeaderData = JSON.parse(thisHeaderData);
|
5694
|
+
} catch (err) {
|
5695
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
|
5696
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5697
|
+
return callback(null, errorObj);
|
5698
|
+
}
|
5699
|
+
} else if (thisHeaderData === null) {
|
5700
|
+
thisHeaderData = { contentType: '' };
|
5701
|
+
}
|
5702
|
+
|
5703
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
5704
|
+
// see adapter code documentation for more information on the request object's fields
|
5705
|
+
const reqObj = {
|
5706
|
+
payload: bodyVars,
|
5707
|
+
uriPathVars: pathVars,
|
5708
|
+
uriQuery: queryParams,
|
5709
|
+
addlHeaders: thisHeaderData
|
5710
|
+
};
|
5711
|
+
|
5712
|
+
try {
|
5713
|
+
// Make the call -
|
5714
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
5715
|
+
return this.requestHandlerInst.identifyRequest('Teams', 'getRepliesToMessageInChannel', reqObj, true, (irReturnData, irReturnError) => {
|
5716
|
+
// if we received an error or their is no response on the results
|
5717
|
+
// return an error
|
5718
|
+
if (irReturnError) {
|
5719
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
5720
|
+
return callback(null, irReturnError);
|
5721
|
+
}
|
5722
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
5723
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getRepliesToMessageInChannel'], null, null, null);
|
5724
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5725
|
+
return callback(null, errorObj);
|
5726
|
+
}
|
5727
|
+
|
5728
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
5729
|
+
// return the response
|
5730
|
+
return callback(irReturnData, null);
|
5731
|
+
});
|
5732
|
+
} catch (ex) {
|
5733
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
5734
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5735
|
+
return callback(null, errorObj);
|
5736
|
+
}
|
5737
|
+
}
|
5738
|
+
|
5318
5739
|
/**
|
5319
5740
|
* @function getareplyofamessageBeta
|
5320
5741
|
* @pronghornType method
|
@@ -5432,6 +5853,123 @@ class MicrosoftGraph extends AdapterBaseCl {
|
|
5432
5853
|
}
|
5433
5854
|
}
|
5434
5855
|
|
5856
|
+
/**
|
5857
|
+
* @function getSingleMessageReplyInChannel
|
5858
|
+
* @pronghornType method
|
5859
|
+
* @name getSingleMessageReplyInChannel
|
5860
|
+
* @summary Get a reply of a message
|
5861
|
+
*
|
5862
|
+
* @param {string} teamId - teamId param
|
5863
|
+
* @param {string} channelId - channelId param
|
5864
|
+
* @param {string} messageId - messageId param
|
5865
|
+
* @param {string} replyId - replyId param
|
5866
|
+
* @param {getCallback} callback - a callback function to return the result
|
5867
|
+
* @return {object} results - An object containing the response of the action
|
5868
|
+
*
|
5869
|
+
* @route {POST} /getSingleMessageReplyInChannel
|
5870
|
+
* @roles admin
|
5871
|
+
* @task true
|
5872
|
+
*/
|
5873
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
5874
|
+
getSingleMessageReplyInChannel(teamId, channelId, messageId, replyId, callback) {
|
5875
|
+
const meth = 'adapter-getSingleMessageReplyInChannel';
|
5876
|
+
const origin = `${this.id}-${meth}`;
|
5877
|
+
log.trace(origin);
|
5878
|
+
|
5879
|
+
if (this.suspended && this.suspendMode === 'error') {
|
5880
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
5881
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5882
|
+
return callback(null, errorObj);
|
5883
|
+
}
|
5884
|
+
|
5885
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
5886
|
+
if (teamId === undefined || teamId === null || teamId === '') {
|
5887
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['teamId'], null, null, null);
|
5888
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5889
|
+
return callback(null, errorObj);
|
5890
|
+
}
|
5891
|
+
if (channelId === undefined || channelId === null || channelId === '') {
|
5892
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['channelId'], null, null, null);
|
5893
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5894
|
+
return callback(null, errorObj);
|
5895
|
+
}
|
5896
|
+
if (messageId === undefined || messageId === null || messageId === '') {
|
5897
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['messageId'], null, null, null);
|
5898
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5899
|
+
return callback(null, errorObj);
|
5900
|
+
}
|
5901
|
+
if (replyId === undefined || replyId === null || replyId === '') {
|
5902
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['replyId'], null, null, null);
|
5903
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5904
|
+
return callback(null, errorObj);
|
5905
|
+
}
|
5906
|
+
|
5907
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
5908
|
+
const queryParamsAvailable = {};
|
5909
|
+
const queryParams = {};
|
5910
|
+
const pathVars = [teamId, channelId, messageId, replyId];
|
5911
|
+
const bodyVars = {};
|
5912
|
+
|
5913
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
5914
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
5915
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
5916
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
5917
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
5918
|
+
}
|
5919
|
+
});
|
5920
|
+
|
5921
|
+
// if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
|
5922
|
+
let thisHeaderData = null;
|
5923
|
+
// if the additional headers was passed in as a string parse the json into an object
|
5924
|
+
if (thisHeaderData !== null && thisHeaderData.constructor === String) {
|
5925
|
+
try {
|
5926
|
+
// parse the additional headers object that was passed in
|
5927
|
+
thisHeaderData = JSON.parse(thisHeaderData);
|
5928
|
+
} catch (err) {
|
5929
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
|
5930
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5931
|
+
return callback(null, errorObj);
|
5932
|
+
}
|
5933
|
+
} else if (thisHeaderData === null) {
|
5934
|
+
thisHeaderData = { contentType: '' };
|
5935
|
+
}
|
5936
|
+
|
5937
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
5938
|
+
// see adapter code documentation for more information on the request object's fields
|
5939
|
+
const reqObj = {
|
5940
|
+
payload: bodyVars,
|
5941
|
+
uriPathVars: pathVars,
|
5942
|
+
uriQuery: queryParams,
|
5943
|
+
addlHeaders: thisHeaderData
|
5944
|
+
};
|
5945
|
+
|
5946
|
+
try {
|
5947
|
+
// Make the call -
|
5948
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
5949
|
+
return this.requestHandlerInst.identifyRequest('Teams', 'getSingleMessageReplyInChannel', reqObj, true, (irReturnData, irReturnError) => {
|
5950
|
+
// if we received an error or their is no response on the results
|
5951
|
+
// return an error
|
5952
|
+
if (irReturnError) {
|
5953
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
5954
|
+
return callback(null, irReturnError);
|
5955
|
+
}
|
5956
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
5957
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getSingleMessageReplyInChannel'], null, null, null);
|
5958
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5959
|
+
return callback(null, errorObj);
|
5960
|
+
}
|
5961
|
+
|
5962
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
5963
|
+
// return the response
|
5964
|
+
return callback(irReturnData, null);
|
5965
|
+
});
|
5966
|
+
} catch (ex) {
|
5967
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
5968
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
5969
|
+
return callback(null, errorObj);
|
5970
|
+
}
|
5971
|
+
}
|
5972
|
+
|
5435
5973
|
/**
|
5436
5974
|
* @function getuserSjoinedteams
|
5437
5975
|
* @pronghornType method
|
@@ -107,7 +107,10 @@
|
|
107
107
|
"name": "deleteapplication",
|
108
108
|
"protocol": "REST",
|
109
109
|
"method": "DELETE",
|
110
|
-
"entitypath":
|
110
|
+
"entitypath": {
|
111
|
+
"beta": "{base_path}/{version}/beta/applications/{pathv1}?{query}",
|
112
|
+
"v1.0": "{base_path}/{version}/v1.0/applications/{pathv1}?{query}"
|
113
|
+
},
|
111
114
|
"requestSchema": "schema.json",
|
112
115
|
"responseSchema": "schema.json",
|
113
116
|
"timeout": 0,
|
@@ -4,7 +4,10 @@
|
|
4
4
|
"name": "getitemstrendingaroundme",
|
5
5
|
"protocol": "REST",
|
6
6
|
"method": "GET",
|
7
|
-
"entitypath":
|
7
|
+
"entitypath": {
|
8
|
+
"beta": "{base_path}/{version}/beta/me/insights/trending?{query}",
|
9
|
+
"v1.0": "{base_path}/{version}/v1.0/me/insights/trending?{query}"
|
10
|
+
},
|
8
11
|
"requestSchema": "schema.json",
|
9
12
|
"responseSchema": "schema.json",
|
10
13
|
"timeout": 0,
|
@@ -4,7 +4,10 @@
|
|
4
4
|
"name": "listretentionLabels",
|
5
5
|
"protocol": "REST",
|
6
6
|
"method": "GET",
|
7
|
-
"entitypath":
|
7
|
+
"entitypath": {
|
8
|
+
"beta": "{base_path}/{version}/beta/security/labels/retentionLabels?{query}",
|
9
|
+
"v1.0": "{base_path}/{version}/v1.0/security/labels/retentionLabels?{query}"
|
10
|
+
},
|
8
11
|
"requestSchema": "schema.json",
|
9
12
|
"responseSchema": "schema.json",
|
10
13
|
"timeout": 0,
|
@@ -25,7 +28,10 @@
|
|
25
28
|
"name": "createretentionLabel",
|
26
29
|
"protocol": "REST",
|
27
30
|
"method": "POST",
|
28
|
-
"entitypath":
|
31
|
+
"entitypath": {
|
32
|
+
"beta": "{base_path}/{version}/beta/security/labels/retentionLabels?{query}",
|
33
|
+
"v1.0": "{base_path}/{version}/v1.0/security/labels/retentionLabels?{query}"
|
34
|
+
},
|
29
35
|
"requestSchema": "schema.json",
|
30
36
|
"responseSchema": "schema.json",
|
31
37
|
"timeout": 0,
|
@@ -45,7 +51,10 @@
|
|
45
51
|
"name": "getretentionLabel",
|
46
52
|
"protocol": "REST",
|
47
53
|
"method": "GET",
|
48
|
-
"entitypath":
|
54
|
+
"entitypath": {
|
55
|
+
"beta": "{base_path}/{version}/beta/security/labels/retentionLabels/{pathv1}?{query}",
|
56
|
+
"v1.0": "{base_path}/{version}/v1.0/security/labels/retentionLabels/{pathv1}?{query}"
|
57
|
+
},
|
49
58
|
"requestSchema": "schema.json",
|
50
59
|
"responseSchema": "schema.json",
|
51
60
|
"timeout": 0,
|
@@ -66,7 +75,10 @@
|
|
66
75
|
"name": "updateretentionLabel",
|
67
76
|
"protocol": "REST",
|
68
77
|
"method": "PATCH",
|
69
|
-
"entitypath":
|
78
|
+
"entitypath": {
|
79
|
+
"beta": "{base_path}/{version}/beta/security/labels/retentionLabels/{pathv1}?{query}",
|
80
|
+
"v1.0": "{base_path}/{version}/v1.0/security/labels/retentionLabels/{pathv1}?{query}"
|
81
|
+
},
|
70
82
|
"requestSchema": "schema.json",
|
71
83
|
"responseSchema": "schema.json",
|
72
84
|
"timeout": 0,
|
@@ -86,7 +98,10 @@
|
|
86
98
|
"name": "deleterentionionLabel",
|
87
99
|
"protocol": "REST",
|
88
100
|
"method": "DELETE",
|
89
|
-
"entitypath":
|
101
|
+
"entitypath": {
|
102
|
+
"beta" :"{base_path}/{version}/beta/security/labels/retentionLabels/{pathv1}?{query}",
|
103
|
+
"v1.0" :"{base_path}/{version}/v1.0/security/labels/retentionLabels/{pathv1}?{query}"
|
104
|
+
},
|
90
105
|
"requestSchema": "schema.json",
|
91
106
|
"responseSchema": "schema.json",
|
92
107
|
"timeout": 0,
|
@@ -25,7 +25,10 @@
|
|
25
25
|
"name": "getmymessagesIMatmentionedin",
|
26
26
|
"protocol": "REST",
|
27
27
|
"method": "GET",
|
28
|
-
"entitypath":
|
28
|
+
"entitypath": {
|
29
|
+
"beta": "{base_path}/{version}/beta/me/messages?{query}",
|
30
|
+
"v1.0": "{base_path}/{version}/v1.0/me/messages?{query}"
|
31
|
+
},
|
29
32
|
"requestSchema": "schema.json",
|
30
33
|
"responseSchema": "schema.json",
|
31
34
|
"timeout": 0,
|