@motif-ai/sdk 0.1.0
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/LICENSE +26 -0
- package/README.md +127 -0
- package/dist/index.cjs +501 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8645 -0
- package/dist/index.d.ts +8645 -0
- package/dist/index.js +450 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Copyright (c) 2025 Motif, Inc. All rights reserved.
|
|
2
|
+
|
|
3
|
+
This software is provided under the Motif SDK License Agreement.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted to any person obtaining a copy of this
|
|
6
|
+
software and associated documentation files (the "Software"), to use
|
|
7
|
+
the Software solely for the purpose of integrating with the Motif API
|
|
8
|
+
in accordance with the Motif Terms of Service.
|
|
9
|
+
|
|
10
|
+
The following restrictions apply:
|
|
11
|
+
|
|
12
|
+
1. You may not modify, merge, publish, distribute, sublicense, or sell
|
|
13
|
+
copies of the Software.
|
|
14
|
+
|
|
15
|
+
2. You may not reverse engineer, decompile, or disassemble the Software.
|
|
16
|
+
|
|
17
|
+
3. You may not use the Software for any purpose other than integrating
|
|
18
|
+
with the Motif API.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
21
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
23
|
+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
25
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
26
|
+
DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# @motif-ai/sdk
|
|
2
|
+
|
|
3
|
+
Official TypeScript SDK for the Motif API. Manage users, investor profiling questionnaires, and personalized investment strategies.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @motif-ai/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { createClient } from '@motif-ai/sdk'
|
|
15
|
+
|
|
16
|
+
const client = createClient({
|
|
17
|
+
apiKey: process.env.MOTIF_API_KEY!,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
// Create a user
|
|
21
|
+
const user = await client.users.create({
|
|
22
|
+
email: 'jane@example.com',
|
|
23
|
+
name: 'Jane Doe',
|
|
24
|
+
externalId: 'your_internal_id_123',
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// List users
|
|
28
|
+
const { data: users } = await client.users.list({ limit: 10 })
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## User-Scoped Operations
|
|
32
|
+
|
|
33
|
+
Operations like profiling and strategy recommendations are scoped to a specific user:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
const userClient = client.forUser(user.id)
|
|
37
|
+
|
|
38
|
+
// Get profiling questions
|
|
39
|
+
const questions = await userClient.profile.getQuestions({ type: 'Basic' })
|
|
40
|
+
|
|
41
|
+
// Save an answer
|
|
42
|
+
await userClient.profile.saveAnswer({
|
|
43
|
+
questionId: questions[0].id,
|
|
44
|
+
answer: 'Growth',
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
// Compute investor profile from answers
|
|
48
|
+
const profile = await userClient.profile.computeInvestorProfile()
|
|
49
|
+
|
|
50
|
+
// Get recommended investment strategy
|
|
51
|
+
const strategy = await userClient.strategies.getRecommended()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Configuration
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
const client = createClient({
|
|
58
|
+
apiKey: 'pk_live_...', // Required
|
|
59
|
+
baseURL: 'https://api.motifapp.ai/api', // Optional (default)
|
|
60
|
+
timeout: 30000, // Optional, ms (default: 30000)
|
|
61
|
+
headers: { 'x-custom': 'value' }, // Optional extra headers
|
|
62
|
+
})
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## API Reference
|
|
66
|
+
|
|
67
|
+
### `createClient(config)`
|
|
68
|
+
|
|
69
|
+
Returns a client with the following namespaces:
|
|
70
|
+
|
|
71
|
+
#### `client.users`
|
|
72
|
+
|
|
73
|
+
| Method | Description |
|
|
74
|
+
| ----------------------------- | -------------------------- |
|
|
75
|
+
| `create(data)` | Create a new user |
|
|
76
|
+
| `list(params?)` | List users with pagination |
|
|
77
|
+
| `get(id)` | Get user by ID |
|
|
78
|
+
| `update(id, data)` | Update user |
|
|
79
|
+
| `delete(id)` | Delete user |
|
|
80
|
+
| `getByExternalId(externalId)` | Get user by external ID |
|
|
81
|
+
|
|
82
|
+
#### `client.forUser(userId)`
|
|
83
|
+
|
|
84
|
+
Returns a user-scoped client with:
|
|
85
|
+
|
|
86
|
+
**`profile`**
|
|
87
|
+
|
|
88
|
+
| Method | Description |
|
|
89
|
+
| ------------------------------- | ------------------------------- |
|
|
90
|
+
| `getQuestions(params)` | Get profiling questions by tier |
|
|
91
|
+
| `saveAnswer(data)` | Save a profiling answer |
|
|
92
|
+
| `getAnswers()` | Get all answers |
|
|
93
|
+
| `getInvestorProfile()` | Get computed investor profile |
|
|
94
|
+
| `computeInvestorProfile(data?)` | Compute/refresh profile |
|
|
95
|
+
| `getCompletion(params)` | Check profiling completion |
|
|
96
|
+
|
|
97
|
+
**`strategies`**
|
|
98
|
+
|
|
99
|
+
| Method | Description |
|
|
100
|
+
| ------------------ | ---------------------------- |
|
|
101
|
+
| `getRecommended()` | Get recommended strategy |
|
|
102
|
+
| `generate(data?)` | Generate AI-powered strategy |
|
|
103
|
+
|
|
104
|
+
## Error Handling
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { createClient, MotifSDKError } from '@motif-ai/sdk'
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
const user = await client.users.get('invalid_id')
|
|
111
|
+
} catch (error) {
|
|
112
|
+
if (error instanceof MotifSDKError) {
|
|
113
|
+
console.error(error.message) // Human-readable message
|
|
114
|
+
console.error(error.statusCode) // HTTP status (e.g. 404)
|
|
115
|
+
console.error(error.response) // Raw response body
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Requirements
|
|
121
|
+
|
|
122
|
+
- Node.js >= 18
|
|
123
|
+
- TypeScript >= 5.0 (optional, for type checking)
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
Proprietary — see [LICENSE](./LICENSE). Use is permitted solely for integrating with the Motif API.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
AdminApiKeysCreateBodyEnvironment: () => AdminApiKeysCreateBodyEnvironment,
|
|
34
|
+
AdminConfigUpdateInvestmentConfigBodyConfigDexRouteOrder: () => AdminConfigUpdateInvestmentConfigBodyConfigDexRouteOrder,
|
|
35
|
+
AdminConfigUpdateInvestmentConfigBodyConfigDexRouteSelectionHierarchyItem: () => AdminConfigUpdateInvestmentConfigBodyConfigDexRouteSelectionHierarchyItem,
|
|
36
|
+
AdminConfigUpdateTransactionConfigBodyConfigRouteSelectionHierarchyItem: () => AdminConfigUpdateTransactionConfigBodyConfigRouteSelectionHierarchyItem,
|
|
37
|
+
AdminOrganizationInviteOrgAdminBodyRole: () => AdminOrganizationInviteOrgAdminBodyRole,
|
|
38
|
+
AdminUserUpdateMemberRoleBodyRole: () => AdminUserUpdateMemberRoleBodyRole,
|
|
39
|
+
MarketDataGetLatestMarketDataProvider: () => MarketDataGetLatestMarketDataProvider,
|
|
40
|
+
MarketDataGetLatestMarketDataResolution: () => MarketDataGetLatestMarketDataResolution,
|
|
41
|
+
MotifSDKError: () => MotifSDKError,
|
|
42
|
+
SdkProfileGetAnswers200ItemTier: () => SdkProfileGetAnswers200ItemTier,
|
|
43
|
+
SdkProfileGetCompletionTier: () => SdkProfileGetCompletionTier,
|
|
44
|
+
SdkProfileGetQuestions200ItemAction: () => SdkProfileGetQuestions200ItemAction,
|
|
45
|
+
SdkProfileGetQuestions200ItemType: () => SdkProfileGetQuestions200ItemType,
|
|
46
|
+
SdkProfileGetQuestionsType: () => SdkProfileGetQuestionsType,
|
|
47
|
+
createClient: () => createClient
|
|
48
|
+
});
|
|
49
|
+
module.exports = __toCommonJS(index_exports);
|
|
50
|
+
|
|
51
|
+
// src/axios-instance.ts
|
|
52
|
+
var import_axios = __toESM(require("axios"), 1);
|
|
53
|
+
var MotifSDKError = class extends Error {
|
|
54
|
+
constructor(message, statusCode, response) {
|
|
55
|
+
super(message);
|
|
56
|
+
this.statusCode = statusCode;
|
|
57
|
+
this.response = response;
|
|
58
|
+
this.name = "MotifSDKError";
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var config = null;
|
|
62
|
+
var configure = (options) => {
|
|
63
|
+
if (!options.apiKey) {
|
|
64
|
+
throw new Error("API key is required");
|
|
65
|
+
}
|
|
66
|
+
config = {
|
|
67
|
+
...options,
|
|
68
|
+
baseURL: options.baseURL || "https://api.motifapp.ai/api",
|
|
69
|
+
timeout: options.timeout || 3e4
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
var customInstance = async (requestConfig) => {
|
|
73
|
+
if (!config) {
|
|
74
|
+
throw new MotifSDKError(
|
|
75
|
+
"Motif SDK not configured. Call configure() first with your API key."
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
const baseURL = config.baseURL;
|
|
79
|
+
let origin;
|
|
80
|
+
let basePath;
|
|
81
|
+
try {
|
|
82
|
+
const parsed = new URL(baseURL);
|
|
83
|
+
origin = parsed.origin;
|
|
84
|
+
basePath = parsed.pathname.replace(/\/+$/, "");
|
|
85
|
+
} catch {
|
|
86
|
+
origin = "";
|
|
87
|
+
basePath = baseURL.replace(/\/+$/, "");
|
|
88
|
+
}
|
|
89
|
+
if (basePath && requestConfig.url) {
|
|
90
|
+
requestConfig.url = `${basePath}${requestConfig.url}`;
|
|
91
|
+
}
|
|
92
|
+
const instance = import_axios.default.create({
|
|
93
|
+
baseURL: origin || void 0,
|
|
94
|
+
timeout: config.timeout,
|
|
95
|
+
headers: {
|
|
96
|
+
"Content-Type": "application/json",
|
|
97
|
+
"x-api-key": config.apiKey,
|
|
98
|
+
...config.headers
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
instance.interceptors.request.use(
|
|
102
|
+
(request) => {
|
|
103
|
+
const isJsonContentType = request.headers?.["Content-Type"] === "application/json";
|
|
104
|
+
const isWriteMethod = ["POST", "PUT", "PATCH"].includes(
|
|
105
|
+
request.method?.toUpperCase() || ""
|
|
106
|
+
);
|
|
107
|
+
if (isJsonContentType && isWriteMethod && request.data === void 0) {
|
|
108
|
+
request.data = {};
|
|
109
|
+
}
|
|
110
|
+
return request;
|
|
111
|
+
},
|
|
112
|
+
(error) => {
|
|
113
|
+
return Promise.reject(error);
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
instance.interceptors.response.use(
|
|
117
|
+
(response) => {
|
|
118
|
+
return response;
|
|
119
|
+
},
|
|
120
|
+
(error) => {
|
|
121
|
+
if (error.response) {
|
|
122
|
+
const message = error.response.data?.message || error.message || "Request failed";
|
|
123
|
+
throw new MotifSDKError(
|
|
124
|
+
message,
|
|
125
|
+
error.response.status,
|
|
126
|
+
error.response.data
|
|
127
|
+
);
|
|
128
|
+
} else if (error.request) {
|
|
129
|
+
throw new MotifSDKError("No response received from server");
|
|
130
|
+
} else {
|
|
131
|
+
throw new MotifSDKError(error.message);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
try {
|
|
136
|
+
const response = await instance.request(requestConfig);
|
|
137
|
+
return response.data;
|
|
138
|
+
} catch (error) {
|
|
139
|
+
if (error instanceof MotifSDKError) {
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
throw new MotifSDKError(
|
|
143
|
+
error instanceof Error ? error.message : "Unknown error"
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// src/generated/sdk/sdk.ts
|
|
149
|
+
var getSdk = () => {
|
|
150
|
+
const sdkUsersCreate = (sdkUsersCreateBody) => {
|
|
151
|
+
return customInstance({
|
|
152
|
+
url: `/v1/sdk/users`,
|
|
153
|
+
method: "POST",
|
|
154
|
+
headers: { "Content-Type": "application/json" },
|
|
155
|
+
data: sdkUsersCreateBody
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
const sdkUsersList = (params) => {
|
|
159
|
+
return customInstance({
|
|
160
|
+
url: `/v1/sdk/users`,
|
|
161
|
+
method: "GET",
|
|
162
|
+
params
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
const sdkUsersGet = (id) => {
|
|
166
|
+
return customInstance({
|
|
167
|
+
url: `/v1/sdk/users/${id}`,
|
|
168
|
+
method: "GET"
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
const sdkUsersUpdate = (id, sdkUsersUpdateBody) => {
|
|
172
|
+
return customInstance({
|
|
173
|
+
url: `/v1/sdk/users/${id}`,
|
|
174
|
+
method: "PATCH",
|
|
175
|
+
headers: { "Content-Type": "application/json" },
|
|
176
|
+
data: sdkUsersUpdateBody
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
const sdkUsersDelete = (id) => {
|
|
180
|
+
return customInstance({
|
|
181
|
+
url: `/v1/sdk/users/${id}`,
|
|
182
|
+
method: "DELETE"
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
const sdkUsersGetByExternalId = (externalId) => {
|
|
186
|
+
return customInstance({
|
|
187
|
+
url: `/v1/sdk/users/external/${externalId}`,
|
|
188
|
+
method: "GET"
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
const sdkProfileGetQuestions = (params) => {
|
|
192
|
+
return customInstance({
|
|
193
|
+
url: `/v1/sdk/profile/questions`,
|
|
194
|
+
method: "GET",
|
|
195
|
+
params
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
const sdkProfileSaveAnswer = (sdkProfileSaveAnswerBody) => {
|
|
199
|
+
return customInstance({
|
|
200
|
+
url: `/v1/sdk/profile/answers`,
|
|
201
|
+
method: "POST",
|
|
202
|
+
headers: { "Content-Type": "application/json" },
|
|
203
|
+
data: sdkProfileSaveAnswerBody
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
const sdkProfileGetAnswers = () => {
|
|
207
|
+
return customInstance({
|
|
208
|
+
url: `/v1/sdk/profile/answers`,
|
|
209
|
+
method: "GET"
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
const sdkProfileGetInvestorProfile = () => {
|
|
213
|
+
return customInstance({
|
|
214
|
+
url: `/v1/sdk/profile/investor-profile`,
|
|
215
|
+
method: "GET"
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
const sdkProfileComputeInvestorProfile = (sdkProfileComputeInvestorProfileBody) => {
|
|
219
|
+
return customInstance({
|
|
220
|
+
url: `/v1/sdk/profile/investor-profile/compute`,
|
|
221
|
+
method: "POST",
|
|
222
|
+
headers: { "Content-Type": "application/json" },
|
|
223
|
+
data: sdkProfileComputeInvestorProfileBody
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
const sdkProfileGetCompletion = (params) => {
|
|
227
|
+
return customInstance({
|
|
228
|
+
url: `/v1/sdk/profile/completion`,
|
|
229
|
+
method: "GET",
|
|
230
|
+
params
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
const sdkStrategiesGetRecommended = () => {
|
|
234
|
+
return customInstance({
|
|
235
|
+
url: `/v1/sdk/strategies/recommended`,
|
|
236
|
+
method: "GET"
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
const sdkStrategiesGenerate = (sdkStrategiesGenerateBody) => {
|
|
240
|
+
return customInstance({
|
|
241
|
+
url: `/v1/sdk/strategies/generate`,
|
|
242
|
+
method: "POST",
|
|
243
|
+
headers: { "Content-Type": "application/json" },
|
|
244
|
+
data: sdkStrategiesGenerateBody
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
return {
|
|
248
|
+
sdkUsersCreate,
|
|
249
|
+
sdkUsersList,
|
|
250
|
+
sdkUsersGet,
|
|
251
|
+
sdkUsersUpdate,
|
|
252
|
+
sdkUsersDelete,
|
|
253
|
+
sdkUsersGetByExternalId,
|
|
254
|
+
sdkProfileGetQuestions,
|
|
255
|
+
sdkProfileSaveAnswer,
|
|
256
|
+
sdkProfileGetAnswers,
|
|
257
|
+
sdkProfileGetInvestorProfile,
|
|
258
|
+
sdkProfileComputeInvestorProfile,
|
|
259
|
+
sdkProfileGetCompletion,
|
|
260
|
+
sdkStrategiesGetRecommended,
|
|
261
|
+
sdkStrategiesGenerate
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// src/generated/models/adminApiKeysCreateBodyEnvironment.ts
|
|
266
|
+
var AdminApiKeysCreateBodyEnvironment = {
|
|
267
|
+
production: "production",
|
|
268
|
+
sandbox: "sandbox"
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
// src/generated/models/adminConfigUpdateInvestmentConfigBodyConfigDexRouteOrder.ts
|
|
272
|
+
var AdminConfigUpdateInvestmentConfigBodyConfigDexRouteOrder = {
|
|
273
|
+
CHEAPEST: "CHEAPEST",
|
|
274
|
+
FASTEST: "FASTEST",
|
|
275
|
+
SAFEST: "SAFEST"
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
// src/generated/models/adminConfigUpdateInvestmentConfigBodyConfigDexRouteSelectionHierarchyItem.ts
|
|
279
|
+
var AdminConfigUpdateInvestmentConfigBodyConfigDexRouteSelectionHierarchyItem = {
|
|
280
|
+
RECOMMENDED: "RECOMMENDED",
|
|
281
|
+
CHEAPEST: "CHEAPEST",
|
|
282
|
+
FASTEST: "FASTEST"
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
// src/generated/models/adminConfigUpdateTransactionConfigBodyConfigRouteSelectionHierarchyItem.ts
|
|
286
|
+
var AdminConfigUpdateTransactionConfigBodyConfigRouteSelectionHierarchyItem = {
|
|
287
|
+
RECOMMENDED: "RECOMMENDED",
|
|
288
|
+
CHEAPEST: "CHEAPEST",
|
|
289
|
+
FASTEST: "FASTEST"
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
// src/generated/models/adminOrganizationInviteOrgAdminBodyRole.ts
|
|
293
|
+
var AdminOrganizationInviteOrgAdminBodyRole = {
|
|
294
|
+
member: "member",
|
|
295
|
+
admin: "admin",
|
|
296
|
+
owner: "owner"
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
// src/generated/models/adminUserUpdateMemberRoleBodyRole.ts
|
|
300
|
+
var AdminUserUpdateMemberRoleBodyRole = {
|
|
301
|
+
member: "member",
|
|
302
|
+
admin: "admin",
|
|
303
|
+
owner: "owner"
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
// src/generated/models/marketDataGetLatestMarketDataProvider.ts
|
|
307
|
+
var MarketDataGetLatestMarketDataProvider = {
|
|
308
|
+
COINMARKETCAP: "COINMARKETCAP",
|
|
309
|
+
LIFI: "LIFI",
|
|
310
|
+
TIINGO: "TIINGO"
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
// src/generated/models/marketDataGetLatestMarketDataResolution.ts
|
|
314
|
+
var MarketDataGetLatestMarketDataResolution = {
|
|
315
|
+
AD_HOC: "AD_HOC",
|
|
316
|
+
FIVE_MIN: "FIVE_MIN",
|
|
317
|
+
FIFTEEN_MIN: "FIFTEEN_MIN",
|
|
318
|
+
ONE_HOUR: "ONE_HOUR",
|
|
319
|
+
ONE_DAY: "ONE_DAY"
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// src/generated/models/sdkProfileGetAnswers200ItemTier.ts
|
|
323
|
+
var SdkProfileGetAnswers200ItemTier = {
|
|
324
|
+
Basic: "Basic",
|
|
325
|
+
Advanced: "Advanced",
|
|
326
|
+
KYC: "KYC"
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
// src/generated/models/sdkProfileGetCompletionTier.ts
|
|
330
|
+
var SdkProfileGetCompletionTier = {
|
|
331
|
+
Basic: "Basic",
|
|
332
|
+
Advanced: "Advanced",
|
|
333
|
+
KYC: "KYC"
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
// src/generated/models/sdkProfileGetQuestions200ItemAction.ts
|
|
337
|
+
var SdkProfileGetQuestions200ItemAction = {
|
|
338
|
+
SingleSelect: "SingleSelect",
|
|
339
|
+
MultiSelect: "MultiSelect",
|
|
340
|
+
Matrix: "Matrix",
|
|
341
|
+
NumberInput: "NumberInput",
|
|
342
|
+
PercentageSlider: "PercentageSlider"
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
// src/generated/models/sdkProfileGetQuestions200ItemType.ts
|
|
346
|
+
var SdkProfileGetQuestions200ItemType = {
|
|
347
|
+
Basic: "Basic",
|
|
348
|
+
Advanced: "Advanced",
|
|
349
|
+
KYC: "KYC"
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
// src/generated/models/sdkProfileGetQuestionsType.ts
|
|
353
|
+
var SdkProfileGetQuestionsType = {
|
|
354
|
+
Basic: "Basic",
|
|
355
|
+
Advanced: "Advanced",
|
|
356
|
+
KYC: "KYC"
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
// src/index.ts
|
|
360
|
+
function createClient(config2) {
|
|
361
|
+
configure(config2);
|
|
362
|
+
const sdk = getSdk();
|
|
363
|
+
return {
|
|
364
|
+
/**
|
|
365
|
+
* User management operations (organization-level)
|
|
366
|
+
*
|
|
367
|
+
* These operations require only an API key and operate at the
|
|
368
|
+
* organization level. Use these to manage end users within your organization.
|
|
369
|
+
*/
|
|
370
|
+
users: {
|
|
371
|
+
/**
|
|
372
|
+
* Create a new end user in the organization
|
|
373
|
+
* @param data - User data (email, name, optional externalId)
|
|
374
|
+
*/
|
|
375
|
+
create: sdk.sdkUsersCreate,
|
|
376
|
+
/**
|
|
377
|
+
* List all users in the organization with pagination
|
|
378
|
+
* @param params - Optional pagination params (limit, cursor)
|
|
379
|
+
*/
|
|
380
|
+
list: sdk.sdkUsersList,
|
|
381
|
+
/**
|
|
382
|
+
* Get a user by their internal Motif ID
|
|
383
|
+
* @param id - User ID
|
|
384
|
+
*/
|
|
385
|
+
get: sdk.sdkUsersGet,
|
|
386
|
+
/**
|
|
387
|
+
* Update user details
|
|
388
|
+
* @param id - User ID
|
|
389
|
+
* @param data - Updated user data
|
|
390
|
+
*/
|
|
391
|
+
update: sdk.sdkUsersUpdate,
|
|
392
|
+
/**
|
|
393
|
+
* Delete a user permanently
|
|
394
|
+
* @param id - User ID
|
|
395
|
+
*/
|
|
396
|
+
delete: sdk.sdkUsersDelete,
|
|
397
|
+
/**
|
|
398
|
+
* Get a user by their external ID (partner-defined identifier)
|
|
399
|
+
* @param externalId - External ID
|
|
400
|
+
*/
|
|
401
|
+
getByExternalId: sdk.sdkUsersGetByExternalId
|
|
402
|
+
},
|
|
403
|
+
/**
|
|
404
|
+
* Create a user-specific client for profile and strategy operations
|
|
405
|
+
*
|
|
406
|
+
* These operations require both an API key and a user context (x-user-id header).
|
|
407
|
+
* Use this method to perform operations on behalf of a specific user.
|
|
408
|
+
*
|
|
409
|
+
* @param userId - The ID of the user to perform operations for
|
|
410
|
+
* @returns User-scoped client with profile and strategies namespaces
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* ```typescript
|
|
414
|
+
* const userClient = client.forUser('user_123')
|
|
415
|
+
* const questions = await userClient.profile.getQuestions({ type: 'Basic' })
|
|
416
|
+
* ```
|
|
417
|
+
*/
|
|
418
|
+
forUser: (userId) => {
|
|
419
|
+
configure({
|
|
420
|
+
...config2,
|
|
421
|
+
headers: {
|
|
422
|
+
...config2.headers,
|
|
423
|
+
"x-user-id": userId
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
const userSdk = getSdk();
|
|
427
|
+
return {
|
|
428
|
+
/**
|
|
429
|
+
* User profiling operations
|
|
430
|
+
*
|
|
431
|
+
* Manage investor profiling questionnaires and computed profiles.
|
|
432
|
+
*/
|
|
433
|
+
profile: {
|
|
434
|
+
/**
|
|
435
|
+
* Get profiling questions for a specific tier
|
|
436
|
+
* @param params - Question type (Basic, Advanced, or KYC)
|
|
437
|
+
*/
|
|
438
|
+
getQuestions: userSdk.sdkProfileGetQuestions,
|
|
439
|
+
/**
|
|
440
|
+
* Save an answer to a profiling question
|
|
441
|
+
* @param data - Question ID and answer
|
|
442
|
+
*/
|
|
443
|
+
saveAnswer: userSdk.sdkProfileSaveAnswer,
|
|
444
|
+
/**
|
|
445
|
+
* Get all profiling answers for the user
|
|
446
|
+
*/
|
|
447
|
+
getAnswers: userSdk.sdkProfileGetAnswers,
|
|
448
|
+
/**
|
|
449
|
+
* Get the computed investor profile
|
|
450
|
+
*/
|
|
451
|
+
getInvestorProfile: userSdk.sdkProfileGetInvestorProfile,
|
|
452
|
+
/**
|
|
453
|
+
* Compute or refresh the investor profile based on current answers
|
|
454
|
+
* @param data - Optional parameters
|
|
455
|
+
*/
|
|
456
|
+
computeInvestorProfile: userSdk.sdkProfileComputeInvestorProfile,
|
|
457
|
+
/**
|
|
458
|
+
* Get profiling completion status for a tier
|
|
459
|
+
* @param params - Tier to check (Basic, Advanced, or KYC)
|
|
460
|
+
*/
|
|
461
|
+
getCompletion: userSdk.sdkProfileGetCompletion
|
|
462
|
+
},
|
|
463
|
+
/**
|
|
464
|
+
* Investment strategy operations
|
|
465
|
+
*
|
|
466
|
+
* Get personalized investment strategy recommendations.
|
|
467
|
+
*/
|
|
468
|
+
strategies: {
|
|
469
|
+
/**
|
|
470
|
+
* Get the recommended investment strategy for the user
|
|
471
|
+
*/
|
|
472
|
+
getRecommended: userSdk.sdkStrategiesGetRecommended,
|
|
473
|
+
/**
|
|
474
|
+
* Generate a new AI-powered investment strategy
|
|
475
|
+
* @param data - Optional generation parameters
|
|
476
|
+
*/
|
|
477
|
+
generate: userSdk.sdkStrategiesGenerate
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
484
|
+
0 && (module.exports = {
|
|
485
|
+
AdminApiKeysCreateBodyEnvironment,
|
|
486
|
+
AdminConfigUpdateInvestmentConfigBodyConfigDexRouteOrder,
|
|
487
|
+
AdminConfigUpdateInvestmentConfigBodyConfigDexRouteSelectionHierarchyItem,
|
|
488
|
+
AdminConfigUpdateTransactionConfigBodyConfigRouteSelectionHierarchyItem,
|
|
489
|
+
AdminOrganizationInviteOrgAdminBodyRole,
|
|
490
|
+
AdminUserUpdateMemberRoleBodyRole,
|
|
491
|
+
MarketDataGetLatestMarketDataProvider,
|
|
492
|
+
MarketDataGetLatestMarketDataResolution,
|
|
493
|
+
MotifSDKError,
|
|
494
|
+
SdkProfileGetAnswers200ItemTier,
|
|
495
|
+
SdkProfileGetCompletionTier,
|
|
496
|
+
SdkProfileGetQuestions200ItemAction,
|
|
497
|
+
SdkProfileGetQuestions200ItemType,
|
|
498
|
+
SdkProfileGetQuestionsType,
|
|
499
|
+
createClient
|
|
500
|
+
});
|
|
501
|
+
//# sourceMappingURL=index.cjs.map
|