You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,3 +39,35 @@ npm link ../../keeperapi
39
39
```
40
40
41
41
from your client folder
42
+
43
+
How to add an api command to this sdk:
44
+
45
+
Prerequisites:
46
+
- Have the keeperapp-protobuf repo alongside this repo (eg: /home/keeper-sdk-javascript and /home/keeperapp-protobuf)
47
+
- Make sure that the protobuf that you want is in the branch of the keeperapp-protobuf project you have loaded
48
+
- In the update-proto:cjs and update-proto:es6 commands in keeperapi/package.json, ensure that the proto files from keeperapp-protobuf that you want are listed there
49
+
50
+
Steps:
51
+
1. Navigate to the keeperapi folder in your terminal (eg: /home/keeper-sdk-javascript/keeperapi)
52
+
2. Run command ```npm run update-proto:cjs``` then command ```npm run update-proto:es6```
53
+
3. Open the file ```keeperapi/src/restMessages.ts```
54
+
4. There are 4 messages we handle with each of their differences:
55
+
a. createInMessage - This expects data to be sent
56
+
b. createOutMessage - This expects data to be received
57
+
c. createMessage - This expects data to be sent and received
58
+
d. createActionMessage - This expects no data sent or received, just make the call
59
+
60
+
5. In the file, you will see various examples of each of those 4 messages being used. Their typical layout is as follows:
61
+
a. createInMessage: export const name = (data: requestType): RestInMessage<requestType> =>
62
+
createInMessage(data, 'api/call', requestType)
63
+
b. createOutMessage: export const name = (): RestOutMessage<responseType> =>
64
+
createOutMessage('api/call', responseType)
65
+
c. createMessage: export const name = (data: requestType): RestMessage<requestType, responseType> =>
0 commit comments