Skip to content

Commit 3cd5905

Browse files
authored
fix: adds templates support (#50)
Signed-off-by: nitish <[email protected]>
1 parent 8326bb1 commit 3cd5905

File tree

6 files changed

+1556
-10
lines changed

6 files changed

+1556
-10
lines changed

.secrets.baseline

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "package-lock.json|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2023-08-02T09:54:43Z",
6+
"generated_at": "2023-08-31T07:38:15Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -102,15 +102,15 @@
102102
"hashed_secret": "52ff58378da9dd5f3352434d0d26c680750acf56",
103103
"is_secret": false,
104104
"is_verified": false,
105-
"line_number": 656,
105+
"line_number": 658,
106106
"type": "Secret Keyword",
107107
"verified_result": null
108108
},
109109
{
110110
"hashed_secret": "d4c3d66fd0c38547a3c7a4c6bdc29c36911bc030",
111111
"is_secret": false,
112112
"is_verified": false,
113-
"line_number": 1200,
113+
"line_number": 1287,
114114
"type": "Secret Keyword",
115115
"verified_result": null
116116
}
@@ -120,21 +120,21 @@
120120
"hashed_secret": "0cc20f91828bed53ddb6294968b7f9abd631a3ba",
121121
"is_secret": false,
122122
"is_verified": false,
123-
"line_number": 1178,
123+
"line_number": 1243,
124124
"type": "Secret Keyword",
125125
"verified_result": null
126126
},
127127
{
128128
"hashed_secret": "d4c3d66fd0c38547a3c7a4c6bdc29c36911bc030",
129129
"is_secret": false,
130130
"is_verified": false,
131-
"line_number": 1228,
131+
"line_number": 1293,
132132
"type": "Secret Keyword",
133133
"verified_result": null
134134
}
135135
]
136136
},
137-
"version": "0.13.1+ibm.60.dss",
137+
"version": "0.13.1+ibm.61.dss",
138138
"word_list": {
139139
"file": null,
140140
"hash": null

README.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ SDK Methods to consume
108108
- [Update Destination](#update-destination)
109109
- [Delete Destination](#delete-destination)
110110
- [Custom Domain_Name_verification](#custom-domain-name-verification)
111+
- [Templates](#templates)
112+
- [Create Template](#create-template)
113+
- [List Templates](#list-templates)
114+
- [Get Template](#get-template)
115+
- [Update Template](#update-template)
116+
- [Delete Template](#delete-template)
111117
- [Push Destination APIs](#push-destination-apis)
112118
- [Create Destination tag subscription](#create-destination-tag-subscription)
113119
- [List Destination tag subscription](#list-destination-tag-subscription)
@@ -482,6 +488,106 @@ const updateSpfVerifyDestinationParams = {
482488
console.warn(err);
483489
}
484490
```
491+
492+
## Templates
493+
494+
Template is a pre-defined layout, that may include content like images, text and dynamic content based on event. Rather than creating a new content from scratch each time, you can use a template as a base and configure them in subscription.
495+
supports the following templates:
496+
497+
- Custom Email notification
498+
- Custom Email invitation
499+
500+
### Create Template
501+
```js
502+
const templateConfigModel = {
503+
params: {
504+
body: '<!DOCTYPE html><html><head><title>IBM Event Notifications</title></head><body><p>Hello! Invitation template</p><table><tr><td>Hello invitation link:{{ ibmen_invitation }} </td></tr></table></body></html>',
505+
subject: 'Hi this is invitation for invitation message',
506+
},
507+
};
508+
let createTemplateParams = {
509+
instanceId: <instance-id>,
510+
name: <template-name>,
511+
type: <template-type>,
512+
templateConfigModel,
513+
description: <template-description>,
514+
};
515+
let createTemplateResult;
516+
try {
517+
createTemplateResult = await eventNotificationsService.createTemplate(createTemplateParams);
518+
console.log(JSON.stringify(createTemplateResult.result, null, 2));
519+
} catch (err) {
520+
console.warn(err);
521+
}
522+
```
523+
### List Templates
524+
```js
525+
const params = {
526+
instanceId: <instance-id>,
527+
};
528+
529+
let res;
530+
try {
531+
res = await eventNotificationsService.listTemplates(params);
532+
console.log(JSON.stringify(res.result, null, 2));
533+
} catch (err) {
534+
console.warn(err);
535+
}
536+
```
537+
538+
### Get Template
539+
```js
540+
const params = {
541+
instanceId: <instance-id>,
542+
id: <template-id>,
543+
};
544+
545+
let res;
546+
try {
547+
res = await eventNotificationsService.getTemplate(params);
548+
console.log(JSON.stringify(res.result, null, 2));
549+
} catch (err) {
550+
console.warn(err);
551+
}
552+
```
553+
554+
### Update Template
555+
```js
556+
const templateConfigModel = {
557+
params: {
558+
body: '<!DOCTYPE html><html><head><title>IBM Event Notifications</title></head><body><p>Hello! Invitation template</p><table><tr><td>Hello invitation link:{{ ibmen_invitation }} </td></tr></table></body></html>',
559+
subject: 'Hi this is invitation for invitation message',
560+
},
561+
};
562+
let updateTemplateParams = {
563+
instanceId: <instance-id>,
564+
name: <template-name>,
565+
type: <template-type>,
566+
templateConfigModel,
567+
description: <template-description>,
568+
};
569+
let updateTemplateResult;
570+
try {
571+
updateTemplateResult = await eventNotificationsService.updateTemplate(updateTemplateParams);
572+
} catch (err) {
573+
console.warn(err);
574+
}
575+
```
576+
577+
### Delete Template
578+
```js
579+
const params = {
580+
instanceId: <instance-id>,
581+
id: <template-id>,
582+
};
583+
584+
try {
585+
await eventNotificationsService.deleteTemplate(params);
586+
} catch (err) {
587+
console.warn(err);
588+
}
589+
```
590+
485591
## Push Destination APIs
486592

487593
### Create Destination tag subscription

0 commit comments

Comments
 (0)