@inkress/admin-sdk 1.0.0 → 1.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/CHANGELOG.md +213 -0
- package/README.md +1174 -87
- package/dist/client.d.ts +3 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/data-mappings.d.ts +177 -0
- package/dist/data-mappings.d.ts.map +1 -0
- package/dist/index.d.ts +34 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +4166 -154
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4203 -153
- package/dist/index.js.map +1 -1
- package/dist/resources/addresses.d.ts +58 -0
- package/dist/resources/addresses.d.ts.map +1 -0
- package/dist/resources/billing-plans.d.ts +32 -15
- package/dist/resources/billing-plans.d.ts.map +1 -1
- package/dist/resources/categories.d.ts +30 -20
- package/dist/resources/categories.d.ts.map +1 -1
- package/dist/resources/currencies.d.ts +41 -0
- package/dist/resources/currencies.d.ts.map +1 -0
- package/dist/resources/exchange-rates.d.ts +50 -0
- package/dist/resources/exchange-rates.d.ts.map +1 -0
- package/dist/resources/fees.d.ts +58 -0
- package/dist/resources/fees.d.ts.map +1 -0
- package/dist/resources/financial-accounts.d.ts +47 -0
- package/dist/resources/financial-accounts.d.ts.map +1 -0
- package/dist/resources/financial-requests.d.ts +51 -0
- package/dist/resources/financial-requests.d.ts.map +1 -0
- package/dist/resources/generics.d.ts +57 -0
- package/dist/resources/generics.d.ts.map +1 -0
- package/dist/resources/kyc.d.ts +118 -0
- package/dist/resources/kyc.d.ts.map +1 -0
- package/dist/resources/merchants.d.ts +52 -15
- package/dist/resources/merchants.d.ts.map +1 -1
- package/dist/resources/orders.d.ts +74 -2
- package/dist/resources/orders.d.ts.map +1 -1
- package/dist/resources/payment-links.d.ts +65 -0
- package/dist/resources/payment-links.d.ts.map +1 -0
- package/dist/resources/payment-methods.d.ts +48 -0
- package/dist/resources/payment-methods.d.ts.map +1 -0
- package/dist/resources/products.d.ts +62 -16
- package/dist/resources/products.d.ts.map +1 -1
- package/dist/resources/public.d.ts +27 -7
- package/dist/resources/public.d.ts.map +1 -1
- package/dist/resources/subscriptions.d.ts +86 -20
- package/dist/resources/subscriptions.d.ts.map +1 -1
- package/dist/resources/tokens.d.ts +62 -0
- package/dist/resources/tokens.d.ts.map +1 -0
- package/dist/resources/transaction-entries.d.ts +48 -0
- package/dist/resources/transaction-entries.d.ts.map +1 -0
- package/dist/resources/users.d.ts +43 -21
- package/dist/resources/users.d.ts.map +1 -1
- package/dist/resources/webhook-urls.d.ts +49 -0
- package/dist/resources/webhook-urls.d.ts.map +1 -0
- package/dist/types/resources.d.ts +1294 -0
- package/dist/types/resources.d.ts.map +1 -0
- package/dist/types.d.ts +1069 -197
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/query-builders.d.ts +518 -0
- package/dist/utils/query-builders.d.ts.map +1 -0
- package/dist/utils/query-transformer.d.ts +123 -0
- package/dist/utils/query-transformer.d.ts.map +1 -0
- package/dist/utils/translators.d.ts +126 -0
- package/dist/utils/translators.d.ts.map +1 -0
- package/dist/utils/webhooks.d.ts +19 -4
- package/dist/utils/webhooks.d.ts.map +1 -1
- package/package.json +14 -4
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { HttpClient } from '../client';
|
|
2
|
+
import { PaymentMethod, CreatePaymentMethodData, UpdatePaymentMethodData, ApiResponse } from '../types';
|
|
3
|
+
import { PaymentMethodQueryBuilder } from '../utils/query-builders';
|
|
4
|
+
import { PaymentMethodFilterParams, PaymentMethodQueryParams, PaymentMethodListResponse } from '../types/resources';
|
|
5
|
+
export declare class PaymentMethodsResource {
|
|
6
|
+
private client;
|
|
7
|
+
constructor(client: HttpClient);
|
|
8
|
+
/**
|
|
9
|
+
* List payment methods with filtering
|
|
10
|
+
*/
|
|
11
|
+
list(params?: PaymentMethodFilterParams): Promise<ApiResponse<PaymentMethodListResponse>>;
|
|
12
|
+
/**
|
|
13
|
+
* Get payment method by ID
|
|
14
|
+
*/
|
|
15
|
+
get(id: number): Promise<ApiResponse<PaymentMethod>>;
|
|
16
|
+
/**
|
|
17
|
+
* Create a new payment method
|
|
18
|
+
*/
|
|
19
|
+
create(data: CreatePaymentMethodData): Promise<ApiResponse<PaymentMethod>>;
|
|
20
|
+
/**
|
|
21
|
+
* Update a payment method
|
|
22
|
+
*/
|
|
23
|
+
update(id: number, data: UpdatePaymentMethodData): Promise<ApiResponse<PaymentMethod>>;
|
|
24
|
+
/**
|
|
25
|
+
* Delete a payment method
|
|
26
|
+
*/
|
|
27
|
+
delete(id: number): Promise<ApiResponse<void>>;
|
|
28
|
+
/**
|
|
29
|
+
* Advanced query interface with full type safety
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const methods = await sdk.paymentMethods.query({
|
|
33
|
+
* active: true,
|
|
34
|
+
* provider: { contains: 'stripe' }
|
|
35
|
+
* });
|
|
36
|
+
*/
|
|
37
|
+
query(params: PaymentMethodQueryParams): Promise<ApiResponse<PaymentMethodListResponse>>;
|
|
38
|
+
/**
|
|
39
|
+
* Create a fluent query builder for payment methods
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* const methods = await sdk.paymentMethods.createQueryBuilder()
|
|
43
|
+
* .whereActiveEquals(true)
|
|
44
|
+
* .execute();
|
|
45
|
+
*/
|
|
46
|
+
createQueryBuilder(): PaymentMethodQueryBuilder;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=payment-methods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-methods.d.ts","sourceRoot":"","sources":["../../src/resources/payment-methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,uBAAuB,EACvB,WAAW,EACZ,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EAE1B,MAAM,oBAAoB,CAAC;AAE5B,qBAAa,sBAAsB;IACrB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAI/F;;OAEG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAI1D;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAIhF;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAI5F;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAIpD;;;;;;;;OAQG;IACG,KAAK,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAK9F;;;;;;;OAOG;IACH,kBAAkB,IAAI,yBAAyB;CAGhD"}
|
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
import { HttpClient } from '../client';
|
|
2
|
-
import { Product, CreateProductData, UpdateProductData, ApiResponse
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export interface ProductListResponse {
|
|
10
|
-
entries: Product[];
|
|
11
|
-
page_info: {
|
|
12
|
-
current_page: number;
|
|
13
|
-
total_pages: number;
|
|
14
|
-
total_entries: number;
|
|
15
|
-
page_size: number;
|
|
16
|
-
};
|
|
2
|
+
import { Product, CreateProductData, UpdateProductData, ApiResponse } from '../types';
|
|
3
|
+
import { ProductQueryBuilder } from '../utils/query-builders';
|
|
4
|
+
import { ProductFilterParams, ProductQueryParams, ProductListResponse } from '../types/resources';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use ProductFilterParams from types/resources instead
|
|
7
|
+
*/
|
|
8
|
+
export interface LegacyProductFilterParams {
|
|
17
9
|
}
|
|
18
10
|
export declare class ProductsResource {
|
|
19
11
|
private client;
|
|
20
12
|
constructor(client: HttpClient);
|
|
13
|
+
/**
|
|
14
|
+
* Convert internal product data (integers) to user-facing data (strings)
|
|
15
|
+
*/
|
|
16
|
+
private translateProductToUserFacing;
|
|
17
|
+
/**
|
|
18
|
+
* Convert user-facing product data (strings) to internal data (integers)
|
|
19
|
+
*/
|
|
20
|
+
private translateProductToInternal;
|
|
21
|
+
/**
|
|
22
|
+
* Convert filter parameters (strings to integers where needed)
|
|
23
|
+
*/
|
|
24
|
+
private translateFilters;
|
|
21
25
|
/**
|
|
22
26
|
* List products with pagination and filtering
|
|
23
27
|
* Requires Client-Id header to be set in the configuration
|
|
24
28
|
*/
|
|
25
|
-
list(params?:
|
|
29
|
+
list(params?: ProductFilterParams): Promise<ApiResponse<ProductListResponse>>;
|
|
26
30
|
/**
|
|
27
31
|
* Get a specific product by ID
|
|
28
32
|
* Requires Client-Id header to be set in the configuration
|
|
@@ -43,5 +47,47 @@ export declare class ProductsResource {
|
|
|
43
47
|
* Requires Client-Id header to be set in the configuration
|
|
44
48
|
*/
|
|
45
49
|
delete(id: number): Promise<ApiResponse<void>>;
|
|
50
|
+
/**
|
|
51
|
+
* List products with enhanced query support
|
|
52
|
+
* Supports filtering by any database field using the new query system
|
|
53
|
+
* Requires Client-Id header to be set in the configuration
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* // Simple queries
|
|
57
|
+
* await products.query({ status: 'published', public: true })
|
|
58
|
+
*
|
|
59
|
+
* // Array queries (IN operations)
|
|
60
|
+
* await products.query({ category_id: [1, 2, 3], status: ['published', 'draft'] })
|
|
61
|
+
*
|
|
62
|
+
* // Range queries
|
|
63
|
+
* await products.query({ price: { min: 10, max: 100 } })
|
|
64
|
+
*
|
|
65
|
+
* // String searches
|
|
66
|
+
* await products.query({ title: { contains: 'shirt' } })
|
|
67
|
+
*
|
|
68
|
+
* // Combined queries
|
|
69
|
+
* await products.query({
|
|
70
|
+
* status: 'published',
|
|
71
|
+
* price: { min: 20 },
|
|
72
|
+
* public: true,
|
|
73
|
+
* page: 1,
|
|
74
|
+
* page_size: 20
|
|
75
|
+
* })
|
|
76
|
+
*/
|
|
77
|
+
query(params?: ProductQueryParams): Promise<ApiResponse<ProductListResponse>>;
|
|
78
|
+
/**
|
|
79
|
+
* Create a query builder for products
|
|
80
|
+
* Provides a fluent interface for building complex queries
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* const products = await sdk.products.createQueryBuilder()
|
|
84
|
+
* .whereStatus('published')
|
|
85
|
+
* .wherePriceRange(10, 100)
|
|
86
|
+
* .whereTitleContains('shirt')
|
|
87
|
+
* .wherePublic(true)
|
|
88
|
+
* .paginate(1, 20)
|
|
89
|
+
* .execute();
|
|
90
|
+
*/
|
|
91
|
+
createQueryBuilder(initialQuery?: ProductQueryParams): ProductQueryBuilder;
|
|
46
92
|
}
|
|
47
93
|
//# sourceMappingURL=products.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../src/resources/products.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,
|
|
1
|
+
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../src/resources/products.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EAGZ,MAAM,UAAU,C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Fees, ApiResponse,
|
|
3
|
-
export interface
|
|
2
|
+
import { Product, PublicMerchantFees, ApiResponse, BaseFilterParams, PublicMerchant } from '../types';
|
|
3
|
+
export interface PublicProductFilterParams extends BaseFilterParams {
|
|
4
4
|
search?: string;
|
|
5
5
|
category?: string;
|
|
6
6
|
limit?: number;
|
|
7
|
+
id?: number;
|
|
8
|
+
title?: string;
|
|
9
|
+
teaser?: string;
|
|
10
|
+
price?: number;
|
|
11
|
+
permalink?: string;
|
|
12
|
+
image?: string;
|
|
13
|
+
public?: boolean;
|
|
14
|
+
unlimited?: boolean;
|
|
15
|
+
units_remaining?: number;
|
|
16
|
+
units_sold?: number;
|
|
17
|
+
rating_sum?: number;
|
|
18
|
+
rating_count?: number;
|
|
19
|
+
tag_ids?: number[];
|
|
20
|
+
uid?: string;
|
|
21
|
+
category_id?: number;
|
|
22
|
+
currency_id?: number;
|
|
23
|
+
user_id?: number;
|
|
24
|
+
inserted_at?: string;
|
|
25
|
+
updated_at?: string;
|
|
7
26
|
}
|
|
8
27
|
export interface PublicProductListResponse {
|
|
9
28
|
entries: Product[];
|
|
@@ -18,6 +37,10 @@ export interface PublicMerchantParams {
|
|
|
18
37
|
username?: string;
|
|
19
38
|
'domain.cname'?: string;
|
|
20
39
|
}
|
|
40
|
+
export interface MerchantFeesParams {
|
|
41
|
+
currency: string;
|
|
42
|
+
total: number;
|
|
43
|
+
}
|
|
21
44
|
export declare class PublicResource {
|
|
22
45
|
private client;
|
|
23
46
|
constructor(client: HttpClient);
|
|
@@ -28,13 +51,10 @@ export declare class PublicResource {
|
|
|
28
51
|
/**
|
|
29
52
|
* Get merchant fees (public endpoint - no auth required)
|
|
30
53
|
*/
|
|
31
|
-
getMerchantFees(merchantUsername: string, params:
|
|
32
|
-
currency: string;
|
|
33
|
-
total: number;
|
|
34
|
-
}): Promise<ApiResponse<PublicMerchantFees>>;
|
|
54
|
+
getMerchantFees(merchantUsername: string, params: MerchantFeesParams): Promise<ApiResponse<PublicMerchantFees>>;
|
|
35
55
|
/**
|
|
36
56
|
* Get merchant products (public endpoint - no auth required)
|
|
37
57
|
*/
|
|
38
|
-
getMerchantProducts(merchantUsername: string, params?:
|
|
58
|
+
getMerchantProducts(merchantUsername: string, params?: PublicProductFilterParams): Promise<ApiResponse<PublicProductListResponse>>;
|
|
39
59
|
}
|
|
40
60
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/resources/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/resources/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,yBAA0B,SAAQ,gBAAgB;IAEjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAA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HttpClient } from '../client';
|
|
2
|
-
import { Subscription, SubscriptionPeriod, ApiResponse, PaginationParams } from '../types';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { Subscription, SubscriptionPeriod, CreateSubscriptionData, SubscriptionChargeData, SubscriptionUsageResponse, SubscriptionCancelResponse, ApiResponse, PaginationParams, SubscriptionStatus } from '../types';
|
|
3
|
+
import { StatusKey } from '../utils/translators';
|
|
4
|
+
import { SubscriptionQueryBuilder } from '../utils/query-builders';
|
|
5
|
+
import { SubscriptionQueryParams, SubscriptionListResponse } from '../types/resources';
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use SubscriptionFilterParams from types/resources instead
|
|
8
|
+
*/
|
|
9
|
+
export interface SubscriptionListParams {
|
|
10
|
+
status?: SubscriptionStatus | StatusKey | number;
|
|
5
11
|
billing_plan_id?: number;
|
|
6
12
|
customer_id?: number;
|
|
7
13
|
limit?: number;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
id?: number;
|
|
15
|
+
record_id?: number;
|
|
16
|
+
record?: string;
|
|
17
|
+
start_date?: string;
|
|
18
|
+
end_date?: string;
|
|
19
|
+
current_period_start?: string;
|
|
20
|
+
current_period_end?: string;
|
|
21
|
+
trial_end?: string;
|
|
22
|
+
canceled_at?: string;
|
|
23
|
+
uid?: string;
|
|
24
|
+
kind?: number;
|
|
25
|
+
token?: string;
|
|
26
|
+
inserted_at?: string;
|
|
27
|
+
updated_at?: string;
|
|
17
28
|
}
|
|
18
29
|
export interface CreateSubscriptionLinkData {
|
|
19
30
|
reference_id: string;
|
|
20
31
|
title: string;
|
|
21
|
-
|
|
32
|
+
plan_uid: string;
|
|
22
33
|
customer: {
|
|
23
34
|
first_name: string;
|
|
24
35
|
last_name: string;
|
|
@@ -26,11 +37,12 @@ export interface CreateSubscriptionLinkData {
|
|
|
26
37
|
};
|
|
27
38
|
}
|
|
28
39
|
export interface CreateSubscriptionLinkResponse {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
status: 'paid';
|
|
41
|
+
total: number;
|
|
42
|
+
reference: string;
|
|
43
|
+
currency: string;
|
|
44
|
+
subscription_status: string;
|
|
45
|
+
subscription_uid: string;
|
|
34
46
|
}
|
|
35
47
|
export interface ChargeSubscriptionData {
|
|
36
48
|
reference_id: string;
|
|
@@ -42,7 +54,13 @@ export interface ChargeSubscriptionResponse {
|
|
|
42
54
|
payment_urls: {
|
|
43
55
|
short_link: string;
|
|
44
56
|
};
|
|
45
|
-
transaction:
|
|
57
|
+
transaction: {
|
|
58
|
+
id: number;
|
|
59
|
+
amount: number;
|
|
60
|
+
status: string;
|
|
61
|
+
reference_id: string;
|
|
62
|
+
[key: string]: any;
|
|
63
|
+
};
|
|
46
64
|
}
|
|
47
65
|
export interface SubscriptionPeriodsParams extends PaginationParams {
|
|
48
66
|
status?: 'pending' | 'paid' | 'failed' | 'cancelled';
|
|
@@ -60,11 +78,42 @@ export interface SubscriptionPeriodsResponse {
|
|
|
60
78
|
export declare class SubscriptionsResource {
|
|
61
79
|
private client;
|
|
62
80
|
constructor(client: HttpClient);
|
|
81
|
+
/**
|
|
82
|
+
* Convert internal subscription data (integers) to user-facing data (strings)
|
|
83
|
+
*/
|
|
84
|
+
private translateToUserFacing;
|
|
85
|
+
/**
|
|
86
|
+
* Convert internal billing plan data to user-facing billing plan
|
|
87
|
+
*/
|
|
88
|
+
private translateBillingPlanToUserFacing;
|
|
89
|
+
/**
|
|
90
|
+
* Convert filter parameters (strings to integers where needed)
|
|
91
|
+
*/
|
|
92
|
+
private translateFilters;
|
|
93
|
+
/**
|
|
94
|
+
* Translate subscription data for API (contextual strings to integers)
|
|
95
|
+
*/
|
|
96
|
+
private translateToInternal;
|
|
63
97
|
/**
|
|
64
98
|
* List billing subscriptions with pagination and filtering
|
|
65
99
|
* Requires Client-Id header to be set in the configuration
|
|
66
100
|
*/
|
|
67
101
|
list(params?: SubscriptionListParams): Promise<ApiResponse<SubscriptionListResponse>>;
|
|
102
|
+
/**
|
|
103
|
+
* Gets a billing subscription by ID
|
|
104
|
+
* Requires Client-Id header to be set in the configuration
|
|
105
|
+
*/
|
|
106
|
+
get(id?: number): Promise<ApiResponse<Subscription>>;
|
|
107
|
+
/**
|
|
108
|
+
* Create a new subscription
|
|
109
|
+
* Requires Client-Id header to be set in the configuration
|
|
110
|
+
*/
|
|
111
|
+
create(data: CreateSubscriptionData): Promise<ApiResponse<Subscription>>;
|
|
112
|
+
/**
|
|
113
|
+
* Delete a subscription
|
|
114
|
+
* Requires Client-Id header to be set in the configuration
|
|
115
|
+
*/
|
|
116
|
+
delete(id: number): Promise<ApiResponse<void>>;
|
|
68
117
|
/**
|
|
69
118
|
* Create a subscription payment link
|
|
70
119
|
* Requires Client-Id header to be set in the configuration
|
|
@@ -75,6 +124,11 @@ export declare class SubscriptionsResource {
|
|
|
75
124
|
* Requires Client-Id header to be set in the configuration
|
|
76
125
|
*/
|
|
77
126
|
charge(uid: string, data: ChargeSubscriptionData): Promise<ApiResponse<ChargeSubscriptionResponse>>;
|
|
127
|
+
/**
|
|
128
|
+
* Record usage for a subscription (for usage-based billing)
|
|
129
|
+
* Requires Client-Id header to be set in the configuration
|
|
130
|
+
*/
|
|
131
|
+
usage(uid: string, data: SubscriptionChargeData): Promise<ApiResponse<SubscriptionUsageResponse>>;
|
|
78
132
|
/**
|
|
79
133
|
* Get subscription billing periods
|
|
80
134
|
* Requires Client-Id header to be set in the configuration
|
|
@@ -84,6 +138,18 @@ export declare class SubscriptionsResource {
|
|
|
84
138
|
* Cancel a subscription
|
|
85
139
|
* Requires Client-Id header to be set in the configuration
|
|
86
140
|
*/
|
|
87
|
-
cancel(uid: number, code: string): Promise<ApiResponse<
|
|
141
|
+
cancel(uid: number, code: string): Promise<ApiResponse<SubscriptionCancelResponse>>;
|
|
142
|
+
/**
|
|
143
|
+
* Query subscriptions with enhanced query support
|
|
144
|
+
* @example
|
|
145
|
+
* await subscriptions.query({ status: 'active', billing_plan_id: 123 })
|
|
146
|
+
*/
|
|
147
|
+
query(params?: SubscriptionQueryParams): Promise<ApiResponse<SubscriptionListResponse>>;
|
|
148
|
+
/**
|
|
149
|
+
* Create a query builder for subscriptions
|
|
150
|
+
* @example
|
|
151
|
+
* await sdk.subscriptions.createQueryBuilder().whereStatus('active').execute()
|
|
152
|
+
*/
|
|
153
|
+
createQueryBuilder(initialQuery?: SubscriptionQueryParams): SubscriptionQueryBuilder;
|
|
88
154
|
}
|
|
89
155
|
//# sourceMappingURL=subscriptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,YAAY,
|
|
1
|
+
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,YAAY,EAKZ,kBAAkB,EAClB,sBAAsB,EAEtB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,EAC1B,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAGL,SAAS,EAEV,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAEL,uBAAuB,EACvB,wBAAwB,EAEzB,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,WAAW,sBAAsB;IAErC,MAAM,CAAC,EAAE,kBAAkB,GAAG,SAAS,GAAG,MAAM,CAAC;IACjD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,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CAAC,CAAC;IAIpD;;;OAGG;IACG,UAAU,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,WAAW,CAAC,8BAA8B,CAAC,CAAC;IAIxG;;;OAGG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;IAIzG;;;OAGG;IACG,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAIvG;;;OAGG;IACG,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;IAIpH;;;OAGG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;IAIzF;;;;OAIG;IACG,KAAK,CAAC,MAAM,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;IAK7F;;;;OAIG;IACH,kBAAkB,CAAC,YAAY,CAAC,EAAE,uBAAuB,GAAG,wBAAwB;CAGrF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { HttpClient } from '../client';
|
|
2
|
+
import { Token, CreateTokenData, ApiResponse } from '../types';
|
|
3
|
+
import { TokenQueryBuilder } from '../utils/query-builders';
|
|
4
|
+
import { TokenFilterParams, TokenQueryParams, TokenListResponse } from '../types/resources';
|
|
5
|
+
/**
|
|
6
|
+
* Tokens Resource
|
|
7
|
+
*
|
|
8
|
+
* ⚠️ LIMITED ACCESS WARNING:
|
|
9
|
+
* This resource is primarily for super_admin and platform_affiliate roles.
|
|
10
|
+
* organisation_admin has limited access (view/list/create/delete only, no update).
|
|
11
|
+
* Use with caution and be aware of permission restrictions.
|
|
12
|
+
*/
|
|
13
|
+
export declare class TokensResource {
|
|
14
|
+
private client;
|
|
15
|
+
constructor(client: HttpClient);
|
|
16
|
+
/**
|
|
17
|
+
* Convert filter parameters (strings to integers where needed)
|
|
18
|
+
*/
|
|
19
|
+
private translateFilters;
|
|
20
|
+
/**
|
|
21
|
+
* Convert user-facing data to internal format
|
|
22
|
+
*/
|
|
23
|
+
private translateToInternal;
|
|
24
|
+
/**
|
|
25
|
+
* List tokens with filtering
|
|
26
|
+
*/
|
|
27
|
+
list(params?: TokenFilterParams): Promise<ApiResponse<TokenListResponse>>;
|
|
28
|
+
/**
|
|
29
|
+
* Get token by ID
|
|
30
|
+
*/
|
|
31
|
+
get(id: number): Promise<ApiResponse<Token>>;
|
|
32
|
+
/**
|
|
33
|
+
* Create a new token
|
|
34
|
+
*/
|
|
35
|
+
create(data: CreateTokenData): Promise<ApiResponse<Token>>;
|
|
36
|
+
/**
|
|
37
|
+
* Delete a token
|
|
38
|
+
*/
|
|
39
|
+
delete(id: number): Promise<ApiResponse<void>>;
|
|
40
|
+
/**
|
|
41
|
+
* Advanced query interface with full type safety
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* const tokens = await sdk.tokens.query({
|
|
45
|
+
* enabled: true,
|
|
46
|
+
* kind: [1, 2],
|
|
47
|
+
* user_id: 123
|
|
48
|
+
* });
|
|
49
|
+
*/
|
|
50
|
+
query(params: TokenQueryParams): Promise<ApiResponse<TokenListResponse>>;
|
|
51
|
+
/**
|
|
52
|
+
* Create a fluent query builder for tokens
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const tokens = await sdk.tokens.createQueryBuilder()
|
|
56
|
+
* .whereEnabledEquals(true)
|
|
57
|
+
* .whereKindIn([1, 2])
|
|
58
|
+
* .execute();
|
|
59
|
+
*/
|
|
60
|
+
createQueryBuilder(): TokenQueryBuilder;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/resources/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,KAAK,EACL,eAAe,EAEf,WAAW,EACZ,MAAM,UAAU,CAAC;AAKlB,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAElB,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;GAOG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAYxB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAK/E;;OAEG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAIlD;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAKhE;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAIpD;;;;;;;;;OASG;IACG,KAAK,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAK9E;;;;;;;;OAQG;IACH,kBAAkB,IAAI,iBAAiB;CAGxC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { HttpClient } from '../client';
|
|
2
|
+
import { TransactionEntry, ApiResponse } from '../types';
|
|
3
|
+
import { TransactionEntryQueryBuilder } from '../utils/query-builders';
|
|
4
|
+
import { TransactionEntryFilterParams, TransactionEntryQueryParams, TransactionEntryListResponse } from '../types/resources';
|
|
5
|
+
/**
|
|
6
|
+
* Transaction Entries Resource
|
|
7
|
+
*
|
|
8
|
+
* ⚠️ READ-ONLY RESOURCE:
|
|
9
|
+
* This resource is READ-ONLY for organisation_admin and owner roles.
|
|
10
|
+
* Only view and list operations are supported.
|
|
11
|
+
* Create/update/delete operations require super_admin privileges.
|
|
12
|
+
*/
|
|
13
|
+
export declare class TransactionEntriesResource {
|
|
14
|
+
private client;
|
|
15
|
+
constructor(client: HttpClient);
|
|
16
|
+
/**
|
|
17
|
+
* List transaction entries with filtering
|
|
18
|
+
*/
|
|
19
|
+
list(params?: TransactionEntryFilterParams): Promise<ApiResponse<TransactionEntryListResponse>>;
|
|
20
|
+
/**
|
|
21
|
+
* Get transaction entry by ID
|
|
22
|
+
*/
|
|
23
|
+
get(id: number): Promise<ApiResponse<TransactionEntry>>;
|
|
24
|
+
/**
|
|
25
|
+
* Advanced query interface with full type safety
|
|
26
|
+
* Note: Transaction entries are read-only for organisation_admin.
|
|
27
|
+
* Create/update/delete operations require super_admin privileges.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const entries = await sdk.transactionEntries.query({
|
|
31
|
+
* amount: { gte: 100 },
|
|
32
|
+
* type: [1, 2],
|
|
33
|
+
* transaction_id: 123
|
|
34
|
+
* });
|
|
35
|
+
*/
|
|
36
|
+
query(params: TransactionEntryQueryParams): Promise<ApiResponse<TransactionEntryListResponse>>;
|
|
37
|
+
/**
|
|
38
|
+
* Create a fluent query builder for transaction entries
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* const entries = await sdk.transactionEntries.createQueryBuilder()
|
|
42
|
+
* .whereAmountGreaterThan(100)
|
|
43
|
+
* .whereTypeIn([1, 2])
|
|
44
|
+
* .execute();
|
|
45
|
+
*/
|
|
46
|
+
createQueryBuilder(): TransactionEntryQueryBuilder;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=transaction-entries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-entries.d.ts","sourceRoot":"","sources":["../../src/resources/transaction-entries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,gBAAgB,EAGhB,WAAW,EACZ,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,4BAA4B,EAE7B,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;GAOG;AACH,qBAAa,0BAA0B;IACzB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC;IAIrG;;OAEG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAI7D;;;;;;;;;;;OAWG;IACG,KAAK,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC;IAKpG;;;;;;;;OAQG;IACH,kBAAkB,IAAI,4BAA4B;CAGnD"}
|
|
@@ -1,38 +1,48 @@
|
|
|
1
1
|
import { HttpClient } from '../client';
|
|
2
|
-
import { User, CreateUserData, UpdateUserData, ApiResponse
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
limit?: number;
|
|
10
|
-
}
|
|
11
|
-
export interface UserListResponse {
|
|
12
|
-
entries: User[];
|
|
13
|
-
page_info: {
|
|
14
|
-
current_page: number;
|
|
15
|
-
total_pages: number;
|
|
16
|
-
total_entries: number;
|
|
17
|
-
page_size: number;
|
|
18
|
-
};
|
|
2
|
+
import { User, CreateUserData, UpdateUserData, ApiResponse } from '../types';
|
|
3
|
+
import { UserQueryBuilder } from '../utils/query-builders';
|
|
4
|
+
import { UserFilterParams, UserQueryParams, UserListResponse } from '../types/resources';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use UserFilterParams from types/resources instead
|
|
7
|
+
*/
|
|
8
|
+
export interface LegacyUserFilterParams {
|
|
19
9
|
}
|
|
20
|
-
export interface CreateUserRequestData
|
|
10
|
+
export interface CreateUserRequestData {
|
|
11
|
+
email: string;
|
|
12
|
+
phone?: string;
|
|
13
|
+
first_name: string;
|
|
14
|
+
last_name: string;
|
|
15
|
+
username?: string;
|
|
16
|
+
password: string;
|
|
17
|
+
status?: number;
|
|
21
18
|
level?: number;
|
|
22
19
|
dob?: number | null;
|
|
23
20
|
sex?: number | null;
|
|
24
21
|
image?: string | null;
|
|
22
|
+
kind?: number;
|
|
25
23
|
organisation_id?: number | null;
|
|
26
|
-
|
|
24
|
+
role_id?: number;
|
|
27
25
|
}
|
|
28
26
|
export declare class UsersResource {
|
|
29
27
|
private client;
|
|
30
28
|
constructor(client: HttpClient);
|
|
29
|
+
/**
|
|
30
|
+
* Convert internal user data (integers) to user-facing data (strings)
|
|
31
|
+
*/
|
|
32
|
+
private translateUserToUserFacing;
|
|
33
|
+
/**
|
|
34
|
+
* Convert user-facing user data (strings) to internal data (integers)
|
|
35
|
+
*/
|
|
36
|
+
private translateUserToInternal;
|
|
37
|
+
/**
|
|
38
|
+
* Convert filter parameters (strings to integers where needed)
|
|
39
|
+
*/
|
|
40
|
+
private translateFilters;
|
|
31
41
|
/**
|
|
32
42
|
* List users with pagination and filtering
|
|
33
43
|
* Requires Client-Id header to be set in the configuration
|
|
34
44
|
*/
|
|
35
|
-
list(params?:
|
|
45
|
+
list(params?: UserFilterParams): Promise<ApiResponse<UserListResponse>>;
|
|
36
46
|
/**
|
|
37
47
|
* Get a specific user by ID
|
|
38
48
|
* Requires Client-Id header to be set in the configuration
|
|
@@ -42,7 +52,7 @@ export declare class UsersResource {
|
|
|
42
52
|
* Create a new user
|
|
43
53
|
* Requires Client-Id header to be set in the configuration
|
|
44
54
|
*/
|
|
45
|
-
create(data:
|
|
55
|
+
create(data: CreateUserData): Promise<ApiResponse<User>>;
|
|
46
56
|
/**
|
|
47
57
|
* Update an existing user
|
|
48
58
|
* Requires Client-Id header to be set in the configuration
|
|
@@ -53,5 +63,17 @@ export declare class UsersResource {
|
|
|
53
63
|
* Requires Client-Id header to be set in the configuration
|
|
54
64
|
*/
|
|
55
65
|
delete(id: number): Promise<ApiResponse<void>>;
|
|
66
|
+
/**
|
|
67
|
+
* Query users with enhanced query support
|
|
68
|
+
* @example
|
|
69
|
+
* await users.query({ status: 'approved', level: { min: 5 } })
|
|
70
|
+
*/
|
|
71
|
+
query(params?: UserQueryParams): Promise<ApiResponse<UserListResponse>>;
|
|
72
|
+
/**
|
|
73
|
+
* Create a query builder for users
|
|
74
|
+
* @example
|
|
75
|
+
* await sdk.users.createQueryBuilder().whereStatus('approved').execute()
|
|
76
|
+
*/
|
|
77
|
+
createQueryBuilder(initialQuery?: UserQueryParams): UserQueryBuilder;
|
|
56
78
|
}
|
|
57
79
|
//# sourceMappingURL=users.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/resources/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,IAAI,EACJ,cAAc,EACd,cAAc,EACd,WAAW,
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/resources/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,IAAI,EACJ,cAAc,EACd,cAAc,EACd,WAAW,EAIZ,MAAM,UAAU,CAAC;AAQlB,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB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