@proveanything/smartlinks 1.1.6 → 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 +94 -2
- package/dist/api/contact.d.ts +2 -1
- package/dist/api/contact.js +6 -0
- 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/contact.d.ts +21 -0
- 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
|
|
@@ -921,6 +922,35 @@ interface ContactListResponse {
|
|
|
921
922
|
}
|
|
922
923
|
```
|
|
923
924
|
|
|
925
|
+
**PublicContactUpsertRequest** (interface)
|
|
926
|
+
```typescript
|
|
927
|
+
interface PublicContactUpsertRequest {
|
|
928
|
+
email?: string
|
|
929
|
+
phone?: string
|
|
930
|
+
userId?: string
|
|
931
|
+
firstName?: string
|
|
932
|
+
lastName?: string
|
|
933
|
+
displayName?: string
|
|
934
|
+
company?: string
|
|
935
|
+
tags?: string[]
|
|
936
|
+
source?: string
|
|
937
|
+
notes?: string
|
|
938
|
+
avatarUrl?: string
|
|
939
|
+
locale?: string
|
|
940
|
+
timezone?: string
|
|
941
|
+
externalIds?: Record<string, any>
|
|
942
|
+
customFields?: ContactCustomFields
|
|
943
|
+
}
|
|
944
|
+
```
|
|
945
|
+
|
|
946
|
+
**PublicContactUpsertResponse** (interface)
|
|
947
|
+
```typescript
|
|
948
|
+
interface PublicContactUpsertResponse {
|
|
949
|
+
ok: boolean
|
|
950
|
+
contactId: string
|
|
951
|
+
}
|
|
952
|
+
```
|
|
953
|
+
|
|
924
954
|
**ContactCustomFields** = `Record<string, any>`
|
|
925
955
|
|
|
926
956
|
### error
|
|
@@ -1204,6 +1234,39 @@ interface SegmentRecipientsResponse {
|
|
|
1204
1234
|
}
|
|
1205
1235
|
```
|
|
1206
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
|
+
|
|
1207
1270
|
### variant
|
|
1208
1271
|
|
|
1209
1272
|
**VariantResponse** = `any`
|
|
@@ -1807,6 +1870,9 @@ Logging: Append many communication events for a list of IDs. POST /admin/collect
|
|
|
1807
1870
|
**upsert**(collectionId: string,
|
|
1808
1871
|
data: ContactCreateRequest) → `Promise<ContactResponse>`
|
|
1809
1872
|
|
|
1873
|
+
**publicUpsert**(collectionId: string,
|
|
1874
|
+
data: PublicContactUpsertRequest) → `Promise<PublicContactUpsertResponse>`
|
|
1875
|
+
|
|
1810
1876
|
**erase**(collectionId: string, contactId: string, body?: any) → `Promise<ContactResponse>`
|
|
1811
1877
|
|
|
1812
1878
|
### crate
|
|
@@ -1990,6 +2056,32 @@ Resolve a short code to related resource identifiers.
|
|
|
1990
2056
|
id: string,
|
|
1991
2057
|
query: { limit?: number; offset?: number } = {}) → `Promise<SegmentRecipientsResponse>`
|
|
1992
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
|
+
|
|
1993
2085
|
### variant
|
|
1994
2086
|
|
|
1995
2087
|
**get**(collectionId: string,
|
package/dist/api/contact.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContactResponse, ContactCreateRequest, ContactUpdateRequest, ContactListResponse } from "../types";
|
|
1
|
+
import { ContactResponse, ContactCreateRequest, ContactUpdateRequest, ContactListResponse, PublicContactUpsertRequest, PublicContactUpsertResponse } from "../types";
|
|
2
2
|
export declare namespace contact {
|
|
3
3
|
function create(collectionId: string, data: ContactCreateRequest): Promise<ContactResponse>;
|
|
4
4
|
function list(collectionId: string, params?: {
|
|
@@ -16,5 +16,6 @@ export declare namespace contact {
|
|
|
16
16
|
phone?: string;
|
|
17
17
|
}): Promise<ContactResponse>;
|
|
18
18
|
function upsert(collectionId: string, data: ContactCreateRequest): Promise<ContactResponse>;
|
|
19
|
+
function publicUpsert(collectionId: string, data: PublicContactUpsertRequest): Promise<PublicContactUpsertResponse>;
|
|
19
20
|
function erase(collectionId: string, contactId: string, body?: any): Promise<ContactResponse>;
|
|
20
21
|
}
|
package/dist/api/contact.js
CHANGED
|
@@ -53,6 +53,12 @@ export var contact;
|
|
|
53
53
|
return post(path, data);
|
|
54
54
|
}
|
|
55
55
|
contact.upsert = upsert;
|
|
56
|
+
// Public contact upsert (privacy-safe): returns only ok + contactId
|
|
57
|
+
async function publicUpsert(collectionId, data) {
|
|
58
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/contact`;
|
|
59
|
+
return post(path, data);
|
|
60
|
+
}
|
|
61
|
+
contact.publicUpsert = publicUpsert;
|
|
56
62
|
async function erase(collectionId, contactId, body) {
|
|
57
63
|
const path = `/admin/collection/${encodeURIComponent(collectionId)}/contacts/${encodeURIComponent(contactId)}/erase`;
|
|
58
64
|
return post(path, body || {});
|
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/contact.d.ts
CHANGED
|
@@ -39,3 +39,24 @@ export interface ContactListResponse {
|
|
|
39
39
|
limit: number;
|
|
40
40
|
offset: number;
|
|
41
41
|
}
|
|
42
|
+
export interface PublicContactUpsertRequest {
|
|
43
|
+
email?: string;
|
|
44
|
+
phone?: string;
|
|
45
|
+
userId?: string;
|
|
46
|
+
firstName?: string;
|
|
47
|
+
lastName?: string;
|
|
48
|
+
displayName?: string;
|
|
49
|
+
company?: string;
|
|
50
|
+
tags?: string[];
|
|
51
|
+
source?: string;
|
|
52
|
+
notes?: string;
|
|
53
|
+
avatarUrl?: string;
|
|
54
|
+
locale?: string;
|
|
55
|
+
timezone?: string;
|
|
56
|
+
externalIds?: Record<string, any>;
|
|
57
|
+
customFields?: ContactCustomFields;
|
|
58
|
+
}
|
|
59
|
+
export interface PublicContactUpsertResponse {
|
|
60
|
+
ok: boolean;
|
|
61
|
+
contactId: string;
|
|
62
|
+
}
|
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;
|