Skip to content

Commit c64791b

Browse files
committed
Update of doc generation config
1 parent 8e9afa1 commit c64791b

21 files changed

+325
-84
lines changed

bin/docgen

+14-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ const mkpath = require('mkpath');
1212
const path = require('path');
1313
const rimraf = require('rimraf');
1414

15-
rimraf.sync(path.resolve(__dirname, '../docs/auto'));
15+
rimraf.sync(path.resolve(__dirname, '../docs'));
1616

17-
const outputDir = path.resolve(__dirname, '../docs/auto');
17+
const outputDir = path.resolve(__dirname, '../docs');
1818

1919
const data = jsdoc2md.getTemplateDataSync({ files: 'src/**/*.js' });
2020

@@ -31,3 +31,15 @@ moduleNames.forEach((name) => {
3131
mkpath.sync(path.dirname(destFile));
3232
fs.writeFileSync(destFile, output);
3333
});
34+
35+
const template = '{{>module-index}}';
36+
const output = jsdoc2md.renderSync({
37+
data,
38+
partial: [
39+
`${__dirname}/misc/module-index-dl.hbs`,
40+
`${__dirname}/misc/doc-link-html.hbs`,
41+
],
42+
template,
43+
});
44+
const dest = `${outputDir}/index.md`;
45+
fs.writeFileSync(dest, output);

