@letta-ai/letta-client 0.1.32 → 0.1.34

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.
Files changed (170) hide show
  1. package/Client.d.ts +3 -0
  2. package/Client.js +23 -18
  3. package/api/resources/agents/client/Client.js +20 -8
  4. package/api/resources/agents/client/requests/CreateAgentRequest.d.ts +2 -1
  5. package/api/resources/agents/resources/archivalMemory/client/Client.js +3 -3
  6. package/api/resources/agents/resources/context/client/Client.js +1 -1
  7. package/api/resources/agents/resources/coreMemory/client/Client.js +6 -6
  8. package/api/resources/agents/resources/memoryVariables/client/Client.js +1 -1
  9. package/api/resources/agents/resources/messages/client/Client.js +5 -5
  10. package/api/resources/agents/resources/sources/client/Client.js +3 -3
  11. package/api/resources/agents/resources/templates/client/Client.js +3 -3
  12. package/api/resources/agents/resources/tools/client/Client.js +3 -3
  13. package/api/resources/blocks/client/Client.js +6 -6
  14. package/api/resources/health/client/Client.js +1 -1
  15. package/api/resources/identities/client/Client.d.ts +109 -0
  16. package/api/resources/identities/client/Client.js +484 -0
  17. package/api/resources/identities/client/index.d.ts +1 -0
  18. package/api/resources/identities/client/index.js +17 -0
  19. package/api/resources/identities/client/requests/CreateIdentityRequest.d.ts +18 -0
  20. package/api/resources/identities/client/requests/CreateIdentityRequest.js +5 -0
  21. package/api/resources/identities/client/requests/IdentityUpdate.d.ts +16 -0
  22. package/api/resources/identities/client/requests/IdentityUpdate.js +5 -0
  23. package/api/resources/identities/client/requests/ListIdentitiesRequest.d.ts +16 -0
  24. package/api/resources/identities/client/requests/ListIdentitiesRequest.js +5 -0
  25. package/api/resources/identities/client/requests/UpsertIdentityRequest.d.ts +18 -0
  26. package/api/resources/identities/client/requests/UpsertIdentityRequest.js +5 -0
  27. package/api/resources/identities/client/requests/index.d.ts +4 -0
  28. package/api/resources/identities/client/requests/index.js +2 -0
  29. package/api/resources/identities/index.d.ts +1 -0
  30. package/api/resources/identities/index.js +17 -0
  31. package/api/resources/index.d.ts +2 -0
  32. package/api/resources/index.js +3 -1
  33. package/api/resources/jobs/client/Client.js +4 -4
  34. package/api/resources/models/client/Client.js +2 -2
  35. package/api/resources/providers/client/Client.js +4 -4
  36. package/api/resources/runs/client/Client.js +6 -6
  37. package/api/resources/sources/client/Client.js +6 -6
  38. package/api/resources/sources/resources/files/client/Client.js +3 -3
  39. package/api/resources/sources/resources/passages/client/Client.js +1 -1
  40. package/api/resources/steps/client/Client.js +2 -2
  41. package/api/resources/tag/client/Client.js +1 -1
  42. package/api/resources/templates/client/Client.js +1 -1
  43. package/api/resources/tools/client/Client.js +11 -11
  44. package/api/types/ActionParametersModel.d.ts +1 -0
  45. package/api/types/ActionResponseModel.d.ts +1 -0
  46. package/api/types/AppAuthSchemeAuthMode.d.ts +2 -1
  47. package/api/types/AppAuthSchemeAuthMode.js +1 -0
  48. package/api/types/Identity.d.ts +18 -0
  49. package/api/types/Identity.js +5 -0
  50. package/api/types/IdentityCreate.d.ts +16 -0
  51. package/api/types/IdentityCreate.js +5 -0
  52. package/api/types/IdentityType.d.ts +12 -0
  53. package/api/types/IdentityType.js +11 -0
  54. package/api/types/index.d.ts +3 -0
  55. package/api/types/index.js +3 -0
  56. package/dist/Client.d.ts +3 -0
  57. package/dist/Client.js +23 -18
  58. package/dist/api/resources/agents/client/Client.js +20 -8
  59. package/dist/api/resources/agents/client/requests/CreateAgentRequest.d.ts +2 -1
  60. package/dist/api/resources/agents/resources/archivalMemory/client/Client.js +3 -3
  61. package/dist/api/resources/agents/resources/context/client/Client.js +1 -1
  62. package/dist/api/resources/agents/resources/coreMemory/client/Client.js +6 -6
  63. package/dist/api/resources/agents/resources/memoryVariables/client/Client.js +1 -1
  64. package/dist/api/resources/agents/resources/messages/client/Client.js +5 -5
  65. package/dist/api/resources/agents/resources/sources/client/Client.js +3 -3
  66. package/dist/api/resources/agents/resources/templates/client/Client.js +3 -3
  67. package/dist/api/resources/agents/resources/tools/client/Client.js +3 -3
  68. package/dist/api/resources/blocks/client/Client.js +6 -6
  69. package/dist/api/resources/health/client/Client.js +1 -1
  70. package/dist/api/resources/identities/client/Client.d.ts +109 -0
  71. package/dist/api/resources/identities/client/Client.js +484 -0
  72. package/dist/api/resources/identities/client/index.d.ts +1 -0
  73. package/dist/api/resources/identities/client/index.js +17 -0
  74. package/dist/api/resources/identities/client/requests/CreateIdentityRequest.d.ts +18 -0
  75. package/dist/api/resources/identities/client/requests/CreateIdentityRequest.js +5 -0
  76. package/dist/api/resources/identities/client/requests/IdentityUpdate.d.ts +16 -0
  77. package/dist/api/resources/identities/client/requests/IdentityUpdate.js +5 -0
  78. package/dist/api/resources/identities/client/requests/ListIdentitiesRequest.d.ts +16 -0
  79. package/dist/api/resources/identities/client/requests/ListIdentitiesRequest.js +5 -0
  80. package/dist/api/resources/identities/client/requests/UpsertIdentityRequest.d.ts +18 -0
  81. package/dist/api/resources/identities/client/requests/UpsertIdentityRequest.js +5 -0
  82. package/dist/api/resources/identities/client/requests/index.d.ts +4 -0
  83. package/dist/api/resources/identities/client/requests/index.js +2 -0
  84. package/dist/api/resources/identities/index.d.ts +1 -0
  85. package/dist/api/resources/identities/index.js +17 -0
  86. package/dist/api/resources/index.d.ts +2 -0
  87. package/dist/api/resources/index.js +3 -1
  88. package/dist/api/resources/jobs/client/Client.js +4 -4
  89. package/dist/api/resources/models/client/Client.js +2 -2
  90. package/dist/api/resources/providers/client/Client.js +4 -4
  91. package/dist/api/resources/runs/client/Client.js +6 -6
  92. package/dist/api/resources/sources/client/Client.js +6 -6
  93. package/dist/api/resources/sources/resources/files/client/Client.js +3 -3
  94. package/dist/api/resources/sources/resources/passages/client/Client.js +1 -1
  95. package/dist/api/resources/steps/client/Client.js +2 -2
  96. package/dist/api/resources/tag/client/Client.js +1 -1
  97. package/dist/api/resources/templates/client/Client.js +1 -1
  98. package/dist/api/resources/tools/client/Client.js +11 -11
  99. package/dist/api/types/ActionParametersModel.d.ts +1 -0
  100. package/dist/api/types/ActionResponseModel.d.ts +1 -0
  101. package/dist/api/types/AppAuthSchemeAuthMode.d.ts +2 -1
  102. package/dist/api/types/AppAuthSchemeAuthMode.js +1 -0
  103. package/dist/api/types/Identity.d.ts +18 -0
  104. package/dist/api/types/Identity.js +5 -0
  105. package/dist/api/types/IdentityCreate.d.ts +16 -0
  106. package/dist/api/types/IdentityCreate.js +5 -0
  107. package/dist/api/types/IdentityType.d.ts +12 -0
  108. package/dist/api/types/IdentityType.js +11 -0
  109. package/dist/api/types/index.d.ts +3 -0
  110. package/dist/api/types/index.js +3 -0
  111. package/dist/serialization/resources/agents/client/requests/CreateAgentRequest.d.ts +1 -1
  112. package/dist/serialization/resources/identities/client/index.d.ts +2 -0
  113. package/dist/serialization/resources/identities/client/index.js +41 -0
  114. package/dist/serialization/resources/identities/client/listIdentities.d.ts +11 -0
  115. package/dist/serialization/resources/identities/client/listIdentities.js +42 -0
  116. package/dist/serialization/resources/identities/client/requests/IdentityUpdate.d.ts +15 -0
  117. package/dist/serialization/resources/identities/client/requests/IdentityUpdate.js +46 -0
  118. package/dist/serialization/resources/identities/client/requests/index.d.ts +1 -0
  119. package/dist/serialization/resources/identities/client/requests/index.js +5 -0
  120. package/dist/serialization/resources/identities/index.d.ts +1 -0
  121. package/dist/serialization/resources/identities/index.js +17 -0
  122. package/dist/serialization/resources/index.d.ts +2 -0
  123. package/dist/serialization/resources/index.js +3 -1
  124. package/dist/serialization/types/ActionParametersModel.d.ts +1 -0
  125. package/dist/serialization/types/ActionParametersModel.js +1 -0
  126. package/dist/serialization/types/ActionResponseModel.d.ts +1 -0
  127. package/dist/serialization/types/ActionResponseModel.js +1 -0
  128. package/dist/serialization/types/AppAuthSchemeAuthMode.d.ts +1 -1
  129. package/dist/serialization/types/AppAuthSchemeAuthMode.js +1 -1
  130. package/dist/serialization/types/Identity.d.ts +19 -0
  131. package/dist/serialization/types/Identity.js +50 -0
  132. package/dist/serialization/types/IdentityCreate.d.ts +17 -0
  133. package/dist/serialization/types/IdentityCreate.js +48 -0
  134. package/dist/serialization/types/IdentityType.d.ts +10 -0
  135. package/dist/serialization/types/IdentityType.js +41 -0
  136. package/dist/serialization/types/index.d.ts +3 -0
  137. package/dist/serialization/types/index.js +3 -0
  138. package/dist/version.d.ts +1 -1
  139. package/dist/version.js +1 -1
  140. package/package.json +1 -1
  141. package/reference.md +340 -0
  142. package/serialization/resources/agents/client/requests/CreateAgentRequest.d.ts +1 -1
  143. package/serialization/resources/identities/client/index.d.ts +2 -0
  144. package/serialization/resources/identities/client/index.js +41 -0
  145. package/serialization/resources/identities/client/listIdentities.d.ts +11 -0
  146. package/serialization/resources/identities/client/listIdentities.js +42 -0
  147. package/serialization/resources/identities/client/requests/IdentityUpdate.d.ts +15 -0
  148. package/serialization/resources/identities/client/requests/IdentityUpdate.js +46 -0
  149. package/serialization/resources/identities/client/requests/index.d.ts +1 -0
  150. package/serialization/resources/identities/client/requests/index.js +5 -0
  151. package/serialization/resources/identities/index.d.ts +1 -0
  152. package/serialization/resources/identities/index.js +17 -0
  153. package/serialization/resources/index.d.ts +2 -0
  154. package/serialization/resources/index.js +3 -1
  155. package/serialization/types/ActionParametersModel.d.ts +1 -0
  156. package/serialization/types/ActionParametersModel.js +1 -0
  157. package/serialization/types/ActionResponseModel.d.ts +1 -0
  158. package/serialization/types/ActionResponseModel.js +1 -0
  159. package/serialization/types/AppAuthSchemeAuthMode.d.ts +1 -1
  160. package/serialization/types/AppAuthSchemeAuthMode.js +1 -1
  161. package/serialization/types/Identity.d.ts +19 -0
  162. package/serialization/types/Identity.js +50 -0
  163. package/serialization/types/IdentityCreate.d.ts +17 -0
  164. package/serialization/types/IdentityCreate.js +48 -0
  165. package/serialization/types/IdentityType.d.ts +10 -0
  166. package/serialization/types/IdentityType.js +41 -0
  167. package/serialization/types/index.d.ts +3 -0
  168. package/serialization/types/index.js +3 -0
  169. package/version.d.ts +1 -1
  170. package/version.js +1 -1
