@proveanything/smartlinks 1.0.37 → 1.0.39

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
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.0.37 | Generated: 2025-09-17T14:45:53.635Z
3
+ Version: 1.0.39 | Generated: 2025-10-07T14:54:51.574Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -8,6 +8,7 @@ This is a concise summary of all available API functions and types.
8
8
 
9
9
  The Smartlinks SDK is organized into the following namespaces:
10
10
 
11
+ - **ai** - Functions for ai operations
11
12
  - **appConfiguration** - Application configuration and settings management
12
13
  - **appRecord** - Functions for appRecord operations
13
14
  - **asset** - File upload and asset management for collections, products, and proofs
@@ -128,6 +129,38 @@ interface AttestationUpdateRequest {
128
129
 
129
130
  **BatchUpdateRequest** = `any`
130
131
 
132
+ ### claimSet
133
+
134
+ **ClaimCodeRef** (interface)
135
+ ```typescript
136
+ interface ClaimCodeRef {
137
+ codeId: string
138
+ claimId: string
139
+ }
140
+ ```
141
+
142
+ **UpdateClaimDataRequest** (interface)
143
+ ```typescript
144
+ interface UpdateClaimDataRequest {
145
+ data: Record<string, any>
146
+ codes: ClaimCodeRef[]
147
+ }
148
+ ```
149
+
150
+ **AssignClaimsRequest** (interface)
151
+ ```typescript
152
+ interface AssignClaimsRequest {
153
+ id: string
154
+ collectionId: string
155
+ productId: string
156
+ batchId?: string
157
+ start?: number
158
+ end?: number
159
+ codeId?: string
160
+ data?: Record<string, any>
161
+ }
162
+ ```
163
+
131
164
  ### collection
132
165
 
133
166
  **CollectionResponse** (interface)
@@ -202,7 +235,7 @@ interface ProductResponse {
202
235
  x512: string
203
236
  }
204
237
  }
