@proveanything/smartlinks 1.0.35 → 1.0.38
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 +120 -1
- package/dist/api/ai.d.ts +74 -0
- package/dist/api/ai.js +56 -0
- package/dist/api/auth.d.ts +13 -0
- package/dist/api/auth.js +10 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +1 -0
- package/dist/api/proof.d.ts +5 -0
- package/dist/api/proof.js +10 -1
- package/dist/types/product.d.ts +1 -1
- package/package.json +1 -1
package/API_SUMMARY.md
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
+
Version: 1.0.38 | Generated: 2025-10-04T11:16:35.687Z
|
|
4
|
+
|
|
3
5
|
This is a concise summary of all available API functions and types.
|
|
4
6
|
|
|
5
7
|
## API Namespaces
|
|
6
8
|
|
|
7
9
|
The Smartlinks SDK is organized into the following namespaces:
|
|
8
10
|
|
|
11
|
+
- **ai** - Functions for ai operations
|
|
9
12
|
- **appConfiguration** - Application configuration and settings management
|
|
10
13
|
- **appRecord** - Functions for appRecord operations
|
|
11
14
|
- **asset** - File upload and asset management for collections, products, and proofs
|
|
@@ -200,7 +203,7 @@ interface ProductResponse {
|
|
|
200
203
|
x512: string
|
|
201
204
|
}
|
|
202
205
|
}
|
|
203
|
-
|
|
206
|
+
tags: {
|
|
204
207
|
[tagName: string]: boolean
|
|
205
208
|
}
|
|
206
209
|
data: {
|
|
@@ -236,6 +239,52 @@ interface ProofResponse {
|
|
|
236
239
|
|
|
237
240
|
**VariantUpdateRequest** = `any`
|
|
238
241
|
|
|
242
|
+
### ai
|
|
243
|
+
|
|
244
|
+
**AIGenerateContentRequest** (interface)
|
|
245
|
+
```typescript
|
|
246
|
+
interface AIGenerateContentRequest {
|
|
247
|
+
contents: string | any
|
|
248
|
+
responseMimeType?: string
|
|
249
|
+
systemInstruction?: string
|
|
250
|
+
provider?: string
|
|
251
|
+
model?: string
|
|
252
|
+
[key: string]: any
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**AIGenerateImageRequest** (interface)
|
|
257
|
+
```typescript
|
|
258
|
+
interface AIGenerateImageRequest {
|
|
259
|
+
prompt: string
|
|
260
|
+
provider?: string
|
|
261
|
+
model?: string
|
|
262
|
+
size?: string
|
|
263
|
+
[key: string]: any
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**AISearchPhotosRequest** (interface)
|
|
268
|
+
```typescript
|
|
269
|
+
interface AISearchPhotosRequest {
|
|
270
|
+
query: string
|
|
271
|
+
per_page?: number
|
|
272
|
+
orientation?: 'landscape' | 'portrait' | 'squarish'
|
|
273
|
+
[key: string]: any
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**AISearchPhotosPhoto** (interface)
|
|
278
|
+
```typescript
|
|
279
|
+
interface AISearchPhotosPhoto {
|
|
280
|
+
url: string
|
|
281
|
+
alt?: string
|
|
282
|
+
photographer?: string
|
|
283
|
+
photographerUrl?: string
|
|
284
|
+
[key: string]: any
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
239
288
|
**AppConfigOptions** = `{
|
|
240
289
|
appId: string
|
|
241
290
|
collectionId?: string
|
|
@@ -304,6 +353,50 @@ interface ProofResponse {
|
|
|
304
353
|
|
|
305
354
|
## API Functions
|
|
306
355
|
|
|
356
|
+
### ai
|
|
357
|
+
|
|
358
|
+
**generateContent**(collectionId: string,
|
|
359
|
+
params: AIGenerateContentRequest,
|
|
360
|
+
admin: boolean = true) → `Promise<any>`
|
|
361
|
+
Generate text/content via AI (admin)
|
|
362
|
+
|
|
363
|
+
**generateImage**(collectionId: string, params: AIGenerateImageRequest) → `Promise<any>`
|
|
364
|
+
Generate an image via AI (admin)
|
|
365
|
+
|
|
366
|
+
**searchPhotos**(collectionId: string,
|
|
367
|
+
params: AISearchPhotosRequest) → `Promise<AISearchPhotosPhoto[]>`
|
|
368
|
+
Search stock photos or similar via AI (admin)
|
|
369
|
+
|
|
370
|
+
**uploadFile**(collectionId: string, params: any) → `Promise<any>`
|
|
371
|
+
Upload a file for AI usage (admin). Pass FormData for binary uploads.
|
|
372
|
+
|
|
373
|
+
**createCache**(collectionId: string, params: any) → `Promise<any>`
|
|
374
|
+
Create or warm a cache for AI (admin)
|
|
375
|
+
|
|
376
|
+
**postChat**(collectionId: string, params: any, admin: boolean = true) → `Promise<any>`
|
|
377
|
+
Post a chat message to the AI (admin or public)
|
|
378
|
+
|
|
379
|
+
**generateContent**(collectionId: string,
|
|
380
|
+
params: AIGenerateContentRequest,
|
|
381
|
+
admin: boolean = true) → `Promise<any>`
|
|
382
|
+
Generate text/content via AI (admin)
|
|
383
|
+
|
|
384
|
+
**generateImage**(collectionId: string, params: AIGenerateImageRequest) → `Promise<any>`
|
|
385
|
+
Generate an image via AI (admin)
|
|
386
|
+
|
|
387
|
+
**searchPhotos**(collectionId: string,
|
|
388
|
+
params: AISearchPhotosRequest) → `Promise<AISearchPhotosPhoto[]>`
|
|
389
|
+
Search stock photos or similar via AI (admin)
|
|
390
|
+
|
|
391
|
+
**uploadFile**(collectionId: string, params: any) → `Promise<any>`
|
|
392
|
+
Upload a file for AI usage (admin). Pass FormData for binary uploads.
|
|
393
|
+
|
|
394
|
+
**createCache**(collectionId: string, params: any) → `Promise<any>`
|
|
395
|
+
Create or warm a cache for AI (admin)
|
|
396
|
+
|
|
397
|
+
**postChat**(collectionId: string, params: any, admin: boolean = true) → `Promise<any>`
|
|
398
|
+
Post a chat message to the AI (admin or public)
|
|
399
|
+
|
|
307
400
|
### appConfiguration
|
|
308
401
|
|
|
309
402
|
**getConfig**(opts: AppConfigOptions) → `Promise<any>`
|
|
@@ -493,6 +586,14 @@ Requests an admin JWT for the current user and a specific collection Returns JWT
|
|
|
493
586
|
**requestPublicJWT**(collectionId: string, productId: string, proofId: string) → `Promise<string>`
|
|
494
587
|
Requests a JWT for the current user and a specific collection/product/proof Validates if the user has access to the resource, and returns a JWT
|
|
495
588
|
|
|
589
|
+
**getUserToken**(opts?: {
|
|
590
|
+
email?: string
|
|
591
|
+
collectionId?: string
|
|
592
|
+
userId?: string
|
|
593
|
+
expiry?: string
|
|
594
|
+
}) → `Promise<`
|
|
595
|
+
Admin: Get a user bearer token (impersonation/automation). POST /admin/auth/userToken All fields are optional; at least one identifier should be provided.
|
|
596
|
+
|
|
496
597
|
**getAccount**() → `Promise<AccountInfoResponse>`
|
|
497
598
|
Gets current account information for the logged in user. Returns user, owner, account, and location objects.
|
|
498
599
|
|
|
@@ -511,6 +612,14 @@ Requests an admin JWT for the current user and a specific collection Returns JWT
|
|
|
511
612
|
**requestPublicJWT**(collectionId: string, productId: string, proofId: string) → `Promise<string>`
|
|
512
613
|
Requests a JWT for the current user and a specific collection/product/proof Validates if the user has access to the resource, and returns a JWT
|
|
513
614
|
|
|
615
|
+
**getUserToken**(opts?: {
|
|
616
|
+
email?: string
|
|
617
|
+
collectionId?: string
|
|
618
|
+
userId?: string
|
|
619
|
+
expiry?: string
|
|
620
|
+
}) → `Promise<`
|
|
621
|
+
Admin: Get a user bearer token (impersonation/automation). POST /admin/auth/userToken All fields are optional; at least one identifier should be provided.
|
|
622
|
+
|
|
514
623
|
**getAccount**() → `Promise<AccountInfoResponse>`
|
|
515
624
|
Gets current account information for the logged in user. Returns user, owner, account, and location objects.
|
|
516
625
|
|
|
@@ -890,6 +999,11 @@ Create a proof for a product (admin only). POST /admin/collection/:collectionId/
|
|
|
890
999
|
values: any) → `Promise<ProofResponse>`
|
|
891
1000
|
Update a proof for a product (admin only). PUT /admin/collection/:collectionId/product/:productId/proof/:proofId
|
|
892
1001
|
|
|
1002
|
+
**remove**(collectionId: string,
|
|
1003
|
+
productId: string,
|
|
1004
|
+
proofId: string) → `Promise<void>`
|
|
1005
|
+
Delete a proof for a product (admin only). DELETE /admin/collection/:collectionId/product/:productId/proof/:proofId
|
|
1006
|
+
|
|
893
1007
|
**getByUser**(collectionId: string,
|
|
894
1008
|
userId: string) → `Promise<ProofResponse[]>`
|
|
895
1009
|
Get proofs for a user in a collection (admin only). GET /admin/collection/:collectionId/proof/findByUser/:userId
|
|
@@ -928,6 +1042,11 @@ Create a proof for a product (admin only). POST /admin/collection/:collectionId/
|
|
|
928
1042
|
values: any) → `Promise<ProofResponse>`
|
|
929
1043
|
Update a proof for a product (admin only). PUT /admin/collection/:collectionId/product/:productId/proof/:proofId
|
|
930
1044
|
|
|
1045
|
+
**remove**(collectionId: string,
|
|
1046
|
+
productId: string,
|
|
1047
|
+
proofId: string) → `Promise<void>`
|
|
1048
|
+
Delete a proof for a product (admin only). DELETE /admin/collection/:collectionId/product/:productId/proof/:proofId
|
|
1049
|
+
|
|
931
1050
|
**getByUser**(collectionId: string,
|
|
932
1051
|
userId: string) → `Promise<ProofResponse[]>`
|
|
933
1052
|
Get proofs for a user in a collection (admin only). GET /admin/collection/:collectionId/proof/findByUser/:userId
|
package/dist/api/ai.d.ts
ADDED
|
@@ -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 = {}));
|
package/dist/api/auth.d.ts
CHANGED
|
@@ -70,6 +70,19 @@ export declare namespace auth {
|
|
|
70
70
|
* Validates if the user has access to the resource, and returns a JWT
|
|
71
71
|
*/
|
|
72
72
|
function requestPublicJWT(collectionId: string, productId: string, proofId: string): Promise<string>;
|
|
73
|
+
/**
|
|
74
|
+
* Admin: Get a user bearer token (impersonation/automation).
|
|
75
|
+
* POST /admin/auth/userToken
|
|
76
|
+
* All fields are optional; at least one identifier should be provided.
|
|
77
|
+
*/
|
|
78
|
+
function getUserToken(opts?: {
|
|
79
|
+
email?: string;
|
|
80
|
+
collectionId?: string;
|
|
81
|
+
userId?: string;
|
|
82
|
+
expiry?: string;
|
|
83
|
+
}): Promise<{
|
|
84
|
+
bearerToken: string;
|
|
85
|
+
}>;
|
|
73
86
|
/**
|
|
74
87
|
* Gets current account information for the logged in user.
|
|
75
88
|
* Returns user, owner, account, and location objects.
|
package/dist/api/auth.js
CHANGED
|
@@ -60,6 +60,16 @@ export var auth;
|
|
|
60
60
|
return post("/public/auth/requestJWT", { collectionId, productId, proofId });
|
|
61
61
|
}
|
|
62
62
|
auth.requestPublicJWT = requestPublicJWT;
|
|
63
|
+
/**
|
|
64
|
+
* Admin: Get a user bearer token (impersonation/automation).
|
|
65
|
+
* POST /admin/auth/userToken
|
|
66
|
+
* All fields are optional; at least one identifier should be provided.
|
|
67
|
+
*/
|
|
68
|
+
async function getUserToken(opts) {
|
|
69
|
+
const body = opts !== null && opts !== void 0 ? opts : {};
|
|
70
|
+
return post("/admin/auth/getUserToken", body);
|
|
71
|
+
}
|
|
72
|
+
auth.getUserToken = getUserToken;
|
|
63
73
|
/**
|
|
64
74
|
* Gets current account information for the logged in user.
|
|
65
75
|
* Returns user, owner, account, and location objects.
|
package/dist/api/index.d.ts
CHANGED
|
@@ -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
package/dist/api/proof.d.ts
CHANGED
|
@@ -19,6 +19,11 @@ export declare namespace proof {
|
|
|
19
19
|
* PUT /admin/collection/:collectionId/product/:productId/proof/:proofId
|
|
20
20
|
*/
|
|
21
21
|
function update(collectionId: string, productId: string, proofId: string, values: any): Promise<ProofResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Delete a proof for a product (admin only).
|
|
24
|
+
* DELETE /admin/collection/:collectionId/product/:productId/proof/:proofId
|
|
25
|
+
*/
|
|
26
|
+
function remove(collectionId: string, productId: string, proofId: string): Promise<void>;
|
|
22
27
|
/**
|
|
23
28
|
* Get proofs for a user in a collection (admin only).
|
|
24
29
|
* GET /admin/collection/:collectionId/proof/findByUser/:userId
|
package/dist/api/proof.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/api/proof.ts
|
|
2
|
-
import { request, post, put } from "../http";
|
|
2
|
+
import { request, post, put, del } from "../http";
|
|
3
3
|
export var proof;
|
|
4
4
|
(function (proof) {
|
|
5
5
|
/**
|
|
@@ -39,6 +39,15 @@ export var proof;
|
|
|
39
39
|
return put(path, values);
|
|
40
40
|
}
|
|
41
41
|
proof.update = update;
|
|
42
|
+
/**
|
|
43
|
+
* Delete a proof for a product (admin only).
|
|
44
|
+
* DELETE /admin/collection/:collectionId/product/:productId/proof/:proofId
|
|
45
|
+
*/
|
|
46
|
+
async function remove(collectionId, productId, proofId) {
|
|
47
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}`;
|
|
48
|
+
return del(path);
|
|
49
|
+
}
|
|
50
|
+
proof.remove = remove;
|
|
42
51
|
/**
|
|
43
52
|
* Get proofs for a user in a collection (admin only).
|
|
44
53
|
* GET /admin/collection/:collectionId/proof/findByUser/:userId
|
package/dist/types/product.d.ts
CHANGED