@tacocarlos/luna-cs-uil 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +50 -2
- package/dist/client.d.ts +29 -0
- package/dist/client.js +38 -0
- package/dist/client.js.map +1 -0
- package/dist/figures.d.ts +15 -0
- package/dist/figures.js +22 -0
- package/dist/figures.js.map +1 -0
- package/dist/generated/apis/CompetitionApi.d.ts +77 -0
- package/dist/generated/apis/CompetitionApi.js +123 -0
- package/dist/generated/apis/CompetitionApi.js.map +1 -0
- package/dist/generated/apis/MetaApi.d.ts +29 -0
- package/dist/generated/apis/MetaApi.js +54 -0
- package/dist/generated/apis/MetaApi.js.map +1 -0
- package/dist/generated/apis/ProblemApi.d.ts +84 -0
- package/dist/generated/apis/ProblemApi.js +130 -0
- package/dist/generated/apis/ProblemApi.js.map +1 -0
- package/dist/generated/apis/index.d.ts +3 -0
- package/dist/generated/apis/index.js +6 -0
- package/dist/generated/apis/index.js.map +1 -0
- package/dist/generated/index.d.ts +3 -0
- package/dist/generated/index.js +6 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/generated/models/ApiError.d.ts +30 -0
- package/dist/generated/models/ApiError.js +44 -0
- package/dist/generated/models/ApiError.js.map +1 -0
- package/dist/generated/models/Competition.d.ts +66 -0
- package/dist/generated/models/Competition.js +82 -0
- package/dist/generated/models/Competition.js.map +1 -0
- package/dist/generated/models/Problem.d.ts +74 -0
- package/dist/generated/models/Problem.js +89 -0
- package/dist/generated/models/Problem.js.map +1 -0
- package/dist/generated/models/ProblemMarkdown.d.ts +36 -0
- package/dist/generated/models/ProblemMarkdown.js +48 -0
- package/dist/generated/models/ProblemMarkdown.js.map +1 -0
- package/dist/generated/models/ShortProblem.d.ts +42 -0
- package/dist/generated/models/ShortProblem.js +56 -0
- package/dist/generated/models/ShortProblem.js.map +1 -0
- package/dist/generated/models/index.d.ts +5 -0
- package/dist/generated/models/index.js +8 -0
- package/dist/generated/models/index.js.map +1 -0
- package/dist/generated/runtime.d.ts +217 -0
- package/dist/generated/runtime.js +457 -0
- package/dist/generated/runtime.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/package.json +29 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Carlos Luna
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @tacocarlos/luna-cs-uil
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript client for the UIL Computer Science problems API at `https://api.lunaghs.dev`: past contests' competitions, problems, statements and judge data.
|
|
4
|
+
|
|
5
|
+
> **Unofficial.** This project is not affiliated with or endorsed by the University Interscholastic League (UIL).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @tacocarlos/luna-cs-uil
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Works anywhere `fetch` is available (Node 18+, Bun, Deno, browsers).
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { LunaCsUilClient } from "@tacocarlos/luna-cs-uil";
|
|
19
|
+
|
|
20
|
+
const client = new LunaCsUilClient();
|
|
21
|
+
|
|
22
|
+
const competitions = await client.competitions.getAllCompetitions();
|
|
23
|
+
const problems = await client.competitions.getCompetitionProblems({ id: competitions[0].id });
|
|
24
|
+
|
|
25
|
+
// The statement as markdown, with figure links pointing at their images.
|
|
26
|
+
const statement = await client.getProblemStatement(problems[0].id);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`client.problems`, `client.competitions` and `client.meta` expose every endpoint. Failed requests throw `ResponseError`; a missing problem or competition is a 404:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { ResponseError } from "@tacocarlos/luna-cs-uil";
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
await client.problems.getProblemById({ id: 123 });
|
|
36
|
+
} catch (error) {
|
|
37
|
+
if (error instanceof ResponseError && error.response.status === 404) {
|
|
38
|
+
// no such problem
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Options: `new LunaCsUilClient({ baseUrl, fetch })`. `baseUrl` is the API origin without `/api`.
|
|
44
|
+
|
|
45
|
+
## Figures
|
|
46
|
+
|
|
47
|
+
Statements refer to figures by placeholder, e.g. ``, and `getProblemMarkdownById` returns each placeholder's current URL in `images`. Image URLs can change, so resolve them when you render rather than storing them. `getProblemStatement` does this for you, or call `resolveFigures(markdown, images)` yourself. Placeholders without an image are left unchanged.
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT. See [LICENSE](LICENSE).
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CompetitionApi, MetaApi, ProblemApi } from "./generated/index.js";
|
|
2
|
+
/** Where the API is hosted. */
|
|
3
|
+
export declare const DEFAULT_BASE_URL = "https://api.lunaghs.dev";
|
|
4
|
+
export interface LunaCsUilClientOptions {
|
|
5
|
+
/** API origin, without the `/api` prefix. Defaults to {@link DEFAULT_BASE_URL}. */
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
/** `fetch` implementation to use, e.g. for tests or older runtimes. */
|
|
8
|
+
fetch?: typeof fetch;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Client for the UIL CS problems API.
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* const client = new LunaCsUilClient();
|
|
15
|
+
* const competitions = await client.competitions.getAllCompetitions();
|
|
16
|
+
* const statement = await client.getProblemStatement(competitions[0].id);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare class LunaCsUilClient {
|
|
20
|
+
readonly problems: ProblemApi;
|
|
21
|
+
readonly competitions: CompetitionApi;
|
|
22
|
+
readonly meta: MetaApi;
|
|
23
|
+
constructor(options?: LunaCsUilClientOptions);
|
|
24
|
+
/**
|
|
25
|
+
* A problem's statement as markdown, with figure placeholders replaced by
|
|
26
|
+
* their current image URLs.
|
|
27
|
+
*/
|
|
28
|
+
getProblemStatement(id: number): Promise<string>;
|
|
29
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CompetitionApi, Configuration, MetaApi, ProblemApi, } from "./generated/index.js";
|
|
2
|
+
import { resolveFigures } from "./figures.js";
|
|
3
|
+
/** Where the API is hosted. */
|
|
4
|
+
export const DEFAULT_BASE_URL = "https://api.lunaghs.dev";
|
|
5
|
+
/**
|
|
6
|
+
* Client for the UIL CS problems API.
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* const client = new LunaCsUilClient();
|
|
10
|
+
* const competitions = await client.competitions.getAllCompetitions();
|
|
11
|
+
* const statement = await client.getProblemStatement(competitions[0].id);
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export class LunaCsUilClient {
|
|
15
|
+
problems;
|
|
16
|
+
competitions;
|
|
17
|
+
meta;
|
|
18
|
+
constructor(options = {}) {
|
|
19
|
+
const configuration = new Configuration({
|
|
20
|
+
basePath: (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, ""),
|
|
21
|
+
fetchApi: options.fetch,
|
|
22
|
+
});
|
|
23
|
+
this.problems = new ProblemApi(configuration);
|
|
24
|
+
this.competitions = new CompetitionApi(configuration);
|
|
25
|
+
this.meta = new MetaApi(configuration);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A problem's statement as markdown, with figure placeholders replaced by
|
|
29
|
+
* their current image URLs.
|
|
30
|
+
*/
|
|
31
|
+
async getProblemStatement(id) {
|
|
32
|
+
const { markdown, images } = await this.problems.getProblemMarkdownById({
|
|
33
|
+
id,
|
|
34
|
+
});
|
|
35
|
+
return resolveFigures(markdown, images);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,aAAa,EACb,OAAO,EACP,UAAU,GACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,+BAA+B;AAC/B,MAAM,CAAC,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;AAS1D;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAe;IACjB,QAAQ,CAAa;IACrB,YAAY,CAAiB;IAC7B,IAAI,CAAU;IAEvB,YAAY,UAAkC,EAAE;QAC9C,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC;YACtC,QAAQ,EAAE,CAAC,OAAO,CAAC,OAAO,IAAI,gBAAgB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YACnE,QAAQ,EAAE,OAAO,CAAC,KAAK;SACxB,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;QAC9C,IAAI,CAAC,YAAY,GAAG,IAAI,cAAc,CAAC,aAAa,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;IACzC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,mBAAmB,CAAC,EAAU;QAClC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAAC;YACtE,EAAE;SACH,CAAC,CAAC;QACH,OAAO,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Problem statements refer to figures by placeholder, e.g.
|
|
3
|
+
* ``, and the API returns the current URL for
|
|
4
|
+
* each placeholder alongside the markdown. URLs can change when the server
|
|
5
|
+
* moves its storage, so resolve them when rendering instead of saving them.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Returns `markdown` with every figure placeholder that `images` knows replaced
|
|
9
|
+
* by its URL. Placeholders without a URL are left as they are, so a renderer
|
|
10
|
+
* can show them as missing.
|
|
11
|
+
*
|
|
12
|
+
* Only link targets are replaced (`](placeholder)`); the placeholder format
|
|
13
|
+
* itself is the server's business, so nothing here depends on it.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveFigures(markdown: string, images: Readonly<Record<string, string>>): string;
|
package/dist/figures.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Problem statements refer to figures by placeholder, e.g.
|
|
3
|
+
* ``, and the API returns the current URL for
|
|
4
|
+
* each placeholder alongside the markdown. URLs can change when the server
|
|
5
|
+
* moves its storage, so resolve them when rendering instead of saving them.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Returns `markdown` with every figure placeholder that `images` knows replaced
|
|
9
|
+
* by its URL. Placeholders without a URL are left as they are, so a renderer
|
|
10
|
+
* can show them as missing.
|
|
11
|
+
*
|
|
12
|
+
* Only link targets are replaced (`](placeholder)`); the placeholder format
|
|
13
|
+
* itself is the server's business, so nothing here depends on it.
|
|
14
|
+
*/
|
|
15
|
+
export function resolveFigures(markdown, images) {
|
|
16
|
+
let resolved = markdown;
|
|
17
|
+
for (const [placeholder, url] of Object.entries(images)) {
|
|
18
|
+
resolved = resolved.split(`](${placeholder})`).join(`](${url})`);
|
|
19
|
+
}
|
|
20
|
+
return resolved;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=figures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figures.js","sourceRoot":"","sources":["../src/figures.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,QAAgB,EAChB,MAAwC;IAExC,IAAI,QAAQ,GAAG,QAAQ,CAAC;IACxB,KAAK,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACxD,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UIL CS API
|
|
3
|
+
* Public API for UIL Computer Science competitions and problems.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.0.1
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import * as runtime from '../runtime.js';
|
|
13
|
+
import { type Competition } from '../models/Competition.js';
|
|
14
|
+
import { type Problem } from '../models/Problem.js';
|
|
15
|
+
export interface GetAllCompetitionsRequest {
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
limit?: number;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
offset?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface GetCompetitionByIdRequest {
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
id: number;
|
|
30
|
+
}
|
|
31
|
+
export interface GetCompetitionProblemsRequest {
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
id: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
export declare class CompetitionApi extends runtime.BaseAPI {
|
|
41
|
+
/**
|
|
42
|
+
* Creates request options for getAllCompetitions without sending the request
|
|
43
|
+
*/
|
|
44
|
+
getAllCompetitionsRequestOpts(requestParameters: GetAllCompetitionsRequest): Promise<runtime.RequestOpts>;
|
|
45
|
+
/**
|
|
46
|
+
* Returns a list of all competitions
|
|
47
|
+
*/
|
|
48
|
+
getAllCompetitionsRaw(requestParameters: GetAllCompetitionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<Competition>>>;
|
|
49
|
+
/**
|
|
50
|
+
* Returns a list of all competitions
|
|
51
|
+
*/
|
|
52
|
+
getAllCompetitions(requestParameters?: GetAllCompetitionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<Competition>>;
|
|
53
|
+
/**
|
|
54
|
+
* Creates request options for getCompetitionById without sending the request
|
|
55
|
+
*/
|
|
56
|
+
getCompetitionByIdRequestOpts(requestParameters: GetCompetitionByIdRequest): Promise<runtime.RequestOpts>;
|
|
57
|
+
/**
|
|
58
|
+
* Get competition data
|
|
59
|
+
*/
|
|
60
|
+
getCompetitionByIdRaw(requestParameters: GetCompetitionByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Competition>>;
|
|
61
|
+
/**
|
|
62
|
+
* Get competition data
|
|
63
|
+
*/
|
|
64
|
+
getCompetitionById(requestParameters: GetCompetitionByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Competition>;
|
|
65
|
+
/**
|
|
66
|
+
* Creates request options for getCompetitionProblems without sending the request
|
|
67
|
+
*/
|
|
68
|
+
getCompetitionProblemsRequestOpts(requestParameters: GetCompetitionProblemsRequest): Promise<runtime.RequestOpts>;
|
|
69
|
+
/**
|
|
70
|
+
* Returns all problems for a given competition
|
|
71
|
+
*/
|
|
72
|
+
getCompetitionProblemsRaw(requestParameters: GetCompetitionProblemsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<Problem>>>;
|
|
73
|
+
/**
|
|
74
|
+
* Returns all problems for a given competition
|
|
75
|
+
*/
|
|
76
|
+
getCompetitionProblems(requestParameters: GetCompetitionProblemsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<Problem>>;
|
|
77
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* UIL CS API
|
|
5
|
+
* Public API for UIL Computer Science competitions and problems.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.0.1
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
import * as runtime from '../runtime.js';
|
|
15
|
+
import { CompetitionFromJSON, } from '../models/Competition.js';
|
|
16
|
+
import { ProblemFromJSON, } from '../models/Problem.js';
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export class CompetitionApi extends runtime.BaseAPI {
|
|
21
|
+
/**
|
|
22
|
+
* Creates request options for getAllCompetitions without sending the request
|
|
23
|
+
*/
|
|
24
|
+
async getAllCompetitionsRequestOpts(requestParameters) {
|
|
25
|
+
const queryParameters = {};
|
|
26
|
+
if (requestParameters['limit'] != null) {
|
|
27
|
+
queryParameters['limit'] = requestParameters['limit'];
|
|
28
|
+
}
|
|
29
|
+
if (requestParameters['offset'] != null) {
|
|
30
|
+
queryParameters['offset'] = requestParameters['offset'];
|
|
31
|
+
}
|
|
32
|
+
const headerParameters = {};
|
|
33
|
+
let urlPath = `/api/competition`;
|
|
34
|
+
return {
|
|
35
|
+
path: urlPath,
|
|
36
|
+
method: 'GET',
|
|
37
|
+
headers: headerParameters,
|
|
38
|
+
query: queryParameters,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Returns a list of all competitions
|
|
43
|
+
*/
|
|
44
|
+
async getAllCompetitionsRaw(requestParameters, initOverrides) {
|
|
45
|
+
const requestOptions = await this.getAllCompetitionsRequestOpts(requestParameters);
|
|
46
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
47
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(CompetitionFromJSON));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Returns a list of all competitions
|
|
51
|
+
*/
|
|
52
|
+
async getAllCompetitions(requestParameters = {}, initOverrides) {
|
|
53
|
+
const response = await this.getAllCompetitionsRaw(requestParameters, initOverrides);
|
|
54
|
+
return await response.value();
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Creates request options for getCompetitionById without sending the request
|
|
58
|
+
*/
|
|
59
|
+
async getCompetitionByIdRequestOpts(requestParameters) {
|
|
60
|
+
if (requestParameters['id'] == null) {
|
|
61
|
+
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getCompetitionById().');
|
|
62
|
+
}
|
|
63
|
+
const queryParameters = {};
|
|
64
|
+
const headerParameters = {};
|
|
65
|
+
let urlPath = `/api/competition/{id}`;
|
|
66
|
+
urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
|
|
67
|
+
return {
|
|
68
|
+
path: urlPath,
|
|
69
|
+
method: 'GET',
|
|
70
|
+
headers: headerParameters,
|
|
71
|
+
query: queryParameters,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get competition data
|
|
76
|
+
*/
|
|
77
|
+
async getCompetitionByIdRaw(requestParameters, initOverrides) {
|
|
78
|
+
const requestOptions = await this.getCompetitionByIdRequestOpts(requestParameters);
|
|
79
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
80
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => CompetitionFromJSON(jsonValue));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Get competition data
|
|
84
|
+
*/
|
|
85
|
+
async getCompetitionById(requestParameters, initOverrides) {
|
|
86
|
+
const response = await this.getCompetitionByIdRaw(requestParameters, initOverrides);
|
|
87
|
+
return await response.value();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Creates request options for getCompetitionProblems without sending the request
|
|
91
|
+
*/
|
|
92
|
+
async getCompetitionProblemsRequestOpts(requestParameters) {
|
|
93
|
+
if (requestParameters['id'] == null) {
|
|
94
|
+
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getCompetitionProblems().');
|
|
95
|
+
}
|
|
96
|
+
const queryParameters = {};
|
|
97
|
+
const headerParameters = {};
|
|
98
|
+
let urlPath = `/api/competition/{id}/problems`;
|
|
99
|
+
urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
|
|
100
|
+
return {
|
|
101
|
+
path: urlPath,
|
|
102
|
+
method: 'GET',
|
|
103
|
+
headers: headerParameters,
|
|
104
|
+
query: queryParameters,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Returns all problems for a given competition
|
|
109
|
+
*/
|
|
110
|
+
async getCompetitionProblemsRaw(requestParameters, initOverrides) {
|
|
111
|
+
const requestOptions = await this.getCompetitionProblemsRequestOpts(requestParameters);
|
|
112
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
113
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ProblemFromJSON));
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Returns all problems for a given competition
|
|
117
|
+
*/
|
|
118
|
+
async getCompetitionProblems(requestParameters, initOverrides) {
|
|
119
|
+
const response = await this.getCompetitionProblemsRaw(requestParameters, initOverrides);
|
|
120
|
+
return await response.value();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=CompetitionApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompetitionApi.js","sourceRoot":"","sources":["../../../src/generated/apis/CompetitionApi.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AAMzC,OAAO,EAEH,mBAAmB,GAEtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEH,eAAe,GAElB,MAAM,sBAAsB,CAAC;AA2B9B;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,OAAO,CAAC,OAAO;IAE/C;;OAEG;IAC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
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import * as runtime from '../runtime.js';
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export declare class MetaApi extends runtime.BaseAPI {
|
|
17
|
+
/**
|
|
18
|
+
* Creates request options for getVersion without sending the request
|
|
19
|
+
*/
|
|
20
|
+
getVersionRequestOpts(): Promise<runtime.RequestOpts>;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the API version
|
|
23
|
+
*/
|
|
24
|
+
getVersionRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<string>>;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the API version
|
|
27
|
+
*/
|
|
28
|
+
getVersion(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<string>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* UIL CS API
|
|
5
|
+
* Public API for UIL Computer Science competitions and problems.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.0.1
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
import * as runtime from '../runtime.js';
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export class MetaApi extends runtime.BaseAPI {
|
|
19
|
+
/**
|
|
20
|
+
* Creates request options for getVersion without sending the request
|
|
21
|
+
*/
|
|
22
|
+
async getVersionRequestOpts() {
|
|
23
|
+
const queryParameters = {};
|
|
24
|
+
const headerParameters = {};
|
|
25
|
+
let urlPath = `/api/version`;
|
|
26
|
+
return {
|
|
27
|
+
path: urlPath,
|
|
28
|
+
method: 'GET',
|
|
29
|
+
headers: headerParameters,
|
|
30
|
+
query: queryParameters,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Returns the API version
|
|
35
|
+
*/
|
|
36
|
+
async getVersionRaw(initOverrides) {
|
|
37
|
+
const requestOptions = await this.getVersionRequestOpts();
|
|
38
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
39
|
+
if (this.isJsonMime(response.headers.get('content-type'))) {
|
|
40
|
+
return new runtime.JSONApiResponse(response);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return new runtime.TextApiResponse(response);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Returns the API version
|
|
48
|
+
*/
|
|
49
|
+
async getVersion(initOverrides) {
|
|
50
|
+
const response = await this.getVersionRaw(initOverrides);
|
|
51
|
+
return await response.value();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=MetaApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetaApi.js","sourceRoot":"","sources":["../../../src/generated/apis/MetaApi.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,OAAQ,SAAQ,OAAO,CAAC,OAAO;IAExC;;OAEG;IACH,KAAK,CAAC,qBAAqB;QACvB,MAAM,eAAe,GAAQ,EAAE,CAAC;QAEhC,MAAM,gBAAgB,GAAwB,EAAE,CAAC;QAGjD,IAAI,OAAO,GAAG,cAAc,CAAC;QAE7B,OAAO;YACH,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,gBAAgB;YACzB,KAAK,EAAE,eAAe;SACzB,CAAC;IACN,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,aAA0D;QAC1E,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC1D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;QAEnE,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC;YACxD,OAAO,IAAI,OAAO,CAAC,eAAe,CAAS,QAAQ,CAAC,CAAC;QACzD,CAAC;aAAM,CAAC;YACJ,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAQ,CAAC;QACxD,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,aAA0D;QACvE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QACzD,OAAO,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;IAClC,CAAC;CAEJ"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UIL CS API
|
|
3
|
+
* Public API for UIL Computer Science competitions and problems.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.0.1
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import * as runtime from '../runtime.js';
|
|
13
|
+
import { type Problem } from '../models/Problem.js';
|
|
14
|
+
import { type ProblemMarkdown } from '../models/ProblemMarkdown.js';
|
|
15
|
+
import { type ShortProblem } from '../models/ShortProblem.js';
|
|
16
|
+
export interface GetAllProblemsRequest {
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
limit?: number;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
offset?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface GetProblemByIdRequest {
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
id: number;
|
|
31
|
+
}
|
|
32
|
+
export interface GetProblemMarkdownByIdRequest {
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
id: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
export declare class ProblemApi extends runtime.BaseAPI {
|
|
42
|
+
/**
|
|
43
|
+
* Creates request options for getAllProblems without sending the request
|
|
44
|
+
*/
|
|
45
|
+
getAllProblemsRequestOpts(requestParameters: GetAllProblemsRequest): Promise<runtime.RequestOpts>;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the id, competition id, name, and problem number for all problems. If a limit or offset are provided, then they are used.
|
|
48
|
+
* Returns minimal data for all problems, or up to a limit if specified
|
|
49
|
+
*/
|
|
50
|
+
getAllProblemsRaw(requestParameters: GetAllProblemsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ShortProblem>>>;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the id, competition id, name, and problem number for all problems. If a limit or offset are provided, then they are used.
|
|
53
|
+
* Returns minimal data for all problems, or up to a limit if specified
|
|
54
|
+
*/
|
|
55
|
+
getAllProblems(requestParameters?: GetAllProblemsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ShortProblem>>;
|
|
56
|
+
/**
|
|
57
|
+
* Creates request options for getProblemById without sending the request
|
|
58
|
+
*/
|
|
59
|
+
getProblemByIdRequestOpts(requestParameters: GetProblemByIdRequest): Promise<runtime.RequestOpts>;
|
|
60
|
+
/**
|
|
61
|
+
* Retrieves the data for a single problem.
|
|
62
|
+
* Get all problem data by id
|
|
63
|
+
*/
|
|
64
|
+
getProblemByIdRaw(requestParameters: GetProblemByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Problem>>;
|
|
65
|
+
/**
|
|
66
|
+
* Retrieves the data for a single problem.
|
|
67
|
+
* Get all problem data by id
|
|
68
|
+
*/
|
|
69
|
+
getProblemById(requestParameters: GetProblemByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Problem>;
|
|
70
|
+
/**
|
|
71
|
+
* Creates request options for getProblemMarkdownById without sending the request
|
|
72
|
+
*/
|
|
73
|
+
getProblemMarkdownByIdRequestOpts(requestParameters: GetProblemMarkdownByIdRequest): Promise<runtime.RequestOpts>;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the problem statement and the URLs of its figures. The markdown refers to each figure by placeholder; substitute the URL from `images` when rendering.
|
|
76
|
+
* Get problem markdown by id
|
|
77
|
+
*/
|
|
78
|
+
getProblemMarkdownByIdRaw(requestParameters: GetProblemMarkdownByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProblemMarkdown>>;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the problem statement and the URLs of its figures. The markdown refers to each figure by placeholder; substitute the URL from `images` when rendering.
|
|
81
|
+
* Get problem markdown by id
|
|
82
|
+
*/
|
|
83
|
+
getProblemMarkdownById(requestParameters: GetProblemMarkdownByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProblemMarkdown>;
|
|
84
|
+
}
|