Skip to content

Commit

Permalink
feat: Support sign request signer group ID
Browse files Browse the repository at this point in the history
  • Loading branch information
congminh1254 committed Feb 22, 2024
1 parent 76646c1 commit f002bde
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/sign-requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ OPTIONS
--signer=signer
(required) A signer for the sign request. 35 is the max number of signers permitted. Can be added multiple times.
Allowed (recommended) properties:
email,role,is-in-person,order,embed-url-external-user-id,redirect-url,declined-redirect-url but snake case is also
supported for: is_in_person,order,embed_url_external_user_id,redirect_url,declined_redirect_url
email,role,is-in-person,order,embed-url-external-user-id,redirect-url,declined-redirect-url,group-id but snake case is also
supported for: is_in_person,order,embed_url_external_user_id,redirect_url,declined_redirect_url,group_id
--source-files=source-files
(required) Comma separated list of files to create a signing document from. This is currently limited to 10 files,
Expand Down
10 changes: 8 additions & 2 deletions src/commands/sign-requests/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ SignRequestsCreateCommand.flags = {
required: true,
description:
'A signer for the sign request. 35 is the max number of signers permitted. Can be added multiple times. ' +
'Allowed (recommended) properties: email,role,is-in-person,order,embed-url-external-user-id,redirect-url,declined-redirect-url ' +
'but snake case is also supported for: is_in_person,order,embed_url_external_user_id,redirect_url,declined_redirect_url',
'Allowed (recommended) properties: email,role,is-in-person,order,embed-url-external-user-id,redirect-url,declined-redirect-url,group-id ' +
'but snake case is also supported for: is_in_person,order,embed_url_external_user_id,redirect_url,declined_redirect_url,group_id',
multiple: true,
parse(input) {
const signer = {
Expand Down Expand Up @@ -107,6 +107,12 @@ SignRequestsCreateCommand.flags = {
signer.declined_redirect_url = value;
break;

case 'signer-group-id':
case 'signer_group_id':
case 'group-id':
case 'group_id':
signer.signer_group_id = value;
break;
default:
throw new BoxCLIError(`Unknown property for signer: ${key}`);
}
Expand Down
14 changes: 9 additions & 5 deletions test/commands/sign-requests.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ describe('Sign requests', () => {
documentTag2Id = '4567',
fixture = getFixture('sign-requests/post_sign_requests'),
redirectUrl = 'https://box.com/redirect_url',
declinedRedirectUrl = 'https://box.com/declined_redirect_url';
declinedRedirectUrl = 'https://box.com/declined_redirect_url',
signerGroupId = 'signers';

test
.nock(TEST_API_ROOT, api => api
Expand All @@ -69,7 +70,8 @@ describe('Sign requests', () => {
email: signerEmail,
is_in_person: true,
redirect_url: signerRedirectUrl,
declined_redirect_url: signerDeclinedRedirectUrl
declined_redirect_url: signerDeclinedRedirectUrl,
signer_group_id: signerGroupId
},
],
source_files: [
Expand Down Expand Up @@ -104,7 +106,7 @@ describe('Sign requests', () => {
.stdout()
.command([
'sign-requests:create',
`--signer=email=${signerEmail},role=approver,is_in_person=1,redirect_url=${signerRedirectUrl},declined_redirect_url=${signerDeclinedRedirectUrl}`,
`--signer=email=${signerEmail},role=approver,is_in_person=1,redirect_url=${signerRedirectUrl},declined_redirect_url=${signerDeclinedRedirectUrl},group_id=${signerGroupId}`,
`--source-files=${fileId},${fileId2}`,
`--parent-folder=${parentFolderId}`,
`--prefill-tag=id=${documentTag1Id},text=${documentTag1Value}`,
Expand All @@ -127,7 +129,8 @@ describe('Sign requests', () => {
email: signerEmail,
is_in_person: true,
redirect_url: signerRedirectUrl,
declined_redirect_url: signerDeclinedRedirectUrl
declined_redirect_url: signerDeclinedRedirectUrl,
signer_group_id: signerGroupId
},
],
source_files: [
Expand Down Expand Up @@ -162,7 +165,7 @@ describe('Sign requests', () => {
.stdout()
.command([
'sign-requests:create',
`--signer=email=${signerEmail},role=approver,is-in-person=1,redirect-url=${signerRedirectUrl},declined-redirect-url=${signerDeclinedRedirectUrl}`,
`--signer=email=${signerEmail},role=approver,is-in-person=1,redirect-url=${signerRedirectUrl},declined-redirect-url=${signerDeclinedRedirectUrl},group-id=${signerGroupId}`,
`--source-files=${fileId},${fileId2}`,
`--parent-folder=${parentFolderId}`,
`--prefill-tag=id=${documentTag1Id},text=${documentTag1Value}`,
Expand All @@ -175,6 +178,7 @@ describe('Sign requests', () => {
.it('should create a sign request with kebab case', ctx => {
assert.equal(ctx.stdout, fixture);
});

});

describe('sign-requests:cancel', () => {
Expand Down

0 comments on commit f002bde

Please sign in to comment.