pingram 1.0.0-alpha.863 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,6 +26,11 @@ export interface GetTemplateRequest {
26
26
  channel: string;
27
27
  templateId: string;
28
28
  }
29
+ export interface InitiateMigrationRequest {
30
+ notificationId: string;
31
+ channel: string;
32
+ templateId: string;
33
+ }
29
34
  export interface ListTemplatesRequest {
30
35
  notificationId: string;
31
36
  channel: string;
@@ -93,6 +98,21 @@ export interface TemplatesApiInterface {
93
98
  * Get a single template by ID
94
99
  */
95
100
  getTemplate(notificationId: string, channel: string, templateId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetTemplatesResponse>;
101
+ /**
102
+ *
103
+ * @summary Initiate AI-powered template migration from complex to simple HTML
104
+ * @param {string} notificationId Notification ID
105
+ * @param {string} channel Channel type
106
+ * @param {string} templateId Template ID
107
+ * @param {*} [options] Override http request option.
108
+ * @throws {RequiredError}
109
+ * @memberof TemplatesApiInterface
110
+ */
111
+ initiateMigrationRaw(requestParameters: InitiateMigrationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Template>>;
112
+ /**
113
+ * Initiate AI-powered template migration from complex to simple HTML
114
+ */
115
+ initiateMigration(notificationId: string, channel: string, templateId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Template>;
96
116
  /**
97
117
  *
98
118
  * @summary List all templates for a notification and channel
@@ -167,6 +187,14 @@ export declare class TemplatesApi extends runtime.BaseAPI implements TemplatesAp
167
187
  * Get a single template by ID
168
188
  */
169
189
  getTemplate(notificationId: string, channel: string, templateId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetTemplatesResponse>;
190
+ /**
191
+ * Initiate AI-powered template migration from complex to simple HTML
192
+ */
193
+ initiateMigrationRaw(requestParameters: InitiateMigrationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Template>>;
194
+ /**
195
+ * Initiate AI-powered template migration from complex to simple HTML
196
+ */
197
+ initiateMigration(notificationId: string, channel: string, templateId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Template>;
170
198
  /**
171
199
  * List all templates for a notification and channel
172
200
  */
@@ -251,6 +251,72 @@ class TemplatesApi extends runtime.BaseAPI {
251
251
  }, initOverrides);
252
252
  return await response.value();
253
253
  }
254
+ /**
255
+ * Initiate AI-powered template migration from complex to simple HTML
256
+ */
257
+ async initiateMigrationRaw(requestParameters, initOverrides) {
258
+ if (requestParameters['notificationId'] == null) {
259
+ throw new runtime.RequiredError('notificationId', 'Required parameter "notificationId" was null or undefined when calling initiateMigration().');
260
+ }
261
+ if (requestParameters['channel'] == null) {
262
+ throw new runtime.RequiredError('channel', 'Required parameter "channel" was null or undefined when calling initiateMigration().');
263
+ }
264
+ if (requestParameters['templateId'] == null) {
265
+ throw new runtime.RequiredError('templateId', 'Required parameter "templateId" was null or undefined when calling initiateMigration().');
266
+ }
267
+ const queryParameters = {};
268
+ const headerParameters = {};
269
+ if (this.configuration &&
270
+ (this.configuration.username !== undefined ||
271
+ this.configuration.password !== undefined)) {
272
+ headerParameters['Authorization'] =
273
+ 'Basic ' +
274
+ btoa(this.configuration.username + ':' + this.configuration.password);
275
+ }
276
+ if (this.configuration &&
277
+ (this.configuration.username !== undefined ||
278
+ this.configuration.password !== undefined)) {
279
+ headerParameters['Authorization'] =
280
+ 'Basic ' +
281
+ btoa(this.configuration.username + ':' + this.configuration.password);
282
+ }
283
+ if (this.configuration && this.configuration.accessToken) {
284
+ const token = this.configuration.accessToken;
285
+ const tokenString = await token('apiKey', []);
286
+ if (tokenString) {
287
+ headerParameters['Authorization'] = `Bearer ${tokenString}`;
288
+ }
289
+ }
290
+ if (this.configuration &&
291
+ (this.configuration.username !== undefined ||
292
+ this.configuration.password !== undefined)) {
293
+ headerParameters['Authorization'] =
294
+ 'Basic ' +
295
+ btoa(this.configuration.username + ':' + this.configuration.password);
296
+ }
297
+ let urlPath = `/notifications/{notificationId}/{channel}/templates/{templateId}/migrate`;
298
+ urlPath = urlPath.replace(`{${'notificationId'}}`, encodeURIComponent(String(requestParameters['notificationId'])));
299
+ urlPath = urlPath.replace(`{${'channel'}}`, encodeURIComponent(String(requestParameters['channel'])));
300
+ urlPath = urlPath.replace(`{${'templateId'}}`, encodeURIComponent(String(requestParameters['templateId'])));
301
+ const response = await this.request({
302
+ path: urlPath,
303
+ method: 'POST',
304
+ headers: headerParameters,
305
+ query: queryParameters
306
+ }, initOverrides);
307
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.TemplateFromJSON)(jsonValue));
308
+ }
309
+ /**
310
+ * Initiate AI-powered template migration from complex to simple HTML
311
+ */
312
+ async initiateMigration(notificationId, channel, templateId, initOverrides) {
313
+ const response = await this.initiateMigrationRaw({
314
+ notificationId: notificationId,
315
+ channel: channel,
316
+ templateId: templateId
317
+ }, initOverrides);
318
+ return await response.value();
319
+ }
254
320
  /**
255
321
  * List all templates for a notification and channel
256
322
  */
@@ -92,6 +92,12 @@ export interface GetTemplatesListResponseInner {
92
92
  * @memberof GetTemplatesListResponseInner
93
93
  */
94
94
  senderEmail: string;
95
+ /**
96
+ *
97
+ * @type {string}
98
+ * @memberof GetTemplatesListResponseInner
99
+ */
100
+ migration?: string;
95
101
  /**
96
102
  *
97
103
  * @type {string}
@@ -91,6 +91,7 @@ function GetTemplatesListResponseInnerFromJSONTyped(json, ignoreDiscriminator) {
91
91
  subject: json['subject'],
92
92
  senderName: json['senderName'],
93
93
  senderEmail: json['senderEmail'],
94
+ migration: json['migration'] == null ? undefined : json['migration'],
94
95
  title: json['title'],
95
96
  redirectURL: json['redirectURL'],
96
97
  imageURL: json['imageURL'],
@@ -134,6 +135,7 @@ function GetTemplatesListResponseInnerToJSONTyped(value, ignoreDiscriminator = f
134
135
  subject: value['subject'],
135
136
  senderName: value['senderName'],
136
137
  senderEmail: value['senderEmail'],
138
+ migration: value['migration'],
137
139
  title: value['title'],
138
140
  redirectURL: value['redirectURL'],
139
141
  imageURL: value['imageURL'],
@@ -90,6 +90,12 @@ export interface GetTemplatesListResponseInnerAnyOf {
90
90
  * @memberof GetTemplatesListResponseInnerAnyOf
91
91
  */
92
92
  senderEmail: string;
93
+ /**
94
+ *
95
+ * @type {string}
96
+ * @memberof GetTemplatesListResponseInnerAnyOf
97
+ */
98
+ migration?: string;
93
99
  }
94
100
  /**
95
101
  * Check if a given object implements the GetTemplatesListResponseInnerAnyOf interface.
@@ -64,7 +64,8 @@ function GetTemplatesListResponseInnerAnyOfFromJSONTyped(json, ignoreDiscriminat
64
64
  internal: json['internal'],
65
65
  subject: json['subject'],
66
66
  senderName: json['senderName'],
67
- senderEmail: json['senderEmail']
67
+ senderEmail: json['senderEmail'],
68
+ migration: json['migration'] == null ? undefined : json['migration']
68
69
  };
69
70
  }
70
71
  function GetTemplatesListResponseInnerAnyOfToJSON(json) {
@@ -86,6 +87,7 @@ function GetTemplatesListResponseInnerAnyOfToJSONTyped(value, ignoreDiscriminato
86
87
  internal: value['internal'],
87
88
  subject: value['subject'],
88
89
  senderName: value['senderName'],
89
- senderEmail: value['senderEmail']
90
+ senderEmail: value['senderEmail'],
91
+ migration: value['migration']
90
92
  };
91
93
  }
@@ -92,6 +92,12 @@ export interface GetTemplatesResponse {
92
92
  * @memberof GetTemplatesResponse
93
93
  */
94
94
  senderEmail: string;
95
+ /**
96
+ *
97
+ * @type {string}
98
+ * @memberof GetTemplatesResponse
99
+ */
100
+ migration?: string;
95
101
  /**
96
102
  *
97
103
  * @type {string}
@@ -91,6 +91,7 @@ function GetTemplatesResponseFromJSONTyped(json, ignoreDiscriminator) {
91
91
  subject: json['subject'],
92
92
  senderName: json['senderName'],
93
93
  senderEmail: json['senderEmail'],
94
+ migration: json['migration'] == null ? undefined : json['migration'],
94
95
  title: json['title'],
95
96
  redirectURL: json['redirectURL'],
96
97
  imageURL: json['imageURL'],
@@ -134,6 +135,7 @@ function GetTemplatesResponseToJSONTyped(value, ignoreDiscriminator = false) {
134
135
  subject: value['subject'],
135
136
  senderName: value['senderName'],
136
137
  senderEmail: value['senderEmail'],
138
+ migration: value['migration'],
137
139
  title: value['title'],
138
140
  redirectURL: value['redirectURL'],
139
141
  imageURL: value['imageURL'],
@@ -53,6 +53,12 @@ export interface TemplatePatchRequest {
53
53
  * @memberof TemplatePatchRequest
54
54
  */
55
55
  senderEmail?: string;
56
+ /**
57
+ * Migration metadata (e.g. from template migration).
58
+ * @type {string}
59
+ * @memberof TemplatePatchRequest
60
+ */
61
+ migration?: string;
56
62
  /**
57
63
  * Notification title (in-app).
58
64
  * @type {string}
@@ -40,6 +40,7 @@ function TemplatePatchRequestFromJSONTyped(json, ignoreDiscriminator) {
40
40
  subject: json['subject'] == null ? undefined : json['subject'],
41
41
  senderName: json['senderName'] == null ? undefined : json['senderName'],
42
42
  senderEmail: json['senderEmail'] == null ? undefined : json['senderEmail'],
43
+ migration: json['migration'] == null ? undefined : json['migration'],
43
44
  title: json['title'] == null ? undefined : json['title'],
44
45
  redirectURL: json['redirectURL'] == null ? undefined : json['redirectURL'],
45
46
  imageURL: json['imageURL'] == null ? undefined : json['imageURL'],
@@ -71,6 +72,7 @@ function TemplatePatchRequestToJSONTyped(value, ignoreDiscriminator = false) {
71
72
  subject: value['subject'],
72
73
  senderName: value['senderName'],
73
74
  senderEmail: value['senderEmail'],
75
+ migration: value['migration'],
74
76
  title: value['title'],
75
77
  redirectURL: value['redirectURL'],
76
78
  imageURL: value['imageURL'],
@@ -59,6 +59,12 @@ export interface TemplatePostRequest {
59
59
  * @memberof TemplatePostRequest
60
60
  */
61
61
  senderEmail?: string;
62
+ /**
63
+ * Migration metadata (e.g. from template migration).
64
+ * @type {string}
65
+ * @memberof TemplatePostRequest
66
+ */
67
+ migration?: string;
62
68
  /**
63
69
  * Notification title (in-app).
64
70
  * @type {string}
@@ -43,6 +43,7 @@ function TemplatePostRequestFromJSONTyped(json, ignoreDiscriminator) {
43
43
  subject: json['subject'] == null ? undefined : json['subject'],
44
44
  senderName: json['senderName'] == null ? undefined : json['senderName'],
45
45
  senderEmail: json['senderEmail'] == null ? undefined : json['senderEmail'],
46
+ migration: json['migration'] == null ? undefined : json['migration'],
46
47
  title: json['title'] == null ? undefined : json['title'],
47
48
  redirectURL: json['redirectURL'] == null ? undefined : json['redirectURL'],
48
49
  imageURL: json['imageURL'] == null ? undefined : json['imageURL'],
@@ -75,6 +76,7 @@ function TemplatePostRequestToJSONTyped(value, ignoreDiscriminator = false) {
75
76
  subject: value['subject'],
76
77
  senderName: value['senderName'],
77
78
  senderEmail: value['senderEmail'],
79
+ migration: value['migration'],
78
80
  title: value['title'],
79
81
  redirectURL: value['redirectURL'],
80
82
  imageURL: value['imageURL'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pingram",
3
- "version": "1.0.0-alpha.863",
3
+ "version": "1.0.0",
4
4
  "description": "Official Node.js SDK for Pingram - Send notifications via Email, SMS, Push, In-App, and more",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",