Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 792a152

Browse files
committed
Use memberId instead of userId for fetch-submissions, and minor tweak documentation.
1 parent c385d76 commit 792a152

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

bin/topcoder-cli.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ program
4141
` "username": "<Topcoder username>",\n` +
4242
` "password": "<Topcoder password>",\n` +
4343
` "m2m": {\n` +
44-
` client_id: "<Client ID for M2M authentication>",\n` +
45-
` client_secret: "<Client Secret for M2M authentication>"\n` +
44+
` "client_id": "<Client ID for M2M authentication>",\n` +
45+
` "client_secret": "<Client Secret for M2M authentication>"\n` +
4646
` }\n` +
4747
`}\n` +
4848
`and execute command \`topcoder submit\` to submit the contents of ` +
@@ -72,7 +72,7 @@ program
7272
'Challenge ID for submissions to be fetched'
7373
)
7474
.option(
75-
'-u, --userId <id>',
75+
'-u, --memberId <id>',
7676
'Fetch only the submission of for a particular user id'
7777
)
7878
.option(
@@ -83,25 +83,25 @@ program
8383
.option('--dev', 'Points to Topcoder development environment')
8484
.on('--help', () => {
8585
console.log(
86-
`\nUse CLI parameters or create a file .topcoderrc in JSON format with below details` +
86+
`\nUse CLI parameters or create a file .topcoderrc in JSON format with below details\n` +
8787
`{\n` +
88-
` "userId": "<Topcoder memberId",\n` +
88+
` "memberId": "<Topcoder memberId",\n` +
8989
` "challengeId": "<Topcoder challengeId",\n` +
9090
` "submissionId": "<Topcoder submissionId",\n` +
9191
` "latest": true,\n` +
9292
` "username": "<Topcoder username>",\n` +
9393
` "password": "<Topcoder password>",\n` +
9494
` "m2m": {\n` +
95-
` client_id: "<Client ID for M2M authentication>",\n` +
96-
` client_secret: "<Client Secret for M2M authentication>"\n` +
95+
` "client_id": "<Client ID for M2M authentication>",\n` +
96+
` "client_secret": "<Client Secret for M2M authentication>"\n` +
9797
` }\n` +
9898
`}\n` +
9999
`and execute command \`topcoder fetch-submissions\` to fetch submissions ` +
100100
`for a challenge and save them.\n` +
101101
`You may specify the m2m config or the username and password config, ` +
102102
`but not both.\n` +
103103
`If the submissionId parameter is provided, you must not provide the ` +
104-
`userId or the latest parameters.\n` +
104+
`memberId or the latest parameters.\n` +
105105
`The challengeId parameter is always required.`
106106
)
107107
})
@@ -140,8 +140,8 @@ program
140140
` "username": "<Topcoder username>",\n` +
141141
` "password": "<Topcoder password>",\n` +
142142
` "m2m": {\n` +
143-
` client_id: "<Client ID for M2M authentication>",\n` +
144-
` client_secret: "<Client Secret for M2M authentication>"\n` +
143+
` "client_id": "<Client ID for M2M authentication>",\n` +
144+
` "client_secret": "<Client Secret for M2M authentication>"\n` +
145145
` }\n` +
146146
`}\n` +
147147
`and execute command \`topcoder fetch-artifacts\` to fetch submissions for` +

src/services/fetchSubmissionService.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ let submissionApiClient
1414
const schemaForRC = helper.defaultAuthSchema
1515
.keys({
1616
challengeId: Joi.string().required(),
17-
userId: Joi.number().integer(),
17+
memberId: Joi.number().integer(),
1818
submissionId: Joi.string(),
1919
latest: Joi.boolean()
2020
})
21-
.without('submissionId', ['userId', 'latest'])
22-
.without('userId', 'submissionId')
21+
.without('submissionId', ['memberId', 'latest'])
22+
.without('memberId', 'submissionId')
2323
.without('latest', 'submissionId')
2424
.unknown()
2525

2626
// Acceptable CLI params
27-
const validCLIParams = ['challengeId', 'userId', 'submissionId', 'latest']
27+
const validCLIParams = ['challengeId', 'memberId', 'submissionId', 'latest']
2828

2929
/**
3030
* Download the submissions to the savePath directory sequentially.s
@@ -92,7 +92,7 @@ async function fetchSubmissions (currDir, cliParams) {
9292
password,
9393
m2m,
9494
challengeId,
95-
userId,
95+
memberId,
9696
submissionId,
9797
latest
9898
} = await helper.readFromRCFile(rcPath, params, schemaForRC, validCLIParams)
@@ -129,9 +129,9 @@ async function fetchSubmissions (currDir, cliParams) {
129129
perPage: 100,
130130
page
131131
}
132-
// If there's a userId specified, filter by userId.
133-
if (userId) {
134-
query.memberId = userId
132+
// If there's a memberId specified, filter by memberId.
133+
if (memberId) {
134+
query.memberId = memberId
135135
}
136136
// Get a list of submissions
137137
const nextSubmissions = await submissionApiClient.searchSubmissions(query)

0 commit comments

Comments
 (0)