@gpt-core/admin 0.9.39 → 0.10.1
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/README.md +52 -0
- package/dist/index.d.mts +455 -47
- package/dist/index.d.ts +455 -47
- package/dist/index.js +5 -1
- package/dist/index.mjs +4 -1
- package/llms.txt +33 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ __export(index_exports, {
|
|
|
26
26
|
ApiKeyAllocateSchema: () => ApiKeyAllocateSchema,
|
|
27
27
|
AuthenticationError: () => AuthenticationError,
|
|
28
28
|
AuthorizationError: () => AuthorizationError,
|
|
29
|
+
DEFAULT_API_VERSION: () => DEFAULT_API_VERSION,
|
|
29
30
|
DocumentBulkDeleteSchema: () => DocumentBulkDeleteSchema,
|
|
30
31
|
DocumentBulkReprocessSchema: () => DocumentBulkReprocessSchema,
|
|
31
32
|
GptAdmin: () => GptAdmin,
|
|
@@ -867,14 +868,16 @@ var client = createClient(
|
|
|
867
868
|
);
|
|
868
869
|
|
|
869
870
|
// src/base-client.ts
|
|
871
|
+
var DEFAULT_API_VERSION = "2025-12-03";
|
|
870
872
|
var BaseClient = class {
|
|
871
873
|
constructor(config = {}) {
|
|
872
874
|
this.config = config;
|
|
875
|
+
this.apiVersion = config.apiVersion ?? DEFAULT_API_VERSION;
|
|
873
876
|
if (config.baseUrl) {
|
|
874
877
|
client.setConfig({ baseUrl: config.baseUrl });
|
|
875
878
|
}
|
|
876
879
|
client.interceptors.request.use((req) => {
|
|
877
|
-
req.headers.set("Accept",
|
|
880
|
+
req.headers.set("Accept", `application/vnd.api+json; version=${this.apiVersion}`);
|
|
878
881
|
req.headers.set("Content-Type", "application/vnd.api+json");
|
|
879
882
|
if (config.apiKey) {
|
|
880
883
|
req.headers.set("x-application-key", config.apiKey);
|
|
@@ -1580,6 +1583,7 @@ var index_default = GptAdmin;
|
|
|
1580
1583
|
ApiKeyAllocateSchema,
|
|
1581
1584
|
AuthenticationError,
|
|
1582
1585
|
AuthorizationError,
|
|
1586
|
+
DEFAULT_API_VERSION,
|
|
1583
1587
|
DocumentBulkDeleteSchema,
|
|
1584
1588
|
DocumentBulkReprocessSchema,
|
|
1585
1589
|
GptAdmin,
|
package/dist/index.mjs
CHANGED
|
@@ -819,14 +819,16 @@ var client = createClient(
|
|
|
819
819
|
);
|
|
820
820
|
|
|
821
821
|
// src/base-client.ts
|
|
822
|
+
var DEFAULT_API_VERSION = "2025-12-03";
|
|
822
823
|
var BaseClient = class {
|
|
823
824
|
constructor(config = {}) {
|
|
824
825
|
this.config = config;
|
|
826
|
+
this.apiVersion = config.apiVersion ?? DEFAULT_API_VERSION;
|
|
825
827
|
if (config.baseUrl) {
|
|
826
828
|
client.setConfig({ baseUrl: config.baseUrl });
|
|
827
829
|
}
|
|
828
830
|
client.interceptors.request.use((req) => {
|
|
829
|
-
req.headers.set("Accept",
|
|
831
|
+
req.headers.set("Accept", `application/vnd.api+json; version=${this.apiVersion}`);
|
|
830
832
|
req.headers.set("Content-Type", "application/vnd.api+json");
|
|
831
833
|
if (config.apiKey) {
|
|
832
834
|
req.headers.set("x-application-key", config.apiKey);
|
|
@@ -1531,6 +1533,7 @@ export {
|
|
|
1531
1533
|
ApiKeyAllocateSchema,
|
|
1532
1534
|
AuthenticationError,
|
|
1533
1535
|
AuthorizationError,
|
|
1536
|
+
DEFAULT_API_VERSION,
|
|
1534
1537
|
DocumentBulkDeleteSchema,
|
|
1535
1538
|
DocumentBulkReprocessSchema,
|
|
1536
1539
|
GptAdmin,
|
package/llms.txt
CHANGED
|
@@ -23,6 +23,39 @@ client.setConfig({
|
|
|
23
23
|
});
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
## API Versioning
|
|
27
|
+
|
|
28
|
+
The SDK sends an API version header with every request.
|
|
29
|
+
Default version: 2025-12-03
|
|
30
|
+
|
|
31
|
+
### Configuration
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { GptAdmin, DEFAULT_API_VERSION } from '@gpt-core/admin';
|
|
35
|
+
|
|
36
|
+
// Use SDK default version
|
|
37
|
+
const client = new GptAdmin({ baseUrl, apiKey });
|
|
38
|
+
|
|
39
|
+
// Pin to specific version (recommended for production)
|
|
40
|
+
const client = new GptAdmin({ baseUrl, apiKey, apiVersion: '2025-12-03' });
|
|
41
|
+
|
|
42
|
+
// Read effective version
|
|
43
|
+
client.apiVersion // "2025-12-03"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Config Options
|
|
47
|
+
|
|
48
|
+
- `baseUrl` (string) - API base URL
|
|
49
|
+
- `token` (string) - User JWT for Bearer auth
|
|
50
|
+
- `apiKey` (string) - Application key for x-application-key header
|
|
51
|
+
- `applicationId` (string) - Application ID for scoped admin operations
|
|
52
|
+
- `retry` (object|false) - Retry config or disable
|
|
53
|
+
- `apiVersion` (string) - API version date, defaults to DEFAULT_API_VERSION
|
|
54
|
+
|
|
55
|
+
### Response Header
|
|
56
|
+
|
|
57
|
+
Every response includes: `x-api-version: 2025-12-03`
|
|
58
|
+
|
|
26
59
|
## Accounts
|
|
27
60
|
|
|
28
61
|
- `getAccounts()` - List accounts
|