bin/misc/doc-link-html.hbs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
{{#if name}}{{#sig no-gfm=true ~}}
3+
{{{@depOpen}~}}
4+
<a href="{{{name}}}.md">
5+
{{~{@codeOpen}~}}
6+
{{#if @prefix}}{{@prefix}} {{/if~}}
7+
{{@accessSymbol}}{{#if (isEvent)}}"{{{name}}}"{{else}}{{{name}}}{{/if~}}
8+
{{~#if @methodSign}}{{#if (isEvent)}} {{@methodSign}}{{else}}{{@methodSign}}{{/if}}{{/if~}}
9+
{{{@codeClose}~}}
10+
</a>
11+
{{~#if @returnSymbol}} {{@returnSymbol}}{{/if~}}
12+
{{#if @returnTypes}} {{>linked-type-list types=@returnTypes html=true delimiter=" | " }}{{/if~}}
13+
{{#if @suffix}} {{@suffix}}{{/if~}}
14+
{{{@depClose}~}}
15+
{{~/sig}}{{/if~}}

bin/misc/module-index-dl.hbs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{#modules~}}
2+
{{#if @first~}}{{>heading-indent}}Modules
3+
4+
<dl>
5+
{{/if~}}
6+
<dt>{{>doc-link-html}}</dt>
7+
<dd>{{{md (inlineLinks description)}}}</dd>
8+
{{#if @last~}}</dl>
9+
10+
{{/if~}}
11+
{{/modules~}}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/auto/actions.md

-38
This file was deleted.

docs/index.md

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
## Modules
2+
3+
<dl>
4+
<dt>
5+
<a href="actions.auth.md">actions.auth</a></dt>
6+
<dd><p>Actions related to Topcoder authentication system.</p>
7+
</dd>
8+
<dt>
9+
<a href="actions.challenge.md">actions.challenge</a></dt>
10+
<dd><p>Actions related to Topcoder challenges APIs.</p>
11+
</dd>
12+
<dt>
13+
<a href="actions.direct.md">actions.direct</a></dt>
14+
<dd><p>Actions related to Direct API: access to projects, billing accounts,
15+
copilot operations, and other similar stuff is handled by them.</p>
16+
</dd>
17+
<dt>
18+
<a href="actions.errors.md">actions.errors</a></dt>
19+
<dd><p>Actions related to the standard application-wide error handling and
20+
messaging.</p>
21+
<p>Pending to be documented. You are not supposed to use them directly anyway.</p>
22+
</dd>
23+
<dt>
24+
<a href="actions.groups.md">actions.groups</a></dt>
25+
<dd><p>Actions related to user groups.</p>
26+
</dd>
27+
<dt>
28+
<a href="actions.member-tasks.md">actions.member-tasks</a></dt>
29+
<dd><p>Actions for management of member tasks and payments. Under the hood it
30+
is very similar to the challenge listing management, as these tasks are in
31+
fact just challenges of a special kind); however, due to differences in the
32+
use cases, we can implement task management more efficient with dedicated
33+
actions and reducer; thus, this module.</p>
34+
</dd>
35+
<dt>
36+
<a href="actions.members.md">actions.members</a></dt>
37+
<dd><p>Actions related to members data.</p>
38+
</dd>
39+
<dt>
40+
<a href="actions.profile.md">actions.profile</a></dt>
41+
<dd><p>Actions for interactions with profile details API.</p>
42+
</dd>
43+
<dt>
44+
<a href="actions.reviewOpportunity.md">actions.reviewOpportunity</a></dt>
45+
<dd><p>Actions for review opportunity details API.</p>
46+
</dd>
47+
<dt>
48+
<a href="actions.smp.md">actions.smp</a></dt>
49+
<dd><p>Actions related to <em>My Submissions Management</em> page.</p>
50+
</dd>
51+
<dt>
52+
<a href="actions.smp.md">actions.smp</a></dt>
53+
<dd><p>Actions related to Topcoder statistics (at the moment, only community
54+
statistics).</p>
55+
</dd>
56+
<dt>
57+
<a href="actions.terms.md">actions.terms</a></dt>
58+
<dd><p>Actions related to Topcoder terms of use.</p>
59+
</dd>
60+
<dt>
61+
<a href="services.api.md">services.api</a></dt>
62+
<dd><p>This module provides a service for conventient access to Topcoder APIs.</p>
63+
</dd>
64+
<dt>
65+
<a href="services/challenges.md">services/challenges</a></dt>
66+
<dd><p>This module provides a service for convenient manipulation with Topcoder
67+
challenges via TC API.</p>
68+
</dd>
69+
</dl>
70+

docs/services.api.md

+197
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
<a name="module_services.api"></a>
2+
3+
## services.api
4+
This module provides a service for conventient access to Topcoder APIs.
5+
6+
7+
* [services.api](#module_services.api)
8+
* _static_
9+
* [.default](#module_services.api.default)
10+
* [.getApiV2(token)](#module_services.api.getApiV2) ⇒ <code>Api</code>
11+
* [.getApiV3(token)](#module_services.api.getApiV3) ⇒ <code>Api</code>
12+
* _inner_
13+
* [~Api](#module_services.api..Api)
14+
* [new Api(base, token)](#new_module_services.api..Api_new)
15+
* [.fetch(enpoint, options)](#module_services.api..Api+fetch) ⇒ <code>Promise</code>
16+
* [.delete(endpoint, body)](#module_services.api..Api+delete) ⇒ <code>Promise</code>
17+
* [.get(endpoint)](#module_services.api..Api+get) ⇒ <code>Promise</code>
18+
* [.post(endpoint, body)](#module_services.api..Api+post) ⇒ <code>Promise</code>
19+
* [.postJson(endpoint, json)](#module_services.api..Api+postJson) ⇒ <code>Promise</code>
20+
* [.put(endpoint, body)](#module_services.api..Api+put) ⇒ <code>Promise</code>
21+
* [.putJson(endpoint, json)](#module_services.api..Api+putJson) ⇒ <code>Promise</code>
22+
* [.upload(endpoint, body, callback)](#module_services.api..Api+upload) ⇒ <code>Promise</code>
23+
24+
<a name="module_services.api.default"></a>
25+
26+
### services.api.default
27+
The default export from the module is
28+
[Api](#module_services.api..Api) class.
29+
30+
**Kind**: static property of [<code>services.api</code>](#module_services.api)
31+
<a name="module_services.api.getApiV2"></a>
32+
33+
### services.api.getApiV2(token) ⇒ <code>Api</code>
34+
Returns a new or existing Api object for Topcoder API v2.
35+
36+
**Kind**: static method of [<code>services.api</code>](#module_services.api)
37+
**Returns**: <code>Api</code> - API v2 service object.
38+
39+
| Param | Type | Description |
40+
| --- | --- | --- |
41+
| token | <code>String</code> | Optional. Auth token for Topcoder API v2. |
42+
43+
<a name="module_services.api.getApiV3"></a>
44+
45+
### services.api.getApiV3(token) ⇒ <code>Api</code>
46+
Returns a new or existing Api object for Topcoder API v3
47+
48+
**Kind**: static method of [<code>services.api</code>](#module_services.api)
49+
**Returns**: <code>Api</code> - API v3 service object.
50+
51+
| Param | Type | Description |
52+
| --- | --- | --- |
53+
| token | <code>String</code> | Optional. Auth token for Topcoder API v3. |
54+
55+
<a name="module_services.api..Api"></a>
56+
57+
### services.api~Api
58+
API service object. It is reused for both Topcoder API v2 and v3,
59+
as in these cases we are fine with the same interface, and the only
60+
thing we need to be different is the base URL and auth token to use.
61+
62+
**Kind**: inner class of [<code>services.api</code>](#module_services.api)
63+
64+
* [~Api](#module_services.api..Api)
65+
* [new Api(base, token)](#new_module_services.api..Api_new)
66+
* [.fetch(enpoint, options)](#module_services.api..Api+fetch) ⇒ <code>Promise</code>
67+
* [.delete(endpoint, body)](#module_services.api..Api+delete) ⇒ <code>Promise</code>
68+
* [.get(endpoint)](#module_services.api..Api+get) ⇒ <code>Promise</code>
69+
* [.post(endpoint, body)](#module_services.api..Api+post) ⇒ <code>Promise</code>
70+
* [.postJson(endpoint, json)](#module_services.api..Api+postJson) ⇒ <code>Promise</code>
71+
* [.put(endpoint, body)](#module_services.api..Api+put) ⇒ <code>Promise</code>
72+
* [.putJson(endpoint, json)](#module_services.api..Api+putJson) ⇒ <code>Promise</code>
73+
* [.upload(endpoint, body, callback)](#module_services.api..Api+upload) ⇒ <code>Promise</code>
74+
75+
<a name="new_module_services.api..Api_new"></a>
76+
77+
#### new Api(base, token)
78+
Creates a new Api object.
79+
80+
81+
| Param | Type | Description |
82+
| --- | --- | --- |
83+
| base | <code>String</code> | Base URL of the API. |
84+
| token | <code>String</code> | Optional. Authorization token. |
85+
86+
<a name="module_services.api..Api+fetch"></a>
87+
88+
#### api.fetch(enpoint, options) ⇒ <code>Promise</code>
89+
Sends HTTP request to the specified API endpoint. This method is just
90+
a convenient wrapper around isomorphic fetch(..):
91+
92+
- If API service has auth token, Authorization header is automatically
93+
added to the request;
94+
95+
- If no Content-Type header set in options, it is automatically set to
96+
"application/json". In case you want to avoid it, pass null into
97+
Content-Type header option.
98+
99+
For additional details see https://github.github.io/fetch/
100+
101+
**Kind**: instance method of [<code>Api</code>](#module_services.api..Api)
102+
**Returns**: <code>Promise</code> - It resolves to the HTTP response object. To get the
103+
actual data you probably want to call .json() method of that object.
104+
Mind that this promise rejects only on network errors. In case of
105+
HTTP errors (404, etc.) the promise will be resolved successfully,
106+
and you should check .status or .ok fields of the response object
107+
to find out the response status.
108+
109+
| Param | Type | Description |
110+
| --- | --- | --- |
111+
| enpoint | <code>String</code> | Should start with slash, like /endpoint. |
112+
| options | <code>Object</code> | Optional. Fetch options. |
113+
114+
<a name="module_services.api..Api+delete"></a>
115+
116+
#### api.delete(endpoint, body) ⇒ <code>Promise</code>
117+
Sends DELETE request to the specified endpoint.
118+
119+
**Kind**: instance method of [<code>Api</code>](#module_services.api..Api)
120+
121+
| Param | Type |
122+
| --- | --- |
123+
| endpoint | <code>String</code> |
124+
| body | <code>Blob</code> \| <code>BufferSource</code> \| <code>FormData</code> \| <code>String</code> |
125+
126+
<a name="module_services.api..Api+get"></a>
127+
128+
#### api.get(endpoint) ⇒ <code>Promise</code>
129+
Sends GET request to the specified endpoint.
130+
131+
**Kind**: instance method of [<code>Api</code>](#module_services.api..Api)
132+
133+
| Param | Type |
134+
| --- | --- |
135+
| endpoint | <code>String</code> |
136+
137+
<a name="module_services.api..Api+post"></a>
138+
139+
#### api.post(endpoint, body) ⇒ <code>Promise</code>
140+
Sends POST request to the specified endpoint.
141+
142+
**Kind**: instance method of [<code>Api</code>](#module_services.api..Api)
143+
144+
| Param | Type |
145+
| --- | --- |
146+
| endpoint | <code>String</code> |
147+
| body | <code>Blob</code> \| <code>BufferSource</code> \| <code>FormData</code> \| <code>String</code> |
148+
149+
<a name="module_services.api..Api+postJson"></a>
150+
151+
#### api.postJson(endpoint, json) ⇒ <code>Promise</code>
152+
Sends POST request to the specified endpoint, with JSON payload.
153+
154+
**Kind**: instance method of [<code>Api</code>](#module_services.api..Api)
155+
156+
| Param | Type |
157+
| --- | --- |
158+
| endpoint | <code>String</code> |
159+
| json | <code>JSON</code> |
160+
161+
<a name="module_services.api..Api+put"></a>
162+
163+
#### api.put(endpoint, body) ⇒ <code>Promise</code>
164+
Sends PUT request to the specified endpoint.
165+
166+
**Kind**: instance method of [<code>Api</code>](#module_services.api..Api)
167+
168+
| Param | Type |
169+
| --- | --- |
170+
| endpoint | <code>String</code> |
171+
| body | <code>Blob</code> \| <code>BufferSource</code> \| <code>FormData</code> \| <code>String</code> |
172+
173+
<a name="module_services.api..Api+putJson"></a>
174+
175+
#### api.putJson(endpoint, json) ⇒ <code>Promise</code>
176+
Sends PUT request to the specified endpoint.
177+
178+
**Kind**: instance method of [<code>Api</code>](#module_services.api..Api)
179+
180+
| Param | Type |
181+
| --- | --- |
182+
| endpoint | <code>String</code> |
183+
| json | <code>JSON</code> |
184+
185+
<a name="module_services.api..Api+upload"></a>
186+
187+
#### api.upload(endpoint, body, callback) ⇒ <code>Promise</code>
188+
Upload with progress
189+
190+
**Kind**: instance method of [<code>Api</code>](#module_services.api..Api)
191+
192+
| Param | Type | Description |
193+
| --- | --- | --- |
194+
| endpoint | <code>String</code> | |
195+
| body | <code>Object</code> | and headers |
196+
| callback | <code>function</code> | handler for update progress only works for client side for now |
197+
File renamed without changes.

docs/test.md

Whitespace-only changes.

0 commit comments

Comments
 (0)