@brickset-api/types 0.0.14 → 0.0.16

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @brickset-api/types
2
2
 
3
+ ## 0.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - ed9db77: Update endpoints
8
+
9
+ ## 0.0.15
10
+
11
+ ### Patch Changes
12
+
13
+ - 2d77e7e: Update types
14
+
3
15
  ## 0.0.14
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,11 @@
1
+ export type GetThemes = GetThemesBase;
2
+
3
+ export type GetThemesOptions = unknown;
4
+
5
+ export type GetThemesBase = {
6
+ theme: String;
7
+ setCount: Number;
8
+ subthemeCount: Number;
9
+ yearFrom: Number;
10
+ yearTo: Number;
11
+ };
package/endpoints.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { GetSets } from "./data/get-sets";
2
+ import type { GetThemes } from "./data/get-themes";
2
3
 
3
4
  export type KnownAuthenticatedEndpoint =
4
5
  | '/setCollection';
@@ -25,14 +26,15 @@ export type ApiKeyOptions = {
25
26
  apiKey: string;
26
27
  };
27
28
 
28
- export type AuthenticatedOptions = ApiKeyOptions & {
29
+ export type AuthenticatedOptions = {
29
30
  userHash: string;
30
31
  };
31
32
 
32
33
  export type OptionsByEndpoint<Endpoint extends string> =
33
34
  Endpoint extends UrlWithParams<'/api/v3.asmx/getSets'> ? Options & ApiKeyOptions :
34
- Endpoint extends '/api/v3.asmx/getThemes' ? Options & ApiKeyOptions :
35
- Partial<AuthenticatedOptions & ApiKeyOptions>;
35
+ Endpoint extends KnownAuthenticatedEndpoint ? Options & ApiKeyOptions & AuthenticatedOptions :
36
+ Endpoint extends KnownEndpoint ? Options & ApiKeyOptions :
37
+ Partial<ApiKeyOptions>;
36
38
 
37
39
  // Common Brickset API v3 response
38
40
  export type ApiResponse<T> = { status: 'success' } & T | { status: 'error'; message: string };
@@ -42,7 +44,7 @@ export type ApiResponse<T> = { status: 'success' } & T | { status: 'error'; mess
42
44
  // result type for endpoint
43
45
  export type EndpointType<Url extends KnownEndpoint | (string & {})> =
44
46
  Url extends UrlWithParams<'/api/v3.asmx/getSets'> ? ApiResponse<{ matches: number; sets: GetSets[] }> :
45
- Url extends '/api/v3.asmx/getThemes' ? ApiResponse<{ matches: number, themes: string[] }> :
47
+ Url extends '/api/v3.asmx/getThemes' ? ApiResponse<{ matches: number, themes: GetThemes[] }> :
46
48
  unknown;
47
49
 
48
50
  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.14",
3
+ "version": "0.0.16",
4
4
  "description": "TypeScript types for all datastructures used by the Brickset API",
5
5
  "license": "MIT",
6
6
  "repository": {