Skip to content

Commit 1baa22c

Browse files
fix(express): adding jsdoc
adding jsdoc to support openapi doc gen Ticket: WP-5643
1 parent 4d12f4f commit 1baa22c

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

modules/express/src/typedRoutes/api/v1/acceptShare.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,38 @@ import { httpRoute, httpRequest, optional } from '@api-ts/io-ts-http';
33
import { BitgoExpressError } from '../../schemas/error';
44

55
export const AcceptShareRequestParams = {
6+
/** ID of the wallet share to accept */
67
shareId: t.string,
78
};
89

910
export const AcceptShareRequestBody = {
11+
/** User's password for authentication */
1012
userPassword: optional(t.string),
13+
/** New passphrase to encrypt the shared wallet's keys */
1114
newWalletPassphrase: optional(t.string),
15+
/** Optional encrypted private key to use instead of generating a new one */
1216
overrideEncryptedXprv: optional(t.string),
1317
};
1418

1519
/**
16-
* Accept a wallet share
20+
* Accept a Wallet Share
21+
* Allows users to accept a wallet share invitation from another user.
22+
* When a wallet is shared with a user, they need to accept the share to gain access
23+
* to the wallet according to the permissions granted by the sharing user.
1724
*
1825
* @operationId express.v1.wallet.acceptShare
1926
*/
2027
export const PostAcceptShare = httpRoute({
21-
path: '/api/v1/walletshare/:shareId/acceptShare',
28+
path: '/api/v1/walletshare/{shareId}/acceptShare',
2229
method: 'POST',
2330
request: httpRequest({
2431
params: AcceptShareRequestParams,
2532
body: AcceptShareRequestBody,
2633
}),
2734
response: {
35+
/** Successfully accepted wallet share */
2836
200: t.UnknownRecord,
37+
/** Error response */
2938
400: BitgoExpressError,
3039
},
3140
});

modules/express/src/typedRoutes/api/v1/pendingApproval.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,45 @@ import { httpRoute, httpRequest, optional } from '@api-ts/io-ts-http';
33
import { BitgoExpressError } from '../../schemas/error';
44

55
export const pendingApprovalRequestParams = {
6+
/** ID of the pending approval to update */
67
id: t.string,
78
};
89

910
export const pendingApprovalRequestBody = {
11+
/** Wallet passphrase for decrypting user keys (required for transaction signing) */
1012
walletPassphrase: optional(t.string),
13+
/** One-time password for 2FA verification */
1114
otp: optional(t.string),
15+
/** Transaction hex to use instead of the original transaction */
1216
tx: optional(t.string),
17+
/** Private key in string form (as an alternative to wallet passphrase) */
1318
xprv: optional(t.string),
19+
/** If true, returns information about pending transactions without approving */
1420
previewPendingTxs: optional(t.boolean),
21+
/** Alternative ID for the pending approval */
1522
pendingApprovalId: optional(t.string),
1623
};
1724

1825
/**
19-
* Pending approval request
26+
* Pending Approval Request
27+
* Approve or reject a pending approval by its ID.
28+
* Handles various approval scenarios including transaction approvals, policy rule changes,
29+
* and user change requests.
2030
*
2131
* @operationId express.v1.pendingapprovals
2232
*/
2333

2434
export const PutPendingApproval = httpRoute({
25-
path: '/api/v1/pendingapprovals/:id/express',
35+
path: '/api/v1/pendingapprovals/{id}/express',
2636
method: 'PUT',
2737
request: httpRequest({
2838
params: pendingApprovalRequestParams,
2939
body: pendingApprovalRequestBody,
3040
}),
3141
response: {
42+
/** Successfully updated pending approval */
3243
200: t.UnknownRecord,
44+
/** Error response */
3345
400: BitgoExpressError,
3446
},
3547
});

modules/express/test/unit/typedRoutes/acceptShare.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ describe('AcceptShare codec tests', function () {
8585
describe('Edge cases', function () {
8686
describe('PostAcceptShare route definition', function () {
8787
it('should have the correct path', function () {
88-
assert.strictEqual(PostAcceptShare.path, '/api/v1/walletshare/:shareId/acceptShare');
88+
assert.strictEqual(PostAcceptShare.path, '/api/v1/walletshare/{shareId}/acceptShare');
8989
});
9090

9191
it('should have the correct HTTP method', function () {

modules/express/test/unit/typedRoutes/pendingApproval.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ describe('PendingApproval codec tests', function () {
182182

183183
describe('PutPendingApproval route definition', function () {
184184
it('should have the correct path', function () {
185-
assert.strictEqual(PutPendingApproval.path, '/api/v1/pendingapprovals/:id/express');
185+
assert.strictEqual(PutPendingApproval.path, '/api/v1/pendingapprovals/{id}/express');
186186
});
187187

188188
it('should have the correct HTTP method', function () {

0 commit comments

Comments
 (0)