@proveanything/smartlinks 1.1.11 → 1.1.12
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 +72 -4
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/location.d.ts +28 -0
- package/dist/api/location.js +69 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/interaction.d.ts +3 -3
- package/dist/types/location.d.ts +41 -0
- package/dist/types/location.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.12 | Generated: 2025-12-28T18:01:35.628Z
|
|
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
|
+
- **location** - Functions for location operations
|
|
50
51
|
- **template** - Functions for template operations
|
|
51
52
|
|
|
52
53
|
## HTTP Utilities
|
|
@@ -834,8 +835,8 @@ interface PublicInteractionsCountsByOutcomeRequest {
|
|
|
834
835
|
**PublicInteractionsByUserRequest** (interface)
|
|
835
836
|
```typescript
|
|
836
837
|
interface PublicInteractionsByUserRequest {
|
|
837
|
-
appId
|
|
838
|
-
interactionId
|
|
838
|
+
appId?: string
|
|
839
|
+
interactionId?: string
|
|
839
840
|
from?: string
|
|
840
841
|
to?: string
|
|
841
842
|
limit?: number
|
|
@@ -877,7 +878,7 @@ interface ActorWithOutcome {
|
|
|
877
878
|
```typescript
|
|
878
879
|
interface InteractionEventBase {
|
|
879
880
|
collectionId: string,
|
|
880
|
-
|
|
881
|
+
orgId?: string,
|
|
881
882
|
userId?: string
|
|
882
883
|
contactId?: string
|
|
883
884
|
interactionId: string
|
|
@@ -1053,6 +1054,54 @@ interface UpdateJourneyBody {
|
|
|
1053
1054
|
}
|
|
1054
1055
|
```
|
|
1055
1056
|
|
|
1057
|
+
### location
|
|
1058
|
+
|
|
1059
|
+
**Location** (interface)
|
|
1060
|
+
```typescript
|
|
1061
|
+
interface Location {
|
|
1062
|
+
locationId: string
|
|
1063
|
+
collectionId: string | null
|
|
1064
|
+
scope: 'global' | 'collection'
|
|
1065
|
+
name: string
|
|
1066
|
+
category?: string
|
|
1067
|
+
description?: string
|
|
1068
|
+
countryName?: string
|
|
1069
|
+
countryCode?: string
|
|
1070
|
+
websiteUrl?: string
|
|
1071
|
+
logoUrl?: string
|
|
1072
|
+
phone?: string
|
|
1073
|
+
email?: string
|
|
1074
|
+
geofence?: Geofence | {}
|
|
1075
|
+
metadata?: Record<string, unknown>
|
|
1076
|
+
createdAt: string
|
|
1077
|
+
updatedAt: string
|
|
1078
|
+
}
|
|
1079
|
+
```
|
|
1080
|
+
|
|
1081
|
+
**LocationSearchQuery** (interface)
|
|
1082
|
+
```typescript
|
|
1083
|
+
interface LocationSearchQuery {
|
|
1084
|
+
q?: string
|
|
1085
|
+
category?: string
|
|
1086
|
+
countryCode?: string
|
|
1087
|
+
countryName?: string
|
|
1088
|
+
limit?: number // default 20; max 100
|
|
1089
|
+
sort?: 'name' | 'countryCode' | 'countryName' // default 'name'
|
|
1090
|
+
}
|
|
1091
|
+
```
|
|
1092
|
+
|
|
1093
|
+
**LocationSearchResponse** (interface)
|
|
1094
|
+
```typescript
|
|
1095
|
+
interface LocationSearchResponse {
|
|
1096
|
+
items: Location[]
|
|
1097
|
+
count: number
|
|
1098
|
+
}
|
|
1099
|
+
```
|
|
1100
|
+
|
|
1101
|
+
**Geofence** = ``
|
|
1102
|
+
|
|
1103
|
+
**LocationPayload** = `Omit<`
|
|
1104
|
+
|
|
1056
1105
|
### nfc
|
|
1057
1106
|
|
|
1058
1107
|
**NfcTagInfo** (interface)
|
|
@@ -1953,6 +2002,25 @@ Appends one interaction event from a public source.
|
|
|
1953
2002
|
**remove**(collectionId: string,
|
|
1954
2003
|
id: string) → `Promise<void>`
|
|
1955
2004
|
|
|
2005
|
+
### location
|
|
2006
|
+
|
|
2007
|
+
**createGlobal**(params: LocationPayload) → `Promise<Location>`
|
|
2008
|
+
Platform: Create a global location (super admin; requires features.adminApps) POST /platform/location
|
|
2009
|
+
|
|
2010
|
+
**create**(collectionId: string, params: LocationPayload) → `Promise<Location>`
|
|
2011
|
+
Admin: Create a collection-scoped location POST /admin/collection/:collectionId/location
|
|
2012
|
+
|
|
2013
|
+
**search**(collectionId: string,
|
|
2014
|
+
query: LocationSearchQuery = {}) → `Promise<LocationSearchResponse>`
|
|
2015
|
+
Admin: Search locations to pick during setup (combines collection + global) GET /admin/collection/:collectionId/location/search
|
|
2016
|
+
|
|
2017
|
+
**getPublic**(locationId: string) → `Promise<Location>`
|
|
2018
|
+
Public: Fetch a global location by ID GET /public/location/:locationId
|
|
2019
|
+
|
|
2020
|
+
**getPublicForCollection**(collectionId: string,
|
|
2021
|
+
locationId: string) → `Promise<Location>`
|
|
2022
|
+
Public: Fetch a location for a collection; returns either a collection-owned or global fallback GET /public/collection/:collectionId/location/:locationId
|
|
2023
|
+
|
|
1956
2024
|
### nfc
|
|
1957
2025
|
|
|
1958
2026
|
**claimTag**(data: NfcClaimTagRequest) → `Promise<NfcTagInfo>`
|
package/dist/api/index.d.ts
CHANGED
|
@@ -22,4 +22,5 @@ export { journeys } from "./journeys";
|
|
|
22
22
|
export { qr } from "./qr";
|
|
23
23
|
export { template } from "./template";
|
|
24
24
|
export { interactions } from "./interactions";
|
|
25
|
+
export { location } from "./location";
|
|
25
26
|
export type { AIGenerateContentRequest, AIGenerateImageRequest, AISearchPhotosRequest, AISearchPhotosPhoto } from "./ai";
|
package/dist/api/index.js
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Location, LocationPayload, LocationSearchQuery, LocationSearchResponse } from "../types/location";
|
|
2
|
+
export declare namespace location {
|
|
3
|
+
/**
|
|
4
|
+
* Platform: Create a global location (super admin; requires features.adminApps)
|
|
5
|
+
* POST /platform/location
|
|
6
|
+
*/
|
|
7
|
+
function createGlobal(params: LocationPayload): Promise<Location>;
|
|
8
|
+
/**
|
|
9
|
+
* Admin: Create a collection-scoped location
|
|
10
|
+
* POST /admin/collection/:collectionId/location
|
|
11
|
+
*/
|
|
12
|
+
function create(collectionId: string, params: LocationPayload): Promise<Location>;
|
|
13
|
+
/**
|
|
14
|
+
* Admin: Search locations to pick during setup (combines collection + global)
|
|
15
|
+
* GET /admin/collection/:collectionId/location/search
|
|
16
|
+
*/
|
|
17
|
+
function search(collectionId: string, query?: LocationSearchQuery): Promise<LocationSearchResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Public: Fetch a global location by ID
|
|
20
|
+
* GET /public/location/:locationId
|
|
21
|
+
*/
|
|
22
|
+
function getPublic(locationId: string): Promise<Location>;
|
|
23
|
+
/**
|
|
24
|
+
* Public: Fetch a location for a collection; returns either a collection-owned or global fallback
|
|
25
|
+
* GET /public/collection/:collectionId/location/:locationId
|
|
26
|
+
*/
|
|
27
|
+
function getPublicForCollection(collectionId: string, locationId: string): Promise<Location>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// src/api/location.ts
|
|
2
|
+
import { request, post } from "../http";
|
|
3
|
+
function buildQueryString(q = {}) {
|
|
4
|
+
var _a, _b;
|
|
5
|
+
const params = new URLSearchParams();
|
|
6
|
+
if (q.q)
|
|
7
|
+
params.set('q', q.q);
|
|
8
|
+
if (q.category)
|
|
9
|
+
params.set('category', q.category);
|
|
10
|
+
if (q.countryCode)
|
|
11
|
+
params.set('countryCode', q.countryCode);
|
|
12
|
+
if (q.countryName)
|
|
13
|
+
params.set('countryName', q.countryName);
|
|
14
|
+
const limit = Math.min(Math.max((_a = q.limit) !== null && _a !== void 0 ? _a : 20, 1), 100);
|
|
15
|
+
params.set('limit', String(limit));
|
|
16
|
+
const sort = ((_b = q.sort) !== null && _b !== void 0 ? _b : 'name');
|
|
17
|
+
params.set('sort', sort);
|
|
18
|
+
const s = params.toString();
|
|
19
|
+
return s ? `?${s}` : '';
|
|
20
|
+
}
|
|
21
|
+
export var location;
|
|
22
|
+
(function (location) {
|
|
23
|
+
/**
|
|
24
|
+
* Platform: Create a global location (super admin; requires features.adminApps)
|
|
25
|
+
* POST /platform/location
|
|
26
|
+
*/
|
|
27
|
+
async function createGlobal(params) {
|
|
28
|
+
const path = `/platform/location`;
|
|
29
|
+
return post(path, params);
|
|
30
|
+
}
|
|
31
|
+
location.createGlobal = createGlobal;
|
|
32
|
+
/**
|
|
33
|
+
* Admin: Create a collection-scoped location
|
|
34
|
+
* POST /admin/collection/:collectionId/location
|
|
35
|
+
*/
|
|
36
|
+
async function create(collectionId, params) {
|
|
37
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/location`;
|
|
38
|
+
return post(path, params);
|
|
39
|
+
}
|
|
40
|
+
location.create = create;
|
|
41
|
+
/**
|
|
42
|
+
* Admin: Search locations to pick during setup (combines collection + global)
|
|
43
|
+
* GET /admin/collection/:collectionId/location/search
|
|
44
|
+
*/
|
|
45
|
+
async function search(collectionId, query = {}) {
|
|
46
|
+
const qs = buildQueryString(query);
|
|
47
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/location/search${qs}`;
|
|
48
|
+
return request(path);
|
|
49
|
+
}
|
|
50
|
+
location.search = search;
|
|
51
|
+
/**
|
|
52
|
+
* Public: Fetch a global location by ID
|
|
53
|
+
* GET /public/location/:locationId
|
|
54
|
+
*/
|
|
55
|
+
async function getPublic(locationId) {
|
|
56
|
+
const path = `/public/location/${encodeURIComponent(locationId)}`;
|
|
57
|
+
return request(path);
|
|
58
|
+
}
|
|
59
|
+
location.getPublic = getPublic;
|
|
60
|
+
/**
|
|
61
|
+
* Public: Fetch a location for a collection; returns either a collection-owned or global fallback
|
|
62
|
+
* GET /public/collection/:collectionId/location/:locationId
|
|
63
|
+
*/
|
|
64
|
+
async function getPublicForCollection(collectionId, locationId) {
|
|
65
|
+
const path = `/public/collection/${encodeURIComponent(collectionId)}/location/${encodeURIComponent(locationId)}`;
|
|
66
|
+
return request(path);
|
|
67
|
+
}
|
|
68
|
+
location.getPublicForCollection = getPublicForCollection;
|
|
69
|
+
})(location || (location = {}));
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -36,8 +36,8 @@ export interface PublicInteractionsCountsByOutcomeRequest {
|
|
|
36
36
|
limit?: number;
|
|
37
37
|
}
|
|
38
38
|
export interface PublicInteractionsByUserRequest {
|
|
39
|
-
appId
|
|
40
|
-
interactionId
|
|
39
|
+
appId?: string;
|
|
40
|
+
interactionId?: string;
|
|
41
41
|
from?: string;
|
|
42
42
|
to?: string;
|
|
43
43
|
limit?: number;
|
|
@@ -66,7 +66,7 @@ export interface ActorWithOutcome {
|
|
|
66
66
|
}
|
|
67
67
|
export interface InteractionEventBase {
|
|
68
68
|
collectionId: string;
|
|
69
|
-
|
|
69
|
+
orgId?: string;
|
|
70
70
|
userId?: string;
|
|
71
71
|
contactId?: string;
|
|
72
72
|
interactionId: string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type Geofence = {
|
|
2
|
+
type: 'bbox';
|
|
3
|
+
minLat: number;
|
|
4
|
+
minLon: number;
|
|
5
|
+
maxLat: number;
|
|
6
|
+
maxLon: number;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'polygon';
|
|
9
|
+
coordinates: Array<[lat: number, lon: number]>;
|
|
10
|
+
} | Record<string, unknown>;
|
|
11
|
+
export type LocationPayload = Omit<Location, 'locationId' | 'collectionId' | 'scope' | 'createdAt' | 'updatedAt'>;
|
|
12
|
+
export interface Location {
|
|
13
|
+
locationId: string;
|
|
14
|
+
collectionId: string | null;
|
|
15
|
+
scope: 'global' | 'collection';
|
|
16
|
+
name: string;
|
|
17
|
+
category?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
countryName?: string;
|
|
20
|
+
countryCode?: string;
|
|
21
|
+
websiteUrl?: string;
|
|
22
|
+
logoUrl?: string;
|
|
23
|
+
phone?: string;
|
|
24
|
+
email?: string;
|
|
25
|
+
geofence?: Geofence | {};
|
|
26
|
+
metadata?: Record<string, unknown>;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
updatedAt: string;
|
|
29
|
+
}
|
|
30
|
+
export interface LocationSearchQuery {
|
|
31
|
+
q?: string;
|
|
32
|
+
category?: string;
|
|
33
|
+
countryCode?: string;
|
|
34
|
+
countryName?: string;
|
|
35
|
+
limit?: number;
|
|
36
|
+
sort?: 'name' | 'countryCode' | 'countryName';
|
|
37
|
+
}
|
|
38
|
+
export interface LocationSearchResponse {
|
|
39
|
+
items: Location[];
|
|
40
|
+
count: number;
|
|
41
|
+
}
|