flexprice-sdk-test 1.0.51 → 1.0.53

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 CHANGED
@@ -1,373 +1,14 @@
1
- # FlexPrice JavaScript/TypeScript SDK
1
+ # flexprice-sdk-test
2
2
 
3
- [![npm version](https://badge.fury.io/js/%40flexprice%2Fsdk.svg)](https://badge.fury.io/js/%40flexprice%2Fsdk)
4
- [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
3
+ Developer-friendly & type-safe Typescript SDK specifically catered to leverage *flexprice-sdk-test* API.
5
4
 
6
- Official TypeScript/JavaScript SDK for the FlexPrice API with modern ES7 module support and comprehensive type safety.
5
+ [![Built by Speakeasy](https://img.shields.io/badge/Built_by-SPEAKEASY-374151?style=for-the-badge&labelColor=f3f4f6)](https://www.speakeasy.com/?utm_source=flexprice-sdk-test&utm_campaign=typescript)
6
+ [![License: MIT](https://img.shields.io/badge/LICENSE_//_MIT-3b5bdb?style=for-the-badge&labelColor=eff6ff)](https://opensource.org/licenses/MIT)
7
7
 
8
- ## Features
9
8
 
10
- - **Full TypeScript Support** - Complete type definitions for all API endpoints
11
- - ✅ **Modern ES7 Modules** - Native ES modules with CommonJS fallback
12
- - **Fetch API** - Built on modern web standards
13
- - ✅ **Browser Compatible** - Works in Node.js, Webpack, and Browserify
14
- - ✅ **Promise & Callback Support** - Flexible async patterns
15
- - ✅ **Comprehensive Documentation** - Auto-generated from OpenAPI specs
16
- - ✅ **Error Handling** - Detailed error messages and status codes
17
-
18
- ## Installation
19
-
20
- ```bash
21
- npm install @flexprice/sdk --save
22
- ```
23
-
24
- ## Quick Start
25
-
26
- ```typescript
27
- import { Configuration, EventsApi, CustomersApi } from "@flexprice/sdk";
28
-
29
- // Configure the API client
30
- const config = new Configuration({
31
- basePath: "https://api.cloud.flexprice.io/v1",
32
- apiKey: "your_api_key_here",
33
- headers: {
34
- "X-Environment-ID": "your_environment_id_here",
35
- },
36
- });
37
-
38
- // Create API instances
39
- const eventsApi = new EventsApi(config);
40
- const customersApi = new CustomersApi(config);
41
-
42
- // Use APIs directly
43
- const eventRequest = {
44
- eventName: "user_signup",
45
- externalCustomerId: "customer-123",
46
- properties: {
47
- plan: "premium",
48
- source: "website",
49
- },
50
- };
51
-
52
- await eventsApi.eventsPost({ event: eventRequest });
53
- ```
54
-
55
- ## Environment Setup
56
-
57
- ### Environment Variables
58
-
59
- Create a `.env` file in your project root:
60
-
61
- ```bash
62
- # FlexPrice Configuration
63
- FLEXPRICE_API_KEY=sk_your_api_key_here
64
- FLEXPRICE_BASE_URL=https://api.cloud.flexprice.io/v1
65
- FLEXPRICE_ENVIRONMENT_ID=env_your_environment_id_here
66
- ```
67
-
68
- ### Vite/React Applications
69
-
70
- For Vite applications, prefix environment variables with `VITE_`:
71
-
72
- ```bash
73
- # .env
74
- VITE_FLEXPRICE_API_KEY=sk_your_api_key_here
75
- VITE_FLEXPRICE_BASE_URL=https://api.cloud.flexprice.io/v1
76
- VITE_FLEXPRICE_ENVIRONMENT_ID=env_your_environment_id_here
77
- ```
78
-
79
- ```typescript
80
- // config.ts
81
- import { Configuration, EventsApi, CustomersApi } from "@flexprice/sdk";
82
-
83
- const API_KEY = import.meta.env.VITE_FLEXPRICE_API_KEY;
84
- const BASE_PATH = import.meta.env.VITE_FLEXPRICE_BASE_URL;
85
- const ENVIRONMENT_ID = import.meta.env.VITE_FLEXPRICE_ENVIRONMENT_ID;
86
-
87
- const config = new Configuration({
88
- basePath: BASE_PATH,
89
- apiKey: API_KEY,
90
- headers: {
91
- "X-Environment-ID": ENVIRONMENT_ID,
92
- },
93
- });
94
-
95
- // Export configured API instances
96
- export const eventsApi = new EventsApi(config);
97
- export const customersApi = new CustomersApi(config);
98
- ```
99
-
100
- ## Available APIs
101
-
102
- - **EventsApi** - Event ingestion and analytics
103
- - **CustomersApi** - Customer management
104
- - **AuthApi** - Authentication and user management
105
- - **PlansApi** - Subscription plan management
106
- - **FeaturesApi** - Feature management
107
- - **InvoicesApi** - Invoice operations
108
- - **SubscriptionsApi** - Subscription management
109
- - **AddonsApi** - Addon management
110
- - **CouponsApi** - Coupon management
111
- - **CreditNotesApi** - Credit note management
112
- - **EntitlementsApi** - Feature access control
113
- - **UsersApi** - User management
114
-
115
- ## API Examples
116
-
117
- ### Events API
118
-
119
- ```typescript
120
- import { EventsApi } from "@flexprice/sdk";
121
-
122
- const eventsApi = new EventsApi(config);
123
-
124
- // Ingest a single event
125
- await eventsApi.eventsPost({
126
- event: {
127
- eventName: "api_call",
128
- externalCustomerId: "customer-123",
129
- properties: {
130
- endpoint: "/api/users",
131
- method: "GET",
132
- responseTime: 150,
133
- },
134
- },
135
- });
136
-
137
- // Query events
138
- const events = await eventsApi.eventsQueryPost({
139
- request: {
140
- externalCustomerId: "customer-123",
141
- eventName: "api_call",
142
- startTime: "2024-01-01T00:00:00Z",
143
- endTime: "2024-01-31T23:59:59Z",
144
- limit: 100,
145
- },
146
- });
147
-
148
- // Get usage analytics
149
- const analytics = await eventsApi.eventsAnalyticsPost({
150
- request: {
151
- externalCustomerId: "customer-123",
152
- startTime: "2024-01-01T00:00:00Z",
153
- endTime: "2024-01-31T23:59:59Z",
154
- windowSize: "day",
155
- },
156
- });
157
- ```
158
-
159
- ### Customers API
160
-
161
- ```typescript
162
- import { CustomersApi } from "@flexprice/sdk";
163
-
164
- const customersApi = new CustomersApi(config);
165
-
166
- // Create a customer
167
- const customer = await customersApi.customersPost({
168
- customer: {
169
- externalId: "customer-123",
170
- email: "user@example.com",
171
- name: "John Doe",
172
- metadata: {
173
- source: "signup_form",
174
- },
175
- },
176
- });
177
-
178
- // Get customer
179
- const customerData = await customersApi.customersIdGet({
180
- id: "customer-123",
181
- });
182
-
183
- // Update customer
184
- const updatedCustomer = await customersApi.customersIdPut({
185
- id: "customer-123",
186
- customer: {
187
- name: "John Smith",
188
- metadata: { plan: "premium" },
189
- },
190
- });
191
-
192
- // List customers
193
- const customers = await customersApi.customersGet({
194
- limit: 50,
195
- offset: 0,
196
- status: "active",
197
- });
198
- ```
199
-
200
- ### Authentication API
201
-
202
- ```typescript
203
- import { AuthApi } from "@flexprice/sdk";
204
-
205
- const authApi = new AuthApi(config);
206
-
207
- // Login user
208
- const authResponse = await authApi.authLoginPost({
209
- login: {
210
- email: "user@example.com",
211
- password: "password123",
212
- },
213
- });
214
-
215
- // Sign up new user
216
- const signupResponse = await authApi.authSignupPost({
217
- signup: {
218
- email: "newuser@example.com",
219
- password: "password123",
220
- name: "New User",
221
- },
222
- });
223
- ```
224
-
225
- ## React Integration
226
-
227
- ### With React Query
228
-
229
- ```typescript
230
- import { useMutation, useQuery } from "@tanstack/react-query";
231
- import { eventsApi } from "./config";
232
-
233
- // Fetch events
234
- const { data: events, isLoading } = useQuery({
235
- queryKey: ["events"],
236
- queryFn: () =>
237
- eventsApi.eventsQueryPost({
238
- request: {
239
- externalCustomerId: "customer-123",
240
- limit: 100,
241
- },
242
- }),
243
- });
244
-
245
- // Fire an event
246
- const { mutate: fireEvent } = useMutation({
247
- mutationFn: (eventData) => eventsApi.eventsPost({ event: eventData }),
248
- onSuccess: () => {
249
- toast.success("Event fired successfully");
250
- },
251
- onError: (error) => {
252
- toast.error("Failed to fire event");
253
- },
254
- });
255
- ```
256
-
257
- ### With useEffect
258
-
259
- ```typescript
260
- import { useEffect, useState } from "react";
261
- import { eventsApi } from "./config";
262
-
263
- const UsageComponent = () => {
264
- const [usage, setUsage] = useState(null);
265
-
266
- useEffect(() => {
267
- const fetchUsage = async () => {
268
- try {
269
- const data = await eventsApi.eventsUsagePost({
270
- request: {
271
- externalCustomerId: "customer-123",
272
- startTime: "2024-01-01",
273
- endTime: "2024-01-31",
274
- },
275
- });
276
- setUsage(data);
277
- } catch (error) {
278
- console.error("Failed to fetch usage:", error);
279
- }
280
- };
281
-
282
- fetchUsage();
283
- }, []);
284
-
285
- return <div>{/* Render usage data */}</div>;
286
- };
287
- ```
288
-
289
- ## Error Handling
290
-
291
- ```typescript
292
- try {
293
- await eventsApi.eventsPost({ event: eventData });
294
- } catch (error) {
295
- if (error.status === 401) {
296
- console.error("Authentication failed");
297
- } else if (error.status === 400) {
298
- console.error("Bad request:", error.response?.body);
299
- } else {
300
- console.error("API Error:", error.message);
301
- }
302
- }
303
- ```
304
-
305
- ## TypeScript Support
306
-
307
- The SDK includes comprehensive TypeScript definitions:
308
-
309
- ```typescript
310
- import type {
311
- DtoIngestEventRequest,
312
- DtoGetUsageRequest,
313
- DtoCreateCustomerRequest,
314
- DtoCustomerResponse,
315
- // ... many more types
316
- } from "@flexprice/sdk";
317
-
318
- // Type-safe event creation
319
- const event: DtoIngestEventRequest = {
320
- eventName: "llm_usage",
321
- externalCustomerId: "user_123",
322
- properties: {
323
- tokens: 150,
324
- model: "gpt-4",
325
- },
326
- };
327
- ```
328
-
329
- ## Browser Usage
330
-
331
- ```html
332
- <script src="https://cdn.jsdelivr.net/npm/@flexprice/sdk/dist/flexprice-sdk.min.js"></script>
333
- <script>
334
- // Configure the API client
335
- const config = new FlexPrice.Configuration({
336
- basePath: "https://api.cloud.flexprice.io/v1",
337
- apiKey: "your-api-key-here",
338
- headers: {
339
- "X-Environment-ID": "your-environment-id-here",
340
- },
341
- });
342
-
343
- // Create API instance
344
- const eventsApi = new FlexPrice.EventsApi(config);
345
-
346
- // Use the SDK
347
- eventsApi.eventsPost({
348
- event: {
349
- eventName: "page_view",
350
- externalCustomerId: "user_123",
351
- properties: { page: "/home" },
352
- },
353
- });
354
- </script>
355
- ```
356
-
357
- ## Troubleshooting
358
-
359
- ### Authentication Issues
360
-
361
- - Verify the key is active and has required permissions
362
- - Check that the `x-api-key` header is being sent correctly
363
- - Verify the `X-Environment-ID` header is included
364
-
365
- ## Support
366
-
367
- For support and questions:
368
-
369
- - Check the [API Documentation](https://docs.flexprice.io)
370
- - Contact support at [support@flexprice.io](mailto:support@flexprice.io)
9
+ <br /><br />
10
+ > [!IMPORTANT]
11
+ > This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your [workspace](https://app.speakeasy.com/org/flexprice/develop-cw0). Delete this section before > publishing to a package manager.
371
12
 
372
13
  <!-- Start Summary [summary] -->
373
14
  ## Summary
@@ -378,19 +19,7 @@ FlexPrice API: FlexPrice API Service
378
19
  <!-- Start Table of Contents [toc] -->
379
20
  ## Table of Contents
380
21
  <!-- $toc-max-depth=2 -->
381
- * [FlexPrice JavaScript/TypeScript SDK](#flexprice-javascripttypescript-sdk)
382
- * [Features](#features)
383
- * [Installation](#installation)
384
- * [Quick Start](#quick-start)
385
- * [Environment Setup](#environment-setup)
386
- * [Available APIs](#available-apis)
387
- * [API Examples](#api-examples)
388
- * [React Integration](#react-integration)
389
- * [Error Handling](#error-handling)
390
- * [TypeScript Support](#typescript-support)
391
- * [Browser Usage](#browser-usage)
392
- * [Troubleshooting](#troubleshooting)
393
- * [Support](#support)
22
+ * [flexprice-sdk-test](#flexprice-sdk-test)
394
23
  * [SDK Installation](#sdk-installation)
395
24
  * [Requirements](#requirements)
396
25
  * [SDK Example Usage](#sdk-example-usage)
@@ -399,9 +28,12 @@ FlexPrice API: FlexPrice API Service
399
28
  * [Standalone functions](#standalone-functions)
400
29
  * [File uploads](#file-uploads)
401
30
  * [Retries](#retries)
402
- * [Error Handling](#error-handling-1)
31
+ * [Error Handling](#error-handling)
403
32
  * [Custom HTTP Client](#custom-http-client)
404
33
  * [Debugging](#debugging)
34
+ * [Development](#development)
35
+ * [Maturity](#maturity)
36
+ * [Contributions](#contributions)
405
37
 
406
38
  <!-- End Table of Contents [toc] -->
407
39
 
@@ -1270,3 +902,18 @@ const sdk = new FlexPrice({ debugLogger: console });
1270
902
  <!-- End Debugging [debug] -->
1271
903
 
1272
904
  <!-- Placeholder for Future Speakeasy SDK Sections -->
905
+
906
+ # Development
907
+
908
+ ## Maturity
909
+
910
+ This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
911
+ to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
912
+ looking for the latest version.
913
+
914
+ ## Contributions
915
+
916
+ While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
917
+ We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
918
+
919
+ ### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=flexprice-sdk-test&utm_campaign=typescript)
@@ -6,7 +6,7 @@
6
6
  "packages": {
7
7
  "..": {
8
8
  "name": "flexprice-sdk-test",
9
- "version": "1.0.51",
9
+ "version": "1.0.53",
10
10
  "dependencies": {
11
11
  "zod": "^3.25.0 || ^4.0.0"
12
12
  },
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "..": {
20
20
  "name": "flexprice-sdk-test",
21
- "version": "1.0.51",
21
+ "version": "1.0.53",
22
22
  "dependencies": {
23
23
  "zod": "^3.25.0 || ^4.0.0"
24
24
  },
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "flexprice-sdk-test",
5
- "version": "1.0.51",
5
+ "version": "1.0.53",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/lib/config.d.ts CHANGED
@@ -31,8 +31,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
31
31
  export declare const SDK_METADATA: {
32
32
  readonly language: "typescript";
33
33
  readonly openapiDocVersion: "1.0";
34
- readonly sdkVersion: "1.0.51";
34
+ readonly sdkVersion: "1.0.53";
35
35
  readonly genVersion: "2.788.15";
36
- readonly userAgent: "speakeasy-sdk/typescript 1.0.51 2.788.15 1.0 flexprice-sdk-test";
36
+ readonly userAgent: "speakeasy-sdk/typescript 1.0.53 2.788.15 1.0 flexprice-sdk-test";
37
37
  };
38
38
  //# sourceMappingURL=config.d.ts.map
package/lib/config.js CHANGED
@@ -28,8 +28,8 @@ function serverURLFromOptions(options) {
28
28
  exports.SDK_METADATA = {
29
29
  language: "typescript",
30
30
  openapiDocVersion: "1.0",
31
- sdkVersion: "1.0.51",
31
+ sdkVersion: "1.0.53",
32
32
  genVersion: "2.788.15",
33
- userAgent: "speakeasy-sdk/typescript 1.0.51 2.788.15 1.0 flexprice-sdk-test",
33
+ userAgent: "speakeasy-sdk/typescript 1.0.53 2.788.15 1.0 flexprice-sdk-test",
34
34
  };
35
35
  //# sourceMappingURL=config.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flexprice-sdk-test",
3
- "version": "1.0.51",
3
+ "version": "1.0.53",
4
4
  "author": "FlexPrice",
5
5
  "main": "./index.js",
6
6
  "sideEffects": false,
package/src/lib/config.ts CHANGED
@@ -58,7 +58,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
58
58
  export const SDK_METADATA = {
59
59
  language: "typescript",
60
60
  openapiDocVersion: "1.0",
61
- sdkVersion: "1.0.51",
61
+ sdkVersion: "1.0.53",
62
62
  genVersion: "2.788.15",
63
- userAgent: "speakeasy-sdk/typescript 1.0.51 2.788.15 1.0 flexprice-sdk-test",
63
+ userAgent: "speakeasy-sdk/typescript 1.0.53 2.788.15 1.0 flexprice-sdk-test",
64
64
  } as const;
package/.eslintrc.js DELETED
@@ -1,27 +0,0 @@
1
- module.exports = {
2
- parser: '@typescript-eslint/parser',
3
- extends: [
4
- 'eslint:recommended',
5
- '@typescript-eslint/recommended',
6
- ],
7
- parserOptions: {
8
- ecmaVersion: 2022,
9
- sourceType: 'module',
10
- project: './tsconfig.json',
11
- },
12
- plugins: ['@typescript-eslint'],
13
- rules: {
14
- '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
15
- '@typescript-eslint/explicit-function-return-type': 'off',
16
- '@typescript-eslint/explicit-module-boundary-types': 'off',
17
- '@typescript-eslint/no-explicit-any': 'warn',
18
- '@typescript-eslint/no-non-null-assertion': 'warn',
19
- 'prefer-const': 'error',
20
- 'no-var': 'error',
21
- },
22
- env: {
23
- node: true,
24
- es2022: true,
25
- },
26
- ignorePatterns: ['dist/', 'node_modules/', '*.js'],
27
- };
package/jest.config.js DELETED
@@ -1,30 +0,0 @@
1
- export default {
2
- preset: 'ts-jest/presets/default-esm',
3
- testEnvironment: 'node',
4
- extensionsToTreatAsEsm: ['.ts'],
5
- globals: {
6
- 'ts-jest': {
7
- useESM: true,
8
- },
9
- },
10
- moduleNameMapper: {
11
- '^(\\.{1,2}/.*)\\.js$': '$1',
12
- },
13
- transform: {
14
- '^.+\\.ts$': ['ts-jest', {
15
- useESM: true,
16
- }],
17
- },
18
- testMatch: [
19
- '**/__tests__/**/*.test.ts',
20
- '**/?(*.)+(spec|test).ts',
21
- ],
22
- collectCoverageFrom: [
23
- 'src/**/*.ts',
24
- '!src/**/*.d.ts',
25
- '!src/**/*.test.ts',
26
- '!src/**/*.spec.ts',
27
- ],
28
- coverageDirectory: 'coverage',
29
- coverageReporters: ['text', 'lcov', 'html'],
30
- };
package/tsconfig.esm.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "module": "esnext",
5
- "outDir": "dist/esm"
6
- }
7
- }