@applica-software-guru/persona-sdk 0.1.3 → 0.1.4
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 +49 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -201,6 +201,54 @@ const mission = await missionsApi.create({ name: 'My Mission' });
|
|
|
201
201
|
await missionsApi.execute(mission.id);
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
+
### Billing
|
|
205
|
+
|
|
206
|
+
The `BillingClient` manages customers, subscriptions, credits and invoices. It uses a separate base URL and can be instantiated directly or via `PersonaSdk`.
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
import { BillingClient } from '@applica-software-guru/persona-sdk';
|
|
210
|
+
|
|
211
|
+
// Standalone usage
|
|
212
|
+
const billing = new BillingClient('https://persona.applica.guru/billing', 'your-api-key');
|
|
213
|
+
|
|
214
|
+
// Or via PersonaSdk
|
|
215
|
+
const billing = sdk.billing('your-api-key');
|
|
216
|
+
|
|
217
|
+
// Customer management
|
|
218
|
+
const customer = await billing.createCustomer({
|
|
219
|
+
owner: 'user-123',
|
|
220
|
+
name: 'Acme Corp',
|
|
221
|
+
email: 'billing@acme.com',
|
|
222
|
+
});
|
|
223
|
+
const existing = await billing.getCustomer('user-123');
|
|
224
|
+
await billing.updateCustomer('user-123', { name: 'Acme Inc.' });
|
|
225
|
+
await billing.deleteCustomer('user-123');
|
|
226
|
+
|
|
227
|
+
// Subscription management
|
|
228
|
+
const subscription = await billing.createSubscription({ owner: 'user-123' });
|
|
229
|
+
const current = await billing.getSubscription('user-123');
|
|
230
|
+
await billing.cancelSubscription('user-123');
|
|
231
|
+
|
|
232
|
+
// Plan changes
|
|
233
|
+
await billing.beginUpgrade('user-123', { toPlanType: 'pro' });
|
|
234
|
+
await billing.downgrade('user-123', { toPlanType: 'starter' });
|
|
235
|
+
await billing.mentorize('user-123', { endDate: '2026-12-31' });
|
|
236
|
+
|
|
237
|
+
// Credits
|
|
238
|
+
await billing.addCredits('user-123', 100);
|
|
239
|
+
await billing.useCredits('user-123', 10, ['chat', 'voice'], 'reference-id');
|
|
240
|
+
const credits = await billing.getCredits('user-123');
|
|
241
|
+
const valid = await billing.isValid('user-123');
|
|
242
|
+
|
|
243
|
+
// Invoices
|
|
244
|
+
const invoices = await billing.listInvoices('user-123', '2026-01-01', '2026-12-31');
|
|
245
|
+
|
|
246
|
+
// Project-level billing
|
|
247
|
+
const projectSub = await billing.getProjectSubscription('project-id');
|
|
248
|
+
await billing.changeProjectSubscriptionPlan('project-id', { toPlanType: 'pro' });
|
|
249
|
+
await billing.addProjectSubscriptionCredits('project-id', { credits: 50 });
|
|
250
|
+
```
|
|
251
|
+
|
|
204
252
|
## Error Handling
|
|
205
253
|
|
|
206
254
|
```typescript
|
|
@@ -235,6 +283,7 @@ try {
|
|
|
235
283
|
| **FeatureTemplatesApi** | `list`, `get`, `create`, `update`, `patch`, `remove`, `getMcpAvailableTools` |
|
|
236
284
|
| **MissionsApi** | `list`, `get`, `create`, `update`, `remove`, `generate`, `execute`, `retry`, `replan`, `sendInstruction`, `stop`, `resume` |
|
|
237
285
|
| **ServicePricesApi** | `list`, `get`, `create`, `update`, `remove` |
|
|
286
|
+
| **BillingClient** | `createCustomer`, `updateCustomer`, `getCustomer`, `saveCustomer`, `deleteCustomer`, `createSubscription`, `getSubscription`, `cancelSubscription`, `beginUpgrade`, `downgrade`, `mentorize`, `addCredits`, `useCredits`, `getCredits`, `isValid`, `listInvoices`, `getProjectSubscription`, `changeProjectSubscriptionPlan`, `addProjectSubscriptionCredits` |
|
|
238
287
|
|
|
239
288
|
## Compatibility
|
|
240
289
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@applica-software-guru/persona-sdk",
|
|
3
3
|
"description": "Official TypeScript SDK for the Persona API — manage agents, sessions, projects, knowledge bases, workflows, triggers and more.",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.4",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"dev": "vite",
|