@proveanything/smartlinks 1.1.8 → 1.1.9
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 +62 -2
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/template.d.ts +15 -0
- package/dist/api/template.js +59 -0
- package/dist/types/actions.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/template.d.ts +30 -0
- package/dist/types/template.js +2 -0
- package/package.json +1 -1
package/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.9 | Generated: 2025-12-24T13:18:43.320Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -47,6 +47,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
47
47
|
|
|
48
48
|
— Other —
|
|
49
49
|
- **attestation** - Functions for attestation operations
|
|
50
|
+
- **template** - Functions for template operations
|
|
50
51
|
|
|
51
52
|
## HTTP Utilities
|
|
52
53
|
|
|
@@ -230,7 +231,7 @@ interface ActionPermissions {
|
|
|
230
231
|
**ActionRecord** (interface)
|
|
231
232
|
```typescript
|
|
232
233
|
interface ActionRecord {
|
|
233
|
-
id
|
|
234
|
+
id?: string
|
|
234
235
|
collectionId: string
|
|
235
236
|
appId: string
|
|
236
237
|
permissions?: ActionPermissions
|
|
@@ -1233,6 +1234,39 @@ interface SegmentRecipientsResponse {
|
|
|
1233
1234
|
}
|
|
1234
1235
|
```
|
|
1235
1236
|
|
|
1237
|
+
### template
|
|
1238
|
+
|
|
1239
|
+
**TemplateBase** (interface)
|
|
1240
|
+
```typescript
|
|
1241
|
+
interface TemplateBase {
|
|
1242
|
+
id: string
|
|
1243
|
+
collectionId: string
|
|
1244
|
+
name: string
|
|
1245
|
+
description?: string
|
|
1246
|
+
type: string
|
|
1247
|
+
resizeMode?: string
|
|
1248
|
+
pdf?: {
|
|
1249
|
+
base: { url: string }
|
|
1250
|
+
orientation: 'portrait' | 'landscape'
|
|
1251
|
+
}
|
|
1252
|
+
subject?: string
|
|
1253
|
+
body?: string
|
|
1254
|
+
css?: string
|
|
1255
|
+
public?: boolean
|
|
1256
|
+
engine?: string
|
|
1257
|
+
component?: string
|
|
1258
|
+
defaultProps?: Record<string, any>
|
|
1259
|
+
collections?: string[]
|
|
1260
|
+
[k: string]: any
|
|
1261
|
+
}
|
|
1262
|
+
```
|
|
1263
|
+
|
|
1264
|
+
**TemplateInput** = `Omit<TemplateBase, 'id' | 'collectionId'>`
|
|
1265
|
+
|
|
1266
|
+
**TemplateUpdate** = `Partial<Omit<TemplateBase, 'id' | 'collectionId'>>`
|
|
1267
|
+
|
|
1268
|
+
**TemplatePublic** = `TemplateBase`
|
|
1269
|
+
|
|
1236
1270
|
### variant
|
|
1237
1271
|
|
|
1238
1272
|
**VariantResponse** = `any`
|
|
@@ -2022,6 +2056,32 @@ Resolve a short code to related resource identifiers.
|
|
|
2022
2056
|
id: string,
|
|
2023
2057
|
query: { limit?: number; offset?: number } = {}) → `Promise<SegmentRecipientsResponse>`
|
|
2024
2058
|
|
|
2059
|
+
### template
|
|
2060
|
+
|
|
2061
|
+
**getAll**(collectionId: string) → `Promise<Template[]>`
|
|
2062
|
+
|
|
2063
|
+
**get**(collectionId: string, templateId: string) → `Promise<Template>`
|
|
2064
|
+
|
|
2065
|
+
**create**(collectionId: string, data: TemplateInput) → `Promise<Template>`
|
|
2066
|
+
|
|
2067
|
+
**update**(collectionId: string,
|
|
2068
|
+
templateId: string,
|
|
2069
|
+
data: TemplateUpdate) → `Promise<Template>`
|
|
2070
|
+
|
|
2071
|
+
**del**(collectionId: string, templateId: string) → `Promise<Template>`
|
|
2072
|
+
|
|
2073
|
+
**uploadAsset**(collectionId: string,
|
|
2074
|
+
templateId: string,
|
|
2075
|
+
file: File | Blob) → `Promise<`
|
|
2076
|
+
|
|
2077
|
+
**getAllowed**(collectionId: string) → `Promise<TemplatePublic[]>`
|
|
2078
|
+
|
|
2079
|
+
**getPublic**(collectionId: string, templateId: string) → `Promise<TemplatePublic>`
|
|
2080
|
+
|
|
2081
|
+
**getGlobal**(templateId: string) → `Promise<TemplatePublic>`
|
|
2082
|
+
|
|
2083
|
+
**getAllowedGlobal**(collectionId: string) → `Promise<TemplatePublic[]>`
|
|
2084
|
+
|
|
2025
2085
|
### variant
|
|
2026
2086
|
|
|
2027
2087
|
**get**(collectionId: string,
|
package/dist/api/index.d.ts
CHANGED
|
@@ -21,4 +21,5 @@ export { broadcasts } from "./broadcasts";
|
|
|
21
21
|
export { segments } from "./segments";
|
|
22
22
|
export { journeys } from "./journeys";
|
|
23
23
|
export { qr } from "./qr";
|
|
24
|
+
export { template } from "./template";
|
|
24
25
|
export type { AIGenerateContentRequest, AIGenerateImageRequest, AISearchPhotosRequest, AISearchPhotosPhoto } from "./ai";
|
package/dist/api/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Template, TemplateInput, TemplateUpdate, TemplatePublic } from "../types";
|
|
2
|
+
export declare namespace template {
|
|
3
|
+
function getAll(collectionId: string): Promise<Template[]>;
|
|
4
|
+
function get(collectionId: string, templateId: string): Promise<Template>;
|
|
5
|
+
function create(collectionId: string, data: TemplateInput): Promise<Template>;
|
|
6
|
+
function update(collectionId: string, templateId: string, data: TemplateUpdate): Promise<Template>;
|
|
7
|
+
function del(collectionId: string, templateId: string): Promise<Template>;
|
|
8
|
+
function uploadAsset(collectionId: string, templateId: string, file: File | Blob): Promise<{
|
|
9
|
+
url: string;
|
|
10
|
+
}>;
|
|
11
|
+
function getAllowed(collectionId: string): Promise<TemplatePublic[]>;
|
|
12
|
+
function getPublic(collectionId: string, templateId: string): Promise<TemplatePublic>;
|
|
13
|
+
function getGlobal(templateId: string): Promise<TemplatePublic>;
|
|
14
|
+
function getAllowedGlobal(collectionId: string): Promise<TemplatePublic[]>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { request, post, put, del as httpDel } from "../http";
|
|
2
|
+
export var template;
|
|
3
|
+
(function (template) {
|
|
4
|
+
// Admin APIs
|
|
5
|
+
async function getAll(collectionId) {
|
|
6
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/template`;
|
|
7
|
+
return request(path);
|
|
8
|
+
}
|
|
9
|
+
template.getAll = getAll;
|
|
10
|
+
async function get(collectionId, templateId) {
|
|
11
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/template/${encodeURIComponent(templateId)}`;
|
|
12
|
+
return request(path);
|
|
13
|
+
}
|
|
14
|
+
template.get = get;
|
|
15
|
+
async function create(collectionId, data) {
|
|
16
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/template`;
|
|
17
|
+
return post(path, data);
|
|
18
|
+
}
|
|
19
|
+
template.create = create;
|
|
20
|
+
async function update(collectionId, templateId, data) {
|
|
21
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/template/${encodeURIComponent(templateId)}`;
|
|
22
|
+
return put(path, data);
|
|
23
|
+
}
|
|
24
|
+
template.update = update;
|
|
25
|
+
// Delete returns the (soft-deleted) Template per spec
|
|
26
|
+
async function del(collectionId, templateId) {
|
|
27
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/template/${encodeURIComponent(templateId)}`;
|
|
28
|
+
return httpDel(path);
|
|
29
|
+
}
|
|
30
|
+
template.del = del;
|
|
31
|
+
async function uploadAsset(collectionId, templateId, file) {
|
|
32
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/template/${encodeURIComponent(templateId)}/addFile`;
|
|
33
|
+
const form = new FormData();
|
|
34
|
+
form.append("file", file);
|
|
35
|
+
return post(path, form);
|
|
36
|
+
}
|
|
37
|
+
template.uploadAsset = uploadAsset;
|
|
38
|
+
// Public APIs
|
|
39
|
+
async function getAllowed(collectionId) {
|
|
40
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/template/getAllowed`;
|
|
41
|
+
return request(path);
|
|
42
|
+
}
|
|
43
|
+
template.getAllowed = getAllowed;
|
|
44
|
+
async function getPublic(collectionId, templateId) {
|
|
45
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/template/${encodeURIComponent(templateId)}`;
|
|
46
|
+
return request(path);
|
|
47
|
+
}
|
|
48
|
+
template.getPublic = getPublic;
|
|
49
|
+
async function getGlobal(templateId) {
|
|
50
|
+
const path = `/public/template/${encodeURIComponent(templateId)}`;
|
|
51
|
+
return request(path);
|
|
52
|
+
}
|
|
53
|
+
template.getGlobal = getGlobal;
|
|
54
|
+
async function getAllowedGlobal(collectionId) {
|
|
55
|
+
const path = `/public/template/getAllowed/${encodeURIComponent(collectionId)}`;
|
|
56
|
+
return request(path);
|
|
57
|
+
}
|
|
58
|
+
template.getAllowedGlobal = getAllowedGlobal;
|
|
59
|
+
})(template || (template = {}));
|
package/dist/types/actions.d.ts
CHANGED
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface TemplateBase {
|
|
2
|
+
id: string;
|
|
3
|
+
collectionId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
type: string;
|
|
7
|
+
resizeMode?: string;
|
|
8
|
+
pdf?: {
|
|
9
|
+
base: {
|
|
10
|
+
url: string;
|
|
11
|
+
};
|
|
12
|
+
orientation: 'portrait' | 'landscape';
|
|
13
|
+
};
|
|
14
|
+
subject?: string;
|
|
15
|
+
body?: string;
|
|
16
|
+
css?: string;
|
|
17
|
+
public?: boolean;
|
|
18
|
+
engine?: string;
|
|
19
|
+
component?: string;
|
|
20
|
+
defaultProps?: Record<string, any>;
|
|
21
|
+
collections?: string[];
|
|
22
|
+
[k: string]: any;
|
|
23
|
+
}
|
|
24
|
+
export interface Template extends TemplateBase {
|
|
25
|
+
deleted?: boolean;
|
|
26
|
+
deletedAt?: string;
|
|
27
|
+
}
|
|
28
|
+
export type TemplateInput = Omit<TemplateBase, 'id' | 'collectionId'>;
|
|
29
|
+
export type TemplateUpdate = Partial<Omit<TemplateBase, 'id' | 'collectionId'>>;
|
|
30
|
+
export type TemplatePublic = TemplateBase;
|