@vly-ai/integrations 0.5.2
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 +245 -0
- package/dist/index.d.mts +253 -0
- package/dist/index.d.ts +253 -0
- package/dist/index.js +535 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +529 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# vly-integrations
|
|
2
|
+
|
|
3
|
+
First-order integrations for AI, email, and payments with automatic usage billing through Vly deployment tokens. Built on the AI SDK for reliable, type-safe AI Gateway integration.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install vly-integrations
|
|
9
|
+
# or
|
|
10
|
+
yarn add vly-integrations
|
|
11
|
+
# or
|
|
12
|
+
pnpm add vly-integrations
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
No additional dependencies required! Built with fetch and AI SDK.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { createVlyIntegrations } from 'vly-integrations';
|
|
21
|
+
|
|
22
|
+
const vly = createVlyIntegrations({
|
|
23
|
+
deploymentToken: process.env.VLY_INTEGRATION_KEY, // Uses VLY_INTEGRATION_KEY env var
|
|
24
|
+
debug: false // optional
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// AI Completions via AI Gateway - supports any Vercel AI Gateway model
|
|
28
|
+
const completion = await vly.ai.completion({
|
|
29
|
+
model: 'gpt-5', // Or any model supported by Vercel AI Gateway
|
|
30
|
+
messages: [
|
|
31
|
+
{ role: 'system', content: 'You are a helpful assistant.' },
|
|
32
|
+
{ role: 'user', content: 'Hello!' }
|
|
33
|
+
],
|
|
34
|
+
temperature: 0.7,
|
|
35
|
+
maxTokens: 150
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Streaming completions
|
|
39
|
+
await vly.ai.streamCompletion({
|
|
40
|
+
model: 'claude-opus-4-1',
|
|
41
|
+
messages: [{ role: 'user', content: 'Tell me a story...' }]
|
|
42
|
+
}, (chunk) => {
|
|
43
|
+
process.stdout.write(chunk); // Real-time streaming
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Send Email
|
|
47
|
+
const emailResult = await vly.email.send({
|
|
48
|
+
to: 'user@example.com',
|
|
49
|
+
subject: 'Welcome!',
|
|
50
|
+
html: '<h1>Welcome to our service!</h1>',
|
|
51
|
+
text: 'Welcome to our service!'
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Create Payment Intent
|
|
55
|
+
const paymentIntent = await vly.payments.createPaymentIntent({
|
|
56
|
+
amount: 2000, // $20.00 in cents
|
|
57
|
+
currency: 'usd',
|
|
58
|
+
description: 'Premium subscription',
|
|
59
|
+
customer: {
|
|
60
|
+
email: 'customer@example.com'
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## AI Gateway Integration
|
|
66
|
+
|
|
67
|
+
Powered by the AI SDK with OpenAI-compatible provider for https://ai-gateway.vly.ai
|
|
68
|
+
|
|
69
|
+
### Supported Models
|
|
70
|
+
|
|
71
|
+
The vly-integrations package supports **all models available through the Vercel AI Gateway**. This includes but is not limited to:
|
|
72
|
+
|
|
73
|
+
- **OpenAI Models**: GPT-5, GPT-5 Mini, GPT-5 Nano, GPT-4, GPT-3.5, etc.
|
|
74
|
+
- **Anthropic Claude**: Claude 4 Opus, Claude 4 Sonnet, Claude 3.7, Claude 3.5, Haiku, etc.
|
|
75
|
+
- **Google Models**: Gemini Pro, Gemini Flash, Gemini Ultra, etc.
|
|
76
|
+
- **Meta Models**: Llama models and variants
|
|
77
|
+
- **Mistral Models**: Mistral Large, Medium, Small, etc.
|
|
78
|
+
- **DeepSeek Models**: DeepSeek R1, DeepSeek Thinking, DeepSeek Coder, etc.
|
|
79
|
+
- **Qwen Models**: Qwen Coder and other variants
|
|
80
|
+
- **And many more...**
|
|
81
|
+
|
|
82
|
+
Simply pass any model identifier supported by the Vercel AI Gateway to the `model` parameter.
|
|
83
|
+
|
|
84
|
+
### Direct AI SDK Access
|
|
85
|
+
|
|
86
|
+
For advanced usage, access the AI SDK provider directly:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { generateText, streamText } from 'ai';
|
|
90
|
+
|
|
91
|
+
// Get the provider
|
|
92
|
+
const provider = vly.ai.getProvider();
|
|
93
|
+
const model = provider('gpt-5');
|
|
94
|
+
|
|
95
|
+
// Use with AI SDK directly
|
|
96
|
+
const result = await generateText({
|
|
97
|
+
model,
|
|
98
|
+
messages: [{ role: 'user', content: 'Hello!' }]
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Or streaming
|
|
102
|
+
const stream = await streamText({
|
|
103
|
+
model,
|
|
104
|
+
messages: [{ role: 'user', content: 'Tell me a story' }]
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
for await (const delta of stream.textStream) {
|
|
108
|
+
process.stdout.write(delta);
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## API Reference
|
|
113
|
+
|
|
114
|
+
### AI Integration
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
// Create completion
|
|
118
|
+
vly.ai.completion(request: AICompletionRequest): Promise<ApiResponse<AICompletionResponse>>
|
|
119
|
+
|
|
120
|
+
// Stream completion
|
|
121
|
+
vly.ai.streamCompletion(
|
|
122
|
+
request: AICompletionRequest,
|
|
123
|
+
onChunk: (chunk: string) => void
|
|
124
|
+
): Promise<ApiResponse<AICompletionResponse>>
|
|
125
|
+
|
|
126
|
+
// Get AI SDK provider for direct usage
|
|
127
|
+
vly.ai.getProvider(): OpenAICompatibleProvider
|
|
128
|
+
|
|
129
|
+
// Generate embeddings (limited support)
|
|
130
|
+
vly.ai.embeddings(input: string | string[]): Promise<ApiResponse<{embeddings: number[][]}>>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Email Integration
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
// Send single email
|
|
137
|
+
vly.email.send(email: EmailRequest): Promise<ApiResponse<EmailResponse>>
|
|
138
|
+
|
|
139
|
+
// Send batch emails
|
|
140
|
+
vly.email.sendBatch(emails: EmailRequest[]): Promise<ApiResponse<EmailResponse[]>>
|
|
141
|
+
|
|
142
|
+
// Get email status
|
|
143
|
+
vly.email.getStatus(emailId: string): Promise<ApiResponse<EmailResponse>>
|
|
144
|
+
|
|
145
|
+
// Domain management
|
|
146
|
+
vly.email.verifyDomain(domain: string): Promise<ApiResponse>
|
|
147
|
+
vly.email.listDomains(): Promise<ApiResponse>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Payments Integration
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
// Payment Intents
|
|
154
|
+
vly.payments.createPaymentIntent(intent: PaymentIntent): Promise<ApiResponse<PaymentIntentResponse>>
|
|
155
|
+
vly.payments.confirmPaymentIntent(intentId: string, paymentMethodId: string): Promise<ApiResponse>
|
|
156
|
+
vly.payments.getPaymentIntent(intentId: string): Promise<ApiResponse>
|
|
157
|
+
vly.payments.cancelPaymentIntent(intentId: string): Promise<ApiResponse>
|
|
158
|
+
|
|
159
|
+
// Subscriptions
|
|
160
|
+
vly.payments.createSubscription(subscription: Subscription): Promise<ApiResponse<SubscriptionResponse>>
|
|
161
|
+
vly.payments.updateSubscription(id: string, updates: Partial<Subscription>): Promise<ApiResponse>
|
|
162
|
+
vly.payments.cancelSubscription(id: string, immediately?: boolean): Promise<ApiResponse>
|
|
163
|
+
vly.payments.getSubscription(id: string): Promise<ApiResponse>
|
|
164
|
+
vly.payments.listSubscriptions(customerId?: string): Promise<ApiResponse>
|
|
165
|
+
|
|
166
|
+
// Checkout & Portal
|
|
167
|
+
vly.payments.createCheckoutSession(session: CheckoutSession): Promise<ApiResponse>
|
|
168
|
+
vly.payments.createCustomerPortal(session: CustomerPortalSession): Promise<ApiResponse>
|
|
169
|
+
|
|
170
|
+
// Customer Management
|
|
171
|
+
vly.payments.createCustomer(customer: Customer): Promise<ApiResponse>
|
|
172
|
+
vly.payments.getCustomer(customerId: string): Promise<ApiResponse>
|
|
173
|
+
vly.payments.updateCustomer(customerId: string, updates: CustomerUpdate): Promise<ApiResponse>
|
|
174
|
+
|
|
175
|
+
// Payment Methods
|
|
176
|
+
vly.payments.listPaymentMethods(customerId: string): Promise<ApiResponse>
|
|
177
|
+
vly.payments.attachPaymentMethod(methodId: string, customerId: string): Promise<ApiResponse>
|
|
178
|
+
vly.payments.detachPaymentMethod(methodId: string): Promise<ApiResponse>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Error Handling
|
|
182
|
+
|
|
183
|
+
All methods return an `ApiResponse` object with the following structure:
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
interface ApiResponse<T> {
|
|
187
|
+
success: boolean;
|
|
188
|
+
data?: T;
|
|
189
|
+
error?: string;
|
|
190
|
+
usage?: {
|
|
191
|
+
credits: number;
|
|
192
|
+
operation: string;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Example error handling:
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
const result = await vly.ai.completion({ ... });
|
|
201
|
+
|
|
202
|
+
if (result.success) {
|
|
203
|
+
console.log('Response:', result.data);
|
|
204
|
+
console.log('Credits used:', result.usage?.credits);
|
|
205
|
+
} else {
|
|
206
|
+
console.error('Error:', result.error);
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Configuration
|
|
211
|
+
|
|
212
|
+
### Environment Variables
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
VLY_INTEGRATION_KEY=your_integration_key_here # The key for authenticating with VLY
|
|
216
|
+
VLY_DEBUG=true # optional, enables debug logging
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Debug Mode
|
|
220
|
+
|
|
221
|
+
Enable debug mode to see detailed logs:
|
|
222
|
+
|
|
223
|
+
```typescript
|
|
224
|
+
const vly = createVlyIntegrations({
|
|
225
|
+
deploymentToken: process.env.VLY_INTEGRATION_KEY, // Note: parameter is 'deploymentToken' but env var is 'VLY_INTEGRATION_KEY'
|
|
226
|
+
debug: true
|
|
227
|
+
});
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## What's New in v0.2.0
|
|
231
|
+
|
|
232
|
+
- ✅ **AI SDK Integration**: Now powered by `@ai-sdk/openai-compatible` for better reliability
|
|
233
|
+
- ✅ **No more axios**: Replaced with built-in fetch for lighter weight
|
|
234
|
+
- ✅ **New AI models**: Support for GPT-5, Claude 4, and Claude 3.7 models
|
|
235
|
+
- ✅ **Direct AI SDK access**: Get the provider for advanced AI SDK usage
|
|
236
|
+
- ✅ **Better streaming**: Improved streaming support with AI SDK
|
|
237
|
+
- ✅ **Type safety**: Enhanced TypeScript support
|
|
238
|
+
|
|
239
|
+
## Billing
|
|
240
|
+
|
|
241
|
+
All API calls are automatically billed to your deployment based on usage. The billing happens transparently through your deployment token, and usage information is included in the API responses.
|
|
242
|
+
|
|
243
|
+
## License
|
|
244
|
+
|
|
245
|
+
MIT
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import * as _ai_sdk_openai_compatible from '@ai-sdk/openai-compatible';
|
|
2
|
+
export { CoreMessage } from 'ai';
|
|
3
|
+
|
|
4
|
+
interface VlyConfig {
|
|
5
|
+
deploymentToken: string;
|
|
6
|
+
debug?: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface RequestOptions {
|
|
9
|
+
timeout?: number;
|
|
10
|
+
retries?: number;
|
|
11
|
+
}
|
|
12
|
+
interface ApiResponse<T = any> {
|
|
13
|
+
success: boolean;
|
|
14
|
+
data?: T;
|
|
15
|
+
error?: string;
|
|
16
|
+
usage?: {
|
|
17
|
+
credits: number;
|
|
18
|
+
operation: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
type AIModel = string;
|
|
22
|
+
interface AICompletionRequest {
|
|
23
|
+
model?: AIModel;
|
|
24
|
+
messages: Array<{
|
|
25
|
+
role: 'system' | 'user' | 'assistant';
|
|
26
|
+
content: string;
|
|
27
|
+
}>;
|
|
28
|
+
temperature?: number;
|
|
29
|
+
maxTokens?: number;
|
|
30
|
+
stream?: boolean;
|
|
31
|
+
}
|
|
32
|
+
interface AICompletionResponse {
|
|
33
|
+
id: string;
|
|
34
|
+
choices: Array<{
|
|
35
|
+
message: {
|
|
36
|
+
role: string;
|
|
37
|
+
content: string;
|
|
38
|
+
};
|
|
39
|
+
finishReason: string;
|
|
40
|
+
}>;
|
|
41
|
+
usage: {
|
|
42
|
+
promptTokens: number;
|
|
43
|
+
completionTokens: number;
|
|
44
|
+
totalTokens: number;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
interface EmailRequest {
|
|
48
|
+
to: string | string[];
|
|
49
|
+
from?: string;
|
|
50
|
+
subject: string;
|
|
51
|
+
html?: string;
|
|
52
|
+
text?: string;
|
|
53
|
+
attachments?: Array<{
|
|
54
|
+
filename: string;
|
|
55
|
+
content: string;
|
|
56
|
+
encoding?: string;
|
|
57
|
+
}>;
|
|
58
|
+
replyTo?: string;
|
|
59
|
+
cc?: string | string[];
|
|
60
|
+
bcc?: string | string[];
|
|
61
|
+
}
|
|
62
|
+
interface EmailResponse {
|
|
63
|
+
id: string;
|
|
64
|
+
status: 'sent' | 'queued' | 'failed';
|
|
65
|
+
messageId?: string;
|
|
66
|
+
error?: string;
|
|
67
|
+
}
|
|
68
|
+
interface PaymentIntent {
|
|
69
|
+
amount: number;
|
|
70
|
+
currency?: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
metadata?: Record<string, any>;
|
|
73
|
+
customer?: {
|
|
74
|
+
email?: string;
|
|
75
|
+
name?: string;
|
|
76
|
+
id?: string;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
interface PaymentIntentResponse {
|
|
80
|
+
id: string;
|
|
81
|
+
clientSecret: string;
|
|
82
|
+
amount: number;
|
|
83
|
+
currency: string;
|
|
84
|
+
status: 'requires_payment_method' | 'requires_confirmation' | 'succeeded' | 'processing' | 'canceled';
|
|
85
|
+
paymentMethodTypes: string[];
|
|
86
|
+
}
|
|
87
|
+
interface Subscription {
|
|
88
|
+
customerId: string;
|
|
89
|
+
priceId: string;
|
|
90
|
+
metadata?: Record<string, any>;
|
|
91
|
+
trialPeriodDays?: number;
|
|
92
|
+
cancelAtPeriodEnd?: boolean;
|
|
93
|
+
}
|
|
94
|
+
interface SubscriptionResponse {
|
|
95
|
+
id: string;
|
|
96
|
+
customerId: string;
|
|
97
|
+
status: 'active' | 'past_due' | 'canceled' | 'incomplete' | 'trialing';
|
|
98
|
+
currentPeriodEnd: string;
|
|
99
|
+
items: Array<{
|
|
100
|
+
id: string;
|
|
101
|
+
priceId: string;
|
|
102
|
+
quantity: number;
|
|
103
|
+
}>;
|
|
104
|
+
}
|
|
105
|
+
interface CustomerPortalSession {
|
|
106
|
+
customerId: string;
|
|
107
|
+
returnUrl?: string;
|
|
108
|
+
}
|
|
109
|
+
interface CustomerPortalResponse {
|
|
110
|
+
id: string;
|
|
111
|
+
url: string;
|
|
112
|
+
returnUrl?: string;
|
|
113
|
+
created: number;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare class VlyAI {
|
|
117
|
+
private provider;
|
|
118
|
+
private config;
|
|
119
|
+
constructor(config: VlyConfig);
|
|
120
|
+
private getModel;
|
|
121
|
+
private mapMessages;
|
|
122
|
+
completion(request: AICompletionRequest, _options?: RequestOptions): Promise<ApiResponse<AICompletionResponse>>;
|
|
123
|
+
streamCompletion(request: AICompletionRequest, onChunk: (chunk: string) => void, _options?: RequestOptions): Promise<ApiResponse<AICompletionResponse>>;
|
|
124
|
+
embeddings(input: string | string[], _options?: RequestOptions & {
|
|
125
|
+
model?: string;
|
|
126
|
+
}): Promise<ApiResponse<{
|
|
127
|
+
embeddings: number[][];
|
|
128
|
+
usage: any;
|
|
129
|
+
}>>;
|
|
130
|
+
getProvider(): _ai_sdk_openai_compatible.OpenAICompatibleProvider<string, string, string, string>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
declare class VlyClient {
|
|
134
|
+
protected config: Required<VlyConfig>;
|
|
135
|
+
constructor(config: VlyConfig);
|
|
136
|
+
protected request<T = any>(endpoint: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE', data?: any, options?: RequestOptions): Promise<ApiResponse<T>>;
|
|
137
|
+
protected log(message: string, data?: any): void;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
declare class VlyEmail extends VlyClient {
|
|
141
|
+
send(email: EmailRequest, options?: RequestOptions): Promise<ApiResponse<EmailResponse>>;
|
|
142
|
+
sendBatch(emails: EmailRequest[], options?: RequestOptions): Promise<ApiResponse<EmailResponse[]>>;
|
|
143
|
+
getStatus(emailId: string, options?: RequestOptions): Promise<ApiResponse<EmailResponse>>;
|
|
144
|
+
verifyDomain(domain: string, options?: RequestOptions): Promise<ApiResponse<{
|
|
145
|
+
domain: string;
|
|
146
|
+
verified: boolean;
|
|
147
|
+
dnsRecords: Array<{
|
|
148
|
+
type: string;
|
|
149
|
+
name: string;
|
|
150
|
+
value: string;
|
|
151
|
+
verified: boolean;
|
|
152
|
+
}>;
|
|
153
|
+
}>>;
|
|
154
|
+
listDomains(options?: RequestOptions): Promise<ApiResponse<Array<{
|
|
155
|
+
domain: string;
|
|
156
|
+
verified: boolean;
|
|
157
|
+
createdAt: string;
|
|
158
|
+
verifiedAt?: string;
|
|
159
|
+
}>>>;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
declare class VlyPayments extends VlyClient {
|
|
163
|
+
createPaymentIntent(intent: PaymentIntent, options?: RequestOptions): Promise<ApiResponse<PaymentIntentResponse>>;
|
|
164
|
+
confirmPaymentIntent(intentId: string, paymentMethodId: string, options?: RequestOptions): Promise<ApiResponse<PaymentIntentResponse>>;
|
|
165
|
+
getPaymentIntent(intentId: string, options?: RequestOptions): Promise<ApiResponse<PaymentIntentResponse>>;
|
|
166
|
+
cancelPaymentIntent(intentId: string, options?: RequestOptions): Promise<ApiResponse<PaymentIntentResponse>>;
|
|
167
|
+
createSubscription(subscription: Subscription, options?: RequestOptions): Promise<ApiResponse<SubscriptionResponse>>;
|
|
168
|
+
updateSubscription(subscriptionId: string, updates: Partial<Subscription>, options?: RequestOptions): Promise<ApiResponse<SubscriptionResponse>>;
|
|
169
|
+
cancelSubscription(subscriptionId: string, immediately?: boolean, options?: RequestOptions): Promise<ApiResponse<SubscriptionResponse>>;
|
|
170
|
+
getSubscription(subscriptionId: string, options?: RequestOptions): Promise<ApiResponse<SubscriptionResponse>>;
|
|
171
|
+
listSubscriptions(customerId?: string, options?: RequestOptions & {
|
|
172
|
+
limit?: number;
|
|
173
|
+
offset?: number;
|
|
174
|
+
}): Promise<ApiResponse<{
|
|
175
|
+
subscriptions: SubscriptionResponse[];
|
|
176
|
+
hasMore: boolean;
|
|
177
|
+
total: number;
|
|
178
|
+
}>>;
|
|
179
|
+
createCustomerPortal(session: CustomerPortalSession, options?: RequestOptions): Promise<ApiResponse<CustomerPortalResponse>>;
|
|
180
|
+
createCheckoutSession(session: {
|
|
181
|
+
customerId?: string;
|
|
182
|
+
customerEmail?: string;
|
|
183
|
+
lineItems: Array<{
|
|
184
|
+
priceId: string;
|
|
185
|
+
quantity: number;
|
|
186
|
+
}>;
|
|
187
|
+
mode: 'payment' | 'subscription';
|
|
188
|
+
successUrl: string;
|
|
189
|
+
cancelUrl: string;
|
|
190
|
+
metadata?: Record<string, any>;
|
|
191
|
+
}, options?: RequestOptions): Promise<ApiResponse<{
|
|
192
|
+
id: string;
|
|
193
|
+
url: string;
|
|
194
|
+
}>>;
|
|
195
|
+
createCustomer(customer: {
|
|
196
|
+
email: string;
|
|
197
|
+
name?: string;
|
|
198
|
+
metadata?: Record<string, any>;
|
|
199
|
+
}, options?: RequestOptions): Promise<ApiResponse<{
|
|
200
|
+
id: string;
|
|
201
|
+
email: string;
|
|
202
|
+
name?: string;
|
|
203
|
+
created: number;
|
|
204
|
+
}>>;
|
|
205
|
+
getCustomer(customerId: string, options?: RequestOptions): Promise<ApiResponse<{
|
|
206
|
+
id: string;
|
|
207
|
+
email: string;
|
|
208
|
+
name?: string;
|
|
209
|
+
created: number;
|
|
210
|
+
metadata?: Record<string, any>;
|
|
211
|
+
}>>;
|
|
212
|
+
updateCustomer(customerId: string, updates: {
|
|
213
|
+
email?: string;
|
|
214
|
+
name?: string;
|
|
215
|
+
metadata?: Record<string, any>;
|
|
216
|
+
}, options?: RequestOptions): Promise<ApiResponse<{
|
|
217
|
+
id: string;
|
|
218
|
+
email: string;
|
|
219
|
+
name?: string;
|
|
220
|
+
created: number;
|
|
221
|
+
metadata?: Record<string, any>;
|
|
222
|
+
}>>;
|
|
223
|
+
listPaymentMethods(customerId: string, options?: RequestOptions): Promise<ApiResponse<Array<{
|
|
224
|
+
id: string;
|
|
225
|
+
type: string;
|
|
226
|
+
card?: {
|
|
227
|
+
brand: string;
|
|
228
|
+
last4: string;
|
|
229
|
+
expMonth: number;
|
|
230
|
+
expYear: number;
|
|
231
|
+
};
|
|
232
|
+
created: number;
|
|
233
|
+
}>>>;
|
|
234
|
+
attachPaymentMethod(paymentMethodId: string, customerId: string, options?: RequestOptions): Promise<ApiResponse<{
|
|
235
|
+
id: string;
|
|
236
|
+
customerId: string;
|
|
237
|
+
attached: boolean;
|
|
238
|
+
}>>;
|
|
239
|
+
detachPaymentMethod(paymentMethodId: string, options?: RequestOptions): Promise<ApiResponse<{
|
|
240
|
+
id: string;
|
|
241
|
+
detached: boolean;
|
|
242
|
+
}>>;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
declare class VlyIntegrations {
|
|
246
|
+
ai: VlyAI;
|
|
247
|
+
email: VlyEmail;
|
|
248
|
+
payments: VlyPayments;
|
|
249
|
+
constructor(config: VlyConfig);
|
|
250
|
+
}
|
|
251
|
+
declare function createVlyIntegrations(config: VlyConfig): VlyIntegrations;
|
|
252
|
+
|
|
253
|
+
export { type AICompletionRequest, type AICompletionResponse, type AIModel, type ApiResponse, type CustomerPortalResponse, type CustomerPortalSession, type EmailRequest, type EmailResponse, type PaymentIntent, type PaymentIntentResponse, type RequestOptions, type Subscription, type SubscriptionResponse, VlyAI, type VlyConfig, VlyEmail, VlyIntegrations, VlyPayments, createVlyIntegrations };
|