Skip to content

Commit e01dd5b

Browse files
committed
fix: update api schema
Signed-off-by: Ákos Sztremi <Akos.Sztremi@ibm.com>
1 parent 7db9298 commit e01dd5b

4 files changed

Lines changed: 969 additions & 959 deletions

File tree

examples/platform-notifications.v1.test.js

Lines changed: 94 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,100 @@ describe('PlatformNotificationsV1', () => {
7575
expect(platformNotificationsService).not.toBeNull();
7676
});
7777

78+
test('listNotifications request example', async () => {
79+
consoleLogMock.mockImplementation((output) => {
80+
originalLog(output);
81+
});
82+
consoleWarnMock.mockImplementation((output) => {
83+
// if an error occurs, display the message and then fail the test
84+
originalWarn(output);
85+
expect(true).toBeFalsy();
86+
});
87+
88+
originalLog('listNotifications() result:');
89+
// begin-list_notifications
90+
91+
const params = {
92+
accountId,
93+
limit: 50,
94+
};
95+
96+
const allResults = [];
97+
try {
98+
const pager = new PlatformNotificationsV1.NotificationsPager(
99+
platformNotificationsService,
100+
params
101+
);
102+
while (pager.hasNext()) {
103+
const nextPage = await pager.getNext();
104+
expect(nextPage).not.toBeNull();
105+
allResults.push(...nextPage);
106+
}
107+
console.log(JSON.stringify(allResults, null, 2));
108+
} catch (err) {
109+
console.warn(err);
110+
}
111+
112+
// end-list_notifications
113+
});
114+
115+
test('getAcknowledgement request example', async () => {
116+
consoleLogMock.mockImplementation((output) => {
117+
originalLog(output);
118+
});
119+
consoleWarnMock.mockImplementation((output) => {
120+
// if an error occurs, display the message and then fail the test
121+
originalWarn(output);
122+
expect(true).toBeFalsy();
123+
});
124+
125+
originalLog('getAcknowledgement() result:');
126+
// begin-get_acknowledgement
127+
128+
const params = {
129+
accountId,
130+
};
131+
132+
let res;
133+
try {
134+
res = await platformNotificationsService.getAcknowledgement(params);
135+
console.log(JSON.stringify(res.result, null, 2));
136+
} catch (err) {
137+
console.warn(err);
138+
}
139+
140+
// end-get_acknowledgement
141+
});
142+
143+
test('replaceNotificationAcknowledgement request example', async () => {
144+
consoleLogMock.mockImplementation((output) => {
145+
originalLog(output);
146+
});
147+
consoleWarnMock.mockImplementation((output) => {
148+
// if an error occurs, display the message and then fail the test
149+
originalWarn(output);
150+
expect(true).toBeFalsy();
151+
});
152+
153+
originalLog('replaceNotificationAcknowledgement() result:');
154+
// begin-replace_notification_acknowledgement
155+
156+
const params = {
157+
lastAcknowledged: 1772804159452,
158+
accountId,
159+
};
160+
161+
let res;
162+
try {
163+
res = await platformNotificationsService.replaceNotificationAcknowledgement(params);
164+
console.log(JSON.stringify(res.result, null, 2));
165+
} catch (err) {
166+
console.warn(err);
167+
}
168+
169+
// end-replace_notification_acknowledgement
170+
});
171+
78172
test('listDistributionListDestinations request example', async () => {
79173
consoleLogMock.mockImplementation((output) => {
80174
originalLog(output);
@@ -324,99 +418,6 @@ describe('PlatformNotificationsV1', () => {
324418
// end-replace_notification_preferences
325419
});
326420

327-
test('listNotifications request example', async () => {
328-
consoleLogMock.mockImplementation((output) => {
329-
originalLog(output);
330-
});
331-
consoleWarnMock.mockImplementation((output) => {
332-
// if an error occurs, display the message and then fail the test
333-
originalWarn(output);
334-
expect(true).toBeFalsy();
335-
});
336-
337-
originalLog('listNotifications() result:');
338-
// begin-list_notifications
339-
340-
const params = {
341-
accountId,
342-
limit: 50,
343-
};
344-
345-
const allResults = [];
346-
try {
347-
const pager = new PlatformNotificationsV1.NotificationsPager(
348-
platformNotificationsService,
349-
params
350-
);
351-
while (pager.hasNext()) {
352-
const nextPage = await pager.getNext();
353-
expect(nextPage).not.toBeNull();
354-
allResults.push(...nextPage);
355-
}
356-
console.log(JSON.stringify(allResults, null, 2));
357-
} catch (err) {
358-
console.warn(err);
359-
}
360-
361-
// end-list_notifications
362-
});
363-
364-
test('getAcknowledgement request example', async () => {
365-
consoleLogMock.mockImplementation((output) => {
366-
originalLog(output);
367-
});
368-
consoleWarnMock.mockImplementation((output) => {
369-
// if an error occurs, display the message and then fail the test
370-
originalWarn(output);
371-
expect(true).toBeFalsy();
372-
});
373-
374-
originalLog('getAcknowledgement() result:');
375-
// begin-get_acknowledgement
376-
377-
const params = {
378-
accountId,
379-
};
380-
381-
let res;
382-
try {
383-
res = await platformNotificationsService.getAcknowledgement(params);
384-
console.log(JSON.stringify(res.result, null, 2));
385-
} catch (err) {
386-
console.warn(err);
387-
}
388-
389-
// end-get_acknowledgement
390-
});
391-
392-
test('replaceNotificationAcknowledgement request example', async () => {
393-
consoleLogMock.mockImplementation((output) => {
394-
originalLog(output);
395-
});
396-
consoleWarnMock.mockImplementation((output) => {
397-
// if an error occurs, display the message and then fail the test
398-
originalWarn(output);
399-
expect(true).toBeFalsy();
400-
});
401-
402-
originalLog('replaceNotificationAcknowledgement() result:');
403-
// begin-replace_notification_acknowledgement
404-
405-
const params = {
406-
lastAcknowledgedId: '1772804159452',
407-
accountId,
408-
};
409-
410-
let res;
411-
try {
412-
res = await platformNotificationsService.replaceNotificationAcknowledgement(params);
413-
console.log(JSON.stringify(res.result, null, 2));
414-
} catch (err) {
415-
console.warn(err);
416-
}
417-
418-
// end-replace_notification_acknowledgement
419-
});
420421

421422
test('deleteDistributionListDestination request example', async () => {
422423
consoleLogMock.mockImplementation((output) => {

0 commit comments

Comments
 (0)