@brickset-api/types 0.0.10 → 0.0.12
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/CHANGELOG.md +12 -0
- package/data/get-sets.ts +2 -11
- package/endpoints.ts +1 -16
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/data/get-sets.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export type GetSets =
|
|
2
|
-
|
|
3
|
-
export type Item = ItemBase;
|
|
1
|
+
export type GetSets = GetSetsBase;
|
|
4
2
|
|
|
5
3
|
export type GetSetsOptions = {
|
|
6
4
|
setID?: number;
|
|
@@ -23,14 +21,7 @@ export type GetSetsOptions = {
|
|
|
23
21
|
extendedData?: boolean;
|
|
24
22
|
};
|
|
25
23
|
|
|
26
|
-
interface
|
|
27
|
-
message?: string;
|
|
28
|
-
status: string;
|
|
29
|
-
matches?: number;
|
|
30
|
-
sets?: ItemBase[];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface ItemBase {
|
|
24
|
+
interface GetSetsBase {
|
|
34
25
|
setID: number;
|
|
35
26
|
number: string;
|
|
36
27
|
numberVariant: string;
|
package/endpoints.ts
CHANGED
|
@@ -10,16 +10,6 @@ export type KnownUnauthorizedEndpoint =
|
|
|
10
10
|
|
|
11
11
|
export type KnownEndpoint = KnownAuthenticatedEndpoint | KnownUnauthorizedEndpoint;
|
|
12
12
|
|
|
13
|
-
// helper types for parameters
|
|
14
|
-
type CombineParameters<P1 extends string, P2 extends string> = `${P1}&${P2}` | `${P2}&${P1}`;
|
|
15
|
-
|
|
16
|
-
type WithParameters<Url extends string, Parameters extends string | undefined> =
|
|
17
|
-
Parameters extends undefined ? Url : `${Url}?${Parameters}`;
|
|
18
|
-
|
|
19
|
-
// helper for endpoints with parameters
|
|
20
|
-
type ParamsParameter = `params=${string}`;
|
|
21
|
-
type EndpointWithParams<Endpoint extends KnownEndpoint> = WithParameters<Endpoint, ParamsParameter>;
|
|
22
|
-
|
|
23
13
|
// options
|
|
24
14
|
type Options = {};
|
|
25
15
|
|
|
@@ -37,14 +27,9 @@ export type OptionsByEndpoint<Endpoint extends string> =
|
|
|
37
27
|
Endpoint extends '/api/v3.asmx/getYears' ? Options & { theme?: string } & ApiKeyOptions :
|
|
38
28
|
Partial<AuthenticatedOptions & ApiKeyOptions>;
|
|
39
29
|
|
|
40
|
-
type ApiResponse<T> = {
|
|
41
|
-
status: string;
|
|
42
|
-
message?: string;
|
|
43
|
-
} & T;
|
|
44
|
-
|
|
45
30
|
// result type for endpoint
|
|
46
31
|
export type EndpointType<Url extends KnownEndpoint | (string & {})> =
|
|
47
|
-
Url extends '/api/v3.asmx/getSets' ?
|
|
32
|
+
Url extends '/api/v3.asmx/getSets' ? { status: 'error'; message: string } | { status: 'success'; matches: number; sets: GetSets[] } :
|
|
48
33
|
unknown;
|
|
49
34
|
|
|
50
35
|
export type ValidateEndpointUrl<T extends string> = unknown extends EndpointType<T> ? 'unknown endpoint url' : T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brickset-api/types",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "TypeScript types for all datastructures used by the Brickset API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"build": "tsc"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"typescript": "5.
|
|
31
|
+
"typescript": "5.6.2"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|