@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
|
@@ -274,6 +274,35 @@ class FeedObjectApiClient {
|
|
|
274
274
|
static feedObjectHideStatus(type, id, config) {
|
|
275
275
|
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.FeedObjectHideStatus.url({ type, id }), method: Endpoints_1.default.FeedObjectHideStatus.method }));
|
|
276
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
* This endpoint retrieves the list of scheduled feed objects
|
|
279
|
+
* @param type
|
|
280
|
+
* @param params
|
|
281
|
+
* @param config
|
|
282
|
+
*/
|
|
283
|
+
static feedObjectScheduledList(type, params, config) {
|
|
284
|
+
const p = (0, url_1.urlParams)(params);
|
|
285
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetScheduledFeedObjects.url({ type })}?${p.toString()}`, method: Endpoints_1.default.GetScheduledFeedObjects.method }));
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* This endpoint retrieves the list of drafted feed objects
|
|
289
|
+
* @param type
|
|
290
|
+
* @param params
|
|
291
|
+
* @param config
|
|
292
|
+
*/
|
|
293
|
+
static feedObjectDraftedList(type, params, config) {
|
|
294
|
+
const p = (0, url_1.urlParams)(params);
|
|
295
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetDraftedFeedObjects.url({ type })}?${p.toString()}`, method: Endpoints_1.default.GetDraftedFeedObjects.method }));
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* This endpoint publishes a drafted or scheduled the feed obj.
|
|
299
|
+
* @param type
|
|
300
|
+
* @param id
|
|
301
|
+
* @param config
|
|
302
|
+
*/
|
|
303
|
+
static publishFeedObject(type, id, config) {
|
|
304
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.PublishFeedObject.url({ type, id }), method: Endpoints_1.default.PublishFeedObject.method }));
|
|
305
|
+
}
|
|
277
306
|
}
|
|
278
307
|
exports.FeedObjectApiClient = FeedObjectApiClient;
|
|
279
308
|
/**
|
|
@@ -440,5 +469,20 @@ class FeedObjectService {
|
|
|
440
469
|
return FeedObjectApiClient.feedObjectHideStatus(type, id, config);
|
|
441
470
|
});
|
|
442
471
|
}
|
|
472
|
+
static feedObjectScheduledList(type, params, config) {
|
|
473
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
474
|
+
return FeedObjectApiClient.feedObjectScheduledList(type, params, config);
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
static feedObjectDraftedList(type, params, config) {
|
|
478
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
479
|
+
return FeedObjectApiClient.feedObjectDraftedList(type, params, config);
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
static publishFeedObject(type, id, config) {
|
|
483
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
484
|
+
return FeedObjectApiClient.publishFeedObject(type, id, config);
|
|
485
|
+
});
|
|
486
|
+
}
|
|
443
487
|
}
|
|
444
488
|
exports.default = FeedObjectService;
|
|
@@ -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,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentApiClient = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const Endpoints_1 = tslib_1.__importDefault(require("../../constants/Endpoints"));
|
|
6
|
+
const apiRequest_1 = require("../../utils/apiRequest");
|
|
7
|
+
const url_1 = require("../../utils/url");
|
|
8
|
+
/**
|
|
9
|
+
* Contains all the endpoints needed to manage payments.
|
|
10
|
+
*/
|
|
11
|
+
class PaymentApiClient {
|
|
12
|
+
/**
|
|
13
|
+
* This endpoint retrieves all the products related to an object of type <content_type> and id <content_id> and the current payment_order
|
|
14
|
+
* @param params
|
|
15
|
+
* @param config
|
|
16
|
+
*/
|
|
17
|
+
static getPaymentContentStatus(params, config) {
|
|
18
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { params, url: `${Endpoints_1.default.GetPaymentContentStatus.url({})}`, method: Endpoints_1.default.GetPaymentContentStatus.method }));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* This endpoint retrieves all the products related to an object of type <content_type> and id <content_id>
|
|
22
|
+
* @param params
|
|
23
|
+
* @param config
|
|
24
|
+
*/
|
|
25
|
+
static getPaywalls(params, config) {
|
|
26
|
+
const p = (0, url_1.urlParams)(params);
|
|
27
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetPaywalls.url({})}?${p.toString()}`, method: Endpoints_1.default.GetPaywalls.method }));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* This endpoint retrieves all the payment products
|
|
31
|
+
* @param params
|
|
32
|
+
* @param config
|
|
33
|
+
*/
|
|
34
|
+
static getPaymentProducts(params, config) {
|
|
35
|
+
const p = (0, url_1.urlParams)(params);
|
|
36
|
+
return (0, apiRequest_1.apiRequest)(Object.assign({ url: `${Endpoints_1.default.GetPaymentProducts.url({})}?${p.toString()}`, method: Endpoints_1.default.GetPaymentProducts.method }, config));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* This endpoint retrieves a specific payment product.
|
|
40
|
+
* @param id
|
|
41
|
+
* @param config
|
|
42
|
+
*/
|
|
43
|
+
static getPaymentProduct(id, config) {
|
|
44
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetPaymentProduct.url({ id }), method: Endpoints_1.default.GetPaymentProduct.method }));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* This endpoint retrieves all the prices related to a product
|
|
48
|
+
* @param id
|
|
49
|
+
* @param params
|
|
50
|
+
* @param config
|
|
51
|
+
*/
|
|
52
|
+
static getPaymentProductPrices(id, params, config) {
|
|
53
|
+
const p = (0, url_1.urlParams)(params);
|
|
54
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetPaymentProductPrices.url({ id })}?${p.toString()}`, method: Endpoints_1.default.GetPaymentProductPrices.method }));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* This endpoint creates a checkout session.
|
|
58
|
+
* @param data
|
|
59
|
+
* @param config
|
|
60
|
+
*/
|
|
61
|
+
static checkoutCreateSession(data, config) {
|
|
62
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CheckoutCreateSession.url({}), method: Endpoints_1.default.CheckoutCreateSession.method, data }));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Create payment product
|
|
66
|
+
* @param data
|
|
67
|
+
* @param config
|
|
68
|
+
*/
|
|
69
|
+
static createPaymentProduct(data, config) {
|
|
70
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CreatePaymentProduct.url({}), method: Endpoints_1.default.CreatePaymentProduct.method, data }));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* This endpoint retrieve checkout session
|
|
74
|
+
* @param params
|
|
75
|
+
* @param config
|
|
76
|
+
*/
|
|
77
|
+
static getCheckoutSession(params, config) {
|
|
78
|
+
const p = (0, url_1.urlParams)(params);
|
|
79
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetCheckoutSession.url({})}?${p.toString()}`, method: Endpoints_1.default.GetCheckoutSession.method }));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* This endpoint complete checkout session
|
|
83
|
+
* @param data
|
|
84
|
+
* @param config
|
|
85
|
+
*/
|
|
86
|
+
static checkoutCompleteSession(data, config) {
|
|
87
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CheckoutSessionComplete.url({}), method: Endpoints_1.default.CheckoutSessionComplete.method, data }));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* This endpoint retrive order history of authenticated user
|
|
91
|
+
* @param params
|
|
92
|
+
* @param config
|
|
93
|
+
*/
|
|
94
|
+
static getPaymentsOrder(params, config) {
|
|
95
|
+
const p = (0, url_1.urlParams)(params);
|
|
96
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetPaymentOrders.url({})}?${p.toString()}`, method: Endpoints_1.default.GetPaymentOrders.method }));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* This endpoint retrieves the single payment order
|
|
100
|
+
* @param id
|
|
101
|
+
* @param config
|
|
102
|
+
*/
|
|
103
|
+
static getPaymentOrder(id, config) {
|
|
104
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetPaymentOrder.url({ id })}`, method: Endpoints_1.default.GetPaymentOrder.method }));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* This endpoint retrieves the single payment order in pdf format
|
|
108
|
+
* @param id
|
|
109
|
+
* @param config
|
|
110
|
+
*/
|
|
111
|
+
static getPaymentOrderPdf(id, config) {
|
|
112
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetPaymentOrderPdf.url({ id })}`, method: Endpoints_1.default.GetPaymentOrderPdf.method }));
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* This endpoint retrive customer portal
|
|
116
|
+
* @param data
|
|
117
|
+
* @param config
|
|
118
|
+
*/
|
|
119
|
+
static getPaymentsCustomerPortal(data, config) {
|
|
120
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CreateCustomerPortalSession.url({}), method: Endpoints_1.default.CreateCustomerPortalSession.method, data }));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.PaymentApiClient = PaymentApiClient;
|
|
124
|
+
/**
|
|
125
|
+
*
|
|
126
|
+
:::tip Payment service can be used in the following way:
|
|
127
|
+
|
|
128
|
+
```jsx
|
|
129
|
+
1. Import the service from our library:
|
|
130
|
+
|
|
131
|
+
import {PaymentService} from "@selfcommunity/api-services";
|
|
132
|
+
```
|
|
133
|
+
```jsx
|
|
134
|
+
2. Create a function and put the service inside it!
|
|
135
|
+
The async function `getPaymentProducts` will return the events matching the search query.
|
|
136
|
+
|
|
137
|
+
async getPaymentProducts() {
|
|
138
|
+
return await PaymentService.getPaymentProducts({...});
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
```jsx
|
|
142
|
+
In case of required `params`, just add them inside the brackets.
|
|
143
|
+
|
|
144
|
+
async getPaymentPrices(eventId) {
|
|
145
|
+
return await PaymentService.getProductPrices(id);
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
```jsx
|
|
149
|
+
If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
150
|
+
|
|
151
|
+
1. Declare it(or declare them, it is possible to add multiple params)
|
|
152
|
+
|
|
153
|
+
const headers = headers: {Authorization: `Bearer ${yourToken}`}
|
|
154
|
+
|
|
155
|
+
2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
156
|
+
```
|
|
157
|
+
:::
|
|
158
|
+
*/
|
|
159
|
+
class PaymentService {
|
|
160
|
+
static getPaymentContentStatus(params, config) {
|
|
161
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
return PaymentApiClient.getPaymentContentStatus(params, config);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
static getPaywalls(params, config) {
|
|
166
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
167
|
+
return PaymentApiClient.getPaywalls(params, config);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
static getPaymentProducts(params, config) {
|
|
171
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
return PaymentApiClient.getPaymentProducts(params, config);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
static getPaymentProduct(id, config) {
|
|
176
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
177
|
+
return PaymentApiClient.getPaymentProduct(id, config);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
static getPaymentProductPrices(id, params, config) {
|
|
181
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
return PaymentApiClient.getPaymentProductPrices(id, params, config);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
static checkoutCreateSession(data, config) {
|
|
186
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
return PaymentApiClient.checkoutCreateSession(data, config);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
static getCheckoutSession(params, config) {
|
|
191
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
192
|
+
return PaymentApiClient.getCheckoutSession(params, config);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
static checkoutCompleteSession(data, config) {
|
|
196
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
return PaymentApiClient.checkoutCompleteSession(data, config);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
static getPaymentsOrder(params, config) {
|
|
201
|
+
return PaymentApiClient.getPaymentsOrder(params, config);
|
|
202
|
+
}
|
|
203
|
+
static getPaymentOrder(id, config) {
|
|
204
|
+
return PaymentApiClient.getPaymentOrder(id, config);
|
|
205
|
+
}
|
|
206
|
+
static getPaymentOrderPdf(id, config) {
|
|
207
|
+
return PaymentApiClient.getPaymentOrderPdf(id, config);
|
|
208
|
+
}
|
|
209
|
+
static getPaymentsCustomerPortal(data, config) {
|
|
210
|
+
return PaymentApiClient.getPaymentsCustomerPortal(data, config);
|
|
211
|
+
}
|
|
212
|
+
static createPaymentProduct(data, config) {
|
|
213
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
214
|
+
return PaymentApiClient.createPaymentProduct(data, config);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
exports.default = PaymentService;
|
|
@@ -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
|
}
|
|
@@ -460,6 +460,34 @@ class UserApiClient {
|
|
|
460
460
|
static getUserLiveStream(id, params, config) {
|
|
461
461
|
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetLiveStream.url({ id }), method: Endpoints_1.default.UserFeed.method, params }));
|
|
462
462
|
}
|
|
463
|
+
/**
|
|
464
|
+
* This endpoint retrieve all order history of authenticated user
|
|
465
|
+
*
|
|
466
|
+
* @param id
|
|
467
|
+
* @param params
|
|
468
|
+
* @param config
|
|
469
|
+
*/
|
|
470
|
+
static getOrderHistory(id, params, config) {
|
|
471
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetOrderHistory.url({ id }), method: Endpoints_1.default.GetOrderHistory.method, params }));
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* This endpoint retrieve detail of an order
|
|
475
|
+
* @param id
|
|
476
|
+
* @param order
|
|
477
|
+
* @param params
|
|
478
|
+
* @param config
|
|
479
|
+
*/
|
|
480
|
+
static getOrderDetail(id, order, params, config) {
|
|
481
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetOrderDetail.url({ id, order }), method: Endpoints_1.default.GetOrderDetail.method, params }));
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* This endpoint retrieve the users corresponding to the sent usernames
|
|
485
|
+
* @param usernames
|
|
486
|
+
* @param config
|
|
487
|
+
*/
|
|
488
|
+
static matchUsernames(usernames, config) {
|
|
489
|
+
return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.UserMatchUsernames.url(), method: Endpoints_1.default.UserMatchUsernames.method, data: usernames }));
|
|
490
|
+
}
|
|
463
491
|
}
|
|
464
492
|
exports.UserApiClient = UserApiClient;
|
|
465
493
|
/**
|
|
@@ -760,5 +788,20 @@ class UserService {
|
|
|
760
788
|
return UserApiClient.getUserLiveStream(id, params, config);
|
|
761
789
|
});
|
|
762
790
|
}
|
|
791
|
+
static getOrderHistory(id, params, config) {
|
|
792
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
793
|
+
return UserApiClient.getOrderHistory(id, params, config);
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
static getOrderDetail(id, order, params, config) {
|
|
797
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
798
|
+
return UserApiClient.getOrderDetail(id, order, params, config);
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
static matchUsernames(usernames, config) {
|
|
802
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
803
|
+
return UserApiClient.matchUsernames(usernames, config);
|
|
804
|
+
});
|
|
805
|
+
}
|
|
763
806
|
}
|
|
764
807
|
exports.default = UserService;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ContactUsRequestParams interface
|
|
3
|
+
*/
|
|
4
|
+
export interface ContactUsRequestParams {
|
|
5
|
+
/**
|
|
6
|
+
* name field for the account
|
|
7
|
+
*/
|
|
8
|
+
name?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Surname field for the account
|
|
11
|
+
*/
|
|
12
|
+
surname?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Email field for the account
|
|
15
|
+
*/
|
|
16
|
+
email?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Contact request message text
|
|
19
|
+
*/
|
|
20
|
+
message?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Any other properties
|
|
23
|
+
*/
|
|
24
|
+
[p: string]: any;
|
|
25
|
+
}
|
|
@@ -43,6 +43,10 @@ export interface FeedObjCreateParams {
|
|
|
43
43
|
* The list of tag ids.
|
|
44
44
|
*/
|
|
45
45
|
addressing?: number[];
|
|
46
|
+
/**
|
|
47
|
+
* If the feed obj is not published yet
|
|
48
|
+
*/
|
|
49
|
+
draft?: boolean;
|
|
46
50
|
}
|
|
47
51
|
/**
|
|
48
52
|
* FeedObjectPollVotesSearch interface
|
|
@@ -53,3 +57,16 @@ export interface FeedObjectPollVotesSearch extends BaseGetParams {
|
|
|
53
57
|
*/
|
|
54
58
|
choice?: number;
|
|
55
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* ScheduledFeedObjParams interface
|
|
62
|
+
*/
|
|
63
|
+
export interface ScheduledFeedObjParams {
|
|
64
|
+
/**
|
|
65
|
+
* Includes posts that were scheduled and already published
|
|
66
|
+
*/
|
|
67
|
+
include_published?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Show only posts that were scheduled and already published
|
|
70
|
+
*/
|
|
71
|
+
only_published?: boolean;
|
|
72
|
+
}
|