@proveanything/smartlinks 1.0.33 → 1.0.35

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/API_SUMMARY.md CHANGED
@@ -190,6 +190,8 @@ interface ProductResponse {
190
190
  name: string
191
191
  collectionId: string
192
192
  description: string
193
+ gtin?: string
194
+ type?: string
193
195
  heroImage: {
194
196
  url: string
195
197
  thumbnails: {
@@ -207,6 +209,10 @@ interface ProductResponse {
207
209
  }
208
210
  ```
209
211
 
212
+ **ProductCreateRequest** = `Omit<ProductResponse, 'id' | 'collectionId'>`
213
+
214
+ **ProductUpdateRequest** = `Partial<Omit<ProductResponse, 'id' | 'collectionId'>>`
215
+
210
216
  ### proof
211
217
 
212
218
  **ProofResponse** (interface)
@@ -806,13 +812,13 @@ Retrieves a single Product Item by Collection ID and Product ID.
806
812
  List all Product Items for a Collection.
807
813
 
808
814
  **create**(collectionId: string,
809
- data: any) → `Promise<ProductResponse>`
810
- Create a new product for a collection (admin only).
815
+ data: ProductCreateRequest) → `Promise<ProductResponse>`
816
+ Create a new product for a collection (admin only). The `data` payload follows the same shape as ProductResponse minus `id` and `collectionId`.
811
817
 
812
818
  **update**(collectionId: string,
813
819
  productId: string,
814
- data: any) → `Promise<ProductResponse>`
815
- Update a product for a collection (admin only).
820
+ data: ProductUpdateRequest) → `Promise<ProductResponse>`
821
+ Update a product for a collection (admin only). The `data` payload is a partial of ProductResponse minus `id` and `collectionId`.
816
822
 
817
823
  **remove**(collectionId: string,
818
824
  productId: string) → `Promise<void>`
@@ -839,13 +845,13 @@ Retrieves a single Product Item by Collection ID and Product ID.
839
845
  List all Product Items for a Collection.
840
846
 
841
847
  **create**(collectionId: string,
842
- data: any) → `Promise<ProductResponse>`
843
- Create a new product for a collection (admin only).
848
+ data: ProductCreateRequest) → `Promise<ProductResponse>`
849
+ Create a new product for a collection (admin only). The `data` payload follows the same shape as ProductResponse minus `id` and `collectionId`.
844
850
 
845
851
  **update**(collectionId: string,
846
852
  productId: string,
847
- data: any) → `Promise<ProductResponse>`
848
- Update a product for a collection (admin only).
853
+ data: ProductUpdateRequest) → `Promise<ProductResponse>`
854
+ Update a product for a collection (admin only). The `data` payload is a partial of ProductResponse minus `id` and `collectionId`.
849
855
 
850
856
  **remove**(collectionId: string,
851
857
  productId: string) → `Promise<void>`
@@ -1,4 +1,4 @@
1
- import { ProductResponse } from "../types/product";
1
+ import { ProductResponse, ProductCreateRequest, ProductUpdateRequest } from "../types/product";
2
2
  export declare namespace product {
3
3
  /**
4
4
  * Retrieves a single Product Item by Collection ID and Product ID.
@@ -19,21 +19,23 @@ export declare namespace product {
19
19
  function list(collectionId: string, admin?: boolean): Promise<ProductResponse[]>;
20
20
  /**
21
21
  * Create a new product for a collection (admin only).
22
+ * The `data` payload follows the same shape as ProductResponse minus `id` and `collectionId`.
22
23
  * @param collectionId – Identifier of the parent collection
23
- * @param data – Product creation data
24
+ * @param data – Product creation data (see ProductCreateRequest)
24
25
  * @returns Promise resolving to a ProductResponse object
25
26
  * @throws ErrorResponse if the request fails
26
27
  */
27
- function create(collectionId: string, data: any): Promise<ProductResponse>;
28
+ function create(collectionId: string, data: ProductCreateRequest): Promise<ProductResponse>;
28
29
  /**
29
30
  * Update a product for a collection (admin only).
31
+ * The `data` payload is a partial of ProductResponse minus `id` and `collectionId`.
30
32
  * @param collectionId – Identifier of the parent collection
31
33
  * @param productId – Identifier of the product
32
- * @param data – Product update data
34
+ * @param data – Product update data (see ProductUpdateRequest)
33
35
  * @returns Promise resolving to a ProductResponse object
34
36
  * @throws ErrorResponse if the request fails
35
37
  */
36
- function update(collectionId: string, productId: string, data: any): Promise<ProductResponse>;
38
+ function update(collectionId: string, productId: string, data: ProductUpdateRequest): Promise<ProductResponse>;
37
39
  /**
38
40
  * Delete a product for a collection (admin only).
39
41
  * @param collectionId – Identifier of the parent collection
@@ -31,8 +31,9 @@ export var product;
31
31
  product.list = list;
32
32
  /**
33
33
  * Create a new product for a collection (admin only).
34
+ * The `data` payload follows the same shape as ProductResponse minus `id` and `collectionId`.
34
35
  * @param collectionId – Identifier of the parent collection
35
- * @param data – Product creation data
36
+ * @param data – Product creation data (see ProductCreateRequest)
36
37
  * @returns Promise resolving to a ProductResponse object
37
38
  * @throws ErrorResponse if the request fails
38
39
  */
@@ -43,9 +44,10 @@ export var product;
43
44
  product.create = create;
44
45
  /**
45
46
  * Update a product for a collection (admin only).
47
+ * The `data` payload is a partial of ProductResponse minus `id` and `collectionId`.
46
48
  * @param collectionId – Identifier of the parent collection
47
49
  * @param productId – Identifier of the product
48
- * @param data – Product update data
50
+ * @param data – Product update data (see ProductUpdateRequest)
49
51
  * @returns Promise resolving to a ProductResponse object
50
52
  * @throws ErrorResponse if the request fails
51
53
  */
package/dist/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export type { AttestationResponse, AttestationCreateRequest, AttestationUpdateRe
6
6
  export type { BatchResponse, BatchCreateRequest, BatchUpdateRequest, } from "./types/batch";
7
7
  export type { VariantResponse, VariantCreateRequest, VariantUpdateRequest, } from "./types/variant";
8
8
  export type { AppConfigOptions } from "./api/appConfiguration";
9
+ export type { ProductCreateRequest, ProductUpdateRequest, } from "./types/product";
@@ -10,6 +10,10 @@ export interface ProductResponse {
10
10
  collectionId: string;
11
11
  /** Detailed description of the product */
12
12
  description: string;
13
+ /** A product GTIN (Global Trade Item Number) */
14
+ gtin?: string;
15
+ /** An optional product type from the standard smartlinks types */
16
+ type?: string;
13
17
  /** Hero image asset object */
14
18
  heroImage: {
15
19
  /** URL to the asset */
@@ -30,3 +34,5 @@ export interface ProductResponse {
30
34
  [key: string]: any;
31
35
  };
32
36
  }
37
+ export type ProductCreateRequest = Omit<ProductResponse, 'id' | 'collectionId'>;
38
+ export type ProductUpdateRequest = Partial<Omit<ProductResponse, 'id' | 'collectionId'>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.0.33",
3
+ "version": "1.0.35",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",