@proveanything/smartlinks 1.8.5 → 1.8.7
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/dist/api/appConfiguration.d.ts +41 -10
- package/dist/api/appConfiguration.js +31 -7
- package/dist/api/collection.d.ts +8 -1
- package/dist/api/collection.js +8 -1
- package/dist/docs/API_SUMMARY.md +273 -263
- package/dist/docs/ai-guide-template.md +21 -0
- package/dist/docs/app-data-storage.md +99 -10
- package/dist/docs/overview.md +32 -0
- package/dist/openapi.yaml +3 -3
- package/docs/API_SUMMARY.md +273 -263
- package/docs/ai-guide-template.md +21 -0
- package/docs/app-data-storage.md +99 -10
- package/docs/overview.md +32 -0
- package/openapi.yaml +3 -3
- package/package.json +1 -1
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.7 | Generated: 2026-03-18T08:55:08.708Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -30,6 +30,28 @@ For detailed guides on specific features:
|
|
|
30
30
|
- **[AI-Native App Manifests](manifests.md)** - How AI workflows discover, configure, and import apps via structured manifests and prose guides
|
|
31
31
|
- **[AI Guide Template](ai-guide-template.md)** - A sample for an app on how to build an AI setup guide
|
|
32
32
|
|
|
33
|
+
## Choosing App Storage
|
|
34
|
+
|
|
35
|
+
When you need flexible app-specific data, choose the storage model based on shape and lifecycle, not just on what can hold JSON.
|
|
36
|
+
|
|
37
|
+
- **`appConfiguration.getConfig` / `setConfig`** - One config blob per scope. Best for settings, feature flags, and app setup.
|
|
38
|
+
- **`appConfiguration.getData` / `getDataItem` / `setDataItem`** - Small keyed documents attached to a scope. Best for lookup tables, content fragments, menus, FAQs, or a handful of standalone items where you already know the ID.
|
|
39
|
+
- **`app.records`** - Default choice for richer app-owned entities that need status, visibility, ownership zones, querying, filtering, parent-child links, or lifecycle fields.
|
|
40
|
+
- **`app.cases`** - Use when the entity is a workflow item that moves toward resolution and may need assignment, priority, and history.
|
|
41
|
+
- **`app.threads`** - Use for conversations, comments, Q&A, or any object centered on replies.
|
|
42
|
+
|
|
43
|
+
Rule of thumb: if you are modelling a real domain object that users will browse, filter, secure, or evolve over time, start with app objects. If you just need a simple keyed payload hanging off a collection or product, scoped data items are still a good fit.
|
|
44
|
+
|
|
45
|
+
## Settings Visibility
|
|
46
|
+
|
|
47
|
+
For `appConfiguration` config blobs and `collection` settings groups, keep endpoint choice separate from visibility semantics.
|
|
48
|
+
|
|
49
|
+
- **`admin: true` means "use the admin endpoint"** for reads or writes.
|
|
50
|
+
- **It does not make every root field private.** Writing through an admin endpoint still saves the normal shared payload.
|
|
51
|
+
- **Root-level fields are the public/shared settings view.** Put public labels, colors, toggles, and general config there.
|
|
52
|
+
- **Use a top-level `admin` object for confidential values.** Public reads omit that block; admin reads include it.
|
|
53
|
+
- **Applies to both** `appConfiguration.getConfig` / `setConfig` **and** `collection.getSettings` / `updateSettings`.
|
|
54
|
+
|
|
33
55
|
## API Namespaces
|
|
34
56
|
|
|
35
57
|
The Smartlinks SDK is organized into the following namespaces:
|
|
@@ -43,6 +65,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
43
65
|
- **crate** - Organize products in containers/crates for logistics and grouping.
|
|
44
66
|
- **form** - Build and manage dynamic forms used by apps and workflows.
|
|
45
67
|
- **appConfiguration** - Read/write app configuration and scoped data (collection/product/proof); hosts the deep-link registry. → [Guide](deep-link-discovery.md)
|
|
68
|
+
- **app** - Flexible app-scoped objects: use records for structured entities, cases for workflows, and threads for discussions. → [Guide](app-objects.md)
|
|
46
69
|
|
|
47
70
|
— Identity & Access —
|
|
48
71
|
- **auth** - Admin authentication and account ops: login/logout, tokens, account info.
|
|
@@ -72,7 +95,6 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
72
95
|
|
|
73
96
|
— Other —
|
|
74
97
|
- **analytics** - Functions for analytics operations
|
|
75
|
-
- **appObjects** - Functions for appObjects operations
|
|
76
98
|
- **async** - Functions for async operations
|
|
77
99
|
- **attestation** - Functions for attestation operations
|
|
78
100
|
- **attestations** - Functions for attestations operations
|
|
@@ -5822,12 +5844,19 @@ type AppConfigOptions = {
|
|
|
5822
5844
|
/** Item ID - required for getDataItem/deleteDataItem */
|
|
5823
5845
|
itemId?: string
|
|
5824
5846
|
|
|
5825
|
-
/**
|
|
5847
|
+
/**
|
|
5848
|
+
* Use admin endpoints instead of public.
|
|
5849
|
+
* This selects which endpoint is called; it does not by itself make root-level config fields private.
|
|
5850
|
+
*/
|
|
5826
5851
|
admin?: boolean
|
|
5827
5852
|
|
|
5828
|
-
/**
|
|
5853
|
+
/**
|
|
5854
|
+
* Configuration object for setConfig.
|
|
5855
|
+
* For admin-only values in app config, store them under a top-level `admin` object.
|
|
5856
|
+
* Public reads return the root config but omit `config.admin`.
|
|
5857
|
+
*/
|
|
5829
5858
|
config?: any
|
|
5830
|
-
/** Data object for setDataItem */
|
|
5859
|
+
/** Data object for setDataItem. Best for small keyed scoped documents rather than richer app domain objects. */
|
|
5831
5860
|
data?: any
|
|
5832
5861
|
}
|
|
5833
5862
|
```
|
|
@@ -5858,145 +5887,118 @@ type VerifyTokenResponse = {
|
|
|
5858
5887
|
|
|
5859
5888
|
## API Functions
|
|
5860
5889
|
|
|
5861
|
-
### analytics
|
|
5862
|
-
|
|
5863
|
-
**track**(event: CollectionAnalyticsEvent,
|
|
5864
|
-
options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
|
|
5865
|
-
Fire-and-forget collection analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5866
|
-
|
|
5867
|
-
**track**(event: TagAnalyticsEvent,
|
|
5868
|
-
options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
|
|
5869
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5870
|
-
|
|
5871
|
-
**configure**(config: AnalyticsBrowserConfig) → `void`
|
|
5872
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5873
|
-
|
|
5874
|
-
**getSessionId**() → `AnalyticsSessionId | undefined`
|
|
5875
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5876
|
-
|
|
5877
|
-
**getVisitorId**() → `string | undefined`
|
|
5878
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5879
|
-
|
|
5880
|
-
**setVisitorId**(visitorId: string,
|
|
5881
|
-
options?: AnalyticsVisitorIdOptions) → `string`
|
|
5882
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5883
|
-
|
|
5884
|
-
**clearVisitorId**(options?: Pick<AnalyticsVisitorIdOptions, 'storage' | 'storageKey'>) → `void`
|
|
5885
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5886
|
-
|
|
5887
|
-
**captureCampaignParams**(search?: string) → `Partial<CollectionAnalyticsEvent>`
|
|
5888
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5889
|
-
|
|
5890
|
-
**setLocation**(location: TagAnalyticsEvent['location'] | null) → `void`
|
|
5891
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5892
|
-
|
|
5893
|
-
**clearLocation**() → `void`
|
|
5894
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5895
|
-
|
|
5896
|
-
**getLocation**() → `TagAnalyticsEvent['location'] | undefined`
|
|
5897
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5898
|
-
|
|
5899
|
-
**detectDevice**() → `CollectionAnalyticsEvent['deviceType']`
|
|
5900
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5901
|
-
|
|
5902
|
-
**captureLocation**(options: AnalyticsGeolocationCaptureOptions = {}) → `Promise<TagAnalyticsEvent['location'] | null>`
|
|
5903
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5904
|
-
|
|
5905
|
-
**trackCollection**(event: Partial<CollectionAnalyticsEvent>,
|
|
5906
|
-
options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
|
|
5907
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5908
|
-
|
|
5909
|
-
**trackTag**(event: Partial<TagAnalyticsEvent>,
|
|
5910
|
-
options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
|
|
5911
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5912
|
-
|
|
5913
|
-
**trackPageView**(event: Partial<CollectionAnalyticsEvent>,
|
|
5914
|
-
options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
|
|
5915
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5916
|
-
|
|
5917
|
-
**trackLinkClick**(event: AnalyticsLinkClickInput,
|
|
5918
|
-
options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
|
|
5919
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5920
|
-
|
|
5921
|
-
**trackTagScan**(event: Partial<TagAnalyticsEvent>,
|
|
5922
|
-
options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
|
|
5923
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5924
|
-
|
|
5925
|
-
**bindPageViews**(binding: AnalyticsPageViewBindingOptions = {}) → `() => void`
|
|
5926
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5927
|
-
|
|
5928
|
-
**bindLinkTracking**(binding: AnalyticsLinkBindingOptions = {}) → `() => void`
|
|
5929
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5890
|
+
### analytics.admin
|
|
5930
5891
|
|
|
5931
5892
|
**summary**(collectionId: string,
|
|
5932
5893
|
body: AnalyticsSummaryRequest) → `Promise<AnalyticsSummaryResponse>`
|
|
5933
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5934
5894
|
|
|
5935
5895
|
**timeseries**(collectionId: string,
|
|
5936
5896
|
body: AnalyticsTimeseriesRequest) → `Promise<AnalyticsTimeseriesResponse>`
|
|
5937
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5938
5897
|
|
|
5939
5898
|
**breakdown**(collectionId: string,
|
|
5940
5899
|
body: AnalyticsBreakdownRequest) → `Promise<AnalyticsBreakdownResponse>`
|
|
5941
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5942
5900
|
|
|
5943
5901
|
**events**(collectionId: string,
|
|
5944
5902
|
body: AnalyticsEventsRequest) → `Promise<AnalyticsEventsResponse>`
|
|
5945
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5946
5903
|
|
|
5947
5904
|
**web**(collectionId: string,
|
|
5948
5905
|
body: LegacyAnalyticsRequest = {}) → `Promise<AnalyticsDashboardResponse>`
|
|
5949
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5950
5906
|
|
|
5951
5907
|
**clicks**(collectionId: string,
|
|
5952
5908
|
body: LegacyAnalyticsRequest = {}) → `Promise<AnalyticsDashboardResponse>`
|
|
5953
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5954
5909
|
|
|
5955
5910
|
**tagScans**(collectionId: string,
|
|
5956
5911
|
body: LegacyAnalyticsRequest = {}) → `Promise<AnalyticsDashboardResponse>`
|
|
5957
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5958
5912
|
|
|
5959
5913
|
**products**(collectionId: string,
|
|
5960
5914
|
body: LegacyAnalyticsRequest = {}) → `Promise<AnalyticsProductsResponse>`
|
|
5961
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5962
5915
|
|
|
5963
5916
|
**qrCodes**(collectionId: string,
|
|
5964
5917
|
body: LegacyAnalyticsRequest = {}) → `Promise<AnalyticsQrCodesResponse>`
|
|
5965
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5966
5918
|
|
|
5967
5919
|
**tags**(collectionId: string,
|
|
5968
5920
|
body: LegacyAnalyticsRequest = {}) → `Promise<AnalyticsTagsResponse>`
|
|
5969
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5970
5921
|
|
|
5971
5922
|
**weekly**(collectionId: string,
|
|
5972
5923
|
body: AnalyticsWeeklyRequest = {}) → `Promise<AnalyticsTimeseriesResponse>`
|
|
5973
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5974
5924
|
|
|
5975
5925
|
**country**(collectionId: string,
|
|
5976
5926
|
body: AnalyticsCountryRequest = {}) → `Promise<AnalyticsBreakdownResponse>`
|
|
5977
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5978
5927
|
|
|
5979
5928
|
**topPages**(collectionId: string,
|
|
5980
5929
|
body: AnalyticsClassicReportRequest = {}) → `Promise<AnalyticsBreakdownResponse>`
|
|
5981
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5982
5930
|
|
|
5983
5931
|
**topReferrers**(collectionId: string,
|
|
5984
5932
|
body: AnalyticsClassicReportRequest = {}) → `Promise<AnalyticsBreakdownResponse>`
|
|
5985
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5986
5933
|
|
|
5987
5934
|
**topCampaigns**(collectionId: string,
|
|
5988
5935
|
body: AnalyticsClassicReportRequest = {}) → `Promise<AnalyticsBreakdownResponse>`
|
|
5989
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5990
5936
|
|
|
5991
5937
|
**topSources**(collectionId: string,
|
|
5992
5938
|
body: AnalyticsClassicReportRequest = {}) → `Promise<AnalyticsBreakdownResponse>`
|
|
5993
|
-
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5994
5939
|
|
|
5995
5940
|
**topDestinations**(collectionId: string,
|
|
5996
5941
|
body: AnalyticsClassicReportRequest = {}) → `Promise<AnalyticsBreakdownResponse>`
|
|
5942
|
+
|
|
5943
|
+
### analytics.browser
|
|
5944
|
+
|
|
5945
|
+
**configure**(config: AnalyticsBrowserConfig) → `void`
|
|
5946
|
+
|
|
5947
|
+
**getSessionId**() → `AnalyticsSessionId | undefined`
|
|
5948
|
+
|
|
5949
|
+
**getVisitorId**() → `string | undefined`
|
|
5950
|
+
|
|
5951
|
+
**setVisitorId**(visitorId: string,
|
|
5952
|
+
options?: AnalyticsVisitorIdOptions) → `string`
|
|
5953
|
+
|
|
5954
|
+
**clearVisitorId**(options?: Pick<AnalyticsVisitorIdOptions, 'storage' | 'storageKey'>) → `void`
|
|
5955
|
+
|
|
5956
|
+
**captureCampaignParams**(search?: string) → `Partial<CollectionAnalyticsEvent>`
|
|
5957
|
+
|
|
5958
|
+
**setLocation**(location: TagAnalyticsEvent['location'] | null) → `void`
|
|
5959
|
+
|
|
5960
|
+
**clearLocation**() → `void`
|
|
5961
|
+
|
|
5962
|
+
**getLocation**() → `TagAnalyticsEvent['location'] | undefined`
|
|
5963
|
+
|
|
5964
|
+
**detectDevice**() → `CollectionAnalyticsEvent['deviceType']`
|
|
5965
|
+
|
|
5966
|
+
**captureLocation**(options: AnalyticsGeolocationCaptureOptions = {}) → `Promise<TagAnalyticsEvent['location'] | null>`
|
|
5967
|
+
|
|
5968
|
+
**trackCollection**(event: Partial<CollectionAnalyticsEvent>,
|
|
5969
|
+
options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
|
|
5970
|
+
|
|
5971
|
+
**trackTag**(event: Partial<TagAnalyticsEvent>,
|
|
5972
|
+
options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
|
|
5973
|
+
|
|
5974
|
+
**trackPageView**(event: Partial<CollectionAnalyticsEvent>,
|
|
5975
|
+
options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
|
|
5976
|
+
|
|
5977
|
+
**trackLinkClick**(event: AnalyticsLinkClickInput,
|
|
5978
|
+
options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
|
|
5979
|
+
|
|
5980
|
+
**trackTagScan**(event: Partial<TagAnalyticsEvent>,
|
|
5981
|
+
options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
|
|
5982
|
+
|
|
5983
|
+
**bindPageViews**(binding: AnalyticsPageViewBindingOptions = {}) → `() => void`
|
|
5984
|
+
|
|
5985
|
+
**bindLinkTracking**(binding: AnalyticsLinkBindingOptions = {}) → `() => void`
|
|
5986
|
+
|
|
5987
|
+
### analytics.collection
|
|
5988
|
+
|
|
5989
|
+
**track**(event: CollectionAnalyticsEvent,
|
|
5990
|
+
options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
|
|
5991
|
+
Fire-and-forget collection analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5992
|
+
|
|
5993
|
+
### analytics.tag
|
|
5994
|
+
|
|
5995
|
+
**track**(event: TagAnalyticsEvent,
|
|
5996
|
+
options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
|
|
5997
5997
|
Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
|
|
5998
5998
|
|
|
5999
|
-
### app
|
|
5999
|
+
### app.cases
|
|
6000
|
+
|
|
6001
|
+
Workflow-oriented app objects for issues, requests, claims, and tasks that move through statuses and often need assignment or history.
|
|
6000
6002
|
|
|
6001
6003
|
**create**(collectionId: string,
|
|
6002
6004
|
appId: string,
|
|
@@ -6051,31 +6053,125 @@ Append an entry to case history (admin only) POST /cases/:caseId/history
|
|
|
6051
6053
|
caseId: string) → `Promise<RelatedResponse>`
|
|
6052
6054
|
Get related threads and records for a case (admin only) GET /cases/:caseId/related
|
|
6053
6055
|
|
|
6056
|
+
### app.records
|
|
6057
|
+
|
|
6058
|
+
General-purpose structured app objects. Use these when a simple scoped data item grows into something queryable, lifecycle-aware, or access-controlled.
|
|
6059
|
+
|
|
6060
|
+
**create**(collectionId: string,
|
|
6061
|
+
appId: string,
|
|
6062
|
+
input: CreateRecordInput,
|
|
6063
|
+
admin: boolean = false) → `Promise<AppRecord>`
|
|
6064
|
+
Create a new record POST /records
|
|
6065
|
+
|
|
6066
|
+
**list**(collectionId: string,
|
|
6067
|
+
appId: string,
|
|
6068
|
+
params?: RecordListQueryParams,
|
|
6069
|
+
admin: boolean = false) → `Promise<PaginatedResponse<AppRecord>>`
|
|
6070
|
+
List records with optional query parameters GET /records
|
|
6071
|
+
|
|
6072
|
+
**get**(collectionId: string,
|
|
6073
|
+
appId: string,
|
|
6074
|
+
recordId: string,
|
|
6075
|
+
admin: boolean = false) → `Promise<AppRecord>`
|
|
6076
|
+
Get a single record by ID GET /records/:recordId
|
|
6077
|
+
|
|
6078
|
+
**update**(collectionId: string,
|
|
6079
|
+
appId: string,
|
|
6080
|
+
recordId: string,
|
|
6081
|
+
input: UpdateRecordInput,
|
|
6082
|
+
admin: boolean = false) → `Promise<AppRecord>`
|
|
6083
|
+
Update a record PATCH /records/:recordId Admin can update any field, public (owner) can only update data and owner
|
|
6084
|
+
|
|
6085
|
+
**remove**(collectionId: string,
|
|
6086
|
+
appId: string,
|
|
6087
|
+
recordId: string,
|
|
6088
|
+
admin: boolean = false) → `Promise<`
|
|
6089
|
+
Soft delete a record DELETE /records/:recordId
|
|
6090
|
+
|
|
6091
|
+
**aggregate**(collectionId: string,
|
|
6092
|
+
appId: string,
|
|
6093
|
+
request: AggregateRequest,
|
|
6094
|
+
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
6095
|
+
Get aggregate statistics for records POST /records/aggregate
|
|
6096
|
+
|
|
6097
|
+
### app.threads
|
|
6098
|
+
|
|
6099
|
+
Conversation-oriented app objects for comments, discussions, Q&A, and reply-driven experiences.
|
|
6100
|
+
|
|
6101
|
+
**create**(collectionId: string,
|
|
6102
|
+
appId: string,
|
|
6103
|
+
input: CreateThreadInput,
|
|
6104
|
+
admin: boolean = false) → `Promise<AppThread>`
|
|
6105
|
+
Create a new thread POST /threads
|
|
6106
|
+
|
|
6107
|
+
**list**(collectionId: string,
|
|
6108
|
+
appId: string,
|
|
6109
|
+
params?: ThreadListQueryParams,
|
|
6110
|
+
admin: boolean = false) → `Promise<PaginatedResponse<AppThread>>`
|
|
6111
|
+
List threads with optional query parameters GET /threads
|
|
6112
|
+
|
|
6113
|
+
**get**(collectionId: string,
|
|
6114
|
+
appId: string,
|
|
6115
|
+
threadId: string,
|
|
6116
|
+
admin: boolean = false) → `Promise<AppThread>`
|
|
6117
|
+
Get a single thread by ID GET /threads/:threadId
|
|
6118
|
+
|
|
6119
|
+
**update**(collectionId: string,
|
|
6120
|
+
appId: string,
|
|
6121
|
+
threadId: string,
|
|
6122
|
+
input: UpdateThreadInput,
|
|
6123
|
+
admin: boolean = false) → `Promise<AppThread>`
|
|
6124
|
+
Update a thread PATCH /threads/:threadId Admin can update any field, public (owner) can only update body, tags, data, owner
|
|
6125
|
+
|
|
6126
|
+
**remove**(collectionId: string,
|
|
6127
|
+
appId: string,
|
|
6128
|
+
threadId: string,
|
|
6129
|
+
admin: boolean = false) → `Promise<`
|
|
6130
|
+
Soft delete a thread DELETE /threads/:threadId
|
|
6131
|
+
|
|
6132
|
+
**reply**(collectionId: string,
|
|
6133
|
+
appId: string,
|
|
6134
|
+
threadId: string,
|
|
6135
|
+
input: ReplyInput,
|
|
6136
|
+
admin: boolean = false) → `Promise<AppThread>`
|
|
6137
|
+
Add a reply to a thread POST /threads/:threadId/reply Atomically appends to replies array, increments replyCount, updates lastReplyAt
|
|
6138
|
+
|
|
6139
|
+
**aggregate**(collectionId: string,
|
|
6140
|
+
appId: string,
|
|
6141
|
+
request: AggregateRequest,
|
|
6142
|
+
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
6143
|
+
Get aggregate statistics for threads POST /threads/aggregate
|
|
6144
|
+
|
|
6054
6145
|
### appConfiguration
|
|
6055
6146
|
|
|
6147
|
+
Scoped config and keyed data items for collections, products, variants, or batches. Best for settings and small standalone documents, not as the default answer for every app-owned entity.
|
|
6148
|
+
|
|
6056
6149
|
**getConfig**(opts: AppConfigOptions) → `Promise<any>`
|
|
6057
|
-
Get app configuration for a collection/product scope. ```typescript const config = await appConfiguration.getConfig({ appId: 'warranty-portal', collectionId: 'my-collection' }); ```
|
|
6150
|
+
Get app configuration for a collection/product scope. Public reads return the public view of the config. If the stored config contains a top-level `admin` object, that block is omitted from public responses and included when `opts.admin === true`. ```typescript const config = await appConfiguration.getConfig({ appId: 'warranty-portal', collectionId: 'my-collection' }); ```
|
|
6151
|
+
|
|
6152
|
+
**getWidgetInstance**(opts: GetWidgetInstanceOptions) → `Promise<WidgetInstance<TWidget>>`
|
|
6153
|
+
Resolve a configured widget instance by ID from an app's stored config. This is a thin convenience wrapper over `getConfig()` that reads `config.widgets[widgetId]`. ```typescript const widget = await appConfiguration.getWidgetInstance({ collectionId: 'my-collection', appId: 'widget-toolkit', widgetId: 'launch-countdown' }) ```
|
|
6058
6154
|
|
|
6059
6155
|
**listWidgetInstances**(opts: Omit<GetWidgetInstanceOptions, 'widgetId'>) → `Promise<WidgetInstanceSummary[]>`
|
|
6060
6156
|
List configured widget instances for an app. Useful for picker UIs, setup schemas, and widget-to-widget references. ```typescript const widgets = await appConfiguration.listWidgetInstances({ collectionId: 'my-collection', appId: 'widget-toolkit' }) ```
|
|
6061
6157
|
|
|
6062
6158
|
**setConfig**(opts: AppConfigOptions) → `Promise<any>`
|
|
6063
|
-
Set app configuration for a collection/product scope. Requires admin authentication. ```typescript await appConfiguration.setConfig({ appId: 'warranty-portal', collectionId: 'my-collection', admin: true, config: { warrantyPeriod: 24, supportEmail: 'support@example.com' } }); ```
|
|
6159
|
+
Set app configuration for a collection/product scope. Requires admin authentication. Writing through the admin endpoint does not make every root-level field private. Use `config.admin` for confidential values that should only be returned on admin reads. ```typescript await appConfiguration.setConfig({ appId: 'warranty-portal', collectionId: 'my-collection', admin: true, config: { warrantyPeriod: 24, supportEmail: 'support@example.com' } }); ```
|
|
6064
6160
|
|
|
6065
6161
|
**deleteConfig**(opts: AppConfigOptions) → `Promise<void>`
|
|
6066
6162
|
Delete app configuration for a collection/product scope. Requires admin authentication. ```typescript await appConfiguration.deleteConfig({ appId: 'warranty-portal', collectionId: 'my-collection', admin: true }); ```
|
|
6067
6163
|
|
|
6068
6164
|
**getData**(opts: AppConfigOptions) → `Promise<any[]>`
|
|
6069
|
-
Get all data items for an app within a scope. ```typescript const items = await appConfiguration.getData({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123' }); ```
|
|
6165
|
+
Get all keyed data items for an app within a scope. Best for a small set of standalone documents such as FAQs, menus, lookup tables, or content fragments where the caller typically knows the item IDs. If you are modelling richer app entities that need filtering, lifecycle fields, visibility, ownership, or relationships, prefer `app.records`, `app.cases`, or `app.threads` instead. ```typescript const items = await appConfiguration.getData({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123' }); ```
|
|
6070
6166
|
|
|
6071
6167
|
**getDataItem**(opts: AppConfigOptions) → `Promise<any>`
|
|
6072
|
-
Get a single data item by ID within a scope. ```typescript const item = await appConfiguration.getDataItem({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123', itemId: 'manual-1' }); ```
|
|
6168
|
+
Get a single keyed data item by ID within a scope. This is ideal when you already know the exact ID of a simple scoped document. For richer domain objects that users browse or query, prefer `app.records`, `app.cases`, or `app.threads`. ```typescript const item = await appConfiguration.getDataItem({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123', itemId: 'manual-1' }); ```
|
|
6073
6169
|
|
|
6074
6170
|
**setDataItem**(opts: AppConfigOptions) → `Promise<any>`
|
|
6075
|
-
Set/create a data item within a scope. Requires admin authentication. ```typescript await appConfiguration.setDataItem({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123', admin: true, data: { id: 'manual-1', title: 'User Manual', url: 'https://...' } }); ```
|
|
6171
|
+
Set/create a keyed data item within a scope. Requires admin authentication. Use this for simple scoped documents attached to a collection/product/variant/batch, especially when you want a small number of items with stable IDs. Do not treat this as the default write path for every app-owned entity. If the data starts behaving like a real object with lifecycle, filtering, visibility, ownership, history, or relationships, prefer `app.records`, `app.cases`, or `app.threads`. ```typescript await appConfiguration.setDataItem({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123', admin: true, data: { id: 'manual-1', title: 'User Manual', url: 'https://...' } }); ```
|
|
6076
6172
|
|
|
6077
6173
|
**deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
|
|
6078
|
-
Delete a data item by ID within a scope. Requires admin authentication. ```typescript await appConfiguration.deleteDataItem({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123', admin: true, itemId: 'manual-1' }); ```
|
|
6174
|
+
Delete a keyed data item by ID within a scope. Requires admin authentication. ```typescript await appConfiguration.deleteDataItem({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123', admin: true, itemId: 'manual-1' }); ```
|
|
6079
6175
|
|
|
6080
6176
|
**getWidgets**(collectionId: string,
|
|
6081
6177
|
options?: GetCollectionWidgetsOptions) → `Promise<CollectionWidgetsResponse>`
|
|
@@ -6473,93 +6569,17 @@ Get all tags/codes assigned to a specific batch. Shows which claim set codes hav
|
|
|
6473
6569
|
**appendBulk**(collectionId: string,
|
|
6474
6570
|
body: BroadcastAppendBulkBody) → `Promise<AppendBulkResult>`
|
|
6475
6571
|
|
|
6476
|
-
### chat
|
|
6477
|
-
|
|
6478
|
-
**create**(collectionId: string,
|
|
6479
|
-
request: ResponsesRequest) → `Promise<ResponsesResult | AsyncIterable<ResponsesStreamEvent>>`
|
|
6480
|
-
Create a Responses API request (streaming or non-streaming)
|
|
6572
|
+
### chat.completions
|
|
6481
6573
|
|
|
6482
6574
|
**create**(collectionId: string,
|
|
6483
6575
|
request: ChatCompletionRequest) → `Promise<ChatCompletionResponse | AsyncIterable<ChatCompletionChunk>>`
|
|
6484
6576
|
Create a chat completion (streaming or non-streaming)
|
|
6485
6577
|
|
|
6486
|
-
|
|
6487
|
-
List available AI models
|
|
6488
|
-
|
|
6489
|
-
**get**(collectionId: string, modelId: string) → `Promise<AIModel>`
|
|
6490
|
-
Get specific model information
|
|
6491
|
-
|
|
6492
|
-
**indexDocument**(collectionId: string,
|
|
6493
|
-
request: IndexDocumentRequest) → `Promise<IndexDocumentResponse>`
|
|
6494
|
-
Index a document for RAG
|
|
6495
|
-
|
|
6496
|
-
**configureAssistant**(collectionId: string,
|
|
6497
|
-
request: ConfigureAssistantRequest) → `Promise<ConfigureAssistantResponse>`
|
|
6498
|
-
Configure AI assistant behavior
|
|
6499
|
-
|
|
6500
|
-
**stats**(collectionId: string) → `Promise<SessionStatistics>`
|
|
6501
|
-
Get session statistics
|
|
6502
|
-
|
|
6503
|
-
**reset**(collectionId: string, userId: string) → `Promise<`
|
|
6504
|
-
Reset rate limit for a user
|
|
6505
|
-
|
|
6506
|
-
**generate**(collectionId: string,
|
|
6507
|
-
request: GeneratePodcastRequest) → `Promise<GeneratePodcastResponse>`
|
|
6508
|
-
Generate a NotebookLM-style conversational podcast from product documents
|
|
6509
|
-
|
|
6510
|
-
**getStatus**(collectionId: string, podcastId: string) → `Promise<PodcastStatus>`
|
|
6511
|
-
Get podcast generation status
|
|
6512
|
-
|
|
6513
|
-
**generate**(collectionId: string,
|
|
6514
|
-
request: TTSRequest) → `Promise<Blob>`
|
|
6515
|
-
Generate text-to-speech audio
|
|
6516
|
-
|
|
6517
|
-
**chat**(collectionId: string,
|
|
6518
|
-
request: PublicChatRequest) → `Promise<PublicChatResponse>`
|
|
6519
|
-
Chat with product assistant (RAG)
|
|
6520
|
-
|
|
6521
|
-
**getSession**(collectionId: string, sessionId: string) → `Promise<Session>`
|
|
6522
|
-
Get session history
|
|
6523
|
-
|
|
6524
|
-
**clearSession**(collectionId: string, sessionId: string) → `Promise<`
|
|
6525
|
-
Clear session history
|
|
6526
|
-
|
|
6527
|
-
**getRateLimit**(collectionId: string, userId: string) → `Promise<RateLimitStatus>`
|
|
6528
|
-
Check rate limit status
|
|
6529
|
-
|
|
6530
|
-
**getToken**(collectionId: string,
|
|
6531
|
-
request: EphemeralTokenRequest) → `Promise<EphemeralTokenResponse>`
|
|
6532
|
-
Generate ephemeral token for Gemini Live
|
|
6533
|
-
|
|
6534
|
-
**isSupported**() → `boolean`
|
|
6535
|
-
Check if voice is supported in browser
|
|
6536
|
-
|
|
6537
|
-
**listen**(language = 'en-US') → `Promise<string>`
|
|
6538
|
-
Listen for voice input
|
|
6539
|
-
|
|
6540
|
-
**speak**(text: string, options?: { voice?: string; rate?: number }) → `Promise<void>`
|
|
6541
|
-
Speak text
|
|
6542
|
-
|
|
6543
|
-
**generateContent**(collectionId: string,
|
|
6544
|
-
params: AIGenerateContentRequest,
|
|
6545
|
-
admin: boolean = true) → `Promise<any>`
|
|
6546
|
-
Generate text/content via AI (admin)
|
|
6547
|
-
|
|
6548
|
-
**generateImage**(collectionId: string, params: AIGenerateImageRequest) → `Promise<any>`
|
|
6549
|
-
Generate an image via AI (admin)
|
|
6550
|
-
|
|
6551
|
-
**searchPhotos**(collectionId: string,
|
|
6552
|
-
params: AISearchPhotosRequest) → `Promise<AISearchPhotosPhoto[]>`
|
|
6553
|
-
Search stock photos or similar via AI (admin)
|
|
6578
|
+
### chat.responses
|
|
6554
6579
|
|
|
6555
|
-
**
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
**createCache**(collectionId: string, params: any) → `Promise<any>`
|
|
6559
|
-
Create or warm a cache for AI (admin)
|
|
6560
|
-
|
|
6561
|
-
**postChat**(collectionId: string, params: any, admin: boolean = true) → `Promise<any>`
|
|
6562
|
-
Post a chat message to the AI (admin or public)
|
|
6580
|
+
**create**(collectionId: string,
|
|
6581
|
+
request: ResponsesRequest) → `Promise<ResponsesResult | AsyncIterable<ResponsesStreamEvent>>`
|
|
6582
|
+
Create a Responses API request (streaming or non-streaming)
|
|
6563
6583
|
|
|
6564
6584
|
### claimSet
|
|
6565
6585
|
|
|
@@ -6611,13 +6631,13 @@ Retrieves all Collections.
|
|
|
6611
6631
|
Retrieve a collection by its shortId (public endpoint).
|
|
6612
6632
|
|
|
6613
6633
|
**getSettings**(collectionId: string, settingGroup: string, admin?: boolean) → `Promise<any>`
|
|
6614
|
-
Retrieve a specific settings group for a collection
|
|
6634
|
+
Retrieve a specific settings group for a collection. Public reads return the public view of the settings group. If the stored payload contains a top-level `admin` object, that block is omitted from public responses and included when `admin === true`.
|
|
6615
6635
|
|
|
6616
6636
|
**getAppsConfig**(collectionId: string) → `Promise<AppsConfigResponse>`
|
|
6617
6637
|
Retrieve all configured app module definitions for a collection (public endpoint).
|
|
6618
6638
|
|
|
6619
6639
|
**updateSettings**(collectionId: string, settingGroup: string, settings: any) → `Promise<any>`
|
|
6620
|
-
Update a specific settings group for a collection (admin endpoint).
|
|
6640
|
+
Update a specific settings group for a collection (admin endpoint). This writes through the admin endpoint, but root-level fields are still part of the public settings payload. Put confidential values under `settings.admin` if they should only be returned on admin reads.
|
|
6621
6641
|
|
|
6622
6642
|
**create**(data: CollectionCreateRequest) → `Promise<CollectionResponse>`
|
|
6623
6643
|
Create a new collection (admin only).
|
|
@@ -6990,6 +7010,14 @@ Public: Fetch a global location by ID GET /public/location/:locationId
|
|
|
6990
7010
|
locationId: string) → `Promise<Location>`
|
|
6991
7011
|
Public: Fetch a location for a collection; returns either a collection-owned or global fallback GET /public/collection/:collectionId/location/:locationId
|
|
6992
7012
|
|
|
7013
|
+
### models
|
|
7014
|
+
|
|
7015
|
+
**list**(collectionId: string, params?: AIModelListParams) → `Promise<AIModelListResponse>`
|
|
7016
|
+
List available AI models
|
|
7017
|
+
|
|
7018
|
+
**get**(collectionId: string, modelId: string) → `Promise<AIModel>`
|
|
7019
|
+
Get specific model information
|
|
7020
|
+
|
|
6993
7021
|
### nfc
|
|
6994
7022
|
|
|
6995
7023
|
**claimTag**(data: NfcClaimTagRequest) → `Promise<NfcTagInfo>`
|
|
@@ -7095,6 +7123,15 @@ Get individual order items for a specific product. Returns all matching items wi
|
|
|
7095
7123
|
params?: GetOrderIdsParams) → `Promise<GetOrderIdsResponse>`
|
|
7096
7124
|
Get unique order IDs containing items for a specific product. Lightweight query that only returns order IDs, not full order objects. ```typescript // Get order IDs for a product const productOrders = await order.getOrderIdsByAttribute( 'coll_123', 'productId', 'prod_789', { limit: 500 } ) ```
|
|
7097
7125
|
|
|
7126
|
+
### podcast
|
|
7127
|
+
|
|
7128
|
+
**generate**(collectionId: string,
|
|
7129
|
+
request: GeneratePodcastRequest) → `Promise<GeneratePodcastResponse>`
|
|
7130
|
+
Generate a NotebookLM-style conversational podcast from product documents
|
|
7131
|
+
|
|
7132
|
+
**getStatus**(collectionId: string, podcastId: string) → `Promise<PodcastStatus>`
|
|
7133
|
+
Get podcast generation status
|
|
7134
|
+
|
|
7098
7135
|
### product
|
|
7099
7136
|
|
|
7100
7137
|
**get**(collectionId: string,
|
|
@@ -7195,57 +7232,52 @@ Get proofs for a batch (admin only). GET /admin/collection/:collectionId/product
|
|
|
7195
7232
|
data: { targetProductId: string }) → `Promise<ProofResponse>`
|
|
7196
7233
|
Migrate a proof to a different product within the same collection (admin only). Because the Firestore ledger document ID is `{productId}-{proofId}`, a proof cannot simply be re-assigned to another product by updating a field — the document must be re-keyed. This endpoint handles that atomically: 1. Reads the source ledger document (`{sourceProductId}-{proofId}`). 2. Writes a new document (`{targetProductId}-{proofId}`) with `productId` and `proofGroup` updated. The short `proofId` (nanoid) is unchanged. 3. Writes a migration history entry to the new document's `history` subcollection (snapshot of the original proof + migration metadata). 4. Copies all subcollections — `assets`, `attestations`, `history` — from the old document to the new one. 5. Deletes the old subcollections and then the old document. Repeated migrations are safe — each one appends a history record; no migration metadata is stored on the proof document itself. ```typescript const migrated = await proof.migrate('coll_123', 'prod_old', 'proof_abc', { targetProductId: 'prod_new', }) console.log(migrated.productId) // 'prod_new' ```
|
|
7197
7234
|
|
|
7235
|
+
### publicClient
|
|
7236
|
+
|
|
7237
|
+
**chat**(collectionId: string,
|
|
7238
|
+
request: PublicChatRequest) → `Promise<PublicChatResponse>`
|
|
7239
|
+
Chat with product assistant (RAG)
|
|
7240
|
+
|
|
7241
|
+
**getSession**(collectionId: string, sessionId: string) → `Promise<Session>`
|
|
7242
|
+
Get session history
|
|
7243
|
+
|
|
7244
|
+
**clearSession**(collectionId: string, sessionId: string) → `Promise<`
|
|
7245
|
+
Clear session history
|
|
7246
|
+
|
|
7247
|
+
**getRateLimit**(collectionId: string, userId: string) → `Promise<RateLimitStatus>`
|
|
7248
|
+
Check rate limit status
|
|
7249
|
+
|
|
7250
|
+
**getToken**(collectionId: string,
|
|
7251
|
+
request: EphemeralTokenRequest) → `Promise<EphemeralTokenResponse>`
|
|
7252
|
+
Generate ephemeral token for Gemini Live
|
|
7253
|
+
|
|
7198
7254
|
### qr
|
|
7199
7255
|
|
|
7200
7256
|
**lookupShortCode**(shortId: string, code: string) → `Promise<QrShortCodeLookupResponse>`
|
|
7201
7257
|
Resolve a short code to related resource identifiers.
|
|
7202
7258
|
|
|
7203
|
-
###
|
|
7204
|
-
|
|
7205
|
-
**getPublicToken**(params: RealtimeTokenRequest) → `Promise<AblyTokenRequest>`
|
|
7206
|
-
Get an Ably token for public (user-scoped) real-time communication. This endpoint returns an Ably TokenRequest that can be used to initialize an Ably client with appropriate permissions for the specified collection and optional app. Requires user authentication (Bearer token). ```ts const tokenRequest = await realtime.getPublicToken({ collectionId: 'my-collection-id', appId: 'my-app-id' }) // Use with Ably const ably = new Ably.Realtime.Promise({ authCallback: async (data, callback) => { callback(null, tokenRequest) } }) // Subscribe to channels matching the pattern const channel = ably.channels.get('collection:my-collection-id:app:my-app-id:chat:general') await channel.subscribe('message', (msg) => console.log(msg.data)) ```
|
|
7207
|
-
|
|
7208
|
-
**getAdminToken**() → `Promise<AblyTokenRequest>`
|
|
7209
|
-
Get an Ably token for admin real-time communication. This endpoint returns an Ably TokenRequest that can be used to initialize an Ably client with admin permissions to receive system notifications and alerts. Admin users get subscribe-only (read-only) access to the interaction:{userId} channel pattern. Requires admin authentication (Bearer token). ```ts const tokenRequest = await realtime.getAdminToken() // Use with Ably const ably = new Ably.Realtime.Promise({ authCallback: async (data, callback) => { callback(null, tokenRequest) } }) // Subscribe to admin interaction channel const userId = 'my-user-id' const channel = ably.channels.get(`interaction:${userId}`) await channel.subscribe((message) => { console.log('Admin notification:', message.data) }) ```
|
|
7259
|
+
### rag
|
|
7210
7260
|
|
|
7211
|
-
|
|
7261
|
+
**indexDocument**(collectionId: string,
|
|
7262
|
+
request: IndexDocumentRequest) → `Promise<IndexDocumentResponse>`
|
|
7263
|
+
Index a document for RAG
|
|
7212
7264
|
|
|
7213
|
-
**
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
admin: boolean = false) → `Promise<AppRecord>`
|
|
7217
|
-
Create a new record POST /records
|
|
7265
|
+
**configureAssistant**(collectionId: string,
|
|
7266
|
+
request: ConfigureAssistantRequest) → `Promise<ConfigureAssistantResponse>`
|
|
7267
|
+
Configure AI assistant behavior
|
|
7218
7268
|
|
|
7219
|
-
|
|
7220
|
-
appId: string,
|
|
7221
|
-
params?: RecordListQueryParams,
|
|
7222
|
-
admin: boolean = false) → `Promise<PaginatedResponse<AppRecord>>`
|
|
7223
|
-
List records with optional query parameters GET /records
|
|
7269
|
+
### rateLimit
|
|
7224
7270
|
|
|
7225
|
-
**
|
|
7226
|
-
|
|
7227
|
-
recordId: string,
|
|
7228
|
-
admin: boolean = false) → `Promise<AppRecord>`
|
|
7229
|
-
Get a single record by ID GET /records/:recordId
|
|
7271
|
+
**reset**(collectionId: string, userId: string) → `Promise<`
|
|
7272
|
+
Reset rate limit for a user
|
|
7230
7273
|
|
|
7231
|
-
|
|
7232
|
-
appId: string,
|
|
7233
|
-
recordId: string,
|
|
7234
|
-
input: UpdateRecordInput,
|
|
7235
|
-
admin: boolean = false) → `Promise<AppRecord>`
|
|
7236
|
-
Update a record PATCH /records/:recordId Admin can update any field, public (owner) can only update data and owner
|
|
7274
|
+
### realtime
|
|
7237
7275
|
|
|
7238
|
-
**
|
|
7239
|
-
|
|
7240
|
-
recordId: string,
|
|
7241
|
-
admin: boolean = false) → `Promise<`
|
|
7242
|
-
Soft delete a record DELETE /records/:recordId
|
|
7276
|
+
**getPublicToken**(params: RealtimeTokenRequest) → `Promise<AblyTokenRequest>`
|
|
7277
|
+
Get an Ably token for public (user-scoped) real-time communication. This endpoint returns an Ably TokenRequest that can be used to initialize an Ably client with appropriate permissions for the specified collection and optional app. Requires user authentication (Bearer token). ```ts const tokenRequest = await realtime.getPublicToken({ collectionId: 'my-collection-id', appId: 'my-app-id' }) // Use with Ably const ably = new Ably.Realtime.Promise({ authCallback: async (data, callback) => { callback(null, tokenRequest) } }) // Subscribe to channels matching the pattern const channel = ably.channels.get('collection:my-collection-id:app:my-app-id:chat:general') await channel.subscribe('message', (msg) => console.log(msg.data)) ```
|
|
7243
7278
|
|
|
7244
|
-
**
|
|
7245
|
-
|
|
7246
|
-
request: AggregateRequest,
|
|
7247
|
-
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
7248
|
-
Get aggregate statistics for records POST /records/aggregate
|
|
7279
|
+
**getAdminToken**() → `Promise<AblyTokenRequest>`
|
|
7280
|
+
Get an Ably token for admin real-time communication. This endpoint returns an Ably TokenRequest that can be used to initialize an Ably client with admin permissions to receive system notifications and alerts. Admin users get subscribe-only (read-only) access to the interaction:{userId} channel pattern. Requires admin authentication (Bearer token). ```ts const tokenRequest = await realtime.getAdminToken() // Use with Ably const ably = new Ably.Realtime.Promise({ authCallback: async (data, callback) => { callback(null, tokenRequest) } }) // Subscribe to admin interaction channel const userId = 'my-user-id' const channel = ably.channels.get(`interaction:${userId}`) await channel.subscribe((message) => { console.log('Admin notification:', message.data) }) ```
|
|
7249
7281
|
|
|
7250
7282
|
### segments
|
|
7251
7283
|
|
|
@@ -7272,6 +7304,11 @@ Get aggregate statistics for records POST /records/aggregate
|
|
|
7272
7304
|
id: string,
|
|
7273
7305
|
query: { limit?: number; offset?: number } = {}) → `Promise<SegmentRecipientsResponse>`
|
|
7274
7306
|
|
|
7307
|
+
### sessions
|
|
7308
|
+
|
|
7309
|
+
**stats**(collectionId: string) → `Promise<SessionStatistics>`
|
|
7310
|
+
Get session statistics
|
|
7311
|
+
|
|
7275
7312
|
### tags
|
|
7276
7313
|
|
|
7277
7314
|
**create**(collectionId: string,
|
|
@@ -7360,54 +7397,16 @@ Reverse lookup by ref via POST (public). `POST /public/collection/:collectionId/
|
|
|
7360
7397
|
**renderSource**(collectionId: string,
|
|
7361
7398
|
body: TemplateRenderSourceRequest) → `Promise<TemplateRenderSourceResponse>`
|
|
7362
7399
|
|
|
7363
|
-
###
|
|
7364
|
-
|
|
7365
|
-
**create**(collectionId: string,
|
|
7366
|
-
appId: string,
|
|
7367
|
-
input: CreateThreadInput,
|
|
7368
|
-
admin: boolean = false) → `Promise<AppThread>`
|
|
7369
|
-
Create a new thread POST /threads
|
|
7370
|
-
|
|
7371
|
-
**list**(collectionId: string,
|
|
7372
|
-
appId: string,
|
|
7373
|
-
params?: ThreadListQueryParams,
|
|
7374
|
-
admin: boolean = false) → `Promise<PaginatedResponse<AppThread>>`
|
|
7375
|
-
List threads with optional query parameters GET /threads
|
|
7376
|
-
|
|
7377
|
-
**get**(collectionId: string,
|
|
7378
|
-
appId: string,
|
|
7379
|
-
threadId: string,
|
|
7380
|
-
admin: boolean = false) → `Promise<AppThread>`
|
|
7381
|
-
Get a single thread by ID GET /threads/:threadId
|
|
7382
|
-
|
|
7383
|
-
**update**(collectionId: string,
|
|
7384
|
-
appId: string,
|
|
7385
|
-
threadId: string,
|
|
7386
|
-
input: UpdateThreadInput,
|
|
7387
|
-
admin: boolean = false) → `Promise<AppThread>`
|
|
7388
|
-
Update a thread PATCH /threads/:threadId Admin can update any field, public (owner) can only update body, tags, data, owner
|
|
7389
|
-
|
|
7390
|
-
**remove**(collectionId: string,
|
|
7391
|
-
appId: string,
|
|
7392
|
-
threadId: string,
|
|
7393
|
-
admin: boolean = false) → `Promise<`
|
|
7394
|
-
Soft delete a thread DELETE /threads/:threadId
|
|
7395
|
-
|
|
7396
|
-
**reply**(collectionId: string,
|
|
7397
|
-
appId: string,
|
|
7398
|
-
threadId: string,
|
|
7399
|
-
input: ReplyInput,
|
|
7400
|
-
admin: boolean = false) → `Promise<AppThread>`
|
|
7401
|
-
Add a reply to a thread POST /threads/:threadId/reply Atomically appends to replies array, increments replyCount, updates lastReplyAt
|
|
7400
|
+
### tts
|
|
7402
7401
|
|
|
7403
|
-
**
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
7407
|
-
Get aggregate statistics for threads POST /threads/aggregate
|
|
7402
|
+
**generate**(collectionId: string,
|
|
7403
|
+
request: TTSRequest) → `Promise<Blob>`
|
|
7404
|
+
Generate text-to-speech audio
|
|
7408
7405
|
|
|
7409
7406
|
### userAppData
|
|
7410
7407
|
|
|
7408
|
+
User-owned app data stored per user and app, shared across collections.
|
|
7409
|
+
|
|
7411
7410
|
**getConfig**(appId: string) → `Promise<any>`
|
|
7412
7411
|
Get user's config blob for an app. This is a single JSON object stored per user+app. ```typescript const config = await userAppData.getConfig('allergy-tracker'); // Returns: { allergies: ['peanuts'], notifications: true } ```
|
|
7413
7412
|
|
|
@@ -7474,3 +7473,14 @@ Get serial numbers for a variant (admin only).
|
|
|
7474
7473
|
codeId: string) → `Promise<any>`
|
|
7475
7474
|
Look up a serial number by code for a variant (admin only).
|
|
7476
7475
|
|
|
7476
|
+
### voice
|
|
7477
|
+
|
|
7478
|
+
**isSupported**() → `boolean`
|
|
7479
|
+
Check if voice is supported in browser
|
|
7480
|
+
|
|
7481
|
+
**listen**(language = 'en-US') → `Promise<string>`
|
|
7482
|
+
Listen for voice input
|
|
7483
|
+
|
|
7484
|
+
**speak**(text: string, options?: { voice?: string; rate?: number }) → `Promise<void>`
|
|
7485
|
+
Speak text
|
|
7486
|
+
|