@selfcommunity/api-services 0.7.0-alpha.0 → 0.7.0-alpha.10
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/lib/cjs/client/index.d.ts +3 -3
- package/lib/cjs/client/index.js +3 -3
- package/lib/cjs/constants/Endpoints.js +105 -0
- package/lib/cjs/index.d.ts +5 -2
- package/lib/cjs/index.js +10 -1
- package/lib/cjs/services/community/index.d.ts +69 -0
- package/lib/cjs/services/community/index.js +74 -0
- package/lib/cjs/services/contact_us/index.d.ts +57 -0
- package/lib/cjs/services/contact_us/index.js +65 -0
- package/lib/cjs/services/custom_menu/index.d.ts +0 -7
- package/lib/cjs/services/custom_menu/index.js +0 -12
- package/lib/cjs/services/feed_object/index.d.ts +28 -1
- package/lib/cjs/services/feed_object/index.js +44 -0
- package/lib/cjs/services/payment/index.d.ts +219 -0
- package/lib/cjs/services/payment/index.js +218 -0
- package/lib/cjs/services/user/index.d.ts +29 -1
- package/lib/cjs/services/user/index.js +43 -0
- package/lib/cjs/types/contactUs.d.ts +25 -0
- package/lib/cjs/types/contactUs.js +5 -0
- package/lib/cjs/types/feedObject.d.ts +17 -0
- package/lib/cjs/types/index.d.ts +4 -2
- package/lib/cjs/types/payment.d.ts +137 -0
- package/lib/cjs/types/payment.js +2 -0
- package/lib/cjs/types/user.d.ts +4 -0
- package/lib/esm/client/index.d.ts +3 -3
- package/lib/esm/client/index.js +3 -3
- package/lib/esm/constants/Endpoints.js +105 -0
- package/lib/esm/index.d.ts +5 -2
- package/lib/esm/index.js +4 -1
- package/lib/esm/services/community/index.d.ts +69 -0
- package/lib/esm/services/community/index.js +69 -0
- package/lib/esm/services/contact_us/index.d.ts +57 -0
- package/lib/esm/services/contact_us/index.js +60 -0
- package/lib/esm/services/custom_menu/index.d.ts +0 -7
- package/lib/esm/services/custom_menu/index.js +0 -12
- package/lib/esm/services/feed_object/index.d.ts +28 -1
- package/lib/esm/services/feed_object/index.js +44 -0
- package/lib/esm/services/payment/index.d.ts +219 -0
- package/lib/esm/services/payment/index.js +213 -0
- package/lib/esm/services/user/index.d.ts +29 -1
- package/lib/esm/services/user/index.js +43 -0
- package/lib/esm/types/contactUs.d.ts +25 -0
- package/lib/esm/types/contactUs.js +4 -0
- package/lib/esm/types/feedObject.d.ts +17 -0
- package/lib/esm/types/index.d.ts +4 -2
- package/lib/esm/types/payment.d.ts +137 -0
- package/lib/esm/types/payment.js +1 -0
- package/lib/esm/types/user.d.ts +4 -0
- package/lib/umd/api-services.js +1 -1
- package/package.json +4 -4
|
@@ -4,7 +4,6 @@ import { AxiosRequestConfig } from 'axios';
|
|
|
4
4
|
export interface CustomMenuApiClientInterface {
|
|
5
5
|
getASpecificCustomMenu(id: number | string, config?: AxiosRequestConfig): Promise<SCCustomMenuType>;
|
|
6
6
|
getAllCustomMenus(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCustomMenuType>>;
|
|
7
|
-
getBaseCustomMenu(config?: AxiosRequestConfig): Promise<SCCustomMenuType>;
|
|
8
7
|
searchCustomMenus(params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCustomMenuType>>;
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
@@ -23,11 +22,6 @@ export declare class CustomMenuApiClient {
|
|
|
23
22
|
* @param config
|
|
24
23
|
*/
|
|
25
24
|
static getAllCustomMenus(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCustomMenuType>>;
|
|
26
|
-
/**
|
|
27
|
-
* This endpoint retrieves the base custom menu.
|
|
28
|
-
* @param config
|
|
29
|
-
*/
|
|
30
|
-
static getBaseCustomMenu(config?: AxiosRequestConfig): Promise<SCCustomMenuType>;
|
|
31
25
|
/**
|
|
32
26
|
* This endpoint performs search of a Custom Menu
|
|
33
27
|
* @param params
|
|
@@ -73,6 +67,5 @@ export declare class CustomMenuApiClient {
|
|
|
73
67
|
export default class CustomMenuService {
|
|
74
68
|
static getASpecificCustomMenu(id: number | string, config?: AxiosRequestConfig): Promise<SCCustomMenuType>;
|
|
75
69
|
static getAllCustomMenus(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCustomMenuType>>;
|
|
76
|
-
static getBaseCustomMenu(config?: AxiosRequestConfig): Promise<SCCustomMenuType>;
|
|
77
70
|
static searchCustomMenus(params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCustomMenuType>>;
|
|
78
71
|
}
|
|
@@ -23,13 +23,6 @@ export class CustomMenuApiClient {
|
|
|
23
23
|
const p = urlParams(params);
|
|
24
24
|
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetCustomMenus.url({})}?${p.toString()}`, method: Endpoints.GetCustomMenus.method }));
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
27
|
-
* This endpoint retrieves the base custom menu.
|
|
28
|
-
* @param config
|
|
29
|
-
*/
|
|
30
|
-
static getBaseCustomMenu(config) {
|
|
31
|
-
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CustomMenu.url({ id: 'base' }), method: Endpoints.CustomMenu.method }));
|
|
32
|
-
}
|
|
33
26
|
/**
|
|
34
27
|
* This endpoint performs search of a Custom Menu
|
|
35
28
|
* @param params
|
|
@@ -86,11 +79,6 @@ export default class CustomMenuService {
|
|
|
86
79
|
return CustomMenuApiClient.getAllCustomMenus(params, config);
|
|
87
80
|
});
|
|
88
81
|
}
|
|
89
|
-
static getBaseCustomMenu(config) {
|
|
90
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
return CustomMenuApiClient.getBaseCustomMenu(config);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
82
|
static searchCustomMenus(params, config) {
|
|
95
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
96
84
|
return CustomMenuApiClient.searchCustomMenus(params, config);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseGetParams, BaseSearchParams, FeedObjCreateParams, FeedObjectPollVotesSearch, FeedObjGetParams, SCPaginatedResponse } from '../../types';
|
|
1
|
+
import { BaseGetParams, BaseSearchParams, FeedObjCreateParams, FeedObjectPollVotesSearch, FeedObjGetParams, SCPaginatedResponse, ScheduledFeedObjParams } from '../../types';
|
|
2
2
|
import { SCContributionType, SCFeedObjectFollowingStatusType, SCFeedObjectHideStatusType, SCFeedObjectSuspendedStatusType, SCFeedObjectType, SCFlagType, SCFlagTypeEnum, SCPollVoteType, SCUserType, SCVoteType } from '@selfcommunity/types';
|
|
3
3
|
import { AxiosRequestConfig } from 'axios';
|
|
4
4
|
export interface FeedObjectApiClientInterface {
|
|
@@ -29,6 +29,9 @@ export interface FeedObjectApiClientInterface {
|
|
|
29
29
|
feedObjectFlagStatus(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFlagType>>;
|
|
30
30
|
hideFeedObject(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<any>;
|
|
31
31
|
feedObjectHideStatus(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCFeedObjectHideStatusType>;
|
|
32
|
+
feedObjectScheduledList(type: Exclude<SCContributionType, SCContributionType.COMMENT>, params?: ScheduledFeedObjParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
|
|
33
|
+
feedObjectDraftedList(type: Exclude<SCContributionType, SCContributionType.COMMENT>, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
|
|
34
|
+
publishFeedObject(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCFeedObjectType>;
|
|
32
35
|
}
|
|
33
36
|
/**
|
|
34
37
|
* Contains all the endpoints needed to manage feed objs (discussions-posts-statuses).
|
|
@@ -233,6 +236,27 @@ export declare class FeedObjectApiClient {
|
|
|
233
236
|
* @param config
|
|
234
237
|
*/
|
|
235
238
|
static feedObjectHideStatus(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCFeedObjectHideStatusType>;
|
|
239
|
+
/**
|
|
240
|
+
* This endpoint retrieves the list of scheduled feed objects
|
|
241
|
+
* @param type
|
|
242
|
+
* @param params
|
|
243
|
+
* @param config
|
|
244
|
+
*/
|
|
245
|
+
static feedObjectScheduledList(type: Exclude<SCContributionType, SCContributionType.COMMENT>, params?: ScheduledFeedObjParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
|
|
246
|
+
/**
|
|
247
|
+
* This endpoint retrieves the list of drafted feed objects
|
|
248
|
+
* @param type
|
|
249
|
+
* @param params
|
|
250
|
+
* @param config
|
|
251
|
+
*/
|
|
252
|
+
static feedObjectDraftedList(type: Exclude<SCContributionType, SCContributionType.COMMENT>, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
|
|
253
|
+
/**
|
|
254
|
+
* This endpoint publishes a drafted or scheduled the feed obj.
|
|
255
|
+
* @param type
|
|
256
|
+
* @param id
|
|
257
|
+
* @param config
|
|
258
|
+
*/
|
|
259
|
+
static publishFeedObject(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCFeedObjectType>;
|
|
236
260
|
}
|
|
237
261
|
/**
|
|
238
262
|
*
|
|
@@ -290,4 +314,7 @@ export default class FeedObjectService {
|
|
|
290
314
|
static feedObjectFlagStatus(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFlagType>>;
|
|
291
315
|
static hideFeedObject(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<any>;
|
|
292
316
|
static feedObjectHideStatus(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCFeedObjectHideStatusType>;
|
|
317
|
+
static feedObjectScheduledList(type: Exclude<SCContributionType, SCContributionType.COMMENT>, params?: ScheduledFeedObjParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
|
|
318
|
+
static feedObjectDraftedList(type: Exclude<SCContributionType, SCContributionType.COMMENT>, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
|
|
319
|
+
static publishFeedObject(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCFeedObjectType>;
|
|
293
320
|
}
|
|
@@ -271,6 +271,35 @@ export class FeedObjectApiClient {
|
|
|
271
271
|
static feedObjectHideStatus(type, id, config) {
|
|
272
272
|
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.FeedObjectHideStatus.url({ type, id }), method: Endpoints.FeedObjectHideStatus.method }));
|
|
273
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* This endpoint retrieves the list of scheduled feed objects
|
|
276
|
+
* @param type
|
|
277
|
+
* @param params
|
|
278
|
+
* @param config
|
|
279
|
+
*/
|
|
280
|
+
static feedObjectScheduledList(type, params, config) {
|
|
281
|
+
const p = urlParams(params);
|
|
282
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetScheduledFeedObjects.url({ type })}?${p.toString()}`, method: Endpoints.GetScheduledFeedObjects.method }));
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* This endpoint retrieves the list of drafted feed objects
|
|
286
|
+
* @param type
|
|
287
|
+
* @param params
|
|
288
|
+
* @param config
|
|
289
|
+
*/
|
|
290
|
+
static feedObjectDraftedList(type, params, config) {
|
|
291
|
+
const p = urlParams(params);
|
|
292
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetDraftedFeedObjects.url({ type })}?${p.toString()}`, method: Endpoints.GetDraftedFeedObjects.method }));
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* This endpoint publishes a drafted or scheduled the feed obj.
|
|
296
|
+
* @param type
|
|
297
|
+
* @param id
|
|
298
|
+
* @param config
|
|
299
|
+
*/
|
|
300
|
+
static publishFeedObject(type, id, config) {
|
|
301
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.PublishFeedObject.url({ type, id }), method: Endpoints.PublishFeedObject.method }));
|
|
302
|
+
}
|
|
274
303
|
}
|
|
275
304
|
/**
|
|
276
305
|
*
|
|
@@ -436,4 +465,19 @@ export default class FeedObjectService {
|
|
|
436
465
|
return FeedObjectApiClient.feedObjectHideStatus(type, id, config);
|
|
437
466
|
});
|
|
438
467
|
}
|
|
468
|
+
static feedObjectScheduledList(type, params, config) {
|
|
469
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
470
|
+
return FeedObjectApiClient.feedObjectScheduledList(type, params, config);
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
static feedObjectDraftedList(type, params, config) {
|
|
474
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
475
|
+
return FeedObjectApiClient.feedObjectDraftedList(type, params, config);
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
static publishFeedObject(type, id, config) {
|
|
479
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
480
|
+
return FeedObjectApiClient.publishFeedObject(type, id, config);
|
|
481
|
+
});
|
|
482
|
+
}
|
|
439
483
|
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { BaseGetParams, PaymentContentStatus, SCPaginatedResponse } from '../../types';
|
|
3
|
+
import { CheckoutCreateSessionParams, CheckoutSessionParams, PaymentProductsParams, CustomerPortalCreateSessionParams, PaymentContentStatusParams, PaymentOrderParams, CreatePaymentProductParams } from '../../types/payment';
|
|
4
|
+
import { SCCheckoutSession, SCPaymentOrder, SCCheckoutSessionDetail, SCCheckoutSessionComplete, SCPaymentProduct, SCPaymentPrice, SCPaymentsCustomerPortalSession, SCPaywall } from '@selfcommunity/types';
|
|
5
|
+
export interface PaymentApiClientInterface {
|
|
6
|
+
/**
|
|
7
|
+
* Get payment products related to an object (aka paywalls) of type <content_type> and id <content_id> and the current payment_order
|
|
8
|
+
* @param params
|
|
9
|
+
* @param config
|
|
10
|
+
*/
|
|
11
|
+
getPaymentContentStatus(params?: PaymentContentStatusParams, config?: AxiosRequestConfig): Promise<PaymentContentStatus>;
|
|
12
|
+
/**
|
|
13
|
+
* Get payment products related to an object (aka paywalls) of type <content_type> and id <content_id>
|
|
14
|
+
* @param params
|
|
15
|
+
* @param config
|
|
16
|
+
*/
|
|
17
|
+
getPaywalls(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaywall>>;
|
|
18
|
+
/**
|
|
19
|
+
* Get payment products
|
|
20
|
+
* @param params
|
|
21
|
+
* @param config
|
|
22
|
+
*/
|
|
23
|
+
getPaymentProducts(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
24
|
+
/**
|
|
25
|
+
* Get product
|
|
26
|
+
* @param id
|
|
27
|
+
* @param config
|
|
28
|
+
*/
|
|
29
|
+
getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
30
|
+
/**
|
|
31
|
+
* Get prices related to a product
|
|
32
|
+
* @param id
|
|
33
|
+
* @param params
|
|
34
|
+
* @param config
|
|
35
|
+
*/
|
|
36
|
+
getPaymentProductPrices(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
37
|
+
/**
|
|
38
|
+
* Create session checkout with price_id for an object of type <content_type> and id <content_id>
|
|
39
|
+
* @param data
|
|
40
|
+
* @param config
|
|
41
|
+
*/
|
|
42
|
+
checkoutCreateSession(data: CheckoutCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<any>;
|
|
43
|
+
/**
|
|
44
|
+
* This endpoint retrieve checkout session
|
|
45
|
+
* @param params
|
|
46
|
+
* @param config
|
|
47
|
+
*/
|
|
48
|
+
getCheckoutSession(params?: CheckoutSessionParams, config?: AxiosRequestConfig): Promise<SCCheckoutSessionDetail>;
|
|
49
|
+
/**
|
|
50
|
+
* Complete session checkout
|
|
51
|
+
* @param data
|
|
52
|
+
* @param config
|
|
53
|
+
*/
|
|
54
|
+
checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
|
|
55
|
+
/**
|
|
56
|
+
* This endpoint retrieve order history of authenticated user
|
|
57
|
+
* @param params
|
|
58
|
+
* @param config
|
|
59
|
+
*/
|
|
60
|
+
getPaymentsOrder(params?: PaymentOrderParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
|
|
61
|
+
/**
|
|
62
|
+
* This endpoint retrieves the single payment order
|
|
63
|
+
* @param id
|
|
64
|
+
* @param config
|
|
65
|
+
*/
|
|
66
|
+
getPaymentOrder(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentOrder>;
|
|
67
|
+
/**
|
|
68
|
+
* This endpoint retrieves the single payment order in pdf format
|
|
69
|
+
* @param id
|
|
70
|
+
* @param config
|
|
71
|
+
*/
|
|
72
|
+
getPaymentOrderPdf(id: number | string, config?: AxiosRequestConfig): Promise<Blob>;
|
|
73
|
+
/**
|
|
74
|
+
* This endpoint retrieve customer portal
|
|
75
|
+
* @param data
|
|
76
|
+
* @param config
|
|
77
|
+
*/
|
|
78
|
+
getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
|
|
79
|
+
/**
|
|
80
|
+
* Create payment product
|
|
81
|
+
* @param data
|
|
82
|
+
* @param config
|
|
83
|
+
*/
|
|
84
|
+
createPaymentProduct(data: CreatePaymentProductParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Contains all the endpoints needed to manage payments.
|
|
88
|
+
*/
|
|
89
|
+
export declare class PaymentApiClient {
|
|
90
|
+
/**
|
|
91
|
+
* This endpoint retrieves all the products related to an object of type <content_type> and id <content_id> and the current payment_order
|
|
92
|
+
* @param params
|
|
93
|
+
* @param config
|
|
94
|
+
*/
|
|
95
|
+
static getPaymentContentStatus(params?: PaymentContentStatusParams, config?: AxiosRequestConfig): Promise<PaymentContentStatus>;
|
|
96
|
+
/**
|
|
97
|
+
* This endpoint retrieves all the products related to an object of type <content_type> and id <content_id>
|
|
98
|
+
* @param params
|
|
99
|
+
* @param config
|
|
100
|
+
*/
|
|
101
|
+
static getPaywalls(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaywall>>;
|
|
102
|
+
/**
|
|
103
|
+
* This endpoint retrieves all the payment products
|
|
104
|
+
* @param params
|
|
105
|
+
* @param config
|
|
106
|
+
*/
|
|
107
|
+
static getPaymentProducts(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
108
|
+
/**
|
|
109
|
+
* This endpoint retrieves a specific payment product.
|
|
110
|
+
* @param id
|
|
111
|
+
* @param config
|
|
112
|
+
*/
|
|
113
|
+
static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
114
|
+
/**
|
|
115
|
+
* This endpoint retrieves all the prices related to a product
|
|
116
|
+
* @param id
|
|
117
|
+
* @param params
|
|
118
|
+
* @param config
|
|
119
|
+
*/
|
|
120
|
+
static getPaymentProductPrices(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
121
|
+
/**
|
|
122
|
+
* This endpoint creates a checkout session.
|
|
123
|
+
* @param data
|
|
124
|
+
* @param config
|
|
125
|
+
*/
|
|
126
|
+
static checkoutCreateSession(data: CheckoutCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSession>;
|
|
127
|
+
/**
|
|
128
|
+
* Create payment product
|
|
129
|
+
* @param data
|
|
130
|
+
* @param config
|
|
131
|
+
*/
|
|
132
|
+
static createPaymentProduct(data: CreatePaymentProductParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
133
|
+
/**
|
|
134
|
+
* This endpoint retrieve checkout session
|
|
135
|
+
* @param params
|
|
136
|
+
* @param config
|
|
137
|
+
*/
|
|
138
|
+
static getCheckoutSession(params?: CheckoutSessionParams, config?: AxiosRequestConfig): Promise<SCCheckoutSessionDetail>;
|
|
139
|
+
/**
|
|
140
|
+
* This endpoint complete checkout session
|
|
141
|
+
* @param data
|
|
142
|
+
* @param config
|
|
143
|
+
*/
|
|
144
|
+
static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
|
|
145
|
+
/**
|
|
146
|
+
* This endpoint retrive order history of authenticated user
|
|
147
|
+
* @param params
|
|
148
|
+
* @param config
|
|
149
|
+
*/
|
|
150
|
+
static getPaymentsOrder(params?: PaymentOrderParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
|
|
151
|
+
/**
|
|
152
|
+
* This endpoint retrieves the single payment order
|
|
153
|
+
* @param id
|
|
154
|
+
* @param config
|
|
155
|
+
*/
|
|
156
|
+
static getPaymentOrder(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentOrder>;
|
|
157
|
+
/**
|
|
158
|
+
* This endpoint retrieves the single payment order in pdf format
|
|
159
|
+
* @param id
|
|
160
|
+
* @param config
|
|
161
|
+
*/
|
|
162
|
+
static getPaymentOrderPdf(id: number | string, config?: AxiosRequestConfig): Promise<Blob>;
|
|
163
|
+
/**
|
|
164
|
+
* This endpoint retrive customer portal
|
|
165
|
+
* @param data
|
|
166
|
+
* @param config
|
|
167
|
+
*/
|
|
168
|
+
static getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
*
|
|
172
|
+
:::tip Payment service can be used in the following way:
|
|
173
|
+
|
|
174
|
+
```jsx
|
|
175
|
+
1. Import the service from our library:
|
|
176
|
+
|
|
177
|
+
import {PaymentService} from "@selfcommunity/api-services";
|
|
178
|
+
```
|
|
179
|
+
```jsx
|
|
180
|
+
2. Create a function and put the service inside it!
|
|
181
|
+
The async function `getPaymentProducts` will return the events matching the search query.
|
|
182
|
+
|
|
183
|
+
async getPaymentProducts() {
|
|
184
|
+
return await PaymentService.getPaymentProducts({...});
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
```jsx
|
|
188
|
+
In case of required `params`, just add them inside the brackets.
|
|
189
|
+
|
|
190
|
+
async getPaymentPrices(eventId) {
|
|
191
|
+
return await PaymentService.getProductPrices(id);
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
```jsx
|
|
195
|
+
If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
196
|
+
|
|
197
|
+
1. Declare it(or declare them, it is possible to add multiple params)
|
|
198
|
+
|
|
199
|
+
const headers = headers: {Authorization: `Bearer ${yourToken}`}
|
|
200
|
+
|
|
201
|
+
2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
202
|
+
```
|
|
203
|
+
:::
|
|
204
|
+
*/
|
|
205
|
+
export default class PaymentService {
|
|
206
|
+
static getPaymentContentStatus(params?: PaymentContentStatusParams, config?: AxiosRequestConfig): Promise<PaymentContentStatus>;
|
|
207
|
+
static getPaywalls(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaywall>>;
|
|
208
|
+
static getPaymentProducts(params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
209
|
+
static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
210
|
+
static getPaymentProductPrices(id: number | string, params?: PaymentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
211
|
+
static checkoutCreateSession(data: CheckoutCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSession>;
|
|
212
|
+
static getCheckoutSession(params?: CheckoutSessionParams, config?: AxiosRequestConfig): Promise<SCCheckoutSessionDetail>;
|
|
213
|
+
static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSessionComplete>;
|
|
214
|
+
static getPaymentsOrder(params?: PaymentOrderParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
|
|
215
|
+
static getPaymentOrder(id: number | string, config?: AxiosRequestConfig): Promise<SCPaymentOrder>;
|
|
216
|
+
static getPaymentOrderPdf(id: number | string, config?: AxiosRequestConfig): Promise<Blob>;
|
|
217
|
+
static getPaymentsCustomerPortal(data: CustomerPortalCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentsCustomerPortalSession>;
|
|
218
|
+
static createPaymentProduct(data: CreatePaymentProductParams | FormData, config?: AxiosRequestConfig): Promise<SCPaymentProduct>;
|
|
219
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import Endpoints from '../../constants/Endpoints';
|
|
3
|
+
import { apiRequest } from '../../utils/apiRequest';
|
|
4
|
+
import { urlParams } from '../../utils/url';
|
|
5
|
+
/**
|
|
6
|
+
* Contains all the endpoints needed to manage payments.
|
|
7
|
+
*/
|
|
8
|
+
export class PaymentApiClient {
|
|
9
|
+
/**
|
|
10
|
+
* This endpoint retrieves all the products related to an object of type <content_type> and id <content_id> and the current payment_order
|
|
11
|
+
* @param params
|
|
12
|
+
* @param config
|
|
13
|
+
*/
|
|
14
|
+
static getPaymentContentStatus(params, config) {
|
|
15
|
+
return apiRequest(Object.assign(Object.assign({}, config), { params, url: `${Endpoints.GetPaymentContentStatus.url({})}`, method: Endpoints.GetPaymentContentStatus.method }));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* This endpoint retrieves all the products related to an object of type <content_type> and id <content_id>
|
|
19
|
+
* @param params
|
|
20
|
+
* @param config
|
|
21
|
+
*/
|
|
22
|
+
static getPaywalls(params, config) {
|
|
23
|
+
const p = urlParams(params);
|
|
24
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetPaywalls.url({})}?${p.toString()}`, method: Endpoints.GetPaywalls.method }));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* This endpoint retrieves all the payment products
|
|
28
|
+
* @param params
|
|
29
|
+
* @param config
|
|
30
|
+
*/
|
|
31
|
+
static getPaymentProducts(params, config) {
|
|
32
|
+
const p = urlParams(params);
|
|
33
|
+
return apiRequest(Object.assign({ url: `${Endpoints.GetPaymentProducts.url({})}?${p.toString()}`, method: Endpoints.GetPaymentProducts.method }, config));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* This endpoint retrieves a specific payment product.
|
|
37
|
+
* @param id
|
|
38
|
+
* @param config
|
|
39
|
+
*/
|
|
40
|
+
static getPaymentProduct(id, config) {
|
|
41
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetPaymentProduct.url({ id }), method: Endpoints.GetPaymentProduct.method }));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* This endpoint retrieves all the prices related to a product
|
|
45
|
+
* @param id
|
|
46
|
+
* @param params
|
|
47
|
+
* @param config
|
|
48
|
+
*/
|
|
49
|
+
static getPaymentProductPrices(id, params, config) {
|
|
50
|
+
const p = urlParams(params);
|
|
51
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetPaymentProductPrices.url({ id })}?${p.toString()}`, method: Endpoints.GetPaymentProductPrices.method }));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* This endpoint creates a checkout session.
|
|
55
|
+
* @param data
|
|
56
|
+
* @param config
|
|
57
|
+
*/
|
|
58
|
+
static checkoutCreateSession(data, config) {
|
|
59
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CheckoutCreateSession.url({}), method: Endpoints.CheckoutCreateSession.method, data }));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Create payment product
|
|
63
|
+
* @param data
|
|
64
|
+
* @param config
|
|
65
|
+
*/
|
|
66
|
+
static createPaymentProduct(data, config) {
|
|
67
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CreatePaymentProduct.url({}), method: Endpoints.CreatePaymentProduct.method, data }));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* This endpoint retrieve checkout session
|
|
71
|
+
* @param params
|
|
72
|
+
* @param config
|
|
73
|
+
*/
|
|
74
|
+
static getCheckoutSession(params, config) {
|
|
75
|
+
const p = urlParams(params);
|
|
76
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetCheckoutSession.url({})}?${p.toString()}`, method: Endpoints.GetCheckoutSession.method }));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* This endpoint complete checkout session
|
|
80
|
+
* @param data
|
|
81
|
+
* @param config
|
|
82
|
+
*/
|
|
83
|
+
static checkoutCompleteSession(data, config) {
|
|
84
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CheckoutSessionComplete.url({}), method: Endpoints.CheckoutSessionComplete.method, data }));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* This endpoint retrive order history of authenticated user
|
|
88
|
+
* @param params
|
|
89
|
+
* @param config
|
|
90
|
+
*/
|
|
91
|
+
static getPaymentsOrder(params, config) {
|
|
92
|
+
const p = urlParams(params);
|
|
93
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetPaymentOrders.url({})}?${p.toString()}`, method: Endpoints.GetPaymentOrders.method }));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* This endpoint retrieves the single payment order
|
|
97
|
+
* @param id
|
|
98
|
+
* @param config
|
|
99
|
+
*/
|
|
100
|
+
static getPaymentOrder(id, config) {
|
|
101
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetPaymentOrder.url({ id })}`, method: Endpoints.GetPaymentOrder.method }));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* This endpoint retrieves the single payment order in pdf format
|
|
105
|
+
* @param id
|
|
106
|
+
* @param config
|
|
107
|
+
*/
|
|
108
|
+
static getPaymentOrderPdf(id, config) {
|
|
109
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetPaymentOrderPdf.url({ id })}`, method: Endpoints.GetPaymentOrderPdf.method }));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* This endpoint retrive customer portal
|
|
113
|
+
* @param data
|
|
114
|
+
* @param config
|
|
115
|
+
*/
|
|
116
|
+
static getPaymentsCustomerPortal(data, config) {
|
|
117
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CreateCustomerPortalSession.url({}), method: Endpoints.CreateCustomerPortalSession.method, data }));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
*
|
|
122
|
+
:::tip Payment service can be used in the following way:
|
|
123
|
+
|
|
124
|
+
```jsx
|
|
125
|
+
1. Import the service from our library:
|
|
126
|
+
|
|
127
|
+
import {PaymentService} from "@selfcommunity/api-services";
|
|
128
|
+
```
|
|
129
|
+
```jsx
|
|
130
|
+
2. Create a function and put the service inside it!
|
|
131
|
+
The async function `getPaymentProducts` will return the events matching the search query.
|
|
132
|
+
|
|
133
|
+
async getPaymentProducts() {
|
|
134
|
+
return await PaymentService.getPaymentProducts({...});
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
```jsx
|
|
138
|
+
In case of required `params`, just add them inside the brackets.
|
|
139
|
+
|
|
140
|
+
async getPaymentPrices(eventId) {
|
|
141
|
+
return await PaymentService.getProductPrices(id);
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
```jsx
|
|
145
|
+
If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
146
|
+
|
|
147
|
+
1. Declare it(or declare them, it is possible to add multiple params)
|
|
148
|
+
|
|
149
|
+
const headers = headers: {Authorization: `Bearer ${yourToken}`}
|
|
150
|
+
|
|
151
|
+
2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
152
|
+
```
|
|
153
|
+
:::
|
|
154
|
+
*/
|
|
155
|
+
export default class PaymentService {
|
|
156
|
+
static getPaymentContentStatus(params, config) {
|
|
157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
return PaymentApiClient.getPaymentContentStatus(params, config);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
static getPaywalls(params, config) {
|
|
162
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
163
|
+
return PaymentApiClient.getPaywalls(params, config);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
static getPaymentProducts(params, config) {
|
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
return PaymentApiClient.getPaymentProducts(params, config);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
static getPaymentProduct(id, config) {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
return PaymentApiClient.getPaymentProduct(id, config);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
static getPaymentProductPrices(id, params, config) {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
+
return PaymentApiClient.getPaymentProductPrices(id, params, config);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
static checkoutCreateSession(data, config) {
|
|
182
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
+
return PaymentApiClient.checkoutCreateSession(data, config);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
static getCheckoutSession(params, config) {
|
|
187
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
+
return PaymentApiClient.getCheckoutSession(params, config);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
static checkoutCompleteSession(data, config) {
|
|
192
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
return PaymentApiClient.checkoutCompleteSession(data, config);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
static getPaymentsOrder(params, config) {
|
|
197
|
+
return PaymentApiClient.getPaymentsOrder(params, config);
|
|
198
|
+
}
|
|
199
|
+
static getPaymentOrder(id, config) {
|
|
200
|
+
return PaymentApiClient.getPaymentOrder(id, config);
|
|
201
|
+
}
|
|
202
|
+
static getPaymentOrderPdf(id, config) {
|
|
203
|
+
return PaymentApiClient.getPaymentOrderPdf(id, config);
|
|
204
|
+
}
|
|
205
|
+
static getPaymentsCustomerPortal(data, config) {
|
|
206
|
+
return PaymentApiClient.getPaymentsCustomerPortal(data, config);
|
|
207
|
+
}
|
|
208
|
+
static createPaymentProduct(data, config) {
|
|
209
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
210
|
+
return PaymentApiClient.createPaymentProduct(data, config);
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SCAvatarType, SCCategoryType, SCFeedUnitType, SCLiveStreamType, SCPlatformType, SCTagType, SCUserAutocompleteType, SCUserAvatarType, SCUserChangeEmailType, SCUserConnectionRequestType, SCUserConnectionStatusType, SCUserCounterType, SCUserEmailTokenType, SCUserFollowedStatusType, SCUserFollowerStatusType, SCUserHiddenByStatusType, SCUserHiddenStatusType, SCUserLoyaltyPointsType, SCUserPermissionType, SCUserProviderAssociationType, SCUserSettingsType, SCUserType } from '@selfcommunity/types';
|
|
1
|
+
import { SCAvatarType, SCCategoryType, SCFeedUnitType, SCLiveStreamType, SCPaymentOrder, SCPlatformType, SCTagType, SCUserAutocompleteType, SCUserAvatarType, SCUserChangeEmailType, SCUserConnectionRequestType, SCUserConnectionStatusType, SCUserCounterType, SCUserEmailTokenType, SCUserFollowedStatusType, SCUserFollowerStatusType, SCUserHiddenByStatusType, SCUserHiddenStatusType, SCUserLoyaltyPointsType, SCUserPermissionType, SCUserProviderAssociationType, SCUserSettingsType, SCUserType } from '@selfcommunity/types';
|
|
2
2
|
import { BaseGetParams, SCPaginatedResponse, UserAutocompleteParams, UserGetParams, UserSearchParams } from '../../types';
|
|
3
3
|
import { AxiosRequestConfig } from 'axios';
|
|
4
4
|
import { DeleteProviderAssociation } from '../../types/user';
|
|
@@ -55,6 +55,9 @@ export interface UserApiClientInterface {
|
|
|
55
55
|
createProviderAssociation(data: SCUserProviderAssociationType, config?: AxiosRequestConfig): Promise<SCUserProviderAssociationType>;
|
|
56
56
|
deleteProviderAssociation(data: DeleteProviderAssociation, config?: AxiosRequestConfig): Promise<any>;
|
|
57
57
|
getUserLiveStream(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCLiveStreamType>>;
|
|
58
|
+
getOrderHistory(id: number, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaymentOrder[]>;
|
|
59
|
+
getOrderDetail(id: number, order: number, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaymentOrder>;
|
|
60
|
+
matchUsernames(usernames: string[], config?: AxiosRequestConfig): Promise<SCUserAutocompleteType[]>;
|
|
58
61
|
}
|
|
59
62
|
/**
|
|
60
63
|
* Contains all the endpoints needed to manage users.
|
|
@@ -392,6 +395,28 @@ export declare class UserApiClient {
|
|
|
392
395
|
* @param config
|
|
393
396
|
*/
|
|
394
397
|
static getUserLiveStream(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCLiveStreamType>>;
|
|
398
|
+
/**
|
|
399
|
+
* This endpoint retrieve all order history of authenticated user
|
|
400
|
+
*
|
|
401
|
+
* @param id
|
|
402
|
+
* @param params
|
|
403
|
+
* @param config
|
|
404
|
+
*/
|
|
405
|
+
static getOrderHistory(id: number, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
|
|
406
|
+
/**
|
|
407
|
+
* This endpoint retrieve detail of an order
|
|
408
|
+
* @param id
|
|
409
|
+
* @param order
|
|
410
|
+
* @param params
|
|
411
|
+
* @param config
|
|
412
|
+
*/
|
|
413
|
+
static getOrderDetail(id: number, order: number, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaymentOrder>;
|
|
414
|
+
/**
|
|
415
|
+
* This endpoint retrieve the users corresponding to the sent usernames
|
|
416
|
+
* @param usernames
|
|
417
|
+
* @param config
|
|
418
|
+
*/
|
|
419
|
+
static matchUsernames(usernames: string[], config?: AxiosRequestConfig): Promise<SCUserAutocompleteType[]>;
|
|
395
420
|
}
|
|
396
421
|
/**
|
|
397
422
|
*
|
|
@@ -483,4 +508,7 @@ export default class UserService {
|
|
|
483
508
|
static createProviderAssociation(data: SCUserProviderAssociationType, config?: AxiosRequestConfig): Promise<SCUserProviderAssociationType>;
|
|
484
509
|
static deleteProviderAssociation(data: DeleteProviderAssociation, config?: AxiosRequestConfig): Promise<any>;
|
|
485
510
|
static getUserLiveStream(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCLiveStreamType>>;
|
|
511
|
+
static getOrderHistory(id: number, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentOrder>>;
|
|
512
|
+
static getOrderDetail(id: number, order: number, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaymentOrder>;
|
|
513
|
+
static matchUsernames(usernames: string[], config?: AxiosRequestConfig): Promise<SCUserAutocompleteType[]>;
|
|
486
514
|
}
|