205
- groupTags: {
238
+ tags: {
206
239
  [tagName: string]: boolean
207
240
  }
208
241
  data: {
@@ -238,6 +271,52 @@ interface ProofResponse {
238
271
 
239
272
  **VariantUpdateRequest** = `any`
240
273
 
274
+ ### ai
275
+
276
+ **AIGenerateContentRequest** (interface)
277
+ ```typescript
278
+ interface AIGenerateContentRequest {
279
+ contents: string | any
280
+ responseMimeType?: string
281
+ systemInstruction?: string
282
+ provider?: string
283
+ model?: string
284
+ [key: string]: any
285
+ }
286
+ ```
287
+
288
+ **AIGenerateImageRequest** (interface)
289
+ ```typescript
290
+ interface AIGenerateImageRequest {
291
+ prompt: string
292
+ provider?: string
293
+ model?: string
294
+ size?: string
295
+ [key: string]: any
296
+ }
297
+ ```
298
+
299
+ **AISearchPhotosRequest** (interface)
300
+ ```typescript
301
+ interface AISearchPhotosRequest {
302
+ query: string
303
+ per_page?: number
304
+ orientation?: 'landscape' | 'portrait' | 'squarish'
305
+ [key: string]: any
306
+ }
307
+ ```
308
+
309
+ **AISearchPhotosPhoto** (interface)
310
+ ```typescript
311
+ interface AISearchPhotosPhoto {
312
+ url: string
313
+ alt?: string
314
+ photographer?: string
315
+ photographerUrl?: string
316
+ [key: string]: any
317
+ }
318
+ ```
319
+
241
320
  **AppConfigOptions** = `{
242
321
  appId: string
243
322
  collectionId?: string
@@ -306,6 +385,50 @@ interface ProofResponse {
306
385
 
307
386
  ## API Functions
308
387
 
388
+ ### ai
389
+
390
+ **generateContent**(collectionId: string,
391
+ params: AIGenerateContentRequest,
392
+ admin: boolean = true) → `Promise<any>`
393
+ Generate text/content via AI (admin)
394
+
395
+ **generateImage**(collectionId: string, params: AIGenerateImageRequest) → `Promise<any>`
396
+ Generate an image via AI (admin)
397
+
398
+ **searchPhotos**(collectionId: string,
399
+ params: AISearchPhotosRequest) → `Promise<AISearchPhotosPhoto[]>`
400
+ Search stock photos or similar via AI (admin)
401
+
402
+ **uploadFile**(collectionId: string, params: any) → `Promise<any>`
403
+ Upload a file for AI usage (admin). Pass FormData for binary uploads.
404
+
405
+ **createCache**(collectionId: string, params: any) → `Promise<any>`
406
+ Create or warm a cache for AI (admin)
407
+
408
+ **postChat**(collectionId: string, params: any, admin: boolean = true) → `Promise<any>`
409
+ Post a chat message to the AI (admin or public)
410
+
411
+ **generateContent**(collectionId: string,
412
+ params: AIGenerateContentRequest,
413
+ admin: boolean = true) → `Promise<any>`
414
+ Generate text/content via AI (admin)
415
+
416
+ **generateImage**(collectionId: string, params: AIGenerateImageRequest) → `Promise<any>`
417
+ Generate an image via AI (admin)
418
+
419
+ **searchPhotos**(collectionId: string,
420
+ params: AISearchPhotosRequest) → `Promise<AISearchPhotosPhoto[]>`
421
+ Search stock photos or similar via AI (admin)
422
+
423
+ **uploadFile**(collectionId: string, params: any) → `Promise<any>`
424
+ Upload a file for AI usage (admin). Pass FormData for binary uploads.
425
+
426
+ **createCache**(collectionId: string, params: any) → `Promise<any>`
427
+ Create or warm a cache for AI (admin)
428
+
429
+ **postChat**(collectionId: string, params: any, admin: boolean = true) → `Promise<any>`
430
+ Post a chat message to the AI (admin or public)
431
+
309
432
  ### appConfiguration
310
433
 
311
434
  **getConfig**(opts: AppConfigOptions) → `Promise<any>`
@@ -652,10 +775,10 @@ Update a claim set for a collection.
652
775
  **makeClaim**(collectionId: string, params: any) → `Promise<any>`
653
776
  Make a claim for a claim set.
654
777
 
655
- **assignClaims**(collectionId: string, data: any) → `Promise<any>`
656
- Assign claims to a claim set.
778
+ **assignClaims**(collectionId: string, data: AssignClaimsRequest) → `Promise<any>`
779
+ Assign claims to a claim set. { id: string, // claim set id (required) collectionId: string,// required productId: string, // required batchId?: string, // optional start?: number, // optional bulk range start end?: number, // optional bulk range end codeId?: string, // optional single code data?: { [k: string]: any } // optional claim key/values }
657
780
 
658
- **updateClaimData**(collectionId: string, data: any) → `Promise<any>`
781
+ **updateClaimData**(collectionId: string, data: UpdateClaimDataRequest) → `Promise<any>`
659
782
  Update claim data for a collection.
660
783
 
661
784
  **getAllForCollection**(collectionId: string) → `Promise<any[]>`
@@ -688,10 +811,10 @@ Update a claim set for a collection.
688
811
  **makeClaim**(collectionId: string, params: any) → `Promise<any>`
689
812
  Make a claim for a claim set.
690
813
 
691
- **assignClaims**(collectionId: string, data: any) → `Promise<any>`
692
- Assign claims to a claim set.
814
+ **assignClaims**(collectionId: string, data: AssignClaimsRequest) → `Promise<any>`
815
+ Assign claims to a claim set. { id: string, // claim set id (required) collectionId: string,// required productId: string, // required batchId?: string, // optional start?: number, // optional bulk range start end?: number, // optional bulk range end codeId?: string, // optional single code data?: { [k: string]: any } // optional claim key/values }
693
816
 
694
- **updateClaimData**(collectionId: string, data: any) → `Promise<any>`
817
+ **updateClaimData**(collectionId: string, data: UpdateClaimDataRequest) → `Promise<any>`
695
818
  Update claim data for a collection.
696
819
 
697
820
  ### collection
@@ -702,6 +825,12 @@ Retrieves a single Collection by its ID.
702
825
  **list**(admin?: boolean) → `Promise<CollectionResponse[]>`
703
826
  Retrieves all Collections.
704
827
 
828
+ **getShortId**(shortId: string) → `Promise<CollectionResponse>`
829
+ Retrieve a collection by its shortId (public endpoint).
830
+
831
+ **getSettings**(collectionId: string, settingGroup: string) → `Promise<any>`
832
+ Retrieve a specific settings group for a collection (public endpoint).
833
+
705
834
  **create**(data: any) → `Promise<CollectionResponse>`
706
835
  Create a new collection (admin only).
707
836
 
@@ -731,6 +860,12 @@ Retrieves a single Collection by its ID.
731
860
  **list**(admin?: boolean) → `Promise<CollectionResponse[]>`
732
861
  Retrieves all Collections.
733
862
 
863
+ **getShortId**(shortId: string) → `Promise<CollectionResponse>`
864
+ Retrieve a collection by its shortId (public endpoint).
865
+
866
+ **getSettings**(collectionId: string, settingGroup: string) → `Promise<any>`
867
+ Retrieve a specific settings group for a collection (public endpoint).
868
+
734
869
  **create**(data: any) → `Promise<CollectionResponse>`
735
870
  Create a new collection (admin only).
736
871
 
@@ -0,0 +1,74 @@
1
+ export interface AIGenerateContentRequest {
2
+ /** The prompt or message contents sent to the AI */
3
+ contents: string | any;
4
+ /** Desired MIME type of the response payload (e.g. 'application/json', 'text/plain') */
5
+ responseMimeType?: string;
6
+ /** Optional system instruction or system prompt to steer the model */
7
+ systemInstruction?: string;
8
+ /** AI provider identifier (e.g. 'openai', 'google', 'anthropic') */
9
+ provider?: string;
10
+ /** The model name to use (e.g. 'gpt-4o', 'gemini-1.5-pro') */
11
+ model?: string;
12
+ /** Allow passing additional provider/model-specific options */
13
+ [key: string]: any;
14
+ }
15
+ export interface AIGenerateImageRequest {
16
+ /** Text prompt describing the desired image */
17
+ prompt: string;
18
+ /** AI provider identifier (e.g. 'openai', 'google', 'stability') */
19
+ provider?: string;
20
+ /** Optional model name to use for image generation */
21
+ model?: string;
22
+ /** Requested image size, e.g. '1024x1024' */
23
+ size?: string;
24
+ /** Additional provider/model-specific options */
25
+ [key: string]: any;
26
+ }
27
+ export interface AISearchPhotosRequest {
28
+ /** Search query keyword(s) */
29
+ query: string;
30
+ /** Number of results to return per page (e.g. 1) */
31
+ per_page?: number;
32
+ /** Desired orientation of photos */
33
+ orientation?: 'landscape' | 'portrait' | 'squarish';
34
+ /** Additional provider-specific options */
35
+ [key: string]: any;
36
+ }
37
+ export interface AISearchPhotosPhoto {
38
+ /** Direct image URL */
39
+ url: string;
40
+ /** Alt text/description for accessibility */
41
+ alt?: string;
42
+ /** Photographer display name */
43
+ photographer?: string;
44
+ /** Link to the photographer profile */
45
+ photographerUrl?: string;
46
+ /** Allow extra fields */
47
+ [key: string]: any;
48
+ }
49
+ export declare namespace ai {
50
+ /**
51
+ * Generate text/content via AI (admin)
52
+ */
53
+ function generateContent(collectionId: string, params: AIGenerateContentRequest, admin?: boolean): Promise<any>;
54
+ /**
55
+ * Generate an image via AI (admin)
56
+ */
57
+ function generateImage(collectionId: string, params: AIGenerateImageRequest): Promise<any>;
58
+ /**
59
+ * Search stock photos or similar via AI (admin)
60
+ */
61
+ function searchPhotos(collectionId: string, params: AISearchPhotosRequest): Promise<AISearchPhotosPhoto[]>;
62
+ /**
63
+ * Upload a file for AI usage (admin). Pass FormData for binary uploads.
64
+ */
65
+ function uploadFile(collectionId: string, params: any): Promise<any>;
66
+ /**
67
+ * Create or warm a cache for AI (admin)
68
+ */
69
+ function createCache(collectionId: string, params: any): Promise<any>;
70
+ /**
71
+ * Post a chat message to the AI (admin or public)
72
+ */
73
+ function postChat(collectionId: string, params: any, admin?: boolean): Promise<any>;
74
+ }
package/dist/api/ai.js ADDED
@@ -0,0 +1,56 @@
1
+ // src/api/ai.ts
2
+ // AI endpoints: public and admin helpers
3
+ import { post } from "../http";
4
+ export var ai;
5
+ (function (ai) {
6
+ /**
7
+ * Generate text/content via AI (admin)
8
+ */
9
+ async function generateContent(collectionId, params, admin = true) {
10
+ const base = admin ? '/admin' : '/public';
11
+ const path = `${base}/collection/${encodeURIComponent(collectionId)}/ai/generateContent`;
12
+ return post(path, params);
13
+ }
14
+ ai.generateContent = generateContent;
15
+ /**
16
+ * Generate an image via AI (admin)
17
+ */
18
+ async function generateImage(collectionId, params) {
19
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/ai/generateImage`;
20
+ return post(path, params);
21
+ }
22
+ ai.generateImage = generateImage;
23
+ /**
24
+ * Search stock photos or similar via AI (admin)
25
+ */
26
+ async function searchPhotos(collectionId, params) {
27
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/ai/searchPhotos`;
28
+ return post(path, params);
29
+ }
30
+ ai.searchPhotos = searchPhotos;
31
+ /**
32
+ * Upload a file for AI usage (admin). Pass FormData for binary uploads.
33
+ */
34
+ async function uploadFile(collectionId, params) {
35
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/ai/uploadFile`;
36
+ return post(path, params);
37
+ }
38
+ ai.uploadFile = uploadFile;
39
+ /**
40
+ * Create or warm a cache for AI (admin)
41
+ */
42
+ async function createCache(collectionId, params) {
43
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/ai/createCache`;
44
+ return post(path, params);
45
+ }
46
+ ai.createCache = createCache;
47
+ /**
48
+ * Post a chat message to the AI (admin or public)
49
+ */
50
+ async function postChat(collectionId, params, admin = true) {
51
+ const base = admin ? '/admin' : '/public';
52
+ const path = `${base}/collection/${encodeURIComponent(collectionId)}/ai/postChat`;
53
+ return post(path, params);
54
+ }
55
+ ai.postChat = postChat;
56
+ })(ai || (ai = {}));
@@ -1,3 +1,4 @@
1
+ import { UpdateClaimDataRequest, AssignClaimsRequest } from "../types";
1
2
  export declare namespace claimSet {
2
3
  /**
3
4
  * Get all claim sets for a collection.
@@ -71,12 +72,22 @@ export declare namespace claimSet {
71
72
  * Assign claims to a claim set.
72
73
  * @param collectionId – The collection identifier
73
74
  * @param data – The claims data to assign
75
+ * {
76
+ * id: string, // claim set id (required)
77
+ * collectionId: string,// required
78
+ * productId: string, // required
79
+ * batchId?: string, // optional
80
+ * start?: number, // optional bulk range start
81
+ * end?: number, // optional bulk range end
82
+ * codeId?: string, // optional single code
83
+ * data?: { [k: string]: any } // optional claim key/values
84
+ * }
74
85
  */
75
- function assignClaims(collectionId: string, data: any): Promise<any>;
86
+ function assignClaims(collectionId: string, data: AssignClaimsRequest): Promise<any>;
76
87
  /**
77
88
  * Update claim data for a collection.
78
89
  * @param collectionId – The collection identifier
79
90
  * @param data – The claim data to update
80
91
  */
81
- function updateClaimData(collectionId: string, data: any): Promise<any>;
92
+ function updateClaimData(collectionId: string, data: UpdateClaimDataRequest): Promise<any>;
82
93
  }
@@ -113,6 +113,16 @@ export var claimSet;
113
113
  * Assign claims to a claim set.
114
114
  * @param collectionId – The collection identifier
115
115
  * @param data – The claims data to assign
116
+ * {
117
+ * id: string, // claim set id (required)
118
+ * collectionId: string,// required
119
+ * productId: string, // required
120
+ * batchId?: string, // optional
121
+ * start?: number, // optional bulk range start
122
+ * end?: number, // optional bulk range end
123
+ * codeId?: string, // optional single code
124
+ * data?: { [k: string]: any } // optional claim key/values
125
+ * }
116
126
  */
117
127
  async function assignClaims(collectionId, data) {
118
128
  const path = `/admin/collection/${encodeURIComponent(collectionId)}/claimSet/${encodeURIComponent(data.id)}/assignClaims`;
@@ -15,6 +15,19 @@ export declare namespace collection {
15
15
  * @throws ErrorResponse if the request fails
16
16
  */
17
17
  function list(admin?: boolean): Promise<CollectionResponse[]>;
18
+ /**
19
+ * Retrieve a collection by its shortId (public endpoint).
20
+ * @param shortId – The short identifier of the collection
21
+ * @returns Promise resolving to a CollectionResponse object
22
+ */
23
+ function getShortId(shortId: string): Promise<CollectionResponse>;
24
+ /**
25
+ * Retrieve a specific settings group for a collection (public endpoint).
26
+ * @param collectionId – Identifier of the collection
27
+ * @param settingGroup – The settings group name
28
+ * @returns Promise resolving to the settings object
29
+ */
30
+ function getSettings(collectionId: string, settingGroup: string): Promise<any>;
18
31
  /**
19
32
  * Create a new collection (admin only).
20
33
  * @param data – Collection creation data
@@ -27,6 +27,27 @@ export var collection;
27
27
  return request(path);
28
28
  }
29
29
  collection.list = list;
30
+ /**
31
+ * Retrieve a collection by its shortId (public endpoint).
32
+ * @param shortId – The short identifier of the collection
33
+ * @returns Promise resolving to a CollectionResponse object
34
+ */
35
+ async function getShortId(shortId) {
36
+ const path = `/public/collection/getShortId/${encodeURIComponent(shortId)}`;
37
+ return request(path);
38
+ }
39
+ collection.getShortId = getShortId;
40
+ /**
41
+ * Retrieve a specific settings group for a collection (public endpoint).
42
+ * @param collectionId – Identifier of the collection
43
+ * @param settingGroup – The settings group name
44
+ * @returns Promise resolving to the settings object
45
+ */
46
+ async function getSettings(collectionId, settingGroup) {
47
+ const path = `/public/collection/${encodeURIComponent(collectionId)}/settings/${encodeURIComponent(settingGroup)}`;
48
+ return request(path);
49
+ }
50
+ collection.getSettings = getSettings;
30
51
  /**
31
52
  * Create a new collection (admin only).
32
53
  * @param data – Collection creation data
@@ -11,3 +11,5 @@ export { claimSet } from "./claimSet";
11
11
  export { crate } from "./crate";
12
12
  export { batch } from "./batch";
13
13
  export { variant } from "./variant";
14
+ export { ai } from "./ai";
15
+ export type { AIGenerateContentRequest, AIGenerateImageRequest, AISearchPhotosRequest, AISearchPhotosPhoto } from "./ai";
package/dist/api/index.js CHANGED
@@ -13,3 +13,4 @@ export { claimSet } from "./claimSet";
13
13
  export { crate } from "./crate";
14
14
  export { batch } from "./batch";
15
15
  export { variant } from "./variant";
16
+ export { ai } from "./ai";
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Reference to a specific claim attached to a code/tag.
3
+ */
4
+ export interface ClaimCodeRef {
5
+ /** Identifier of the code (e.g., tag or QR code) */
6
+ codeId: string;
7
+ /** Identifier of the claim within the claim set */
8
+ claimId: string;
9
+ }
10
+ /**
11
+ * Request body for updating claim data on a claim set.
12
+ * Contains arbitrary key/value pairs and a list of code+claim references to update.
13
+ */
14
+ export interface UpdateClaimDataRequest {
15
+ /** Arbitrary key/value pairs for the claim data update */
16
+ data: Record<string, any>;
17
+ /** Array of code+claim references affected by this update */
18
+ codes: ClaimCodeRef[];
19
+ }
20
+ /**
21
+ * Request body for assigning claims to codes or ranges within a collection.
22
+ */
23
+ export interface AssignClaimsRequest {
24
+ /** The claim set ID (required) */
25
+ id: string;
26
+ /** The collection ID (required) */
27
+ collectionId: string;
28
+ /** The product ID (required) */
29
+ productId: string;
30
+ /** Optional batch identifier */
31
+ batchId?: string;
32
+ /** Optional start index for bulk assignment */
33
+ start?: number;
34
+ /** Optional end index for bulk assignment */
35
+ end?: number;
36
+ /** Optional single code identifier for single assignment */
37
+ codeId?: string;
38
+ /** Optional key/value pairs to set on the claim */
39
+ data?: Record<string, any>;
40
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -6,3 +6,4 @@ export * from "./error";
6
6
  export * from "./asset";
7
7
  export * from "./batch";
8
8
  export * from "./variant";
9
+ export * from "./claimSet";
@@ -8,3 +8,4 @@ export * from "./error";
8
8
  export * from "./asset";
9
9
  export * from "./batch";
10
10
  export * from "./variant";
11
+ export * from "./claimSet";
@@ -26,7 +26,7 @@ export interface ProductResponse {
26
26
  };
27
27
  };
28
28
  /** Flexible map of tags with true/false values */
29
- groupTags: {
29
+ tags: {
30
30
  [tagName: string]: boolean;
31
31
  };
32
32
  /** Flexible key/value data map */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",