@plyaz/types 1.16.8 → 1.17.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.
|
@@ -280,6 +280,92 @@ export type ApiClientWithEvents<TEventManager, EndpointsList = UnknownRecord> =
|
|
|
280
280
|
updateConfig(updates: Partial<ApiClientOptions>, options?: UpdateConfigOptions): void;
|
|
281
281
|
clearTemporaryOverrides(): void;
|
|
282
282
|
getConfig(): ApiConfigWithMetadata;
|
|
283
|
+
/**
|
|
284
|
+
* Make a GET request to the specified URL path.
|
|
285
|
+
*
|
|
286
|
+
* @warning **TESTING/DEBUGGING ONLY** - Do NOT use in production code.
|
|
287
|
+
* @warning **DO NOT MERGE TO MAIN** - Use typed endpoint methods instead.
|
|
288
|
+
*
|
|
289
|
+
* For production, define endpoints in `src/api/endpoints/` and use typed methods.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```typescript
|
|
293
|
+
* // WRONG - Don't do this in production:
|
|
294
|
+
* const response = await client.get('/users/123');
|
|
295
|
+
*
|
|
296
|
+
* // CORRECT - Use typed endpoints:
|
|
297
|
+
* const response = await client.getUser({ urlPathParams: { id: '123' } });
|
|
298
|
+
* ```
|
|
299
|
+
*
|
|
300
|
+
* @deprecated Use typed endpoint methods for production code.
|
|
301
|
+
*/
|
|
302
|
+
get<TResponse = unknown, TParams = Record<string, unknown>>(url: string, config?: Partial<RequestConfig<TResponse, never, TParams, Record<string, string>>>): Promise<FetchResponse<TResponse>>;
|
|
303
|
+
/**
|
|
304
|
+
* Make a POST request to the specified URL path.
|
|
305
|
+
*
|
|
306
|
+
* @warning **TESTING/DEBUGGING ONLY** - Do NOT use in production code.
|
|
307
|
+
* @warning **DO NOT MERGE TO MAIN** - Use typed endpoint methods instead.
|
|
308
|
+
*
|
|
309
|
+
* For production, define endpoints in `src/api/endpoints/` and use typed methods.
|
|
310
|
+
*
|
|
311
|
+
* @deprecated Use typed endpoint methods for production code.
|
|
312
|
+
*/
|
|
313
|
+
post<TResponse = unknown, TBody = unknown, TParams = Record<string, unknown>>(url: string, data?: TBody, config?: Partial<RequestConfig<TResponse, TBody, TParams, Record<string, string>>>): Promise<FetchResponse<TResponse>>;
|
|
314
|
+
/**
|
|
315
|
+
* Make a PUT request to the specified URL path.
|
|
316
|
+
*
|
|
317
|
+
* @warning **TESTING/DEBUGGING ONLY** - Do NOT use in production code.
|
|
318
|
+
* @warning **DO NOT MERGE TO MAIN** - Use typed endpoint methods instead.
|
|
319
|
+
*
|
|
320
|
+
* For production, define endpoints in `src/api/endpoints/` and use typed methods.
|
|
321
|
+
*
|
|
322
|
+
* @deprecated Use typed endpoint methods for production code.
|
|
323
|
+
*/
|
|
324
|
+
put<TResponse = unknown, TBody = unknown, TParams = Record<string, unknown>>(url: string, data?: TBody, config?: Partial<RequestConfig<TResponse, TBody, TParams, Record<string, string>>>): Promise<FetchResponse<TResponse>>;
|
|
325
|
+
/**
|
|
326
|
+
* Make a PATCH request to the specified URL path.
|
|
327
|
+
*
|
|
328
|
+
* @warning **TESTING/DEBUGGING ONLY** - Do NOT use in production code.
|
|
329
|
+
* @warning **DO NOT MERGE TO MAIN** - Use typed endpoint methods instead.
|
|
330
|
+
*
|
|
331
|
+
* For production, define endpoints in `src/api/endpoints/` and use typed methods.
|
|
332
|
+
*
|
|
333
|
+
* @deprecated Use typed endpoint methods for production code.
|
|
334
|
+
*/
|
|
335
|
+
patch<TResponse = unknown, TBody = unknown, TParams = Record<string, unknown>>(url: string, data?: TBody, config?: Partial<RequestConfig<TResponse, TBody, TParams, Record<string, string>>>): Promise<FetchResponse<TResponse>>;
|
|
336
|
+
/**
|
|
337
|
+
* Make a DELETE request to the specified URL path.
|
|
338
|
+
*
|
|
339
|
+
* @warning **TESTING/DEBUGGING ONLY** - Do NOT use in production code.
|
|
340
|
+
* @warning **DO NOT MERGE TO MAIN** - Use typed endpoint methods instead.
|
|
341
|
+
*
|
|
342
|
+
* For production, define endpoints in `src/api/endpoints/` and use typed methods.
|
|
343
|
+
*
|
|
344
|
+
* @deprecated Use typed endpoint methods for production code.
|
|
345
|
+
*/
|
|
346
|
+
delete<TResponse = unknown, TParams = Record<string, unknown>>(url: string, config?: Partial<RequestConfig<TResponse, never, TParams, Record<string, string>>>): Promise<FetchResponse<TResponse>>;
|
|
347
|
+
/**
|
|
348
|
+
* Make a HEAD request to the specified URL path.
|
|
349
|
+
*
|
|
350
|
+
* @warning **TESTING/DEBUGGING ONLY** - Do NOT use in production code.
|
|
351
|
+
* @warning **DO NOT MERGE TO MAIN** - Use typed endpoint methods instead.
|
|
352
|
+
*
|
|
353
|
+
* For production, define endpoints in `src/api/endpoints/` and use typed methods.
|
|
354
|
+
*
|
|
355
|
+
* @deprecated Use typed endpoint methods for production code.
|
|
356
|
+
*/
|
|
357
|
+
head<TParams = Record<string, unknown>>(url: string, config?: Partial<RequestConfig<void, never, TParams, Record<string, string>>>): Promise<FetchResponse<void>>;
|
|
358
|
+
/**
|
|
359
|
+
* Make an OPTIONS request to the specified URL path.
|
|
360
|
+
*
|
|
361
|
+
* @warning **TESTING/DEBUGGING ONLY** - Do NOT use in production code.
|
|
362
|
+
* @warning **DO NOT MERGE TO MAIN** - Use typed endpoint methods instead.
|
|
363
|
+
*
|
|
364
|
+
* For production, define endpoints in `src/api/endpoints/` and use typed methods.
|
|
365
|
+
*
|
|
366
|
+
* @deprecated Use typed endpoint methods for production code.
|
|
367
|
+
*/
|
|
368
|
+
options<TResponse = unknown, TParams = Record<string, unknown>>(url: string, config?: Partial<RequestConfig<TResponse, never, TParams, Record<string, string>>>): Promise<FetchResponse<TResponse>>;
|
|
283
369
|
};
|
|
284
370
|
/**
|
|
285
371
|
* Configuration for temporary override setup
|
|
@@ -5,6 +5,17 @@ import type { PROVIDER_PRODUCT_STATUS } from './enums';
|
|
|
5
5
|
* Billing cycle for subscription or recurring payments
|
|
6
6
|
*/
|
|
7
7
|
export type BillingCycle = 'daily' | 'weekly' | 'monthly' | 'quarterly' | 'yearly' | 'one-time';
|
|
8
|
+
export type Interval = 'day' | 'week' | 'month' | 'year';
|
|
9
|
+
export interface CustomInterval {
|
|
10
|
+
/** Stripe-compatible interval (for fixed intervals) */
|
|
11
|
+
interval?: Interval;
|
|
12
|
+
/** Number of intervals (for fixed intervals) */
|
|
13
|
+
interval_count?: number;
|
|
14
|
+
/** Custom start date (optional) */
|
|
15
|
+
startDate?: Date;
|
|
16
|
+
/** Custom end date (optional) */
|
|
17
|
+
endDate?: Date;
|
|
18
|
+
}
|
|
8
19
|
/**
|
|
9
20
|
* Parameters to create a new product in the payment provider
|
|
10
21
|
*/
|
|
@@ -353,9 +353,17 @@ export interface SavedPaymentMethod<TMetadata extends object = object> {
|
|
|
353
353
|
export interface CreateSubscriptionParams<TMetadata extends object = object> {
|
|
354
354
|
/** Plyaz user ID (Stripe customer ID or your internal user ID mapped to Stripe) */
|
|
355
355
|
userId: string;
|
|
356
|
+
/** Selected payment method from supported options */
|
|
356
357
|
paymentMethod: PAYMENT_METHOD;
|
|
358
|
+
/**
|
|
359
|
+
* Optional provider override for advanced use cases
|
|
360
|
+
* If not specified, optimal provider will be auto-selected
|
|
361
|
+
*/
|
|
362
|
+
provider?: PAYMENT_PROVIDER_TYPE;
|
|
357
363
|
/** Plan to subscribe the user to (internal plan name) */
|
|
358
364
|
plan: string;
|
|
365
|
+
/** Product pricing */
|
|
366
|
+
priceId: string;
|
|
359
367
|
/** Optional trial period in days */
|
|
360
368
|
trialDays?: number;
|
|
361
369
|
/** URL to redirect user after successful payment completion */
|
package/package.json
CHANGED