@selfcommunity/api-services 0.6.7-alpha.3 → 0.6.7-payments.144
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 +198 -0
- package/lib/cjs/index.d.ts +4 -2
- package/lib/cjs/index.js +8 -1
- package/lib/cjs/services/course/index.d.ts +449 -0
- package/lib/cjs/services/course/index.js +643 -0
- package/lib/cjs/services/payment/index.d.ts +117 -0
- package/lib/cjs/services/payment/index.js +120 -0
- package/lib/cjs/services/suggestion/index.d.ts +9 -1
- package/lib/cjs/services/suggestion/index.js +13 -0
- package/lib/cjs/services/user/index.d.ts +19 -0
- package/lib/cjs/services/user/index.js +29 -0
- package/lib/cjs/types/course.d.ts +123 -0
- package/lib/cjs/types/course.js +12 -0
- package/lib/cjs/types/index.d.ts +2 -1
- package/lib/cjs/types/index.js +3 -1
- package/lib/cjs/types/payment.d.ts +39 -0
- package/lib/cjs/types/payment.js +2 -0
- package/lib/esm/client/index.d.ts +3 -3
- package/lib/esm/client/index.js +3 -3
- package/lib/esm/constants/Endpoints.js +198 -0
- package/lib/esm/index.d.ts +4 -2
- package/lib/esm/index.js +4 -2
- package/lib/esm/services/course/index.d.ts +449 -0
- package/lib/esm/services/course/index.js +638 -0
- package/lib/esm/services/payment/index.d.ts +117 -0
- package/lib/esm/services/payment/index.js +115 -0
- package/lib/esm/services/suggestion/index.d.ts +9 -1
- package/lib/esm/services/suggestion/index.js +13 -0
- package/lib/esm/services/user/index.d.ts +19 -0
- package/lib/esm/services/user/index.js +29 -0
- package/lib/esm/types/course.d.ts +123 -0
- package/lib/esm/types/course.js +9 -0
- package/lib/esm/types/index.d.ts +2 -1
- package/lib/esm/types/index.js +2 -1
- package/lib/esm/types/payment.d.ts +39 -0
- package/lib/esm/types/payment.js +1 -0
- package/lib/umd/api-services.js +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { SCPaymentProduct, SCPaymentPrice } from '@selfcommunity/types';
|
|
2
|
+
import { AxiosRequestConfig } from 'axios';
|
|
3
|
+
import { BaseGetParams, SCPaginatedResponse } from '../../types';
|
|
4
|
+
import { CheckoutCreateSessionParams, CheckoutSessionParams, ContentProductsParams } from '../../types/payment';
|
|
5
|
+
import { SCCheckoutSession } from '@selfcommunity/types';
|
|
6
|
+
import { SCCheckoutSessionDetail } from '@selfcommunity/types';
|
|
7
|
+
export interface PaymentApiClientInterface {
|
|
8
|
+
/**
|
|
9
|
+
* Get paywall products related to an object of type <content_type> and id <content_id>
|
|
10
|
+
* @param params
|
|
11
|
+
* @param config
|
|
12
|
+
*/
|
|
13
|
+
getPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
14
|
+
/**
|
|
15
|
+
* Get prices related to a product
|
|
16
|
+
* @param id
|
|
17
|
+
* @param params
|
|
18
|
+
* @param config
|
|
19
|
+
*/
|
|
20
|
+
getPaymentProductPrices(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
21
|
+
/**
|
|
22
|
+
* Create session checkout with price_id for an object of type <content_type> and id <content_id>
|
|
23
|
+
* @param data
|
|
24
|
+
* @param config
|
|
25
|
+
*/
|
|
26
|
+
checkoutCreateSession(data: CheckoutCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<any>;
|
|
27
|
+
/**
|
|
28
|
+
* This endpoint retrieve checkout session
|
|
29
|
+
* @param params
|
|
30
|
+
* @param config
|
|
31
|
+
*/
|
|
32
|
+
getCheckoutSession(params?: CheckoutSessionParams, config?: AxiosRequestConfig): Promise<SCCheckoutSessionDetail>;
|
|
33
|
+
/**
|
|
34
|
+
* Complete session checkout
|
|
35
|
+
* @param data
|
|
36
|
+
* @param config
|
|
37
|
+
*/
|
|
38
|
+
checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<any>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Contains all the endpoints needed to manage payments.
|
|
42
|
+
*/
|
|
43
|
+
export declare class PaymentApiClient {
|
|
44
|
+
/**
|
|
45
|
+
* This endpoint retrieves all the products related to an object of type <content_type> and id <content_id>
|
|
46
|
+
* @param params
|
|
47
|
+
* @param config
|
|
48
|
+
*/
|
|
49
|
+
static getPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
50
|
+
/**
|
|
51
|
+
* This endpoint retrieves all the prices related to a product
|
|
52
|
+
* @param id
|
|
53
|
+
* @param params
|
|
54
|
+
* @param config
|
|
55
|
+
*/
|
|
56
|
+
static getPaymentProductPrices(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
57
|
+
/**
|
|
58
|
+
* This endpoint creates a checkout session.
|
|
59
|
+
* @param data
|
|
60
|
+
* @param config
|
|
61
|
+
*/
|
|
62
|
+
static checkoutCreateSession(data: CheckoutCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSession>;
|
|
63
|
+
/**
|
|
64
|
+
* This endpoint retrieve checkout session
|
|
65
|
+
* @param params
|
|
66
|
+
* @param config
|
|
67
|
+
*/
|
|
68
|
+
static getCheckoutSession(params?: CheckoutSessionParams, config?: AxiosRequestConfig): Promise<SCCheckoutSessionDetail>;
|
|
69
|
+
/**
|
|
70
|
+
* This endpoint complete checkout session
|
|
71
|
+
* @param data
|
|
72
|
+
* @param config
|
|
73
|
+
*/
|
|
74
|
+
static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<any>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
*
|
|
78
|
+
:::tip Payment service can be used in the following way:
|
|
79
|
+
|
|
80
|
+
```jsx
|
|
81
|
+
1. Import the service from our library:
|
|
82
|
+
|
|
83
|
+
import {PaymentService} from "@selfcommunity/api-services";
|
|
84
|
+
```
|
|
85
|
+
```jsx
|
|
86
|
+
2. Create a function and put the service inside it!
|
|
87
|
+
The async function `getPaymentProducts` will return the events matching the search query.
|
|
88
|
+
|
|
89
|
+
async getPaymentProducts() {
|
|
90
|
+
return await PaymentService.getPaymentProducts({...});
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
```jsx
|
|
94
|
+
In case of required `params`, just add them inside the brackets.
|
|
95
|
+
|
|
96
|
+
async getPaymentPrices(eventId) {
|
|
97
|
+
return await PaymentService.getProductPrices(id);
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
```jsx
|
|
101
|
+
If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
102
|
+
|
|
103
|
+
1. Declare it(or declare them, it is possible to add multiple params)
|
|
104
|
+
|
|
105
|
+
const headers = headers: {Authorization: `Bearer ${yourToken}`}
|
|
106
|
+
|
|
107
|
+
2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
108
|
+
```
|
|
109
|
+
:::
|
|
110
|
+
*/
|
|
111
|
+
export default class PaymentService {
|
|
112
|
+
static getPaymentProducts(params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentProduct>>;
|
|
113
|
+
static getPaymentProductPrices(id: number | string, params?: ContentProductsParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPaymentPrice>>;
|
|
114
|
+
static checkoutCreateSession(data: CheckoutCreateSessionParams | FormData, config?: AxiosRequestConfig): Promise<SCCheckoutSession>;
|
|
115
|
+
static getCheckoutSession(params?: CheckoutSessionParams, config?: AxiosRequestConfig): Promise<SCCheckoutSessionDetail>;
|
|
116
|
+
static checkoutCompleteSession(data: CheckoutSessionParams | FormData, config?: AxiosRequestConfig): Promise<any>;
|
|
117
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
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>
|
|
11
|
+
* @param params
|
|
12
|
+
* @param config
|
|
13
|
+
*/
|
|
14
|
+
static getPaymentProducts(params, config) {
|
|
15
|
+
const p = urlParams(params);
|
|
16
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetContentProducts.url({})}?${p.toString()}`, method: Endpoints.GetContentProducts.method }));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* This endpoint retrieves all the prices related to a product
|
|
20
|
+
* @param id
|
|
21
|
+
* @param params
|
|
22
|
+
* @param config
|
|
23
|
+
*/
|
|
24
|
+
static getPaymentProductPrices(id, params, config) {
|
|
25
|
+
const p = urlParams(params);
|
|
26
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetProductPrices.url({ id })}?${p.toString()}`, method: Endpoints.GetProductPrices.method }));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* This endpoint creates a checkout session.
|
|
30
|
+
* @param data
|
|
31
|
+
* @param config
|
|
32
|
+
*/
|
|
33
|
+
static checkoutCreateSession(data, config) {
|
|
34
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CheckoutCreateSession.url({}), method: Endpoints.CheckoutCreateSession.method, data }));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* This endpoint retrieve checkout session
|
|
38
|
+
* @param params
|
|
39
|
+
* @param config
|
|
40
|
+
*/
|
|
41
|
+
static getCheckoutSession(params, config) {
|
|
42
|
+
const p = urlParams(params);
|
|
43
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetCheckoutSession.url({})}?${p.toString()}`, method: Endpoints.GetCheckoutSession.method }));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* This endpoint complete checkout session
|
|
47
|
+
* @param data
|
|
48
|
+
* @param config
|
|
49
|
+
*/
|
|
50
|
+
static checkoutCompleteSession(data, config) {
|
|
51
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CheckoutSessionComplete.url({}), method: Endpoints.CheckoutSessionComplete.method, data }));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
:::tip Payment service can be used in the following way:
|
|
57
|
+
|
|
58
|
+
```jsx
|
|
59
|
+
1. Import the service from our library:
|
|
60
|
+
|
|
61
|
+
import {PaymentService} from "@selfcommunity/api-services";
|
|
62
|
+
```
|
|
63
|
+
```jsx
|
|
64
|
+
2. Create a function and put the service inside it!
|
|
65
|
+
The async function `getPaymentProducts` will return the events matching the search query.
|
|
66
|
+
|
|
67
|
+
async getPaymentProducts() {
|
|
68
|
+
return await PaymentService.getPaymentProducts({...});
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
```jsx
|
|
72
|
+
In case of required `params`, just add them inside the brackets.
|
|
73
|
+
|
|
74
|
+
async getPaymentPrices(eventId) {
|
|
75
|
+
return await PaymentService.getProductPrices(id);
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
```jsx
|
|
79
|
+
If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
80
|
+
|
|
81
|
+
1. Declare it(or declare them, it is possible to add multiple params)
|
|
82
|
+
|
|
83
|
+
const headers = headers: {Authorization: `Bearer ${yourToken}`}
|
|
84
|
+
|
|
85
|
+
2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
86
|
+
```
|
|
87
|
+
:::
|
|
88
|
+
*/
|
|
89
|
+
export default class PaymentService {
|
|
90
|
+
static getPaymentProducts(params, config) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
return PaymentApiClient.getPaymentProducts(params, config);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
static getPaymentProductPrices(id, params, config) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
return PaymentApiClient.getPaymentProductPrices(id, params, config);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
static checkoutCreateSession(data, config) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
return PaymentApiClient.checkoutCreateSession(data, config);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
static getCheckoutSession(params, config) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
return PaymentApiClient.getCheckoutSession(params, config);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
static checkoutCompleteSession(data, config) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
return PaymentApiClient.checkoutCompleteSession(data, config);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { BaseGetParams, SCPaginatedResponse } from '../../types';
|
|
2
|
-
import { SCCategoryType, SCEventType, SCFeedObjectType, SCIncubatorType, SCSuggestionType, SCUserType } from '@selfcommunity/types';
|
|
2
|
+
import { SCCategoryType, SCCourseType, SCEventType, SCFeedObjectType, SCIncubatorType, SCSuggestionType, SCUserType } from '@selfcommunity/types';
|
|
3
3
|
import { AxiosRequestConfig } from 'axios';
|
|
4
4
|
export interface SuggestionApiClientInterface {
|
|
5
5
|
getCategorySuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCategoryType>>;
|
|
6
|
+
getCourseSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCourseType>>;
|
|
6
7
|
getIncubatorSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCIncubatorType>>;
|
|
7
8
|
getPollSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
|
|
8
9
|
getUserSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
@@ -19,6 +20,12 @@ export declare class SuggestionApiClient {
|
|
|
19
20
|
* @param config
|
|
20
21
|
*/
|
|
21
22
|
static getCategorySuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCategoryType>>;
|
|
23
|
+
/**
|
|
24
|
+
* This endpoint retrieves a list of courses suggested to the current user.
|
|
25
|
+
* @param params
|
|
26
|
+
* @param config
|
|
27
|
+
*/
|
|
28
|
+
static getCourseSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCourseType>>;
|
|
22
29
|
/**
|
|
23
30
|
* This endpoint retrieves a list of suggested incubators.
|
|
24
31
|
* @param params
|
|
@@ -81,6 +88,7 @@ export declare class SuggestionApiClient {
|
|
|
81
88
|
*/
|
|
82
89
|
export default class SuggestionService {
|
|
83
90
|
static getCategorySuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCategoryType>>;
|
|
91
|
+
static getCourseSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCourseType>>;
|
|
84
92
|
static getIncubatorSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCIncubatorType>>;
|
|
85
93
|
static getPollSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
|
|
86
94
|
static getUserSuggestion(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
|
|
@@ -14,6 +14,14 @@ export class SuggestionApiClient {
|
|
|
14
14
|
static getCategorySuggestion(params, config) {
|
|
15
15
|
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CategoriesSuggestion.url({}), method: Endpoints.CategoriesSuggestion.method, params }));
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* This endpoint retrieves a list of courses suggested to the current user.
|
|
19
|
+
* @param params
|
|
20
|
+
* @param config
|
|
21
|
+
*/
|
|
22
|
+
static getCourseSuggestion(params, config) {
|
|
23
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CourseSuggestion.url({}), method: Endpoints.CourseSuggestion.method, params }));
|
|
24
|
+
}
|
|
17
25
|
/**
|
|
18
26
|
* This endpoint retrieves a list of suggested incubators.
|
|
19
27
|
* @param params
|
|
@@ -91,6 +99,11 @@ export default class SuggestionService {
|
|
|
91
99
|
return SuggestionApiClient.getCategorySuggestion(params, config);
|
|
92
100
|
});
|
|
93
101
|
}
|
|
102
|
+
static getCourseSuggestion(params, config) {
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
return SuggestionApiClient.getCourseSuggestion(params, config);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
94
107
|
static getIncubatorSuggestion(params, config) {
|
|
95
108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
96
109
|
return SuggestionApiClient.getIncubatorSuggestion(params, config);
|
|
@@ -55,6 +55,8 @@ 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(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<any[]>;
|
|
59
|
+
getOrderDetail(id: number, order: number, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<any>;
|
|
58
60
|
}
|
|
59
61
|
/**
|
|
60
62
|
* Contains all the endpoints needed to manage users.
|
|
@@ -392,6 +394,21 @@ export declare class UserApiClient {
|
|
|
392
394
|
* @param config
|
|
393
395
|
*/
|
|
394
396
|
static getUserLiveStream(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCLiveStreamType>>;
|
|
397
|
+
/**
|
|
398
|
+
* This endpoint retrieve all order history of authenticated user
|
|
399
|
+
*
|
|
400
|
+
* @param params
|
|
401
|
+
* @param config
|
|
402
|
+
*/
|
|
403
|
+
static getOrderHistory(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<any>>;
|
|
404
|
+
/**
|
|
405
|
+
* This endpoint retrieve detail of an order
|
|
406
|
+
* @param id
|
|
407
|
+
* @param order
|
|
408
|
+
* @param params
|
|
409
|
+
* @param config
|
|
410
|
+
*/
|
|
411
|
+
static getOrderDetail(id: number, order: number, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<any>;
|
|
395
412
|
}
|
|
396
413
|
/**
|
|
397
414
|
*
|
|
@@ -483,4 +500,6 @@ export default class UserService {
|
|
|
483
500
|
static createProviderAssociation(data: SCUserProviderAssociationType, config?: AxiosRequestConfig): Promise<SCUserProviderAssociationType>;
|
|
484
501
|
static deleteProviderAssociation(data: DeleteProviderAssociation, config?: AxiosRequestConfig): Promise<any>;
|
|
485
502
|
static getUserLiveStream(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCLiveStreamType>>;
|
|
503
|
+
static getOrderHistory(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<any>>;
|
|
504
|
+
static getOrderDetail(id: number, order: number, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<any>>;
|
|
486
505
|
}
|
|
@@ -457,6 +457,25 @@ export class UserApiClient {
|
|
|
457
457
|
static getUserLiveStream(id, params, config) {
|
|
458
458
|
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetLiveStream.url({ id }), method: Endpoints.UserFeed.method, params }));
|
|
459
459
|
}
|
|
460
|
+
/**
|
|
461
|
+
* This endpoint retrieve all order history of authenticated user
|
|
462
|
+
*
|
|
463
|
+
* @param params
|
|
464
|
+
* @param config
|
|
465
|
+
*/
|
|
466
|
+
static getOrderHistory(params, config) {
|
|
467
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetOrderHistory.url({}), method: Endpoints.GetOrderHistory.method, params }));
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* This endpoint retrieve detail of an order
|
|
471
|
+
* @param id
|
|
472
|
+
* @param order
|
|
473
|
+
* @param params
|
|
474
|
+
* @param config
|
|
475
|
+
*/
|
|
476
|
+
static getOrderDetail(id, order, params, config) {
|
|
477
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetOrderDetail.url({ id, order }), method: Endpoints.GetOrderDetail.method, params }));
|
|
478
|
+
}
|
|
460
479
|
}
|
|
461
480
|
/**
|
|
462
481
|
*
|
|
@@ -756,4 +775,14 @@ export default class UserService {
|
|
|
756
775
|
return UserApiClient.getUserLiveStream(id, params, config);
|
|
757
776
|
});
|
|
758
777
|
}
|
|
778
|
+
static getOrderHistory(params, config) {
|
|
779
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
780
|
+
return UserApiClient.getOrderHistory(params, config);
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
static getOrderDetail(id, order, params, config) {
|
|
784
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
785
|
+
return UserApiClient.getOrderDetail(id, order, params, config);
|
|
786
|
+
});
|
|
787
|
+
}
|
|
759
788
|
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CourseCreateParams interface
|
|
3
|
+
*/
|
|
4
|
+
import { SCCoursePrivacyType, SCCourseJoinStatusType, SCCourseTypologyType } from '@selfcommunity/types';
|
|
5
|
+
import { BaseGetParams, BaseSearchParams } from './baseParams';
|
|
6
|
+
export interface CourseCreateParams {
|
|
7
|
+
/**
|
|
8
|
+
* A unique name for the course
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* The course description
|
|
13
|
+
*/
|
|
14
|
+
description?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The course type
|
|
17
|
+
*/
|
|
18
|
+
type: SCCourseTypologyType;
|
|
19
|
+
/**
|
|
20
|
+
* The course privacy
|
|
21
|
+
*/
|
|
22
|
+
privacy: SCCoursePrivacyType;
|
|
23
|
+
/**
|
|
24
|
+
* The categories id
|
|
25
|
+
*/
|
|
26
|
+
categories: number[];
|
|
27
|
+
}
|
|
28
|
+
export interface CourseSectionParams {
|
|
29
|
+
/**
|
|
30
|
+
* A unique name for the course section
|
|
31
|
+
*/
|
|
32
|
+
name: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* CourseUserParams interface.
|
|
36
|
+
*/
|
|
37
|
+
export interface CourseUserParams extends BaseGetParams {
|
|
38
|
+
/**
|
|
39
|
+
* Filter results by subscription_status
|
|
40
|
+
*/
|
|
41
|
+
join_status?: SCCourseJoinStatusType;
|
|
42
|
+
/**
|
|
43
|
+
* Return only courses created by this user id
|
|
44
|
+
*/
|
|
45
|
+
created_by?: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* CourseSearchParams interface.
|
|
49
|
+
*/
|
|
50
|
+
export interface CourseSearchParams extends BaseSearchParams {
|
|
51
|
+
/**
|
|
52
|
+
* The categories ids
|
|
53
|
+
*/
|
|
54
|
+
categories?: number[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* CourseInfoView enum
|
|
58
|
+
*/
|
|
59
|
+
export declare enum CourseInfoViewType {
|
|
60
|
+
USER = "user",
|
|
61
|
+
EDIT = "edit",
|
|
62
|
+
DASHBOARD = "dashboard"
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* CourseInfoParams interface.
|
|
66
|
+
*/
|
|
67
|
+
export interface CourseInfoParams {
|
|
68
|
+
view?: CourseInfoViewType;
|
|
69
|
+
user?: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* CourseLessonCommentsParams interface.
|
|
73
|
+
*/
|
|
74
|
+
export interface CourseLessonCommentsParams extends BaseGetParams {
|
|
75
|
+
/**
|
|
76
|
+
* The ordering of the comments; use - for order desc.
|
|
77
|
+
* Default to created_at
|
|
78
|
+
*/
|
|
79
|
+
ordering?: string;
|
|
80
|
+
/**
|
|
81
|
+
* The Id of the parent Course Comment; used for retrieve nested comments
|
|
82
|
+
*/
|
|
83
|
+
parent?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* CourseUserRoleParams interface.
|
|
87
|
+
*/
|
|
88
|
+
export interface CourseUserRoleParams {
|
|
89
|
+
/**
|
|
90
|
+
* List of id of User to set as managers role.
|
|
91
|
+
* At least one parameter between managers, joined and unjoined is required.
|
|
92
|
+
*/
|
|
93
|
+
managers?: number[];
|
|
94
|
+
/**
|
|
95
|
+
* List of id of User to force to join the course as normal users.
|
|
96
|
+
* At least one parameter between managers, joined and unjoined is required.
|
|
97
|
+
*/
|
|
98
|
+
joined?: number[];
|
|
99
|
+
/**
|
|
100
|
+
* List of id of User to force to unjoin the course.
|
|
101
|
+
* At least one parameter between managers, joined and unjoined is required.
|
|
102
|
+
*/
|
|
103
|
+
unjoined?: number[];
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* CourseUsersParams interface.
|
|
107
|
+
*/
|
|
108
|
+
export interface CourseUsersParams extends BaseGetParams {
|
|
109
|
+
/**
|
|
110
|
+
* Filter by join_status; default: ["manager", "joined"].
|
|
111
|
+
* Only creator, manager and joined are valid status for this route
|
|
112
|
+
*/
|
|
113
|
+
statuses?: SCCourseJoinStatusType[];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* CourseDashboardUsersParams interface.
|
|
117
|
+
*/
|
|
118
|
+
export interface CourseDashboardUsersParams extends BaseSearchParams {
|
|
119
|
+
/**
|
|
120
|
+
* Filter by join_status; default: ["manager", "joined"]
|
|
121
|
+
*/
|
|
122
|
+
statuses?: SCCourseJoinStatusType[];
|
|
123
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CourseInfoView enum
|
|
3
|
+
*/
|
|
4
|
+
export var CourseInfoViewType;
|
|
5
|
+
(function (CourseInfoViewType) {
|
|
6
|
+
CourseInfoViewType["USER"] = "user";
|
|
7
|
+
CourseInfoViewType["EDIT"] = "edit";
|
|
8
|
+
CourseInfoViewType["DASHBOARD"] = "dashboard";
|
|
9
|
+
})(CourseInfoViewType || (CourseInfoViewType = {}));
|
package/lib/esm/types/index.d.ts
CHANGED
|
@@ -27,4 +27,5 @@ import { GroupCreateParams, GroupFeedParams } from './group';
|
|
|
27
27
|
import { EventCreateParams, EventFeedParams, EventRelatedParams, EventSearchParams } from './event';
|
|
28
28
|
import { LiveStreamCreateParams, LiveStreamSearchParams, LiveStreamRemoveParticipantParams } from './liveStream';
|
|
29
29
|
import { StartStepParams, OnBoardingStep } from './onBoarding';
|
|
30
|
-
|
|
30
|
+
import { CourseCreateParams, CourseSearchParams, CourseInfoViewType, CourseInfoParams, CourseLessonCommentsParams, CourseUserRoleParams, CourseUsersParams, CourseDashboardUsersParams } from './course';
|
|
31
|
+
export { AccountCreateParams, AccountVerifyParams, AccountRecoverParams, AccountResetParams, AccountSearchParams, SCPaginatedResponse, WebhookParamType, WebhookEventsType, SSOSignUpParams, CommentListParams, CommentCreateParams, IncubatorCreateParams, IncubatorSearchParams, LoyaltyPrizeParams, LoyaltyGetPrizeParams, ModerationParams, ModerateContributionParams, FlaggedContributionParams, CustomNotificationParams, UserGetParams, UserAutocompleteParams, UserScoreParams, UserSearchParams, TagParams, TagGetParams, MediaCreateParams, MediaTypes, ChunkUploadCompleteParams, ChunkUploadParams, ThreadParams, ThreadDeleteParams, MessageCreateParams, MessageMediaUploadParams, MessageThumbnailUploadParams, MessageChunkUploadDoneParams, MessageMediaChunksParams, CategoryParams, CustomAdvParams, CustomPageParams, CustomPageSearchParams, EmbedUpdateParams, EmbedSearchParams, BaseGetParams, BaseSearchParams, FeedObjGetParams, FeedObjCreateParams, FeedObjectPollVotesSearch, FeedParams, LegalPageFilterParams, FeatureParams, ScoreParams, InsightContributionParams, InsightUserParams, InsightEmbedParams, InsightCommonParams, ReactionParams, GroupCreateParams, GroupFeedParams, EventCreateParams, EventFeedParams, EventRelatedParams, EventSearchParams, LiveStreamCreateParams, LiveStreamSearchParams, LiveStreamRemoveParticipantParams, StartStepParams, OnBoardingStep, CourseCreateParams, CourseSearchParams, CourseInfoViewType, CourseInfoParams, CourseLessonCommentsParams, CourseUserRoleParams, CourseUsersParams, CourseDashboardUsersParams };
|
package/lib/esm/types/index.js
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { BaseGetParams } from './baseParams';
|
|
2
|
+
import { SCContentType } from '@selfcommunity/types';
|
|
3
|
+
/**
|
|
4
|
+
* PaymentParams interface.
|
|
5
|
+
*/
|
|
6
|
+
export interface ContentProductsParams extends BaseGetParams {
|
|
7
|
+
/**
|
|
8
|
+
* Content id
|
|
9
|
+
*/
|
|
10
|
+
id?: number | string;
|
|
11
|
+
/**
|
|
12
|
+
* Content id
|
|
13
|
+
*/
|
|
14
|
+
content_id?: number | string;
|
|
15
|
+
/**
|
|
16
|
+
* Content type
|
|
17
|
+
*/
|
|
18
|
+
content_type?: SCContentType;
|
|
19
|
+
}
|
|
20
|
+
export interface CheckoutCreateSessionParams {
|
|
21
|
+
/**
|
|
22
|
+
* Content id
|
|
23
|
+
*/
|
|
24
|
+
content_id: number;
|
|
25
|
+
/**
|
|
26
|
+
* Content type
|
|
27
|
+
*/
|
|
28
|
+
content_type: SCContentType;
|
|
29
|
+
/**
|
|
30
|
+
* Price id
|
|
31
|
+
*/
|
|
32
|
+
payment_price_id: number;
|
|
33
|
+
}
|
|
34
|
+
export interface CheckoutSessionParams {
|
|
35
|
+
/**
|
|
36
|
+
* Session Id
|
|
37
|
+
*/
|
|
38
|
+
session_id: string;
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|