Skip to content

Commit 1f0cfe7

Browse files
committed
CCM-11580: Update sandbox endpoints to match OAS
1 parent 84e756e commit 1f0cfe7

File tree

8 files changed

+150
-520
lines changed

8 files changed

+150
-520
lines changed

sandbox/api/openapi.yaml

Lines changed: 140 additions & 410 deletions
Large diffs are not rendered by default.

sandbox/controllers/MiController.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,7 @@ const createMI = async (request, response) => {
1212
await Controller.handleRequest(request, response, service.createMI);
1313
};
1414

15-
const getMi = async (request, response) => {
16-
await Controller.handleRequest(request, response, service.getMi);
17-
};
18-
19-
const listMi = async (request, response) => {
20-
await Controller.handleRequest(request, response, service.listMi);
21-
};
22-
2315

2416
module.exports = {
2517
createMI,
26-
getMi,
27-
listMi,
2818
};

sandbox/data/examples/getMI/responses/getMI.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

sandbox/data/examples/listMI/responses/listMI.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

sandbox/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"swagger-ui-express": "^4.0.2",
1313
"winston": "^3.2.1"
1414
},
15-
"description": "API for communication suppliers to integrate with NHS Notify",
15+
"description": "API for communication suppliers to integrate with NHS Notify. This specification represents the in-development 'next' version of the API schema and should be treated as unstable. ",
1616
"devDependencies": {
1717
"chai": "^4.2.0",
1818
"chai-as-promised": "^7.1.1",
@@ -38,5 +38,5 @@
3838
"prestart": "npm install",
3939
"start": "node index.js"
4040
},
41-
"version": "0.0.1"
41+
"version": "next"
4242
}

sandbox/services/DataService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const getDataId = ({ id, xRequestID, xCorrelationID }) => new Promise(
2626
},
2727
);
2828
/**
29-
* Check for the existance of a data file
29+
* Check for the existence of a data file
3030
*
3131
* id String Unique identifier of this resource
3232
* xRequestID String Unique request identifier, in the format of a GUID

sandbox/services/LetterService.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ const getLetterStatus = ({ xRequestID, id, xCorrelationID }) => new Promise(
3030
},
3131
);
3232
/**
33-
* Get a list of letters
33+
* Get a list of PENDING letters
3434
* The key use of this endpoint is to query letters which are ready to be printed
3535
*
3636
* xRequestID String Unique request identifier, in the format of a GUID
37-
* status String Status of a letter
3837
* xCorrelationID String An optional ID which you can use to track transactions across multiple systems. It can take any value, but we recommend avoiding `.` characters. If not provided in the request, NHS Notify will default to a system generated ID in its place. The ID will be returned in a response header. (optional)
38+
* limit BigDecimal The maximum number of items to return in a single request (optional)
3939
* returns listLetters_200_response
4040
* */
41-
const listLetters = ({ xRequestID, status, xCorrelationID, page }) => new Promise(
41+
const listLetters = ({ xRequestID, xCorrelationID, limit }) => new Promise(
4242
async (resolve, reject) => {
4343
try {
44-
const fileData = await ResponseProvider.getLettersResponse(status, page);
44+
const fileData = await ResponseProvider.getLettersResponse('PENDING', limit);
4545

4646
resolve(Service.successResponse({
4747
xRequestID,
@@ -66,11 +66,11 @@ const listLetters = ({ xRequestID, status, xCorrelationID, page }) => new Promis
6666
* xCorrelationID String An optional ID which you can use to track transactions across multiple systems. It can take any value, but we recommend avoiding `.` characters. If not provided in the request, NHS Notify will default to a system generated ID in its place. The ID will be returned in a response header. (optional)
6767
* returns getLetterStatus_200_response
6868
* */
69-
const patchLetters = ({ xRequestID, id, body, xCorrelationID }) => new Promise(
69+
const patchLetters = ({ xRequestID, id, patchLettersRequest, xCorrelationID }) => new Promise(
7070
async (resolve, reject) => {
7171

7272
try {
73-
const fileData = await ResponseProvider.patchLettersResponse(body);
73+
const fileData = await ResponseProvider.patchLettersResponse(patchLettersRequest);
7474

7575
resolve(Service.successResponse({
7676
xRequestID,

sandbox/services/MiService.js

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const Service = require('./Service');
77
* xRequestID String Unique request identifier, in the format of a GUID
88
* createMIRequest CreateMIRequest
99
* xCorrelationID String An optional ID which you can use to track transactions across multiple systems. It can take any value, but we recommend avoiding `.` characters. If not provided in the request, NHS Notify will default to a system generated ID in its place. The ID will be returned in a response header. (optional)
10-
* returns listMi_200_response_data_inner
10+
* returns createMI_201_response
1111
* */
1212
const createMI = ({ xRequestID, createMIRequest, xCorrelationID }) => new Promise(
1313
async (resolve, reject) => {
@@ -25,55 +25,7 @@ const createMI = ({ xRequestID, createMIRequest, xCorrelationID }) => new Promis
2525
}
2626
},
2727
);
28-
/**
29-
* Fetch a specific MI record
30-
*
31-
* xRequestID String Unique request identifier, in the format of a GUID
32-
* id String Unique identifier of this resource
33-
* xCorrelationID String An optional ID which you can use to track transactions across multiple systems. It can take any value, but we recommend avoiding `.` characters. If not provided in the request, NHS Notify will default to a system generated ID in its place. The ID will be returned in a response header. (optional)
34-
* returns getMi_200_response
35-
* */
36-
const getMi = ({ xRequestID, id, xCorrelationID }) => new Promise(
37-
async (resolve, reject) => {
38-
try {
39-
resolve(Service.successResponse({
40-
xRequestID,
41-
id,
42-
xCorrelationID,
43-
}));
44-
} catch (e) {
45-
reject(Service.rejectResponse(
46-
e.message || 'Invalid input',
47-
e.status || 405,
48-
));
49-
}
50-
},
51-
);
52-
/**
53-
* List MI Records
54-
*
55-
* xRequestID String Unique request identifier, in the format of a GUID
56-
* xCorrelationID String An optional ID which you can use to track transactions across multiple systems. It can take any value, but we recommend avoiding `.` characters. If not provided in the request, NHS Notify will default to a system generated ID in its place. The ID will be returned in a response header. (optional)
57-
* returns listMi_200_response
58-
* */
59-
const listMi = ({ xRequestID, xCorrelationID }) => new Promise(
60-
async (resolve, reject) => {
61-
try {
62-
resolve(Service.successResponse({
63-
xRequestID,
64-
xCorrelationID,
65-
}));
66-
} catch (e) {
67-
reject(Service.rejectResponse(
68-
e.message || 'Invalid input',
69-
e.status || 405,
70-
));
71-
}
72-
},
73-
);
7428

7529
module.exports = {
7630
createMI,
77-
getMi,
78-
listMi,
7931
};

0 commit comments

Comments
 (0)