notifications-node-client 8.3.1 → 8.3.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notifications-node-client",
3
- "version": "8.3.1",
3
+ "version": "8.3.2",
4
4
  "homepage": "https://docs.notifications.service.gov.uk/node.html",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,44 @@
1
+ export = ApiClient;
2
+ /**
3
+ * @param {string} apiKeyOrUrl - API key (1 arg), or base URL (2-3 args)
4
+ * @param {string} [serviceIdOrApiKey] - API key (2 args), or service ID (3 args)
5
+ * @param {string} [apiKeyId] - API key (3 args)
6
+ * @constructor
7
+ */
8
+ declare function ApiClient(apiKeyOrUrl: string, serviceIdOrApiKey?: string, apiKeyId?: string, ...args: any[]): void;
9
+ declare class ApiClient {
10
+ /**
11
+ * @param {string} apiKeyOrUrl - API key (1 arg), or base URL (2-3 args)
12
+ * @param {string} [serviceIdOrApiKey] - API key (2 args), or service ID (3 args)
13
+ * @param {string} [apiKeyId] - API key (3 args)
14
+ * @constructor
15
+ */
16
+ constructor(apiKeyOrUrl: string, serviceIdOrApiKey?: string, apiKeyId?: string, ...args: any[]);
17
+ proxy: import("axios").AxiosProxyConfig;
18
+ restClient: import("axios").AxiosStatic;
19
+ urlBase: any;
20
+ apiKeyId: any;
21
+ serviceId: any;
22
+ /**
23
+ * @param {string} path
24
+ * @param {import('axios').AxiosRequestConfig} [additionalOptions]
25
+ * @returns {Promise<import('axios').AxiosResponse>}
26
+ */
27
+ get(path: string, additionalOptions?: import("axios").AxiosRequestConfig): Promise<import("axios").AxiosResponse>;
28
+ /**
29
+ * @param {string} path
30
+ * @param {object} data
31
+ * @returns {Promise<import('axios').AxiosResponse>}
32
+ */
33
+ post(path: string, data: object): Promise<import("axios").AxiosResponse>;
34
+ /**
35
+ * @param {import('axios').AxiosProxyConfig} proxyConfig
36
+ * @returns {void}
37
+ */
38
+ setProxy(proxyConfig: import("axios").AxiosProxyConfig): void;
39
+ /**
40
+ * @param {import('axios').AxiosInstance} restClient
41
+ * @returns {void}
42
+ */
43
+ setClient(restClient: import("axios").AxiosInstance): void;
44
+ }
@@ -0,0 +1,2 @@
1
+ export = createGovukNotifyToken;
2
+ declare function createGovukNotifyToken(request_method: any, request_path: any, secret: any, client_id: any): any;
@@ -0,0 +1,365 @@
1
+ declare namespace _exports {
2
+ export { NotificationType, PostageType, TemplateRef, NotificationResponse, TemplateData };
3
+ }
4
+ declare namespace _exports {
5
+ export { NotifyClient };
6
+ }
7
+ export = _exports;
8
+ type NotificationType = "sms" | "letter" | "email";
9
+ type PostageType = "first" | "second" | "economy" | "europe" | "rest-of-world";
10
+ type TemplateRef = {
11
+ id: string;
12
+ version: number;
13
+ uri: string;
14
+ };
15
+ type NotificationResponse = {
16
+ id: string;
17
+ reference?: string;
18
+ type: NotificationType;
19
+ status: string;
20
+ template: {
21
+ id: string;
22
+ name: string;
23
+ version: number;
24
+ };
25
+ body: string;
26
+ created_at: string;
27
+ created_by_name?: string;
28
+ sent_at?: string;
29
+ completed_at?: string;
30
+ scheduled_for?: string;
31
+ one_click_unsubscribe?: string;
32
+ is_cost_data_ready: boolean;
33
+ cost_in_pounds?: number;
34
+ cost_details?: {
35
+ billable_sheets_of_paper?: number;
36
+ postage?: string;
37
+ } | {
38
+ billable_sms_fragments?: number;
39
+ international_rate_multiplier?: number;
40
+ sms_rate?: number;
41
+ };
42
+ email_address?: string;
43
+ phone_number?: string;
44
+ subject?: string;
45
+ line_1?: string;
46
+ line_2?: string;
47
+ line_3?: string;
48
+ line_4?: string;
49
+ line_5?: string;
50
+ line_6?: string;
51
+ line_7?: string;
52
+ postage?: PostageType;
53
+ };
54
+ type TemplateData = {
55
+ id: string;
56
+ name: string;
57
+ type: NotificationType;
58
+ created_at: string;
59
+ updated_at: string | null;
60
+ created_by: string;
61
+ version: number;
62
+ body: string;
63
+ subject?: string;
64
+ letter_contact_block?: string;
65
+ postage?: PostageType;
66
+ };
67
+ /**
68
+ * @typedef {"sms" | "letter" | "email"} NotificationType
69
+ */
70
+ /**
71
+ * @typedef {"first" | "second" | "economy" | "europe" | "rest-of-world"} PostageType
72
+ */
73
+ /**
74
+ * @typedef {Object} TemplateRef
75
+ * @property {string} id
76
+ * @property {number} version
77
+ * @property {string} uri
78
+ */
79
+ /**
80
+ * @typedef {Object} NotificationResponse
81
+ * @property {string} id
82
+ * @property {string} [reference]
83
+ * @property {NotificationType} type
84
+ * @property {string} status
85
+ * @property {{id: string, name: string, version: number}} template
86
+ * @property {string} body
87
+ * @property {string} created_at
88
+ * @property {string} [created_by_name]
89
+ * @property {string} [sent_at]
90
+ * @property {string} [completed_at]
91
+ * @property {string} [scheduled_for]
92
+ * @property {string} [one_click_unsubscribe]
93
+ * @property {boolean} is_cost_data_ready
94
+ * @property {number} [cost_in_pounds]
95
+ * @property {{billable_sheets_of_paper?: number, postage?: string} | {billable_sms_fragments?: number, international_rate_multiplier?: number, sms_rate?: number}} [cost_details]
96
+ * @property {string} [email_address]
97
+ * @property {string} [phone_number]
98
+ * @property {string} [subject]
99
+ * @property {string} [line_1]
100
+ * @property {string} [line_2]
101
+ * @property {string} [line_3]
102
+ * @property {string} [line_4]
103
+ * @property {string} [line_5]
104
+ * @property {string} [line_6]
105
+ * @property {string} [line_7]
106
+ * @property {PostageType} [postage]
107
+ */
108
+ /**
109
+ * @typedef {Object} TemplateData
110
+ * @property {string} id
111
+ * @property {string} name
112
+ * @property {NotificationType} type
113
+ * @property {string} created_at
114
+ * @property {string | null} updated_at
115
+ * @property {string} created_by
116
+ * @property {number} version
117
+ * @property {string} body
118
+ * @property {string} [subject]
119
+ * @property {string} [letter_contact_block]
120
+ * @property {PostageType} [postage]
121
+ */
122
+ /**
123
+ * @param {string} apiKeyOrUrl - API key (1 arg), or base URL (2-3 args)
124
+ * @param {string} [serviceIdOrApiKey] - API key (2 args), or service ID (3 args)
125
+ * @param {string} [apiKeyId] - API key (3 args)
126
+ * @constructor
127
+ */
128
+ declare function NotifyClient(apiKeyOrUrl: string, serviceIdOrApiKey?: string, apiKeyId?: string, ...args: any[]): void;
129
+ declare class NotifyClient {
130
+ /**
131
+ * @typedef {"sms" | "letter" | "email"} NotificationType
132
+ */
133
+ /**
134
+ * @typedef {"first" | "second" | "economy" | "europe" | "rest-of-world"} PostageType
135
+ */
136
+ /**
137
+ * @typedef {Object} TemplateRef
138
+ * @property {string} id
139
+ * @property {number} version
140
+ * @property {string} uri
141
+ */
142
+ /**
143
+ * @typedef {Object} NotificationResponse
144
+ * @property {string} id
145
+ * @property {string} [reference]
146
+ * @property {NotificationType} type
147
+ * @property {string} status
148
+ * @property {{id: string, name: string, version: number}} template
149
+ * @property {string} body
150
+ * @property {string} created_at
151
+ * @property {string} [created_by_name]
152
+ * @property {string} [sent_at]
153
+ * @property {string} [completed_at]
154
+ * @property {string} [scheduled_for]
155
+ * @property {string} [one_click_unsubscribe]
156
+ * @property {boolean} is_cost_data_ready
157
+ * @property {number} [cost_in_pounds]
158
+ * @property {{billable_sheets_of_paper?: number, postage?: string} | {billable_sms_fragments?: number, international_rate_multiplier?: number, sms_rate?: number}} [cost_details]
159
+ * @property {string} [email_address]
160
+ * @property {string} [phone_number]
161
+ * @property {string} [subject]
162
+ * @property {string} [line_1]
163
+ * @property {string} [line_2]
164
+ * @property {string} [line_3]
165
+ * @property {string} [line_4]
166
+ * @property {string} [line_5]
167
+ * @property {string} [line_6]
168
+ * @property {string} [line_7]
169
+ * @property {PostageType} [postage]
170
+ */
171
+ /**
172
+ * @typedef {Object} TemplateData
173
+ * @property {string} id
174
+ * @property {string} name
175
+ * @property {NotificationType} type
176
+ * @property {string} created_at
177
+ * @property {string | null} updated_at
178
+ * @property {string} created_by
179
+ * @property {number} version
180
+ * @property {string} body
181
+ * @property {string} [subject]
182
+ * @property {string} [letter_contact_block]
183
+ * @property {PostageType} [postage]
184
+ */
185
+ /**
186
+ * @param {string} apiKeyOrUrl - API key (1 arg), or base URL (2-3 args)
187
+ * @param {string} [serviceIdOrApiKey] - API key (2 args), or service ID (3 args)
188
+ * @param {string} [apiKeyId] - API key (3 args)
189
+ * @constructor
190
+ */
191
+ constructor(apiKeyOrUrl: string, serviceIdOrApiKey?: string, apiKeyId?: string, ...args: any[]);
192
+ apiClient: any;
193
+ /**
194
+ * @param {string} templateId
195
+ * @param {string} emailAddress
196
+ * @param {{personalisation?: Object, reference?: string, emailReplyToId?: string, oneClickUnsubscribeURL?: string}} [options]
197
+ * @returns {Promise<import('axios').AxiosResponse<{id: string, reference?: string, content: {body: string, subject: string, from_email: string, one_click_unsubscribe_url?: string}, uri: string, template: TemplateRef}>>}
198
+ */
199
+ sendEmail(templateId: string, emailAddress: string, options?: {
200
+ personalisation?: any;
201
+ reference?: string;
202
+ emailReplyToId?: string;
203
+ oneClickUnsubscribeURL?: string;
204
+ }): Promise<import("axios").AxiosResponse<{
205
+ id: string;
206
+ reference?: string;
207
+ content: {
208
+ body: string;
209
+ subject: string;
210
+ from_email: string;
211
+ one_click_unsubscribe_url?: string;
212
+ };
213
+ uri: string;
214
+ template: TemplateRef;
215
+ }>>;
216
+ /**
217
+ * @param {string} templateId
218
+ * @param {string} phoneNumber
219
+ * @param {{personalisation?: Object, reference?: string, smsSenderId?: string}} [options]
220
+ * @returns {Promise<import('axios').AxiosResponse<{id: string, reference?: string, content: {body: string, from_number: string}, uri: string, template: TemplateRef}>>}
221
+ */
222
+ sendSms(templateId: string, phoneNumber: string, options?: {
223
+ personalisation?: any;
224
+ reference?: string;
225
+ smsSenderId?: string;
226
+ }): Promise<import("axios").AxiosResponse<{
227
+ id: string;
228
+ reference?: string;
229
+ content: {
230
+ body: string;
231
+ from_number: string;
232
+ };
233
+ uri: string;
234
+ template: TemplateRef;
235
+ }>>;
236
+ /**
237
+ * @param {string} templateId
238
+ * @param {{personalisation?: Object, reference?: string}} [options]
239
+ * @returns {Promise<import('axios').AxiosResponse<{id: string, reference?: string, content: {body: string, subject: string}, uri: string, template: TemplateRef, scheduled_for: string | null}>>}
240
+ */
241
+ sendLetter(templateId: string, options?: {
242
+ personalisation?: any;
243
+ reference?: string;
244
+ }): Promise<import("axios").AxiosResponse<{
245
+ id: string;
246
+ reference?: string;
247
+ content: {
248
+ body: string;
249
+ subject: string;
250
+ };
251
+ uri: string;
252
+ template: TemplateRef;
253
+ scheduled_for: string | null;
254
+ }>>;
255
+ /**
256
+ * @param {string} reference
257
+ * @param {Buffer | string} pdf_file
258
+ * @param {"first" | "second" | "economy" | "europe" | "rest-of-world"} [postage]
259
+ * @returns {Promise<import('axios').AxiosResponse<{id: string, reference: string, postage: PostageType}>>}
260
+ */
261
+ sendPrecompiledLetter(reference: string, pdf_file: Buffer | string, postage?: "first" | "second" | "economy" | "europe" | "rest-of-world"): Promise<import("axios").AxiosResponse<{
262
+ id: string;
263
+ reference: string;
264
+ postage: PostageType;
265
+ }>>;
266
+ /**
267
+ * @param {string} notificationId
268
+ * @returns {Promise<import('axios').AxiosResponse<NotificationResponse>>}
269
+ */
270
+ getNotificationById(notificationId: string): Promise<import("axios").AxiosResponse<NotificationResponse>>;
271
+ /**
272
+ * @param {string} [templateType]
273
+ * @param {string} [status]
274
+ * @param {string} [reference]
275
+ * @param {string} [olderThanId]
276
+ * @returns {Promise<import('axios').AxiosResponse<{notifications: NotificationResponse[], links: {current: string, next: string}}>>}
277
+ */
278
+ getNotifications(templateType?: string, status?: string, reference?: string, olderThanId?: string): Promise<import("axios").AxiosResponse<{
279
+ notifications: NotificationResponse[];
280
+ links: {
281
+ current: string;
282
+ next: string;
283
+ };
284
+ }>>;
285
+ /**
286
+ * @param {string} notificationId
287
+ * @returns {Promise<Buffer>}
288
+ */
289
+ getPdfForLetterNotification(notificationId: string): Promise<Buffer>;
290
+ /**
291
+ * @param {string} templateId
292
+ * @returns {Promise<import('axios').AxiosResponse<TemplateData>>}
293
+ */
294
+ getTemplateById(templateId: string): Promise<import("axios").AxiosResponse<TemplateData>>;
295
+ /**
296
+ * @param {string} templateId
297
+ * @param {number} version
298
+ * @returns {Promise<import('axios').AxiosResponse<TemplateData>>}
299
+ */
300
+ getTemplateByIdAndVersion(templateId: string, version: number): Promise<import("axios").AxiosResponse<TemplateData>>;
301
+ /**
302
+ * @param {NotificationType} [templateType]
303
+ * @returns {Promise<import('axios').AxiosResponse<{templates: TemplateData[]}>>}
304
+ */
305
+ getAllTemplates(templateType?: NotificationType): Promise<import("axios").AxiosResponse<{
306
+ templates: TemplateData[];
307
+ }>>;
308
+ /**
309
+ * @param {string} templateId
310
+ * @param {Object} [personalisation]
311
+ * @returns {Promise<import('axios').AxiosResponse<{id: string, type: NotificationType, version: number, body: string, html?: string, subject?: string, postage?: PostageType}>>}
312
+ */
313
+ previewTemplateById(templateId: string, personalisation?: any): Promise<import("axios").AxiosResponse<{
314
+ id: string;
315
+ type: NotificationType;
316
+ version: number;
317
+ body: string;
318
+ html?: string;
319
+ subject?: string;
320
+ postage?: PostageType;
321
+ }>>;
322
+ /**
323
+ * @param {string} [olderThan]
324
+ * @returns {Promise<import('axios').AxiosResponse<{received_text_messages: Array<{id: string, user_number: string, notify_number: string, created_at: string, service_id: string, content: string}>, links: {current: string, next: string}}>>}
325
+ */
326
+ getReceivedTexts(olderThan?: string): Promise<import("axios").AxiosResponse<{
327
+ received_text_messages: Array<{
328
+ id: string;
329
+ user_number: string;
330
+ notify_number: string;
331
+ created_at: string;
332
+ service_id: string;
333
+ content: string;
334
+ }>;
335
+ links: {
336
+ current: string;
337
+ next: string;
338
+ };
339
+ }>>;
340
+ /**
341
+ * @param {import('axios').AxiosProxyConfig} proxyConfig
342
+ * @returns {void}
343
+ */
344
+ setProxy(proxyConfig: import("axios").AxiosProxyConfig): void;
345
+ /**
346
+ * @param {import('axios').AxiosInstance} client
347
+ * @returns {void}
348
+ */
349
+ setClient(client: import("axios").AxiosInstance): void;
350
+ /**
351
+ * @param {Buffer | string} fileData
352
+ * @param {{filename?: string, confirmEmailBeforeDownload?: boolean, retentionPeriod?: string}} [options]
353
+ * @returns {{file: string, filename: string | null, confirm_email_before_download: boolean | null, retention_period: string | null}}
354
+ */
355
+ prepareUpload(fileData: Buffer | string, options?: {
356
+ filename?: string;
357
+ confirmEmailBeforeDownload?: boolean;
358
+ retentionPeriod?: string;
359
+ }): {
360
+ file: string;
361
+ filename: string | null;
362
+ confirm_email_before_download: boolean | null;
363
+ retention_period: string | null;
364
+ };
365
+ }
@@ -0,0 +1,3 @@
1
+ import NotifyClient_1 = require("./client/notification.js");
2
+ import NotifyClient = NotifyClient_1.NotifyClient;
3
+ export { NotifyClient };