@proveanything/smartlinks 1.9.15 → 1.9.17

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.
@@ -25,12 +25,12 @@ export var authKit;
25
25
  authKit.googleLogin = googleLogin;
26
26
  /** Send a magic link email to the user (public). */
27
27
  async function sendMagicLink(clientId, data) {
28
- return post(`/authkit/${encodeURIComponent(clientId)}/magic-link/send`, data);
28
+ return post(`/authkit/${encodeURIComponent(clientId)}/auth/magic-link/send`, data);
29
29
  }
30
30
  authKit.sendMagicLink = sendMagicLink;
31
31
  /** Verify a magic link token and authenticate/create the user (public). */
32
32
  async function verifyMagicLink(clientId, token) {
33
- const res = await post(`/authkit/${encodeURIComponent(clientId)}/magic-link/verify`, { token });
33
+ const res = await post(`/authkit/${encodeURIComponent(clientId)}/auth/magic-link/verify`, { token });
34
34
  if (res.token)
35
35
  setBearerToken(res.token);
36
36
  return res;
@@ -0,0 +1,56 @@
1
+ export declare namespace http {
2
+ /**
3
+ * Perform a GET request to any API endpoint.
4
+ *
5
+ * @param path - Path after the base URL, e.g. `'/public/config/fields'`
6
+ * @returns Parsed JSON response body typed as `T`
7
+ * @throws {SmartlinksApiError} on non-2xx responses
8
+ *
9
+ * @example
10
+ * const fields = await http.get<FieldDefinition[]>('/public/config/fields')
11
+ */
12
+ function get<T>(path: string): Promise<T>;
13
+ /**
14
+ * Perform a POST request to any API endpoint.
15
+ *
16
+ * @param path - Path after the base URL, e.g. `'/public/app/eticket/uploadTickets'`
17
+ * @param body - Request body (serialized to JSON, or sent as-is for FormData)
18
+ * @returns Parsed JSON response body typed as `T`
19
+ * @throws {SmartlinksApiError} on non-2xx responses
20
+ *
21
+ * @example
22
+ * const result = await http.post('/public/app/eticket/uploadTickets', {
23
+ * collectionId,
24
+ * productId,
25
+ * appId,
26
+ * data,
27
+ * })
28
+ */
29
+ function post<T>(path: string, body: any): Promise<T>;
30
+ /**
31
+ * Perform a PUT request to any API endpoint.
32
+ *
33
+ * @param path - Path after the base URL
34
+ * @param body - Request body (serialized to JSON, or sent as-is for FormData)
35
+ * @returns Parsed JSON response body typed as `T`
36
+ * @throws {SmartlinksApiError} on non-2xx responses
37
+ */
38
+ function put<T>(path: string, body: any): Promise<T>;
39
+ /**
40
+ * Perform a PATCH request to any API endpoint.
41
+ *
42
+ * @param path - Path after the base URL
43
+ * @param body - Partial request body (serialized to JSON)
44
+ * @returns Parsed JSON response body typed as `T`
45
+ * @throws {SmartlinksApiError} on non-2xx responses
46
+ */
47
+ function patch<T>(path: string, body: any): Promise<T>;
48
+ /**
49
+ * Perform a DELETE request to any API endpoint.
50
+ *
51
+ * @param path - Path after the base URL
52
+ * @returns Parsed JSON response body typed as `T`
53
+ * @throws {SmartlinksApiError} on non-2xx responses
54
+ */
55
+ function del<T>(path: string): Promise<T>;
56
+ }
@@ -0,0 +1,101 @@
1
+ // src/api/http.ts
2
+ // Escape-hatch namespace for calling arbitrary API endpoints that are not yet
3
+ // covered by a dedicated SDK namespace.
4
+ //
5
+ // Paths are relative to the base URL configured via initializeApi() — which
6
+ // already includes "/api/v1". You only need to supply the path segment that
7
+ // comes *after* that prefix:
8
+ //
9
+ // ✅ http.post('/public/app/eticket/uploadTickets', { ... })
10
+ // ✅ http.get('/admin/collection/abc123/customReport')
11
+ // ❌ http.post('/api/v1/public/...') — do NOT repeat the prefix
12
+ //
13
+ // All methods use the same auth headers (API key / bearer token), proxy mode,
14
+ // and caching behaviour as every other SDK namespace. Errors are thrown as
15
+ // SmartlinksApiError — catch them the same way you would for any SDK call.
16
+ //
17
+ // Example — calling a custom app endpoint:
18
+ //
19
+ // import { http } from '@smartlinks/sdk'
20
+ //
21
+ // const result = await http.post<{ uploaded: number }>(
22
+ // '/public/app/eticket/uploadTickets',
23
+ // { collectionId, productId, appId, data }
24
+ // )
25
+ import { request as _get, post as _post, put as _put, patch as _patch, del as _del, } from '../http';
26
+ /** Ensure the path always starts with `/` so it concatenates correctly with baseURL. */
27
+ function normalizePath(path) {
28
+ return path.startsWith('/') ? path : `/${path}`;
29
+ }
30
+ export var http;
31
+ (function (http) {
32
+ /**
33
+ * Perform a GET request to any API endpoint.
34
+ *
35
+ * @param path - Path after the base URL, e.g. `'/public/config/fields'`
36
+ * @returns Parsed JSON response body typed as `T`
37
+ * @throws {SmartlinksApiError} on non-2xx responses
38
+ *
39
+ * @example
40
+ * const fields = await http.get<FieldDefinition[]>('/public/config/fields')
41
+ */
42
+ async function get(path) {
43
+ return _get(normalizePath(path));
44
+ }
45
+ http.get = get;
46
+ /**
47
+ * Perform a POST request to any API endpoint.
48
+ *
49
+ * @param path - Path after the base URL, e.g. `'/public/app/eticket/uploadTickets'`
50
+ * @param body - Request body (serialized to JSON, or sent as-is for FormData)
51
+ * @returns Parsed JSON response body typed as `T`
52
+ * @throws {SmartlinksApiError} on non-2xx responses
53
+ *
54
+ * @example
55
+ * const result = await http.post('/public/app/eticket/uploadTickets', {
56
+ * collectionId,
57
+ * productId,
58
+ * appId,
59
+ * data,
60
+ * })
61
+ */
62
+ async function post(path, body) {
63
+ return _post(normalizePath(path), body);
64
+ }
65
+ http.post = post;
66
+ /**
67
+ * Perform a PUT request to any API endpoint.
68
+ *
69
+ * @param path - Path after the base URL
70
+ * @param body - Request body (serialized to JSON, or sent as-is for FormData)
71
+ * @returns Parsed JSON response body typed as `T`
72
+ * @throws {SmartlinksApiError} on non-2xx responses
73
+ */
74
+ async function put(path, body) {
75
+ return _put(normalizePath(path), body);
76
+ }
77
+ http.put = put;
78
+ /**
79
+ * Perform a PATCH request to any API endpoint.
80
+ *
81
+ * @param path - Path after the base URL
82
+ * @param body - Partial request body (serialized to JSON)
83
+ * @returns Parsed JSON response body typed as `T`
84
+ * @throws {SmartlinksApiError} on non-2xx responses
85
+ */
86
+ async function patch(path, body) {
87
+ return _patch(normalizePath(path), body);
88
+ }
89
+ http.patch = patch;
90
+ /**
91
+ * Perform a DELETE request to any API endpoint.
92
+ *
93
+ * @param path - Path after the base URL
94
+ * @returns Parsed JSON response body typed as `T`
95
+ * @throws {SmartlinksApiError} on non-2xx responses
96
+ */
97
+ async function del(path) {
98
+ return _del(normalizePath(path));
99
+ }
100
+ http.del = del;
101
+ })(http || (http = {}));
@@ -37,3 +37,4 @@ export { containers } from "./containers";
37
37
  export { loyalty } from "./loyalty";
38
38
  export { translations } from "./translations";
39
39
  export { config } from "./config";
40
+ export { http } from "./http";
package/dist/api/index.js CHANGED
@@ -40,3 +40,4 @@ export { containers } from "./containers";
40
40
  export { loyalty } from "./loyalty";
41
41
  export { translations } from "./translations";
42
42
  export { config } from "./config";
43
+ export { http } from "./http";
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.9.15 | Generated: 2026-04-13T12:48:02.968Z
3
+ Version: 1.9.17 | Generated: 2026-04-15T16:54:07.573Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -106,6 +106,7 @@ The Smartlinks SDK is organized into the following namespaces:
106
106
  - **config** - Functions for config operations
107
107
  - **containers** - Functions for containers operations
108
108
  - **facets** - Functions for facets operations
109
+ - **http** - Functions for http operations
109
110
  - **jobs** - Functions for jobs operations
110
111
  - **journeysAnalytics** - Functions for journeysAnalytics operations
111
112
  - **location** - Functions for location operations
@@ -7929,6 +7930,23 @@ Update a form for a collection (admin only).
7929
7930
  **remove**(collectionId: string, formId: string) → `Promise<void>`
7930
7931
  Delete a form for a collection (admin only).
7931
7932
 
7933
+ ### http
7934
+
7935
+ **get**(path: string) → `Promise<T>`
7936
+ Perform a GET request to any API endpoint. const fields = await http.get<FieldDefinition[]>('/public/config/fields')
7937
+
7938
+ **post**(path: string, body: any) → `Promise<T>`
7939
+ Perform a POST request to any API endpoint. const result = await http.post('/public/app/eticket/uploadTickets', { collectionId, productId, appId, data, })
7940
+
7941
+ **put**(path: string, body: any) → `Promise<T>`
7942
+ Perform a PUT request to any API endpoint.
7943
+
7944
+ **patch**(path: string, body: any) → `Promise<T>`
7945
+ Perform a PATCH request to any API endpoint.
7946
+
7947
+ **del**(path: string) → `Promise<T>`
7948
+ Perform a DELETE request to any API endpoint.
7949
+
7932
7950
  ### interactions
7933
7951
 
7934
7952
  **query**(collectionId: string,
package/dist/openapi.yaml CHANGED
@@ -8380,6 +8380,65 @@ paths:
8380
8380
  description: Unauthorized
8381
8381
  404:
8382
8382
  description: Not found
8383
+ /authkit/{clientId}/auth/magic-link/send:
8384
+ post:
8385
+ tags:
8386
+ - authKit
8387
+ summary: Login with email + password (public).
8388
+ operationId: authKit_sendMagicLink
8389
+ security: []
8390
+ parameters:
8391
+ - name: clientId
8392
+ in: path
8393
+ required: true
8394
+ schema:
8395
+ type: string
8396
+ responses:
8397
+ 200:
8398
+ description: Success
8399
+ content:
8400
+ application/json:
8401
+ schema:
8402
+ $ref: "#/components/schemas/MagicLinkSendResponse"
8403
+ 400:
8404
+ description: Bad request
8405
+ 401:
8406
+ description: Unauthorized
8407
+ 404:
8408
+ description: Not found
8409
+ requestBody:
8410
+ required: true
8411
+ content:
8412
+ application/json:
8413
+ schema:
8414
+ type: object
8415
+ additionalProperties: true
8416
+ /authkit/{clientId}/auth/magic-link/verify:
8417
+ post:
8418
+ tags:
8419
+ - authKit
8420
+ summary: Google OAuth login (public).
8421
+ operationId: authKit_verifyMagicLink
8422
+ security: []
8423
+ parameters:
8424
+ - name: clientId
8425
+ in: path
8426
+ required: true
8427
+ schema:
8428
+ type: string
8429
+ responses:
8430
+ 200:
8431
+ description: Success
8432
+ content:
8433
+ application/json:
8434
+ schema:
8435
+ $ref: "#/components/schemas/MagicLinkVerifyResponse"
8436
+ 400:
8437
+ description: Bad request
8438
+ 401:
8439
+ description: Unauthorized
8440
+ 404:
8441
+ description: Not found
8383
8442
  /authkit/{clientId}/auth/phone/send-code:
8384
8443
  post:
8385
8444
  tags:
@@ -8616,65 +8675,6 @@ paths:
8616
8675
  description: Unauthorized
8617
8676
  404:
8618
8677
  description: Not found
8619
- /authkit/{clientId}/magic-link/send:
8620
- post:
8621
- tags:
8622
- - authKit
8623
- summary: Login with email + password (public).
8624
- operationId: authKit_sendMagicLink
8625
- security: []
8626
- parameters:
8627
- - name: clientId
8628
- in: path
8629
- required: true
8630
- schema:
8631
- type: string
8632
- responses:
8633
- 200:
8634
- description: Success
8635
- content:
8636
- application/json:
8637
- schema:
8638
- $ref: "#/components/schemas/MagicLinkSendResponse"
8639
- 400:
8640
- description: Bad request
8641
- 401:
8642
- description: Unauthorized
8643
- 404:
8644
- description: Not found
8645
- requestBody:
8646
- required: true
8647
- content:
8648
- application/json:
8649
- schema:
8650
- type: object
8651
- additionalProperties: true
8652
- /authkit/{clientId}/magic-link/verify:
8653
- post:
8654
- tags:
8655
- - authKit
8656
- summary: Google OAuth login (public).
8657
- operationId: authKit_verifyMagicLink
8658
- security: []
8659
- parameters:
8660
- - name: clientId
8661
- in: path
8662
- required: true
8663
- schema:
8664
- type: string
8665
- responses:
8666
- 200:
8667
- description: Success
8668
- content:
8669
- application/json:
8670
- schema:
8671
- $ref: "#/components/schemas/MagicLinkVerifyResponse"
8672
- 400:
8673
- description: Bad request
8674
- 401:
8675
- description: Unauthorized
8676
- 404:
8677
- description: Not found
8678
8678
  /platform/location:
8679
8679
  post:
8680
8680
  tags:
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.9.15 | Generated: 2026-04-13T12:48:02.968Z
3
+ Version: 1.9.17 | Generated: 2026-04-15T16:54:07.573Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -106,6 +106,7 @@ The Smartlinks SDK is organized into the following namespaces:
106
106
  - **config** - Functions for config operations
107
107
  - **containers** - Functions for containers operations
108
108
  - **facets** - Functions for facets operations
109
+ - **http** - Functions for http operations
109
110
  - **jobs** - Functions for jobs operations
110
111
  - **journeysAnalytics** - Functions for journeysAnalytics operations
111
112
  - **location** - Functions for location operations
@@ -7929,6 +7930,23 @@ Update a form for a collection (admin only).
7929
7930
  **remove**(collectionId: string, formId: string) → `Promise<void>`
7930
7931
  Delete a form for a collection (admin only).
7931
7932
 
7933
+ ### http
7934
+
7935
+ **get**(path: string) → `Promise<T>`
7936
+ Perform a GET request to any API endpoint. const fields = await http.get<FieldDefinition[]>('/public/config/fields')
7937
+
7938
+ **post**(path: string, body: any) → `Promise<T>`
7939
+ Perform a POST request to any API endpoint. const result = await http.post('/public/app/eticket/uploadTickets', { collectionId, productId, appId, data, })
7940
+
7941
+ **put**(path: string, body: any) → `Promise<T>`
7942
+ Perform a PUT request to any API endpoint.
7943
+
7944
+ **patch**(path: string, body: any) → `Promise<T>`
7945
+ Perform a PATCH request to any API endpoint.
7946
+
7947
+ **del**(path: string) → `Promise<T>`
7948
+ Perform a DELETE request to any API endpoint.
7949
+
7932
7950
  ### interactions
7933
7951
 
7934
7952
  **query**(collectionId: string,
package/openapi.yaml CHANGED
@@ -8380,6 +8380,65 @@ paths:
8380
8380
  description: Unauthorized
8381
8381
  404:
8382
8382
  description: Not found
8383
+ /authkit/{clientId}/auth/magic-link/send:
8384
+ post:
8385
+ tags:
8386
+ - authKit
8387
+ summary: Login with email + password (public).
8388
+ operationId: authKit_sendMagicLink
8389
+ security: []
8390
+ parameters:
8391
+ - name: clientId
8392
+ in: path
8393
+ required: true
8394
+ schema:
8395
+ type: string
8396
+ responses:
8397
+ 200:
8398
+ description: Success
8399
+ content:
8400
+ application/json:
8401
+ schema:
8402
+ $ref: "#/components/schemas/MagicLinkSendResponse"
8403
+ 400:
8404
+ description: Bad request
8405
+ 401:
8406
+ description: Unauthorized
8407
+ 404:
8408
+ description: Not found
8409
+ requestBody:
8410
+ required: true
8411
+ content:
8412
+ application/json:
8413
+ schema:
8414
+ type: object
8415
+ additionalProperties: true
8416
+ /authkit/{clientId}/auth/magic-link/verify:
8417
+ post:
8418
+ tags:
8419
+ - authKit
8420
+ summary: Google OAuth login (public).
8421
+ operationId: authKit_verifyMagicLink
8422
+ security: []
8423
+ parameters:
8424
+ - name: clientId
8425
+ in: path
8426
+ required: true
8427
+ schema:
8428
+ type: string
8429
+ responses:
8430
+ 200:
8431
+ description: Success
8432
+ content:
8433
+ application/json:
8434
+ schema:
8435
+ $ref: "#/components/schemas/MagicLinkVerifyResponse"
8436
+ 400:
8437
+ description: Bad request
8438
+ 401:
8439
+ description: Unauthorized
8440
+ 404:
8441
+ description: Not found
8383
8442
  /authkit/{clientId}/auth/phone/send-code:
8384
8443
  post:
8385
8444
  tags:
@@ -8616,65 +8675,6 @@ paths:
8616
8675
  description: Unauthorized
8617
8676
  404:
8618
8677
  description: Not found
8619
- /authkit/{clientId}/magic-link/send:
8620
- post:
8621
- tags:
8622
- - authKit
8623
- summary: Login with email + password (public).
8624
- operationId: authKit_sendMagicLink
8625
- security: []
8626
- parameters:
8627
- - name: clientId
8628
- in: path
8629
- required: true
8630
- schema:
8631
- type: string
8632
- responses:
8633
- 200:
8634
- description: Success
8635
- content:
8636
- application/json:
8637
- schema:
8638
- $ref: "#/components/schemas/MagicLinkSendResponse"
8639
- 400:
8640
- description: Bad request
8641
- 401:
8642
- description: Unauthorized
8643
- 404:
8644
- description: Not found
8645
- requestBody:
8646
- required: true
8647
- content:
8648
- application/json:
8649
- schema:
8650
- type: object
8651
- additionalProperties: true
8652
- /authkit/{clientId}/magic-link/verify:
8653
- post:
8654
- tags:
8655
- - authKit
8656
- summary: Google OAuth login (public).
8657
- operationId: authKit_verifyMagicLink
8658
- security: []
8659
- parameters:
8660
- - name: clientId
8661
- in: path
8662
- required: true
8663
- schema:
8664
- type: string
8665
- responses:
8666
- 200:
8667
- description: Success
8668
- content:
8669
- application/json:
8670
- schema:
8671
- $ref: "#/components/schemas/MagicLinkVerifyResponse"
8672
- 400:
8673
- description: Bad request
8674
- 401:
8675
- description: Unauthorized
8676
- 404:
8677
- description: Not found
8678
8678
  /platform/location:
8679
8679
  post:
8680
8680
  tags:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.9.15",
3
+ "version": "1.9.17",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",