@proveanything/smartlinks 1.9.15 → 1.9.16

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.
@@ -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,97 @@
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
+ export var http;
27
+ (function (http) {
28
+ /**
29
+ * Perform a GET request to any API endpoint.
30
+ *
31
+ * @param path - Path after the base URL, e.g. `'/public/config/fields'`
32
+ * @returns Parsed JSON response body typed as `T`
33
+ * @throws {SmartlinksApiError} on non-2xx responses
34
+ *
35
+ * @example
36
+ * const fields = await http.get<FieldDefinition[]>('/public/config/fields')
37
+ */
38
+ async function get(path) {
39
+ return _get(path);
40
+ }
41
+ http.get = get;
42
+ /**
43
+ * Perform a POST request to any API endpoint.
44
+ *
45
+ * @param path - Path after the base URL, e.g. `'/public/app/eticket/uploadTickets'`
46
+ * @param body - Request body (serialized to JSON, or sent as-is for FormData)
47
+ * @returns Parsed JSON response body typed as `T`
48
+ * @throws {SmartlinksApiError} on non-2xx responses
49
+ *
50
+ * @example
51
+ * const result = await http.post('/public/app/eticket/uploadTickets', {
52
+ * collectionId,
53
+ * productId,
54
+ * appId,
55
+ * data,
56
+ * })
57
+ */
58
+ async function post(path, body) {
59
+ return _post(path, body);
60
+ }
61
+ http.post = post;
62
+ /**
63
+ * Perform a PUT request to any API endpoint.
64
+ *
65
+ * @param path - Path after the base URL
66
+ * @param body - Request body (serialized to JSON, or sent as-is for FormData)
67
+ * @returns Parsed JSON response body typed as `T`
68
+ * @throws {SmartlinksApiError} on non-2xx responses
69
+ */
70
+ async function put(path, body) {
71
+ return _put(path, body);
72
+ }
73
+ http.put = put;
74
+ /**
75
+ * Perform a PATCH request to any API endpoint.
76
+ *
77
+ * @param path - Path after the base URL
78
+ * @param body - Partial request body (serialized to JSON)
79
+ * @returns Parsed JSON response body typed as `T`
80
+ * @throws {SmartlinksApiError} on non-2xx responses
81
+ */
82
+ async function patch(path, body) {
83
+ return _patch(path, body);
84
+ }
85
+ http.patch = patch;
86
+ /**
87
+ * Perform a DELETE request to any API endpoint.
88
+ *
89
+ * @param path - Path after the base URL
90
+ * @returns Parsed JSON response body typed as `T`
91
+ * @throws {SmartlinksApiError} on non-2xx responses
92
+ */
93
+ async function del(path) {
94
+ return _del(path);
95
+ }
96
+ http.del = del;
97
+ })(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.16 | Generated: 2026-04-13T17:25:57.673Z
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,
@@ -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.16 | Generated: 2026-04-13T17:25:57.673Z
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.9.15",
3
+ "version": "1.9.16",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",