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

Commit 81d9e95

Browse files
Merge submission resource methods
1 parent 16e900a commit 81d9e95

30 files changed

+1870
-57
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules
22
.env
33
env.sh
4+
.nyc_output
5+
coverage

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ Wrapper library for Topcoder Submission API
77
1. Include the wrapper in package.json as follows
88

99
```bash
10-
"tc-submission-api-wrapper": "topcoder-platform/tc-submission-api-wrapper.git"
10+
"topcoder-submission-api-wrapper": "topcoder-platform/topcoder-submission-api-wrapper.git"
1111
```
1212

1313
2. Create an instance of this wrapper with the configuration variables listed below
1414

1515
```javascript
16-
const submissionApi = require('tc-submission-api-wrapper')
16+
const submissionApi = require('topcoder-submission-api-wrapper')
1717
const submissionApiClient = submissionApi(_.pick(config,
1818
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
1919
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -92,6 +92,23 @@ Method | HTTP request | Description
9292
[**patchReviewSummation**](docs/ReviewSummationsApi.md#patchReviewSummation) | **PATCH** /reviewSummations/{reviewSummationId} | Partially update review summation.
9393
[**deleteReviewSummation**](docs/ReviewSummationsApi.md#deleteReviewSummation) | **DELETE** /reviewSummations/{reviewSummationId} | Delete the review summation.
9494

95+
### Submissions wrapper methods
96+
97+
Method | HTTP request | Description
98+
------------- | ------------- | -------------
99+
[**searchSubmissions**](docs/SubmissionsApi.md#searchSubmissions) | **GET** /submissions | Search submissions.
100+
[**headSubmissions**](docs/SubmissionsApi.md#headSubmissions) | **HEAD** /submissions | Same to search submissions, but only response status and headers information return.
101+
[**createSubmission**](docs/SubmissionsApi.md#createSubmission) | **POST** /submissions | Create a submission.
102+
[**getSubmission**](docs/SubmissionsApi.md#getSubmission) | **GET** /submissions/{submissionId} | Get the submission.
103+
[**headSubmission**](docs/SubmissionsApi.md#headSubmission) | **HEAD** /submissions/{submissionId} | Same to get submission, but only response status and headers information return.
104+
[**updateSubmission**](docs/SubmissionsApi.md#updateSubmission) | **PUT** /submissions/{submissionId} | Fully update submission.
105+
[**patchSubmission**](docs/SubmissionsApi.md#patchSubmission) | **PATCH** /submissions/{submissionId} | Partially update submission.
106+
[**deleteSubmission**](docs/SubmissionsApi.md#deleteSubmission) | **DELETE** /submissions/{submissionId} | Delete the submission.
107+
[**downloadSubmission**](docs/SubmissionsApi.md#downloadSubmission) | **GET** /submissions/{submissionId}/download | Download the submission.
108+
[**createArtifact**](docs/SubmissionsApi.md#createArtifact) | **POST** /submissions/{submissionId}/artifacts | Create artifact for submission.
109+
[**listArtifacts**](docs/SubmissionsApi.md#listArtifacts) | **GET** /submissions/{submissionId}/artifacts | List artifacts of specified submission.
110+
[**downloadArtifact**](docs/SubmissionsApi.md#downloadArtifact) | **GET** /submissions/{submissionId}/artifacts/{artifactId}/download | Download artifact
111+
95112
## Authorization
96113

97114
The wrapper internally generates a **JWT token using Auth0 credentials** and pass it in the `Authorization` header.

Verification.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@
88

99
## Test Coverage Report
1010

11-
172 passing (9m)
11+
226 passing (5m)
1212

13-
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
14-
------------------------------------------ | ------- | -------- | ------- | ------- | -----------------
15-
All files | 99.14 | 84.62 | 100 | 99.14 |
16-
topcoder-submission-api-wrapper | 100 | 100 | 100 | 100 |
17-
index.js | 100 | 100 | 100 | 100 |
18-
topcoder-submission-api-wrapper/src | 100 | 100 | 100 | 100 |
19-
ReviewSummationsApi.js | 100 | 100 | 100 | 100 |
20-
ReviewTypesApi.js | 100 | 100 | 100 | 100 |
21-
ReviewsApi.js | 100 | 100 | 100 | 100 |
22-
topcoder-submission-api-wrapper/src/common | 96 | 81.82 | 100 | 96 |
23-
helper.js | 96 | 81.82 | 100 | 96 | 63
13+
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
14+
--------------------------------------------|----------|----------|----------|----------|-------------------
15+
All files | 99.42 | 90 | 100 | 99.42 |
16+
topcoder-submission-api-wrapper | 100 | 100 | 100 | 100 |
17+
index.js | 100 | 100 | 100 | 100 |
18+
topcoder-submission-api-wrapper/src | 100 | 100 | 100 | 100 |
19+
ReviewSummationsApi.js | 100 | 100 | 100 | 100 |
20+
ReviewTypesApi.js | 100 | 100 | 100 | 100 |
21+
ReviewsApi.js | 100 | 100 | 100 | 100 |
22+
SubmissionsApi.js | 100 | 100 | 100 | 100 |
23+
topcoder-submission-api-wrapper/src/common | 97.56 | 88.89 | 100 | 97.56 |
24+
helper.js | 97.56 | 88.89 | 100 | 97.56 | 63

docs/Artifact.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Artifact
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**artifact** | **String** | The artifact file name. |

docs/ArtifactData.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# ArtifactData
2+
3+
It is a form data
4+
5+
## Properties
6+
7+
Name | Type | Description | Notes
8+
------------ | ------------- | ------------- | -------------
9+
**typeId** | **String** | The type id. |
10+
**artifact** | **File** | The artifact file to be uploaded. | The object should have properties name(indicate the file name) and data(a Buffer represents the file content)

docs/Criteria.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Criteria
22

33
## Properties
4+
45
Name | Type | Description | Notes
56
------------ | ------------- | ------------- | -------------
67
**page** | **Integer** | The page number. | Default value is 1

docs/ListArtifactsData.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ListArtifactsData
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**artifacts** | **Array of String** | submission's artifacts. |

docs/Review.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Review
22

33
## Properties
4+
45
Name | Type | Description | Notes
56
------------ | ------------- | ------------- | -------------
67
**id** | **String** | The review id. |

docs/ReviewData.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# ReviewData
22

33
## Properties
4+
45
Name | Type | Description | Notes
56
------------ | ------------- | ------------- | -------------
67
**score** | **Number** | The review score. |

docs/ReviewSummation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Review Summation
22

33
## Properties
4+
45
Name | Type | Description | Notes
56
------------ | ------------- | ------------- | -------------
67
**id** | **String** | The review summation id. |
@@ -13,4 +14,3 @@ Name | Type | Description | Notes
1314
**updated** | **String** | The ISO date string of updated date. |
1415
**createdBy** | **String** | The created by user. |
1516
**updatedBy** | **String** | The updated by user. |
16-

docs/ReviewSummationData.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# ReviewSummationData
22

33
## Properties
4+
45
Name | Type | Description | Notes
56
------------ | ------------- | ------------- | -------------
67
**submissionId** | **String** | The submission id. |
78
**aggregateScore** | **Number** | The aggregate score. |Double
89
**scoreCardId** | **Number or String** | The score card id. |GUID string in swagger but integer in implementation
910
**isPassing** | **Boolean** | The passing boolean flag. |
1011
**metadata** | **Object** | The review summation's metadata. | Optional
11-

docs/ReviewSummationsApi.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Search review summations. Link headers are sent back and they have rel set to pr
2121

2222
### Example
2323
```javascript
24-
const submissionApi = require('tc-submission-api-wrapper')
24+
const submissionApi = require('topcoder-submission-api-wrapper')
2525
const submissionApiClient = submissionApi(_.pick(config,
2626
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
2727
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -50,7 +50,7 @@ await submissionApiClient.searchReviewSummations(reqQuery)
5050

5151
Name | Type | Description
5252
------------- | ------------- | -------------
53-
**reqQuery** | [**SearchReviewSummationsCriteria**](SearchReviewSummationsCriteria.md) | the search review summations criteria
53+
**reqQuery** | [**SearchReviewSummationsCriteria**](SearchReviewSummationsCriteria.md) | the search review summations criteria
5454

5555
### Return type
5656

@@ -74,7 +74,7 @@ Same to search review summations, but only response status and headers informati
7474

7575
### Example
7676
```javascript
77-
const submissionApi = require('tc-submission-api-wrapper')
77+
const submissionApi = require('topcoder-submission-api-wrapper')
7878
const submissionApiClient = submissionApi(_.pick(config,
7979
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
8080
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -127,7 +127,7 @@ Create a review summation.
127127

128128
### Example
129129
```javascript
130-
const submissionApi = require('tc-submission-api-wrapper')
130+
const submissionApi = require('topcoder-submission-api-wrapper')
131131
const submissionApiClient = submissionApi(_.pick(config,
132132
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
133133
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -155,7 +155,7 @@ await submissionApiClient.createReviewSummation(reqBody)
155155

156156
Name | Type | Description
157157
------------- | ------------- | -------------
158-
**reqBody** | [**ReviewSummationData**](ReviewSummationData.md) | the review summation data
158+
**reqBody** | [**ReviewSummationData**](ReviewSummationData.md) | the review summation data
159159

160160
### Return type
161161

@@ -179,7 +179,7 @@ Get the review summation by id.
179179

180180
### Example
181181
```javascript
182-
const submissionApi = require('tc-submission-api-wrapper')
182+
const submissionApi = require('topcoder-submission-api-wrapper')
183183
const submissionApiClient = submissionApi(_.pick(config,
184184
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
185185
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -200,7 +200,7 @@ await submissionApiClient.getReviewSummation(reviewSummationId)
200200

201201
Name | Type | Description
202202
------------- | ------------- | -------------
203-
**reviewSummationId** | String | the review summation id
203+
**reviewSummationId** | String | the review summation id
204204

205205
### Return type
206206

@@ -224,7 +224,7 @@ Same to get review summation, but only response status and headers information r
224224

225225
### Example
226226
```javascript
227-
const submissionApi = require('tc-submission-api-wrapper')
227+
const submissionApi = require('topcoder-submission-api-wrapper')
228228
const submissionApiClient = submissionApi(_.pick(config,
229229
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
230230
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -246,11 +246,11 @@ await submissionApiClient.headReviewSummation(reviewId)
246246

247247
Name | Type | Description
248248
------------- | ------------- | -------------
249-
**reviewSummationId** | String | the review summation id
249+
**reviewSummationId** | String | the review summation id
250250

251251
### Return type
252252

253-
[**ReviewSummation**](ReviewSummation.md)
253+
null (empty response body)
254254

255255
### Authorization
256256

@@ -270,7 +270,7 @@ Fully update review summation.
270270

271271
### Example
272272
```javascript
273-
const submissionApi = require('tc-submission-api-wrapper')
273+
const submissionApi = require('topcoder-submission-api-wrapper')
274274
const submissionApiClient = submissionApi(_.pick(config,
275275
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
276276
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -299,8 +299,8 @@ await submissionApiClient.updateReviewSummation(reviewSummationId, reqBody)
299299

300300
Name | Type | Description
301301
------------- | ------------- | -------------
302-
**reviewSummationId** | String | the review summation id
303-
**reqBody** | [**ReviewSummationData**](ReviewSummationData.md) | the review summation data
302+
**reviewSummationId** | String | the review summation id
303+
**reqBody** | [**ReviewSummationData**](ReviewSummationData.md) | the review summation data
304304

305305
### Return type
306306

@@ -324,7 +324,7 @@ Partially update review summation.
324324

325325
### Example
326326
```javascript
327-
const submissionApi = require('tc-submission-api-wrapper')
327+
const submissionApi = require('topcoder-submission-api-wrapper')
328328
const submissionApiClient = submissionApi(_.pick(config,
329329
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
330330
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -350,8 +350,8 @@ await submissionApiClient.patchReviewSummation(reviewSummationId, reqBody)
350350

351351
Name | Type | Description
352352
------------- | ------------- | -------------
353-
**reviewSummationId** | String | the review summation id
354-
**reqBody** | [**ReviewSummationData**](ReviewSummationData.md) | the review summation data
353+
**reviewSummationId** | String | the review summation id
354+
**reqBody** | [**ReviewSummationData**](ReviewSummationData.md) | the review summation data
355355

356356
### Return type
357357

@@ -375,7 +375,7 @@ Delete review summation by id.
375375

376376
### Example
377377
```javascript
378-
const submissionApi = require('tc-submission-api-wrapper')
378+
const submissionApi = require('topcoder-submission-api-wrapper')
379379
const submissionApiClient = submissionApi(_.pick(config,
380380
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
381381
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -397,7 +397,7 @@ await submissionApiClient.deleteReviewSummation(reviewSummationId)
397397

398398
Name | Type | Description
399399
------------- | ------------- | -------------
400-
**reviewSummationId** | String | the review summation id
400+
**reviewSummationId** | String | the review summation id
401401

402402
### Return type
403403

docs/ReviewType.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# ReviewType
22

33
## Properties
4+
45
Name | Type | Description | Notes
56
------------ | ------------- | ------------- | -------------
67
**id** | **String** | The review type id. |

docs/ReviewTypesApi.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Search review types. Link headers are sent back and they have rel set to prev, n
2121

2222
### Example
2323
```javascript
24-
const submissionApi = require('tc-submission-api-wrapper')
24+
const submissionApi = require('topcoder-submission-api-wrapper')
2525
const submissionApiClient = submissionApi(_.pick(config,
2626
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
2727
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -71,7 +71,7 @@ Same to search review types, but only response status and headers information re
7171

7272
### Example
7373
```javascript
74-
const submissionApi = require('tc-submission-api-wrapper')
74+
const submissionApi = require('topcoder-submission-api-wrapper')
7575
const submissionApiClient = submissionApi(_.pick(config,
7676
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
7777
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -121,7 +121,7 @@ Create a review type.
121121

122122
### Example
123123
```javascript
124-
const submissionApi = require('tc-submission-api-wrapper')
124+
const submissionApi = require('topcoder-submission-api-wrapper')
125125
const submissionApiClient = submissionApi(_.pick(config,
126126
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
127127
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -169,7 +169,7 @@ Get the review type by id.
169169

170170
### Example
171171
```javascript
172-
const submissionApi = require('tc-submission-api-wrapper')
172+
const submissionApi = require('topcoder-submission-api-wrapper')
173173
const submissionApiClient = submissionApi(_.pick(config,
174174
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
175175
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -213,7 +213,7 @@ Same to get review type, but only response status and headers information return
213213

214214
### Example
215215
```javascript
216-
const submissionApi = require('tc-submission-api-wrapper')
216+
const submissionApi = require('topcoder-submission-api-wrapper')
217217
const submissionApiClient = submissionApi(_.pick(config,
218218
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
219219
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -239,7 +239,7 @@ Name | Type | Description
239239

240240
### Return type
241241

242-
[**ReviewType**](ReviewType.md)
242+
null (empty response body)
243243

244244
### Authorization
245245

@@ -258,7 +258,7 @@ Fully update review type.
258258

259259
### Example
260260
```javascript
261-
const submissionApi = require('tc-submission-api-wrapper')
261+
const submissionApi = require('topcoder-submission-api-wrapper')
262262
const submissionApiClient = submissionApi(_.pick(config,
263263
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
264264
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -308,7 +308,7 @@ Partially update review type.
308308

309309
### Example
310310
```javascript
311-
const submissionApi = require('tc-submission-api-wrapper')
311+
const submissionApi = require('topcoder-submission-api-wrapper')
312312
const submissionApiClient = submissionApi(_.pick(config,
313313
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
314314
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',
@@ -358,7 +358,7 @@ Delete review type by id.
358358

359359
### Example
360360
```javascript
361-
const submissionApi = require('tc-submission-api-wrapper')
361+
const submissionApi = require('topcoder-submission-api-wrapper')
362362
const submissionApiClient = submissionApi(_.pick(config,
363363
['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME',
364364
'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET', 'SUBMISSION_API_URL',

0 commit comments

Comments
 (0)