@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.
Files changed (40) hide show
  1. package/lib/cjs/client/index.d.ts +3 -3
  2. package/lib/cjs/client/index.js +3 -3
  3. package/lib/cjs/constants/Endpoints.js +198 -0
  4. package/lib/cjs/index.d.ts +4 -2
  5. package/lib/cjs/index.js +8 -1
  6. package/lib/cjs/services/course/index.d.ts +449 -0
  7. package/lib/cjs/services/course/index.js +643 -0
  8. package/lib/cjs/services/payment/index.d.ts +117 -0
  9. package/lib/cjs/services/payment/index.js +120 -0
  10. package/lib/cjs/services/suggestion/index.d.ts +9 -1
  11. package/lib/cjs/services/suggestion/index.js +13 -0
  12. package/lib/cjs/services/user/index.d.ts +19 -0
  13. package/lib/cjs/services/user/index.js +29 -0
  14. package/lib/cjs/types/course.d.ts +123 -0
  15. package/lib/cjs/types/course.js +12 -0
  16. package/lib/cjs/types/index.d.ts +2 -1
  17. package/lib/cjs/types/index.js +3 -1
  18. package/lib/cjs/types/payment.d.ts +39 -0
  19. package/lib/cjs/types/payment.js +2 -0
  20. package/lib/esm/client/index.d.ts +3 -3
  21. package/lib/esm/client/index.js +3 -3
  22. package/lib/esm/constants/Endpoints.js +198 -0
  23. package/lib/esm/index.d.ts +4 -2
  24. package/lib/esm/index.js +4 -2
  25. package/lib/esm/services/course/index.d.ts +449 -0
  26. package/lib/esm/services/course/index.js +638 -0
  27. package/lib/esm/services/payment/index.d.ts +117 -0
  28. package/lib/esm/services/payment/index.js +115 -0
  29. package/lib/esm/services/suggestion/index.d.ts +9 -1
  30. package/lib/esm/services/suggestion/index.js +13 -0
  31. package/lib/esm/services/user/index.d.ts +19 -0
  32. package/lib/esm/services/user/index.js +29 -0
  33. package/lib/esm/types/course.d.ts +123 -0
  34. package/lib/esm/types/course.js +9 -0
  35. package/lib/esm/types/index.d.ts +2 -1
  36. package/lib/esm/types/index.js +2 -1
  37. package/lib/esm/types/payment.d.ts +39 -0
  38. package/lib/esm/types/payment.js +1 -0
  39. package/lib/umd/api-services.js +1 -1
  40. 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,120 @@
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>
14
+ * @param params
15
+ * @param config
16
+ */
17
+ static getPaymentProducts(params, config) {
18
+ const p = (0, url_1.urlParams)(params);
19
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetContentProducts.url({})}?${p.toString()}`, method: Endpoints_1.default.GetContentProducts.method }));
20
+ }
21
+ /**
22
+ * This endpoint retrieves all the prices related to a product
23
+ * @param id
24
+ * @param params
25
+ * @param config
26
+ */
27
+ static getPaymentProductPrices(id, params, config) {
28
+ const p = (0, url_1.urlParams)(params);
29
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetProductPrices.url({ id })}?${p.toString()}`, method: Endpoints_1.default.GetProductPrices.method }));
30
+ }
31
+ /**
32
+ * This endpoint creates a checkout session.
33
+ * @param data
34
+ * @param config
35
+ */
36
+ static checkoutCreateSession(data, config) {
37
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CheckoutCreateSession.url({}), method: Endpoints_1.default.CheckoutCreateSession.method, data }));
38
+ }
39
+ /**
40
+ * This endpoint retrieve checkout session
41
+ * @param params
42
+ * @param config
43
+ */
44
+ static getCheckoutSession(params, config) {
45
+ const p = (0, url_1.urlParams)(params);
46
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetCheckoutSession.url({})}?${p.toString()}`, method: Endpoints_1.default.GetCheckoutSession.method }));
47
+ }
48
+ /**
49
+ * This endpoint complete checkout session
50
+ * @param data
51
+ * @param config
52
+ */
53
+ static checkoutCompleteSession(data, config) {
54
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CheckoutSessionComplete.url({}), method: Endpoints_1.default.CheckoutSessionComplete.method, data }));
55
+ }
56
+ }
57
+ exports.PaymentApiClient = PaymentApiClient;
58
+ /**
59
+ *
60
+ :::tip Payment service can be used in the following way:
61
+
62
+ ```jsx
63
+ 1. Import the service from our library:
64
+
65
+ import {PaymentService} from "@selfcommunity/api-services";
66
+ ```
67
+ ```jsx
68
+ 2. Create a function and put the service inside it!
69
+ The async function `getPaymentProducts` will return the events matching the search query.
70
+
71
+ async getPaymentProducts() {
72
+ return await PaymentService.getPaymentProducts({...});
73
+ }
74
+ ```
75
+ ```jsx
76
+ In case of required `params`, just add them inside the brackets.
77
+
78
+ async getPaymentPrices(eventId) {
79
+ return await PaymentService.getProductPrices(id);
80
+ }
81
+ ```
82
+ ```jsx
83
+ If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
84
+
85
+ 1. Declare it(or declare them, it is possible to add multiple params)
86
+
87
+ const headers = headers: {Authorization: `Bearer ${yourToken}`}
88
+
89
+ 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
90
+ ```
91
+ :::
92
+ */
93
+ class PaymentService {
94
+ static getPaymentProducts(params, config) {
95
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
96
+ return PaymentApiClient.getPaymentProducts(params, config);
97
+ });
98
+ }
99
+ static getPaymentProductPrices(id, params, config) {
100
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
101
+ return PaymentApiClient.getPaymentProductPrices(id, params, config);
102
+ });
103
+ }
104
+ static checkoutCreateSession(data, config) {
105
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
106
+ return PaymentApiClient.checkoutCreateSession(data, config);
107
+ });
108
+ }
109
+ static getCheckoutSession(params, config) {
110
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
111
+ return PaymentApiClient.getCheckoutSession(params, config);
112
+ });
113
+ }
114
+ static checkoutCompleteSession(data, config) {
115
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
116
+ return PaymentApiClient.checkoutCompleteSession(data, config);
117
+ });
118
+ }
119
+ }
120
+ exports.default = PaymentService;
@@ -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>>;
@@ -17,6 +17,14 @@ class SuggestionApiClient {
17
17
  static getCategorySuggestion(params, config) {
18
18
  return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CategoriesSuggestion.url({}), method: Endpoints_1.default.CategoriesSuggestion.method, params }));
19
19
  }
20
+ /**
21
+ * This endpoint retrieves a list of courses suggested to the current user.
22
+ * @param params
23
+ * @param config
24
+ */
25
+ static getCourseSuggestion(params, config) {
26
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.CourseSuggestion.url({}), method: Endpoints_1.default.CourseSuggestion.method, params }));
27
+ }
20
28
  /**
21
29
  * This endpoint retrieves a list of suggested incubators.
22
30
  * @param params
@@ -95,6 +103,11 @@ class SuggestionService {
95
103
  return SuggestionApiClient.getCategorySuggestion(params, config);
96
104
  });
97
105
  }
106
+ static getCourseSuggestion(params, config) {
107
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
108
+ return SuggestionApiClient.getCourseSuggestion(params, config);
109
+ });
110
+ }
98
111
  static getIncubatorSuggestion(params, config) {
99
112
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
100
113
  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
  }
@@ -460,6 +460,25 @@ 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 params
467
+ * @param config
468
+ */
469
+ static getOrderHistory(params, config) {
470
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetOrderHistory.url({}), method: Endpoints_1.default.GetOrderHistory.method, params }));
471
+ }
472
+ /**
473
+ * This endpoint retrieve detail of an order
474
+ * @param id
475
+ * @param order
476
+ * @param params
477
+ * @param config
478
+ */
479
+ static getOrderDetail(id, order, params, config) {
480
+ 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 }));
481
+ }
463
482
  }
464
483
  exports.UserApiClient = UserApiClient;
465
484
  /**
@@ -760,5 +779,15 @@ class UserService {
760
779
  return UserApiClient.getUserLiveStream(id, params, config);
761
780
  });
762
781
  }
782
+ static getOrderHistory(params, config) {
783
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
784
+ return UserApiClient.getOrderHistory(params, config);
785
+ });
786
+ }
787
+ static getOrderDetail(id, order, params, config) {
788
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
789
+ return UserApiClient.getOrderDetail(id, order, params, config);
790
+ });
791
+ }
763
792
  }
764
793
  exports.default = UserService;
@@ -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,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CourseInfoViewType = void 0;
4
+ /**
5
+ * CourseInfoView enum
6
+ */
7
+ var CourseInfoViewType;
8
+ (function (CourseInfoViewType) {
9
+ CourseInfoViewType["USER"] = "user";
10
+ CourseInfoViewType["EDIT"] = "edit";
11
+ CourseInfoViewType["DASHBOARD"] = "dashboard";
12
+ })(CourseInfoViewType = exports.CourseInfoViewType || (exports.CourseInfoViewType = {}));
@@ -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
- 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 };
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 };
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OnBoardingStep = exports.MediaTypes = void 0;
3
+ exports.CourseInfoViewType = exports.OnBoardingStep = exports.MediaTypes = void 0;
4
4
  const media_1 = require("./media");
5
5
  Object.defineProperty(exports, "MediaTypes", { enumerable: true, get: function () { return media_1.MediaTypes; } });
6
6
  const onBoarding_1 = require("./onBoarding");
7
7
  Object.defineProperty(exports, "OnBoardingStep", { enumerable: true, get: function () { return onBoarding_1.OnBoardingStep; } });
8
+ const course_1 = require("./course");
9
+ Object.defineProperty(exports, "CourseInfoViewType", { enumerable: true, get: function () { return course_1.CourseInfoViewType; } });
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,17 +2,17 @@ import { AxiosInstance, AxiosResponse } from 'axios';
2
2
  /**
3
3
  * List of all Http methods
4
4
  */
5
- export type HttpMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
5
+ export declare type HttpMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
6
6
  /**
7
7
  * AxiosResponseHeaders interface
8
8
  */
9
- export type AxiosResponseHeaders = Record<string, string> & {
9
+ export declare type AxiosResponseHeaders = Record<string, string> & {
10
10
  'set-cookie'?: string[];
11
11
  };
12
12
  /**
13
13
  * General HttpResponse
14
14
  */
15
- export type HttpResponse<T = unknown, D = any> = AxiosResponse<T, D>;
15
+ export declare type HttpResponse<T = unknown, D = any> = AxiosResponse<T, D>;
16
16
  /**
17
17
  * Interface for the ApiClient
18
18
  */
@@ -6,9 +6,6 @@ import axios from 'axios';
6
6
  * should we choose to do so in the future, without it breaking our app.
7
7
  */
8
8
  export class ApiClient {
9
- createClient(config) {
10
- return axios.create(Object.assign(Object.assign({}, (config && config.baseURL && { baseURL: config.baseURL })), { responseType: 'json', headers: Object.assign({}, (config && config.accessToken && { Authorization: `Token ${config.accessToken}` })), timeout: ApiClient.DEFAULT_TIMEOUT }));
11
- }
12
9
  constructor(config) {
13
10
  /**
14
11
  * Set default header
@@ -50,6 +47,9 @@ export class ApiClient {
50
47
  this.client = this.createClient(config);
51
48
  this.setDefaultHeader({ name: 'Content-Type', value: 'application/json', methods: ['post'] });
52
49
  }
50
+ createClient(config) {
51
+ return axios.create(Object.assign(Object.assign({}, (config && config.baseURL && { baseURL: config.baseURL })), { responseType: 'json', headers: Object.assign({}, (config && config.accessToken && { Authorization: `Token ${config.accessToken}` })), timeout: ApiClient.DEFAULT_TIMEOUT }));
52
+ }
53
53
  /**
54
54
  * Get client instance
55
55
  */