@@ -0,0 +1,484 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
39
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
40
+ return new (P || (P = Promise))(function (resolve, reject) {
41
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
42
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
43
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
44
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
45
+ });
46
+ };
47
+ var __importDefault = (this && this.__importDefault) || function (mod) {
48
+ return (mod && mod.__esModule) ? mod : { "default": mod };
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.Identities = void 0;
52
+ const environments = __importStar(require("../../../../environments"));
53
+ const core = __importStar(require("../../../../core"));
54
+ const Letta = __importStar(require("../../../index"));
55
+ const url_join_1 = __importDefault(require("url-join"));
56
+ const serializers = __importStar(require("../../../../serialization/index"));
57
+ const errors = __importStar(require("../../../../errors/index"));
58
+ class Identities {
59
+ constructor(_options = {}) {
60
+ this._options = _options;
61
+ }
62
+ /**
63
+ * Get a list of all identities in the database
64
+ *
65
+ * @param {Letta.ListIdentitiesRequest} request
66
+ * @param {Identities.RequestOptions} requestOptions - Request-specific configuration.
67
+ *
68
+ * @throws {@link Letta.UnprocessableEntityError}
69
+ *
70
+ * @example
71
+ * await client.identities.listIdentities()
72
+ */
73
+ listIdentities() {
74
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
75
+ var _a, _b, _c;
76
+ const { name, projectId, identityType, before, after, limit } = request;
77
+ const _queryParams = {};
78
+ if (name != null) {
79
+ _queryParams["name"] = name;
80
+ }
81
+ if (projectId != null) {
82
+ _queryParams["project_id"] = projectId;
83
+ }
84
+ if (identityType != null) {
85
+ _queryParams["identity_type"] = identityType;
86
+ }
87
+ if (before != null) {
88
+ _queryParams["before"] = before;
89
+ }
90
+ if (after != null) {
91
+ _queryParams["after"] = after;
92
+ }
93
+ if (limit != null) {
94
+ _queryParams["limit"] = limit.toString();
95
+ }
96
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
97
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, "v1/identities/"),
98
+ method: "GET",
99
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.34", "User-Agent": "@letta-ai/letta-client/0.1.34", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
100
+ contentType: "application/json",
101
+ queryParameters: _queryParams,
102
+ requestType: "json",
103
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
104
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
105
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
106
+ });
107
+ if (_response.ok) {
108
+ return serializers.identities.listIdentities.Response.parseOrThrow(_response.body, {
109
+ unrecognizedObjectKeys: "passthrough",
110
+ allowUnrecognizedUnionMembers: true,
111
+ allowUnrecognizedEnumValues: true,
112
+ skipValidation: true,
113
+ breadcrumbsPrefix: ["response"],
114
+ });
115
+ }
116
+ if (_response.error.reason === "status-code") {
117
+ switch (_response.error.statusCode) {
118
+ case 422:
119
+ throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
120
+ unrecognizedObjectKeys: "passthrough",
121
+ allowUnrecognizedUnionMembers: true,
122
+ allowUnrecognizedEnumValues: true,
123
+ skipValidation: true,
124
+ breadcrumbsPrefix: ["response"],
125
+ }));
126
+ default:
127
+ throw new errors.LettaError({
128
+ statusCode: _response.error.statusCode,
129
+ body: _response.error.body,
130
+ });
131
+ }
132
+ }
133
+ switch (_response.error.reason) {
134
+ case "non-json":
135
+ throw new errors.LettaError({
136
+ statusCode: _response.error.statusCode,
137
+ body: _response.error.rawBody,
138
+ });
139
+ case "timeout":
140
+ throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/identities/.");
141
+ case "unknown":
142
+ throw new errors.LettaError({
143
+ message: _response.error.errorMessage,
144
+ });
145
+ }
146
+ });
147
+ }
148
+ /**
149
+ * @param {Letta.CreateIdentityRequest} request
150
+ * @param {Identities.RequestOptions} requestOptions - Request-specific configuration.
151
+ *
152
+ * @throws {@link Letta.UnprocessableEntityError}
153
+ *
154
+ * @example
155
+ * await client.identities.createIdentity({
156
+ * body: {
157
+ * identifierKey: "identifier_key",
158
+ * name: "name",
159
+ * identityType: "org"
160
+ * }
161
+ * })
162
+ */
163
+ createIdentity(request, requestOptions) {
164
+ return __awaiter(this, void 0, void 0, function* () {
165
+ var _a, _b, _c;
166
+ const { projectSlug, body: _body } = request;
167
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
168
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, "v1/identities/"),
169
+ method: "POST",
170
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.34", "User-Agent": "@letta-ai/letta-client/0.1.34", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "project-slug": projectSlug != null ? projectSlug : undefined }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
171
+ contentType: "application/json",
172
+ requestType: "json",
173
+ body: serializers.IdentityCreate.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }),
174
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
175
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
176
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
177
+ });
178
+ if (_response.ok) {
179
+ return serializers.Identity.parseOrThrow(_response.body, {
180
+ unrecognizedObjectKeys: "passthrough",
181
+ allowUnrecognizedUnionMembers: true,
182
+ allowUnrecognizedEnumValues: true,
183
+ skipValidation: true,
184
+ breadcrumbsPrefix: ["response"],
185
+ });
186
+ }
187
+ if (_response.error.reason === "status-code") {
188
+ switch (_response.error.statusCode) {
189
+ case 422:
190
+ throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
191
+ unrecognizedObjectKeys: "passthrough",
192
+ allowUnrecognizedUnionMembers: true,
193
+ allowUnrecognizedEnumValues: true,
194
+ skipValidation: true,
195
+ breadcrumbsPrefix: ["response"],
196
+ }));
197
+ default:
198
+ throw new errors.LettaError({
199
+ statusCode: _response.error.statusCode,
200
+ body: _response.error.body,
201
+ });
202
+ }
203
+ }
204
+ switch (_response.error.reason) {
205
+ case "non-json":
206
+ throw new errors.LettaError({
207
+ statusCode: _response.error.statusCode,
208
+ body: _response.error.rawBody,
209
+ });
210
+ case "timeout":
211
+ throw new errors.LettaTimeoutError("Timeout exceeded when calling POST /v1/identities/.");
212
+ case "unknown":
213
+ throw new errors.LettaError({
214
+ message: _response.error.errorMessage,
215
+ });
216
+ }
217
+ });
218
+ }
219
+ /**
220
+ * @param {Letta.UpsertIdentityRequest} request
221
+ * @param {Identities.RequestOptions} requestOptions - Request-specific configuration.
222
+ *
223
+ * @throws {@link Letta.UnprocessableEntityError}
224
+ *
225
+ * @example
226
+ * await client.identities.upsertIdentity({
227
+ * body: {
228
+ * identifierKey: "identifier_key",
229
+ * name: "name",
230
+ * identityType: "org"
231
+ * }
232
+ * })
233
+ */
234
+ upsertIdentity(request, requestOptions) {
235
+ return __awaiter(this, void 0, void 0, function* () {
236
+ var _a, _b, _c;
237
+ const { projectSlug, body: _body } = request;
238
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
239
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, "v1/identities/"),
240
+ method: "PUT",
241
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.34", "User-Agent": "@letta-ai/letta-client/0.1.34", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "project-slug": projectSlug != null ? projectSlug : undefined }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
242
+ contentType: "application/json",
243
+ requestType: "json",
244
+ body: serializers.IdentityCreate.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }),
245
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
246
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
247
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
248
+ });
249
+ if (_response.ok) {
250
+ return serializers.Identity.parseOrThrow(_response.body, {
251
+ unrecognizedObjectKeys: "passthrough",
252
+ allowUnrecognizedUnionMembers: true,
253
+ allowUnrecognizedEnumValues: true,
254
+ skipValidation: true,
255
+ breadcrumbsPrefix: ["response"],
256
+ });
257
+ }
258
+ if (_response.error.reason === "status-code") {
259
+ switch (_response.error.statusCode) {
260
+ case 422:
261
+ throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
262
+ unrecognizedObjectKeys: "passthrough",
263
+ allowUnrecognizedUnionMembers: true,
264
+ allowUnrecognizedEnumValues: true,
265
+ skipValidation: true,
266
+ breadcrumbsPrefix: ["response"],
267
+ }));
268
+ default:
269
+ throw new errors.LettaError({
270
+ statusCode: _response.error.statusCode,
271
+ body: _response.error.body,
272
+ });
273
+ }
274
+ }
275
+ switch (_response.error.reason) {
276
+ case "non-json":
277
+ throw new errors.LettaError({
278
+ statusCode: _response.error.statusCode,
279
+ body: _response.error.rawBody,
280
+ });
281
+ case "timeout":
282
+ throw new errors.LettaTimeoutError("Timeout exceeded when calling PUT /v1/identities/.");
283
+ case "unknown":
284
+ throw new errors.LettaError({
285
+ message: _response.error.errorMessage,
286
+ });
287
+ }
288
+ });
289
+ }
290
+ /**
291
+ * @param {string} identifierKey
292
+ * @param {Identities.RequestOptions} requestOptions - Request-specific configuration.
293
+ *
294
+ * @throws {@link Letta.UnprocessableEntityError}
295
+ *
296
+ * @example
297
+ * await client.identities.getIdentityFromIdentifierKey("identifier_key")
298
+ */
299
+ getIdentityFromIdentifierKey(identifierKey, requestOptions) {
300
+ return __awaiter(this, void 0, void 0, function* () {
301
+ var _a, _b, _c;
302
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
303
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/identities/${encodeURIComponent(identifierKey)}`),
304
+ method: "GET",
305
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.34", "User-Agent": "@letta-ai/letta-client/0.1.34", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
306
+ contentType: "application/json",
307
+ requestType: "json",
308
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
309
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
310
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
311
+ });
312
+ if (_response.ok) {
313
+ return serializers.Identity.parseOrThrow(_response.body, {
314
+ unrecognizedObjectKeys: "passthrough",
315
+ allowUnrecognizedUnionMembers: true,
316
+ allowUnrecognizedEnumValues: true,
317
+ skipValidation: true,
318
+ breadcrumbsPrefix: ["response"],
319
+ });
320
+ }
321
+ if (_response.error.reason === "status-code") {
322
+ switch (_response.error.statusCode) {
323
+ case 422:
324
+ throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
325
+ unrecognizedObjectKeys: "passthrough",
326
+ allowUnrecognizedUnionMembers: true,
327
+ allowUnrecognizedEnumValues: true,
328
+ skipValidation: true,
329
+ breadcrumbsPrefix: ["response"],
330
+ }));
331
+ default:
332
+ throw new errors.LettaError({
333
+ statusCode: _response.error.statusCode,
334
+ body: _response.error.body,
335
+ });
336
+ }
337
+ }
338
+ switch (_response.error.reason) {
339
+ case "non-json":
340
+ throw new errors.LettaError({
341
+ statusCode: _response.error.statusCode,
342
+ body: _response.error.rawBody,
343
+ });
344
+ case "timeout":
345
+ throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/identities/{identifier_key}.");
346
+ case "unknown":
347
+ throw new errors.LettaError({
348
+ message: _response.error.errorMessage,
349
+ });
350
+ }
351
+ });
352
+ }
353
+ /**
354
+ * Delete an identity by its identifier key
355
+ *
356
+ * @param {string} identifierKey
357
+ * @param {Identities.RequestOptions} requestOptions - Request-specific configuration.
358
+ *
359
+ * @throws {@link Letta.UnprocessableEntityError}
360
+ *
361
+ * @example
362
+ * await client.identities.deleteIdentity("identifier_key")
363
+ */
364
+ deleteIdentity(identifierKey, requestOptions) {
365
+ return __awaiter(this, void 0, void 0, function* () {
366
+ var _a, _b, _c;
367
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
368
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/identities/${encodeURIComponent(identifierKey)}`),
369
+ method: "DELETE",
370
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.34", "User-Agent": "@letta-ai/letta-client/0.1.34", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
371
+ contentType: "application/json",
372
+ requestType: "json",
373
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
374
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
375
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
376
+ });
377
+ if (_response.ok) {
378
+ return _response.body;
379
+ }
380
+ if (_response.error.reason === "status-code") {
381
+ switch (_response.error.statusCode) {
382
+ case 422:
383
+ throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
384
+ unrecognizedObjectKeys: "passthrough",
385
+ allowUnrecognizedUnionMembers: true,
386
+ allowUnrecognizedEnumValues: true,
387
+ skipValidation: true,
388
+ breadcrumbsPrefix: ["response"],
389
+ }));
390
+ default:
391
+ throw new errors.LettaError({
392
+ statusCode: _response.error.statusCode,
393
+ body: _response.error.body,
394
+ });
395
+ }
396
+ }
397
+ switch (_response.error.reason) {
398
+ case "non-json":
399
+ throw new errors.LettaError({
400
+ statusCode: _response.error.statusCode,
401
+ body: _response.error.rawBody,
402
+ });
403
+ case "timeout":
404
+ throw new errors.LettaTimeoutError("Timeout exceeded when calling DELETE /v1/identities/{identifier_key}.");
405
+ case "unknown":
406
+ throw new errors.LettaError({
407
+ message: _response.error.errorMessage,
408
+ });
409
+ }
410
+ });
411
+ }
412
+ /**
413
+ * @param {string} identifierKey
414
+ * @param {Letta.IdentityUpdate} request
415
+ * @param {Identities.RequestOptions} requestOptions - Request-specific configuration.
416
+ *
417
+ * @throws {@link Letta.UnprocessableEntityError}
418
+ *
419
+ * @example
420
+ * await client.identities.updateIdentity("identifier_key")
421
+ */
422
+ updateIdentity(identifierKey_1) {
423
+ return __awaiter(this, arguments, void 0, function* (identifierKey, request = {}, requestOptions) {
424
+ var _a, _b, _c;
425
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
426
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/identities/${encodeURIComponent(identifierKey)}`),
427
+ method: "PATCH",
428
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.34", "User-Agent": "@letta-ai/letta-client/0.1.34", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
429
+ contentType: "application/json",
430
+ requestType: "json",
431
+ body: serializers.IdentityUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
432
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
433
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
434
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
435
+ });
436
+ if (_response.ok) {
437
+ return serializers.Identity.parseOrThrow(_response.body, {
438
+ unrecognizedObjectKeys: "passthrough",
439
+ allowUnrecognizedUnionMembers: true,
440
+ allowUnrecognizedEnumValues: true,
441
+ skipValidation: true,
442
+ breadcrumbsPrefix: ["response"],
443
+ });
444
+ }
445
+ if (_response.error.reason === "status-code") {
446
+ switch (_response.error.statusCode) {
447
+ case 422:
448
+ throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
449
+ unrecognizedObjectKeys: "passthrough",
450
+ allowUnrecognizedUnionMembers: true,
451
+ allowUnrecognizedEnumValues: true,
452
+ skipValidation: true,
453
+ breadcrumbsPrefix: ["response"],
454
+ }));
455
+ default:
456
+ throw new errors.LettaError({
457
+ statusCode: _response.error.statusCode,
458
+ body: _response.error.body,
459
+ });
460
+ }
461
+ }
462
+ switch (_response.error.reason) {
463
+ case "non-json":
464
+ throw new errors.LettaError({
465
+ statusCode: _response.error.statusCode,
466
+ body: _response.error.rawBody,
467
+ });
468
+ case "timeout":
469
+ throw new errors.LettaTimeoutError("Timeout exceeded when calling PATCH /v1/identities/{identifier_key}.");
470
+ case "unknown":
471
+ throw new errors.LettaError({
472
+ message: _response.error.errorMessage,
473
+ });
474
+ }
475
+ });
476
+ }
477
+ _getCustomAuthorizationHeaders() {
478
+ return __awaiter(this, void 0, void 0, function* () {
479
+ const tokenValue = yield core.Supplier.get(this._options.token);
480
+ return { Authorization: `Bearer ${tokenValue}` };
481
+ });
482
+ }
483
+ }
484
+ exports.Identities = Identities;
@@ -0,0 +1 @@
1
+ export * from "./requests";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests"), exports);
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Letta from "../../../../index";
5
+ /**
6
+ * @example
7
+ * {
8
+ * body: {
9
+ * identifierKey: "identifier_key",
10
+ * name: "name",
11
+ * identityType: "org"
12
+ * }
13
+ * }
14
+ */
15
+ export interface CreateIdentityRequest {
16
+ projectSlug?: string;
17
+ body: Letta.IdentityCreate;
18
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Letta from "../../../../index";
5
+ /**
6
+ * @example
7
+ * {}
8
+ */
9
+ export interface IdentityUpdate {
10
+ /** The name of the identity. */
11
+ name?: string;
12
+ /** The type of the identity. */
13
+ identityType?: Letta.IdentityType;
14
+ /** The agent ids that are associated with the identity. */
15
+ agentIds?: string[];
16
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Letta from "../../../../index";
5
+ /**
6
+ * @example
7
+ * {}
8
+ */
9
+ export interface ListIdentitiesRequest {
10
+ name?: string;
11
+ projectId?: string;
12
+ identityType?: Letta.IdentityType;
13
+ before?: string;
14
+ after?: string;
15
+ limit?: number;
16
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Letta from "../../../../index";
5
+ /**
6
+ * @example
7
+ * {
8
+ * body: {
9
+ * identifierKey: "identifier_key",
10
+ * name: "name",
11
+ * identityType: "org"
12
+ * }
13
+ * }
14
+ */
15
+ export interface UpsertIdentityRequest {
16
+ projectSlug?: string;
17
+ body: Letta.IdentityCreate;
18
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export { type ListIdentitiesRequest } from "./ListIdentitiesRequest";
2
+ export { type CreateIdentityRequest } from "./CreateIdentityRequest";
3
+ export { type UpsertIdentityRequest } from "./UpsertIdentityRequest";
4
+ export { type IdentityUpdate } from "./IdentityUpdate";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./client";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client"), exports);
@@ -4,6 +4,7 @@ export * as templates from "./templates";
4
4
  export * from "./templates/types";
5
5
  export * as tools from "./tools";
6
6
  export * as sources from "./sources";
7
+ export * as identities from "./identities";
7
8
  export * as models from "./models";
8
9
  export * as blocks from "./blocks";
9
10
  export * as jobs from "./jobs";
@@ -15,6 +16,7 @@ export * as tag from "./tag";
15
16
  export * from "./tools/client/requests";
16
17
  export * from "./sources/client/requests";
17
18
  export * from "./agents/client/requests";
19
+ export * from "./identities/client/requests";
18
20
  export * from "./blocks/client/requests";
19
21
  export * from "./jobs/client/requests";
20
22
  export * from "./providers/client/requests";