@proveanything/smartlinks 1.13.4 → 1.13.6
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/asset.d.ts +4 -0
- package/dist/api/asset.js +20 -13
- package/dist/api/realtime.js +2 -2
- package/dist/docs/API_SUMMARY.md +17 -2
- package/dist/docs/assets.md +26 -0
- package/dist/openapi.yaml +77 -51
- package/dist/types/asset.d.ts +19 -0
- package/docs/API_SUMMARY.md +17 -2
- package/docs/assets.md +26 -0
- package/openapi.yaml +77 -51
- package/package.json +1 -1
package/dist/api/asset.d.ts
CHANGED
|
@@ -110,6 +110,10 @@ export declare namespace asset {
|
|
|
110
110
|
/**
|
|
111
111
|
* Request a single-use upload token for a public (unauthenticated) upload.
|
|
112
112
|
* The token encodes the upload policy (allowed types, max size, review requirement).
|
|
113
|
+
*
|
|
114
|
+
* Policy source: collection-scoped app config at
|
|
115
|
+
* `sites/{collectionId}/apps/{appId}` (`uploadPolicy` key).
|
|
116
|
+
* Global `apps/{appId}` config is not used for this endpoint.
|
|
113
117
|
*
|
|
114
118
|
* @example
|
|
115
119
|
* ```typescript
|
package/dist/api/asset.js
CHANGED
|
@@ -9,9 +9,20 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { request, post, put, del, getApiHeaders, isProxyEnabled, proxyUploadFormData } from "../http";
|
|
12
|
+
import { request, post, put, del, getApiHeaders, getBaseURL, isProxyEnabled, proxyUploadFormData } from "../http";
|
|
13
13
|
export var asset;
|
|
14
14
|
(function (asset) {
|
|
15
|
+
function resolveApiUrl(path) {
|
|
16
|
+
const configuredBase = getBaseURL();
|
|
17
|
+
if (configuredBase) {
|
|
18
|
+
return `${configuredBase}${path}`;
|
|
19
|
+
}
|
|
20
|
+
// Backward compatibility for legacy browser integrations that set a global base URL.
|
|
21
|
+
if (typeof window !== 'undefined' && window.SMARTLINKS_API_BASEURL) {
|
|
22
|
+
return `${window.SMARTLINKS_API_BASEURL}${path}`;
|
|
23
|
+
}
|
|
24
|
+
throw new Error('HTTP client is not initialized. Call initializeApi(...) first.');
|
|
25
|
+
}
|
|
15
26
|
/**
|
|
16
27
|
* Error type for asset uploads
|
|
17
28
|
*/
|
|
@@ -55,9 +66,7 @@ export var asset;
|
|
|
55
66
|
formData.append("metadata", JSON.stringify(options.metadata));
|
|
56
67
|
// If progress callback provided and NOT in proxy mode, use XHR for progress events (browser-only)
|
|
57
68
|
if (options.onProgress && typeof window !== "undefined" && !isProxyEnabled()) {
|
|
58
|
-
const url = (
|
|
59
|
-
? window.SMARTLINKS_API_BASEURL + path
|
|
60
|
-
: path;
|
|
69
|
+
const url = resolveApiUrl(path);
|
|
61
70
|
const headers = getApiHeaders ? getApiHeaders() : {};
|
|
62
71
|
return new Promise((resolve, reject) => {
|
|
63
72
|
const xhr = new XMLHttpRequest();
|
|
@@ -346,9 +355,7 @@ export var asset;
|
|
|
346
355
|
const formData = new FormData();
|
|
347
356
|
formData.append('file', options.file);
|
|
348
357
|
if (options.onProgress && typeof window !== 'undefined' && !isProxyEnabled()) {
|
|
349
|
-
const url = (
|
|
350
|
-
? window.SMARTLINKS_API_BASEURL + path
|
|
351
|
-
: path;
|
|
358
|
+
const url = resolveApiUrl(path);
|
|
352
359
|
const headers = getApiHeaders ? getApiHeaders() : {};
|
|
353
360
|
return new Promise((resolve, reject) => {
|
|
354
361
|
const xhr = new XMLHttpRequest();
|
|
@@ -424,6 +431,10 @@ export var asset;
|
|
|
424
431
|
/**
|
|
425
432
|
* Request a single-use upload token for a public (unauthenticated) upload.
|
|
426
433
|
* The token encodes the upload policy (allowed types, max size, review requirement).
|
|
434
|
+
*
|
|
435
|
+
* Policy source: collection-scoped app config at
|
|
436
|
+
* `sites/{collectionId}/apps/{appId}` (`uploadPolicy` key).
|
|
437
|
+
* Global `apps/{appId}` config is not used for this endpoint.
|
|
427
438
|
*
|
|
428
439
|
* @example
|
|
429
440
|
* ```typescript
|
|
@@ -465,9 +476,7 @@ export var asset;
|
|
|
465
476
|
if (options.metadata)
|
|
466
477
|
formData.append('metadata', JSON.stringify(options.metadata));
|
|
467
478
|
if (options.onProgress && typeof window !== 'undefined' && !isProxyEnabled()) {
|
|
468
|
-
const baseUrl = (
|
|
469
|
-
? window.SMARTLINKS_API_BASEURL + path
|
|
470
|
-
: path;
|
|
479
|
+
const baseUrl = resolveApiUrl(path);
|
|
471
480
|
const headers = Object.assign(Object.assign({}, getApiHeaders()), { 'X-Upload-Token': options.tokenId });
|
|
472
481
|
return new Promise((resolve, reject) => {
|
|
473
482
|
const xhr = new XMLHttpRequest();
|
|
@@ -504,9 +513,7 @@ export var asset;
|
|
|
504
513
|
}
|
|
505
514
|
// Pass the token as a header via a custom fetch; post() doesn't accept extra headers,
|
|
506
515
|
// so we build the request manually using the same base URL resolution.
|
|
507
|
-
const baseUrl = (
|
|
508
|
-
? window.SMARTLINKS_API_BASEURL + path
|
|
509
|
-
: path;
|
|
516
|
+
const baseUrl = resolveApiUrl(path);
|
|
510
517
|
const headers = Object.assign(Object.assign({}, getApiHeaders()), { 'X-Upload-Token': options.tokenId });
|
|
511
518
|
const response = await fetch(baseUrl, { method: 'POST', headers, body: formData });
|
|
512
519
|
if (!response.ok) {
|
package/dist/api/realtime.js
CHANGED
|
@@ -75,7 +75,7 @@ export async function getPublicToken(params) {
|
|
|
75
75
|
if (params.appId) {
|
|
76
76
|
queryParams.append('appId', params.appId);
|
|
77
77
|
}
|
|
78
|
-
return request(`/
|
|
78
|
+
return request(`/public/push/token?${queryParams.toString()}`);
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
81
|
* Get an Ably token for admin real-time communication.
|
|
@@ -109,5 +109,5 @@ export async function getPublicToken(params) {
|
|
|
109
109
|
* ```
|
|
110
110
|
*/
|
|
111
111
|
export async function getAdminToken() {
|
|
112
|
-
return request('/
|
|
112
|
+
return request('/admin/auth/push');
|
|
113
113
|
}
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.13.
|
|
3
|
+
Version: 1.13.6 | Generated: 2026-05-09T13:35:50.729Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -2472,10 +2472,25 @@ interface BulkDeleteAssetsOptions {
|
|
|
2472
2472
|
}
|
|
2473
2473
|
```
|
|
2474
2474
|
|
|
2475
|
+
**UploadPolicyConfig** (interface)
|
|
2476
|
+
```typescript
|
|
2477
|
+
interface UploadPolicyConfig {
|
|
2478
|
+
enabled: boolean
|
|
2479
|
+
requireLevel?: 'anonymous' | 'contact' | 'owner'
|
|
2480
|
+
allowedMimeTypes?: string[]
|
|
2481
|
+
maxFileSizeBytes?: number
|
|
2482
|
+
reviewRequired?: boolean
|
|
2483
|
+
tokenTtlSeconds?: number
|
|
2484
|
+
maxUsesPerToken?: number
|
|
2485
|
+
}
|
|
2486
|
+
```
|
|
2487
|
+
|
|
2475
2488
|
**RequestUploadTokenOptions** (interface)
|
|
2476
2489
|
```typescript
|
|
2477
2490
|
interface RequestUploadTokenOptions {
|
|
2478
2491
|
collectionId: string
|
|
2492
|
+
* App ID whose collection-scoped config provides `uploadPolicy`.
|
|
2493
|
+
* Resolved from `sites/{collectionId}/apps/{appId}`.
|
|
2479
2494
|
appId: string
|
|
2480
2495
|
contactId?: string
|
|
2481
2496
|
productId?: string
|
|
@@ -7797,7 +7812,7 @@ Restore a soft-deleted asset (clears `deletedAt`).
|
|
|
7797
7812
|
Soft-delete multiple assets in one request.
|
|
7798
7813
|
|
|
7799
7814
|
**requestUploadToken**(options: RequestUploadTokenOptions) → `Promise<UploadTokenResponse>`
|
|
7800
|
-
Request a single-use upload token for a public (unauthenticated) upload. The token encodes the upload policy (allowed types, max size, review requirement). ```typescript const { tokenId, policy } = await asset.requestUploadToken({ collectionId: 'my-collection', appId: 'user-gallery', contactId: contact.id, }) const uploaded = await asset.publicUploadWithToken({ collectionId: 'my-collection', tokenId, file: selectedFile, }) ```
|
|
7815
|
+
Request a single-use upload token for a public (unauthenticated) upload. The token encodes the upload policy (allowed types, max size, review requirement). Policy source: collection-scoped app config at `sites/{collectionId}/apps/{appId}` (`uploadPolicy` key). Global `apps/{appId}` config is not used for this endpoint. ```typescript const { tokenId, policy } = await asset.requestUploadToken({ collectionId: 'my-collection', appId: 'user-gallery', contactId: contact.id, }) const uploaded = await asset.publicUploadWithToken({ collectionId: 'my-collection', tokenId, file: selectedFile, }) ```
|
|
7801
7816
|
|
|
7802
7817
|
**publicUploadWithToken**(options: PublicTokenUploadOptions) → `Promise<Asset>`
|
|
7803
7818
|
Upload a file using a single-use upload token (no admin auth required). Assets are created with `status: 'pending_review'` when the token policy has `reviewRequired: true`.
|
package/dist/docs/assets.md
CHANGED
|
@@ -249,6 +249,32 @@ For anonymous or contact-initiated uploads from the portal — no admin auth req
|
|
|
249
249
|
|
|
250
250
|
### 1. Request an upload token
|
|
251
251
|
|
|
252
|
+
```
|
|
253
|
+
POST /api/public/collection/:collectionId/asset/token
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Policy source (important):
|
|
257
|
+
|
|
258
|
+
- Public upload policy is resolved from the collection-scoped app config at `sites/{collectionId}/apps/{appId}`.
|
|
259
|
+
- Global app config (`apps/{appId}`) is not used for this endpoint.
|
|
260
|
+
- SDKs/clients that provision app config should save `uploadPolicy` on the collection app document.
|
|
261
|
+
|
|
262
|
+
Expected app config shape:
|
|
263
|
+
|
|
264
|
+
```typescript
|
|
265
|
+
{
|
|
266
|
+
uploadPolicy: {
|
|
267
|
+
enabled: boolean
|
|
268
|
+
requireLevel?: 'anonymous' | 'contact' | 'owner'
|
|
269
|
+
allowedMimeTypes?: string[]
|
|
270
|
+
maxFileSizeBytes?: number
|
|
271
|
+
reviewRequired?: boolean
|
|
272
|
+
tokenTtlSeconds?: number
|
|
273
|
+
maxUsesPerToken?: number
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
252
278
|
```typescript
|
|
253
279
|
const { tokenId, expiresAt, policy } = await Api.asset.requestUploadToken({
|
|
254
280
|
collectionId: 'my-collection',
|
package/dist/openapi.yaml
CHANGED
|
@@ -57,6 +57,27 @@ tags:
|
|
|
57
57
|
security:
|
|
58
58
|
- bearerAuth: []
|
|
59
59
|
paths:
|
|
60
|
+
/admin/auth/push:
|
|
61
|
+
get:
|
|
62
|
+
tags:
|
|
63
|
+
- realtime
|
|
64
|
+
summary: Get an Ably token for admin real-time communication.
|
|
65
|
+
operationId: realtime_getAdminToken
|
|
66
|
+
security:
|
|
67
|
+
- bearerAuth: []
|
|
68
|
+
responses:
|
|
69
|
+
200:
|
|
70
|
+
description: Success
|
|
71
|
+
content:
|
|
72
|
+
application/json:
|
|
73
|
+
schema:
|
|
74
|
+
$ref: "#/components/schemas/AblyTokenRequest"
|
|
75
|
+
400:
|
|
76
|
+
description: Bad request
|
|
77
|
+
401:
|
|
78
|
+
description: Unauthorized
|
|
79
|
+
404:
|
|
80
|
+
description: Not found
|
|
60
81
|
/admin/auth/requestJWT:
|
|
61
82
|
post:
|
|
62
83
|
tags:
|
|
@@ -7835,57 +7856,6 @@ paths:
|
|
|
7835
7856
|
application/json:
|
|
7836
7857
|
schema:
|
|
7837
7858
|
$ref: "#/components/schemas/TranslationUpdateRequest"
|
|
7838
|
-
/api/admin/auth/push:
|
|
7839
|
-
get:
|
|
7840
|
-
tags:
|
|
7841
|
-
- realtime
|
|
7842
|
-
summary: Get an Ably token for admin real-time communication.
|
|
7843
|
-
operationId: realtime_getAdminToken
|
|
7844
|
-
security: []
|
|
7845
|
-
responses:
|
|
7846
|
-
200:
|
|
7847
|
-
description: Success
|
|
7848
|
-
content:
|
|
7849
|
-
application/json:
|
|
7850
|
-
schema:
|
|
7851
|
-
$ref: "#/components/schemas/AblyTokenRequest"
|
|
7852
|
-
400:
|
|
7853
|
-
description: Bad request
|
|
7854
|
-
401:
|
|
7855
|
-
description: Unauthorized
|
|
7856
|
-
404:
|
|
7857
|
-
description: Not found
|
|
7858
|
-
/api/public/push/token:
|
|
7859
|
-
get:
|
|
7860
|
-
tags:
|
|
7861
|
-
- realtime
|
|
7862
|
-
summary: realtime.getPublicToken
|
|
7863
|
-
operationId: realtime_getPublicToken
|
|
7864
|
-
security: []
|
|
7865
|
-
parameters:
|
|
7866
|
-
- name: collectionId
|
|
7867
|
-
in: query
|
|
7868
|
-
required: false
|
|
7869
|
-
schema:
|
|
7870
|
-
type: string
|
|
7871
|
-
- name: appId
|
|
7872
|
-
in: query
|
|
7873
|
-
required: false
|
|
7874
|
-
schema:
|
|
7875
|
-
type: string
|
|
7876
|
-
responses:
|
|
7877
|
-
200:
|
|
7878
|
-
description: Success
|
|
7879
|
-
content:
|
|
7880
|
-
application/json:
|
|
7881
|
-
schema:
|
|
7882
|
-
$ref: "#/components/schemas/AblyTokenRequest"
|
|
7883
|
-
400:
|
|
7884
|
-
description: Bad request
|
|
7885
|
-
401:
|
|
7886
|
-
description: Unauthorized
|
|
7887
|
-
404:
|
|
7888
|
-
description: Not found
|
|
7889
7859
|
/authKit/{authKitId}/config:
|
|
7890
7860
|
get:
|
|
7891
7861
|
tags:
|
|
@@ -11840,6 +11810,37 @@ paths:
|
|
|
11840
11810
|
application/json:
|
|
11841
11811
|
schema:
|
|
11842
11812
|
$ref: "#/components/schemas/NfcValidateRequest"
|
|
11813
|
+
/public/push/token:
|
|
11814
|
+
get:
|
|
11815
|
+
tags:
|
|
11816
|
+
- realtime
|
|
11817
|
+
summary: realtime.getPublicToken
|
|
11818
|
+
operationId: realtime_getPublicToken
|
|
11819
|
+
security: []
|
|
11820
|
+
parameters:
|
|
11821
|
+
- name: collectionId
|
|
11822
|
+
in: query
|
|
11823
|
+
required: false
|
|
11824
|
+
schema:
|
|
11825
|
+
type: string
|
|
11826
|
+
- name: appId
|
|
11827
|
+
in: query
|
|
11828
|
+
required: false
|
|
11829
|
+
schema:
|
|
11830
|
+
type: string
|
|
11831
|
+
responses:
|
|
11832
|
+
200:
|
|
11833
|
+
description: Success
|
|
11834
|
+
content:
|
|
11835
|
+
application/json:
|
|
11836
|
+
schema:
|
|
11837
|
+
$ref: "#/components/schemas/AblyTokenRequest"
|
|
11838
|
+
400:
|
|
11839
|
+
description: Bad request
|
|
11840
|
+
401:
|
|
11841
|
+
description: Unauthorized
|
|
11842
|
+
404:
|
|
11843
|
+
description: Not found
|
|
11843
11844
|
/public/qr/lookupShortCode/{shortId}/{code}:
|
|
11844
11845
|
get:
|
|
11845
11846
|
tags:
|
|
@@ -16825,6 +16826,31 @@ components:
|
|
|
16825
16826
|
required:
|
|
16826
16827
|
- collectionId
|
|
16827
16828
|
- assetIds
|
|
16829
|
+
UploadPolicyConfig:
|
|
16830
|
+
type: object
|
|
16831
|
+
properties:
|
|
16832
|
+
enabled:
|
|
16833
|
+
type: boolean
|
|
16834
|
+
requireLevel:
|
|
16835
|
+
type: string
|
|
16836
|
+
enum:
|
|
16837
|
+
- anonymous
|
|
16838
|
+
- contact
|
|
16839
|
+
- owner
|
|
16840
|
+
allowedMimeTypes:
|
|
16841
|
+
type: array
|
|
16842
|
+
items:
|
|
16843
|
+
type: string
|
|
16844
|
+
maxFileSizeBytes:
|
|
16845
|
+
type: number
|
|
16846
|
+
reviewRequired:
|
|
16847
|
+
type: boolean
|
|
16848
|
+
tokenTtlSeconds:
|
|
16849
|
+
type: number
|
|
16850
|
+
maxUsesPerToken:
|
|
16851
|
+
type: number
|
|
16852
|
+
required:
|
|
16853
|
+
- enabled
|
|
16828
16854
|
RequestUploadTokenOptions:
|
|
16829
16855
|
type: object
|
|
16830
16856
|
properties:
|
package/dist/types/asset.d.ts
CHANGED
|
@@ -253,8 +253,27 @@ export interface BulkDeleteAssetsOptions {
|
|
|
253
253
|
assetIds: string[];
|
|
254
254
|
graceDays?: number;
|
|
255
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* Collection-scoped app config policy used by `requestUploadToken`.
|
|
258
|
+
*
|
|
259
|
+
* Important: this policy is read from `sites/{collectionId}/apps/{appId}`
|
|
260
|
+
* (collection app config), not from global `apps/{appId}` config.
|
|
261
|
+
*/
|
|
262
|
+
export interface UploadPolicyConfig {
|
|
263
|
+
enabled: boolean;
|
|
264
|
+
requireLevel?: 'anonymous' | 'contact' | 'owner';
|
|
265
|
+
allowedMimeTypes?: string[];
|
|
266
|
+
maxFileSizeBytes?: number;
|
|
267
|
+
reviewRequired?: boolean;
|
|
268
|
+
tokenTtlSeconds?: number;
|
|
269
|
+
maxUsesPerToken?: number;
|
|
270
|
+
}
|
|
256
271
|
export interface RequestUploadTokenOptions {
|
|
257
272
|
collectionId: string;
|
|
273
|
+
/**
|
|
274
|
+
* App ID whose collection-scoped config provides `uploadPolicy`.
|
|
275
|
+
* Resolved from `sites/{collectionId}/apps/{appId}`.
|
|
276
|
+
*/
|
|
258
277
|
appId: string;
|
|
259
278
|
/** Required when the app policy requireLevel is 'contact' */
|
|
260
279
|
contactId?: string;
|
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.13.
|
|
3
|
+
Version: 1.13.6 | Generated: 2026-05-09T13:35:50.729Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -2472,10 +2472,25 @@ interface BulkDeleteAssetsOptions {
|
|
|
2472
2472
|
}
|
|
2473
2473
|
```
|
|
2474
2474
|
|
|
2475
|
+
**UploadPolicyConfig** (interface)
|
|
2476
|
+
```typescript
|
|
2477
|
+
interface UploadPolicyConfig {
|
|
2478
|
+
enabled: boolean
|
|
2479
|
+
requireLevel?: 'anonymous' | 'contact' | 'owner'
|
|
2480
|
+
allowedMimeTypes?: string[]
|
|
2481
|
+
maxFileSizeBytes?: number
|
|
2482
|
+
reviewRequired?: boolean
|
|
2483
|
+
tokenTtlSeconds?: number
|
|
2484
|
+
maxUsesPerToken?: number
|
|
2485
|
+
}
|
|
2486
|
+
```
|
|
2487
|
+
|
|
2475
2488
|
**RequestUploadTokenOptions** (interface)
|
|
2476
2489
|
```typescript
|
|
2477
2490
|
interface RequestUploadTokenOptions {
|
|
2478
2491
|
collectionId: string
|
|
2492
|
+
* App ID whose collection-scoped config provides `uploadPolicy`.
|
|
2493
|
+
* Resolved from `sites/{collectionId}/apps/{appId}`.
|
|
2479
2494
|
appId: string
|
|
2480
2495
|
contactId?: string
|
|
2481
2496
|
productId?: string
|
|
@@ -7797,7 +7812,7 @@ Restore a soft-deleted asset (clears `deletedAt`).
|
|
|
7797
7812
|
Soft-delete multiple assets in one request.
|
|
7798
7813
|
|
|
7799
7814
|
**requestUploadToken**(options: RequestUploadTokenOptions) → `Promise<UploadTokenResponse>`
|
|
7800
|
-
Request a single-use upload token for a public (unauthenticated) upload. The token encodes the upload policy (allowed types, max size, review requirement). ```typescript const { tokenId, policy } = await asset.requestUploadToken({ collectionId: 'my-collection', appId: 'user-gallery', contactId: contact.id, }) const uploaded = await asset.publicUploadWithToken({ collectionId: 'my-collection', tokenId, file: selectedFile, }) ```
|
|
7815
|
+
Request a single-use upload token for a public (unauthenticated) upload. The token encodes the upload policy (allowed types, max size, review requirement). Policy source: collection-scoped app config at `sites/{collectionId}/apps/{appId}` (`uploadPolicy` key). Global `apps/{appId}` config is not used for this endpoint. ```typescript const { tokenId, policy } = await asset.requestUploadToken({ collectionId: 'my-collection', appId: 'user-gallery', contactId: contact.id, }) const uploaded = await asset.publicUploadWithToken({ collectionId: 'my-collection', tokenId, file: selectedFile, }) ```
|
|
7801
7816
|
|
|
7802
7817
|
**publicUploadWithToken**(options: PublicTokenUploadOptions) → `Promise<Asset>`
|
|
7803
7818
|
Upload a file using a single-use upload token (no admin auth required). Assets are created with `status: 'pending_review'` when the token policy has `reviewRequired: true`.
|
package/docs/assets.md
CHANGED
|
@@ -249,6 +249,32 @@ For anonymous or contact-initiated uploads from the portal — no admin auth req
|
|
|
249
249
|
|
|
250
250
|
### 1. Request an upload token
|
|
251
251
|
|
|
252
|
+
```
|
|
253
|
+
POST /api/public/collection/:collectionId/asset/token
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Policy source (important):
|
|
257
|
+
|
|
258
|
+
- Public upload policy is resolved from the collection-scoped app config at `sites/{collectionId}/apps/{appId}`.
|
|
259
|
+
- Global app config (`apps/{appId}`) is not used for this endpoint.
|
|
260
|
+
- SDKs/clients that provision app config should save `uploadPolicy` on the collection app document.
|
|
261
|
+
|
|
262
|
+
Expected app config shape:
|
|
263
|
+
|
|
264
|
+
```typescript
|
|
265
|
+
{
|
|
266
|
+
uploadPolicy: {
|
|
267
|
+
enabled: boolean
|
|
268
|
+
requireLevel?: 'anonymous' | 'contact' | 'owner'
|
|
269
|
+
allowedMimeTypes?: string[]
|
|
270
|
+
maxFileSizeBytes?: number
|
|
271
|
+
reviewRequired?: boolean
|
|
272
|
+
tokenTtlSeconds?: number
|
|
273
|
+
maxUsesPerToken?: number
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
252
278
|
```typescript
|
|
253
279
|
const { tokenId, expiresAt, policy } = await Api.asset.requestUploadToken({
|
|
254
280
|
collectionId: 'my-collection',
|
package/openapi.yaml
CHANGED
|
@@ -57,6 +57,27 @@ tags:
|
|
|
57
57
|
security:
|
|
58
58
|
- bearerAuth: []
|
|
59
59
|
paths:
|
|
60
|
+
/admin/auth/push:
|
|
61
|
+
get:
|
|
62
|
+
tags:
|
|
63
|
+
- realtime
|
|
64
|
+
summary: Get an Ably token for admin real-time communication.
|
|
65
|
+
operationId: realtime_getAdminToken
|
|
66
|
+
security:
|
|
67
|
+
- bearerAuth: []
|
|
68
|
+
responses:
|
|
69
|
+
200:
|
|
70
|
+
description: Success
|
|
71
|
+
content:
|
|
72
|
+
application/json:
|
|
73
|
+
schema:
|
|
74
|
+
$ref: "#/components/schemas/AblyTokenRequest"
|
|
75
|
+
400:
|
|
76
|
+
description: Bad request
|
|
77
|
+
401:
|
|
78
|
+
description: Unauthorized
|
|
79
|
+
404:
|
|
80
|
+
description: Not found
|
|
60
81
|
/admin/auth/requestJWT:
|
|
61
82
|
post:
|
|
62
83
|
tags:
|
|
@@ -7835,57 +7856,6 @@ paths:
|
|
|
7835
7856
|
application/json:
|
|
7836
7857
|
schema:
|
|
7837
7858
|
$ref: "#/components/schemas/TranslationUpdateRequest"
|
|
7838
|
-
/api/admin/auth/push:
|
|
7839
|
-
get:
|
|
7840
|
-
tags:
|
|
7841
|
-
- realtime
|
|
7842
|
-
summary: Get an Ably token for admin real-time communication.
|
|
7843
|
-
operationId: realtime_getAdminToken
|
|
7844
|
-
security: []
|
|
7845
|
-
responses:
|
|
7846
|
-
200:
|
|
7847
|
-
description: Success
|
|
7848
|
-
content:
|
|
7849
|
-
application/json:
|
|
7850
|
-
schema:
|
|
7851
|
-
$ref: "#/components/schemas/AblyTokenRequest"
|
|
7852
|
-
400:
|
|
7853
|
-
description: Bad request
|
|
7854
|
-
401:
|
|
7855
|
-
description: Unauthorized
|
|
7856
|
-
404:
|
|
7857
|
-
description: Not found
|
|
7858
|
-
/api/public/push/token:
|
|
7859
|
-
get:
|
|
7860
|
-
tags:
|
|
7861
|
-
- realtime
|
|
7862
|
-
summary: realtime.getPublicToken
|
|
7863
|
-
operationId: realtime_getPublicToken
|
|
7864
|
-
security: []
|
|
7865
|
-
parameters:
|
|
7866
|
-
- name: collectionId
|
|
7867
|
-
in: query
|
|
7868
|
-
required: false
|
|
7869
|
-
schema:
|
|
7870
|
-
type: string
|
|
7871
|
-
- name: appId
|
|
7872
|
-
in: query
|
|
7873
|
-
required: false
|
|
7874
|
-
schema:
|
|
7875
|
-
type: string
|
|
7876
|
-
responses:
|
|
7877
|
-
200:
|
|
7878
|
-
description: Success
|
|
7879
|
-
content:
|
|
7880
|
-
application/json:
|
|
7881
|
-
schema:
|
|
7882
|
-
$ref: "#/components/schemas/AblyTokenRequest"
|
|
7883
|
-
400:
|
|
7884
|
-
description: Bad request
|
|
7885
|
-
401:
|
|
7886
|
-
description: Unauthorized
|
|
7887
|
-
404:
|
|
7888
|
-
description: Not found
|
|
7889
7859
|
/authKit/{authKitId}/config:
|
|
7890
7860
|
get:
|
|
7891
7861
|
tags:
|
|
@@ -11840,6 +11810,37 @@ paths:
|
|
|
11840
11810
|
application/json:
|
|
11841
11811
|
schema:
|
|
11842
11812
|
$ref: "#/components/schemas/NfcValidateRequest"
|
|
11813
|
+
/public/push/token:
|
|
11814
|
+
get:
|
|
11815
|
+
tags:
|
|
11816
|
+
- realtime
|
|
11817
|
+
summary: realtime.getPublicToken
|
|
11818
|
+
operationId: realtime_getPublicToken
|
|
11819
|
+
security: []
|
|
11820
|
+
parameters:
|
|
11821
|
+
- name: collectionId
|
|
11822
|
+
in: query
|
|
11823
|
+
required: false
|
|
11824
|
+
schema:
|
|
11825
|
+
type: string
|
|
11826
|
+
- name: appId
|
|
11827
|
+
in: query
|
|
11828
|
+
required: false
|
|
11829
|
+
schema:
|
|
11830
|
+
type: string
|
|
11831
|
+
responses:
|
|
11832
|
+
200:
|
|
11833
|
+
description: Success
|
|
11834
|
+
content:
|
|
11835
|
+
application/json:
|
|
11836
|
+
schema:
|
|
11837
|
+
$ref: "#/components/schemas/AblyTokenRequest"
|
|
11838
|
+
400:
|
|
11839
|
+
description: Bad request
|
|
11840
|
+
401:
|
|
11841
|
+
description: Unauthorized
|
|
11842
|
+
404:
|
|
11843
|
+
description: Not found
|
|
11843
11844
|
/public/qr/lookupShortCode/{shortId}/{code}:
|
|
11844
11845
|
get:
|
|
11845
11846
|
tags:
|
|
@@ -16825,6 +16826,31 @@ components:
|
|
|
16825
16826
|
required:
|
|
16826
16827
|
- collectionId
|
|
16827
16828
|
- assetIds
|
|
16829
|
+
UploadPolicyConfig:
|
|
16830
|
+
type: object
|
|
16831
|
+
properties:
|
|
16832
|
+
enabled:
|
|
16833
|
+
type: boolean
|
|
16834
|
+
requireLevel:
|
|
16835
|
+
type: string
|
|
16836
|
+
enum:
|
|
16837
|
+
- anonymous
|
|
16838
|
+
- contact
|
|
16839
|
+
- owner
|
|
16840
|
+
allowedMimeTypes:
|
|
16841
|
+
type: array
|
|
16842
|
+
items:
|
|
16843
|
+
type: string
|
|
16844
|
+
maxFileSizeBytes:
|
|
16845
|
+
type: number
|
|
16846
|
+
reviewRequired:
|
|
16847
|
+
type: boolean
|
|
16848
|
+
tokenTtlSeconds:
|
|
16849
|
+
type: number
|
|
16850
|
+
maxUsesPerToken:
|
|
16851
|
+
type: number
|
|
16852
|
+
required:
|
|
16853
|
+
- enabled
|
|
16828
16854
|
RequestUploadTokenOptions:
|
|
16829
16855
|
type: object
|
|
16830
16856
|
properties:
|