@brickset-api/types 0.0.9 → 0.0.10

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,11 @@
1
1
  # @brickset-api/types
2
2
 
3
+ ## 0.0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - df6f3b5: Create new release
8
+
3
9
  ## 0.0.9
4
10
 
5
11
  ### Patch Changes
package/endpoints.ts CHANGED
@@ -4,7 +4,9 @@ export type KnownAuthenticatedEndpoint =
4
4
  | '/setCollection';
5
5
 
6
6
  export type KnownUnauthorizedEndpoint =
7
- | '/getSets';
7
+ | '/api/v3.asmx/getSets'
8
+ | '/api/v3.asmx/getThemes'
9
+ | '/api/v3.asmx/getYears';
8
10
 
9
11
  export type KnownEndpoint = KnownAuthenticatedEndpoint | KnownUnauthorizedEndpoint;
10
12
 
@@ -14,17 +16,10 @@ type CombineParameters<P1 extends string, P2 extends string> = `${P1}&${P2}` | `
14
16
  type WithParameters<Url extends string, Parameters extends string | undefined> =
15
17
  Parameters extends undefined ? Url : `${Url}?${Parameters}`;
16
18
 
17
- // helper for paginated endpoints
18
- type PaginationParameters = `pageNumber=${number}` | CombineParameters<`pageNumber=${number}`, `pageSize=${number}`>;
19
- type PaginatedEndpointUrl<Endpoint extends KnownEndpoint> = Endpoint | WithParameters<Endpoint, PaginationParameters>;
20
-
21
19
  // helper for endpoints with parameters
22
20
  type ParamsParameter = `params=${string}`;
23
21
  type EndpointWithParams<Endpoint extends KnownEndpoint> = WithParameters<Endpoint, ParamsParameter>;
24
22
 
25
- type BulkExpandedManyEndpointUrl<Endpoint extends KnownEndpoint> = EndpointWithParams<Endpoint>;
26
- type BulkExpandedEndpointUrl<Endpoint extends KnownEndpoint> = BulkExpandedManyEndpointUrl<Endpoint> | Endpoint;
27
-
28
23
  // options
29
24
  type Options = {};
30
25
 
@@ -37,15 +32,19 @@ export type AuthenticatedOptions = ApiKeyOptions &{
37
32
  };
38
33
 
39
34
  export type OptionsByEndpoint<Endpoint extends string> =
40
- Endpoint extends BulkExpandedEndpointUrl<KnownEndpoint & KnownUnauthorizedEndpoint> ? Options & ApiKeyOptions :
41
- Endpoint extends KnownAuthenticatedEndpoint ? Options & AuthenticatedOptions :
42
- Endpoint extends KnownUnauthorizedEndpoint ? Options & ApiKeyOptions :
43
- Endpoint extends KnownEndpoint ? Options & ApiKeyOptions :
44
- ApiKeyOptions & Partial<AuthenticatedOptions>;
35
+ Endpoint extends '/api/v3.asmx/getSets' ? Options & { params: string } & ApiKeyOptions :
36
+ Endpoint extends '/api/v3.asmx/getThemes' ? Options & ApiKeyOptions :
37
+ Endpoint extends '/api/v3.asmx/getYears' ? Options & { theme?: string } & ApiKeyOptions :
38
+ Partial<AuthenticatedOptions & ApiKeyOptions>;
39
+
40
+ type ApiResponse<T> = {
41
+ status: string;
42
+ message?: string;
43
+ } & T;
45
44
 
46
45
  // result type for endpoint
47
46
  export type EndpointType<Url extends KnownEndpoint | (string & {})> =
48
- Url extends BulkExpandedEndpointUrl<'/getSets'> ? GetSets :
47
+ Url extends '/api/v3.asmx/getSets' ? ApiResponse<{ sets: GetSets }> :
49
48
  unknown;
50
49
 
51
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.9",
3
+ "version": "0.0.10",
4
4
  "description": "TypeScript types for all datastructures used by the Brickset API",
5
5
  "license": "MIT",
6
6
  "repository": {