@selfcommunity/api-services 0.7.0-alpha.0 → 0.7.0-alpha.1

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 (39) 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 +88 -1
  4. package/lib/cjs/index.d.ts +4 -2
  5. package/lib/cjs/index.js +7 -1
  6. package/lib/cjs/services/community/index.d.ts +65 -0
  7. package/lib/cjs/services/community/index.js +70 -0
  8. package/lib/cjs/services/feed_object/index.d.ts +28 -1
  9. package/lib/cjs/services/feed_object/index.js +44 -0
  10. package/lib/cjs/services/payment/index.d.ts +219 -0
  11. package/lib/cjs/services/payment/index.js +218 -0
  12. package/lib/cjs/services/user/index.d.ts +21 -1
  13. package/lib/cjs/services/user/index.js +30 -0
  14. package/lib/cjs/types/feedObject.d.ts +17 -0
  15. package/lib/cjs/types/index.d.ts +3 -2
  16. package/lib/cjs/types/payment.d.ts +137 -0
  17. package/lib/cjs/types/payment.js +2 -0
  18. package/lib/esm/client/index.d.ts +3 -3
  19. package/lib/esm/client/index.js +3 -3
  20. package/lib/esm/constants/Endpoints.js +88 -1
  21. package/lib/esm/index.d.ts +4 -2
  22. package/lib/esm/index.js +3 -1
  23. package/lib/esm/services/community/index.d.ts +65 -0
  24. package/lib/esm/services/community/index.js +65 -0
  25. package/lib/esm/services/feed_object/index.d.ts +28 -1
  26. package/lib/esm/services/feed_object/index.js +44 -0
  27. package/lib/esm/services/payment/index.d.ts +219 -0
  28. package/lib/esm/services/payment/index.js +213 -0
  29. package/lib/esm/services/user/index.d.ts +21 -1
  30. package/lib/esm/services/user/index.js +30 -0
  31. package/lib/esm/types/feedObject.d.ts +17 -0
  32. package/lib/esm/types/index.d.ts +3 -2
  33. package/lib/esm/types/payment.d.ts +137 -0
  34. package/lib/esm/types/payment.js +1 -0
  35. package/lib/umd/740.js +2 -0
  36. package/lib/umd/api-services.js +1 -1
  37. package/package.json +4 -4
  38. package/lib/umd/956.js +0 -2
  39. /package/lib/umd/{956.js.LICENSE.txt → 740.js.LICENSE.txt} +0 -0
@@ -0,0 +1,137 @@
1
+ import { BaseGetParams, BaseSearchParams } from './baseParams';
2
+ import { SCCheckoutSessionUIMode, SCContentType, SCPaymentOrder, SCPaymentPriceCurrencyType, SCPaywall } from '@selfcommunity/types';
3
+ /**
4
+ * PaymentParams interface.
5
+ */
6
+ export interface PaymentProductsParams 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
+ * Return url
35
+ */
36
+ return_url?: string;
37
+ /**
38
+ * Success url
39
+ */
40
+ success_url?: string;
41
+ /**
42
+ * Session UI mode
43
+ */
44
+ ui_mode?: SCCheckoutSessionUIMode;
45
+ }
46
+ export interface CheckoutSessionParams {
47
+ /**
48
+ * Session Id
49
+ */
50
+ session_id: string;
51
+ }
52
+ export interface CustomerPortalCreateSessionParams {
53
+ /**
54
+ * Return url
55
+ */
56
+ return_url?: string;
57
+ }
58
+ /**
59
+ * PaymentContentStatusParams interface.
60
+ */
61
+ export interface PaymentContentStatusParams extends BaseGetParams {
62
+ /**
63
+ * Content id
64
+ */
65
+ content_id?: number | string;
66
+ /**
67
+ * Content type
68
+ */
69
+ content_type?: SCContentType;
70
+ }
71
+ /**
72
+ * PaymentOrderParams interface.
73
+ */
74
+ export interface PaymentOrderParams extends BaseSearchParams {
75
+ /**
76
+ * Ordering
77
+ */
78
+ ordering?: string;
79
+ /**
80
+ * The content type
81
+ */
82
+ content_type?: SCContentType;
83
+ /**
84
+ * The creation date
85
+ */
86
+ created_at?: string;
87
+ /**
88
+ * The creation date
89
+ */
90
+ created_at__gte?: string;
91
+ /**
92
+ * The creation date
93
+ */
94
+ created_at__lte?: string;
95
+ }
96
+ /**
97
+ * CreatePaymentProduct interface.
98
+ */
99
+ export interface CreatePaymentProductParams {
100
+ /**
101
+ * Product name
102
+ */
103
+ name: string;
104
+ /**
105
+ * Prduct price
106
+ */
107
+ unit_amount: number;
108
+ /**
109
+ * Description name
110
+ */
111
+ description?: string;
112
+ /**
113
+ * Price currency
114
+ */
115
+ currency?: SCPaymentPriceCurrencyType;
116
+ }
117
+ /**
118
+ * PaymentContentStatus response interface.
119
+ */
120
+ export interface PaymentContentStatus {
121
+ /**
122
+ * Content id
123
+ */
124
+ content_id?: number | string;
125
+ /**
126
+ * Content type
127
+ */
128
+ content_type?: SCContentType;
129
+ /**
130
+ * Payment Order
131
+ */
132
+ payment_order?: SCPaymentOrder;
133
+ /**
134
+ * Price currency
135
+ */
136
+ paywalls?: SCPaywall[];
137
+ }
@@ -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(Object.assign({}, (config && config.baseURL && { baseURL: config.baseURL })), (config && config.responseType ? { responseType: config.responseType } : { 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
  */
@@ -152,6 +152,18 @@ const Endpoints = {
152
152
  url: urlReplacer('/api/v2/$(type)/$(id)/flag/'),
153
153
  method: 'POST'
154
154
  },
155
+ GetScheduledFeedObjects: {
156
+ url: urlReplacer('/api/v2/$(type)/scheduled/'),
157
+ method: 'GET'
158
+ },
159
+ PublishFeedObject: {
160
+ url: urlReplacer('/api/v2/$(type)/$(id)/publish/'),
161
+ method: 'POST'
162
+ },
163
+ GetDraftedFeedObjects: {
164
+ url: urlReplacer('/api/v2/$(type)/drafted/'),
165
+ method: 'GET'
166
+ },
155
167
  /**
156
168
  * Comments
157
169
  */
@@ -519,6 +531,14 @@ const Endpoints = {
519
531
  url: urlReplacer('/api/v2/user/$(id)/live_stream/'),
520
532
  method: 'GET'
521
533
  },
534
+ GetOrderHistory: {
535
+ url: urlReplacer('/api/v2/user/$(id)/order/'),
536
+ method: 'GET'
537
+ },
538
+ GetOrderDetail: {
539
+ url: urlReplacer('/api/v2/user/$(id)/order/$(order)/'),
540
+ method: 'GET'
541
+ },
522
542
  /**
523
543
  * Broadcast Messages
524
544
  */
@@ -1570,6 +1590,73 @@ const Endpoints = {
1570
1590
  GetUserJoinedCourses: {
1571
1591
  url: urlReplacer('/api/v2/user/$(id)/courses/'),
1572
1592
  method: 'GET'
1573
- }
1593
+ },
1594
+ /**
1595
+ * Community
1596
+ */
1597
+ GetCommunities: {
1598
+ url: urlReplacer('/api/v2/community/'),
1599
+ method: 'GET'
1600
+ },
1601
+ GetCommunity: {
1602
+ url: urlReplacer('/api/v2/community/$(id)/'),
1603
+ method: 'GET'
1604
+ },
1605
+ /**
1606
+ * Payments/Paywalls
1607
+ */
1608
+ GetPaymentContentStatus: {
1609
+ url: urlReplacer('/api/v2/payments/content_status/'),
1610
+ method: 'GET'
1611
+ },
1612
+ GetPaywalls: {
1613
+ url: urlReplacer('/api/v2/payments/paywall/'),
1614
+ method: 'GET'
1615
+ },
1616
+ GetPaywall: {
1617
+ url: urlReplacer('/api/v2/payments/paywall/$(id)/'),
1618
+ method: 'GET'
1619
+ },
1620
+ GetPaymentProducts: {
1621
+ url: urlReplacer('/api/v2/payments/payment_product/'),
1622
+ method: 'GET'
1623
+ },
1624
+ GetPaymentProduct: {
1625
+ url: urlReplacer('/api/v2/payments/payment_product/$(id)/'),
1626
+ method: 'GET'
1627
+ },
1628
+ GetPaymentProductPrices: {
1629
+ url: urlReplacer('/api/v2/payments/payment_product/$(id)/'),
1630
+ method: 'GET'
1631
+ },
1632
+ GetCheckoutSession: {
1633
+ url: urlReplacer('/api/v2/payments/checkout_session/'),
1634
+ method: 'GET'
1635
+ },
1636
+ CheckoutCreateSession: {
1637
+ url: urlReplacer('/api/v2/payments/checkout_session/'),
1638
+ method: 'POST'
1639
+ },
1640
+ CheckoutSessionComplete: {
1641
+ url: urlReplacer('/api/v2/payments/checkout_session/complete/'),
1642
+ method: 'POST'
1643
+ },
1644
+ GetPaymentOrders: {
1645
+ url: urlReplacer('/api/v2/payments/payment_order/'),
1646
+ method: 'GET'
1647
+ },
1648
+ GetPaymentOrder: {
1649
+ url: urlReplacer('/api/v2/payments/payment_order/$(id)/'),
1650
+ method: 'GET'
1651
+ },
1652
+ GetPaymentOrderPdf: {
1653
+ url: urlReplacer('/api/v2/payments/payment_order/$(id)/pdf/'),
1654
+ method: 'GET'
1655
+ },
1656
+ CreateCustomerPortalSession: {
1657
+ url: urlReplacer('/api/v2/payments/customer_portal_session/'),
1658
+ method: 'POST'
1659
+ },
1660
+ CreatePaymentProduct: { url: urlReplacer('/api/v2/payments/payment_product/price/'), method: 'POST' }
1574
1661
  };
1575
1662
  export default Endpoints;
@@ -51,11 +51,13 @@ import EventService, { EventApiClient, EventApiClientInterface } from './service
51
51
  import LiveStreamService, { LiveStreamApiClient, LiveStreamApiClientInterface } from './services/live_stream';
52
52
  import OnBoardingService, { OnBoardingApiClient, OnBoardingApiClientInterface } from './services/onboarding';
53
53
  import CourseService, { CourseApiClient, CourseApiClientInterface } from './services/course';
54
+ import PaymentService, { PaymentApiClient, PaymentApiClientInterface } from './services/payment';
55
+ import CommunityService, { CommunityApiClient, CommunityApiClientInterface } from './services/community';
54
56
  /**
55
57
  * Types
56
58
  */
57
- import { AccountCreateParams, AccountVerifyParams, AccountResetParams, AccountRecoverParams, AccountSearchParams, SCPaginatedResponse, WebhookParamType, WebhookEventsType, SSOSignUpParams, CommentListParams, CommentCreateParams, IncubatorCreateParams, IncubatorSearchParams, LoyaltyPrizeParams, LoyaltyGetPrizeParams, ModerationParams, ModerateContributionParams, FlaggedContributionParams, CustomNotificationParams, UserAutocompleteParams, UserScoreParams, UserSearchParams, TagParams, TagGetParams, MediaCreateParams, MediaTypes, ChunkUploadParams, ChunkUploadCompleteParams, ThreadParams, 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, EventSearchParams, LiveStreamCreateParams, LiveStreamSearchParams, LiveStreamRemoveParticipantParams, StartStepParams, OnBoardingStep, CourseCreateParams, CourseSearchParams, CourseInfoViewType, CourseInfoParams, CourseLessonCommentsParams, CourseUserRoleParams, CourseUsersParams, CourseDashboardUsersParams } from './types';
59
+ import { AccountCreateParams, AccountVerifyParams, AccountResetParams, AccountRecoverParams, AccountSearchParams, SCPaginatedResponse, WebhookParamType, WebhookEventsType, SSOSignUpParams, CommentListParams, CommentCreateParams, IncubatorCreateParams, IncubatorSearchParams, LoyaltyPrizeParams, LoyaltyGetPrizeParams, ModerationParams, ModerateContributionParams, FlaggedContributionParams, CustomNotificationParams, UserAutocompleteParams, UserScoreParams, UserSearchParams, TagParams, TagGetParams, MediaCreateParams, MediaTypes, ChunkUploadParams, ChunkUploadCompleteParams, ThreadParams, MessageCreateParams, MessageMediaUploadParams, MessageThumbnailUploadParams, MessageChunkUploadDoneParams, MessageMediaChunksParams, CategoryParams, CustomAdvParams, CustomPageParams, CustomPageSearchParams, EmbedUpdateParams, EmbedSearchParams, BaseGetParams, BaseSearchParams, FeedObjGetParams, FeedObjCreateParams, FeedObjectPollVotesSearch, ScheduledFeedObjParams, FeedParams, LegalPageFilterParams, FeatureParams, ScoreParams, InsightContributionParams, InsightUserParams, InsightEmbedParams, InsightCommonParams, ReactionParams, GroupCreateParams, GroupFeedParams, EventCreateParams, EventFeedParams, EventSearchParams, LiveStreamCreateParams, LiveStreamSearchParams, LiveStreamRemoveParticipantParams, StartStepParams, OnBoardingStep, CourseCreateParams, CourseSearchParams, CourseInfoViewType, CourseInfoParams, CourseLessonCommentsParams, CourseUserRoleParams, CourseUsersParams, CourseDashboardUsersParams, PaymentContentStatusParams, PaymentContentStatus, PaymentProductsParams, CustomerPortalCreateSessionParams, CheckoutSessionParams, CheckoutCreateSessionParams, PaymentOrderParams } from './types';
58
60
  /**
59
61
  * Export all
60
62
  */
61
- export { http, HttpResponse, HttpMethod, apiRequest, formatHttpError, formatHttpErrorCode, getCancelTokenSourceRequest, generateJWTToken, parseJwt, urlParams, Endpoints, EndpointType, AccountService, AccountApiClient, AccountApiClientInterface, PreferenceService, PreferenceApiClient, PreferenceApiClientInterface, UserService, UserApiClient, UserApiClientInterface, FeatureService, FeatureApiClient, FeatureApiClientInterface, CategoryService, CategoryApiClient, CategoryApiClientInterface, CommentService, CommentApiClient, CommentApiClientInterface, CustomAdvService, CustomAdvApiClient, CustomAdvApiClientInterface, CustomMenuService, CustomMenuApiClient, CustomMenuApiClientInterface, CustomPageService, CustomPageApiClient, CustomPageApiClientInterface, DataPortabilityService, DataPortabilityApiClient, DataPortabilityApiClientInterface, EmbedService, EmbedApiClient, EmbedApiClientInterface, FeedService, FeedApiClient, FeedApiClientInterface, FeedObjectService, FeedObjectApiClient, FeedObjectApiClientInterface, IncubatorService, IncubatorApiClient, IncubatorApiClientInterface, InsightService, InsightApiClient, InsightApiClientInterface, InviteService, InviteApiClient, InviteApiClientInterface, LegalPageService, LegalPageApiClient, LegalPageApiClientInterface, LocalityService, LocalityApiClient, LocalityApiClientInterface, LoyaltyService, LoyaltyApiClient, LoyaltyApiClientInterface, MediaService, MediaApiClient, MediaApiClientInterface, ModerationService, ModerationApiClient, ModerationApiClientInterface, NotificationService, NotificationApiClient, NotificationApiClientInterface, PrivateMessageService, PrivateMessageApiClient, PrivateMessageApiClientInterface, PromoService, PromoApiClient, PromoApiClientInterface, ScoreService, ScoreApiClient, ScoreApiClientInterface, SSOService, SSOApiClient, SSOApiClientInterface, SuggestionService, SuggestionApiClient, SuggestionApiClientInterface, TagService, TagApiClient, TagApiClientInterface, WebhookService, WebhookApiClient, WebhookApiClientInterface, SCPaginatedResponse, WebhookParamType, WebhookEventsType, AccountSearchParams, AccountCreateParams, AccountVerifyParams, AccountResetParams, AccountRecoverParams, CommentCreateParams, IncubatorCreateParams, IncubatorSearchParams, SSOSignUpParams, CommentListParams, LoyaltyPrizeParams, LoyaltyGetPrizeParams, ModerationParams, FlaggedContributionParams, ModerateContributionParams, CustomNotificationParams, UserAutocompleteParams, UserScoreParams, UserSearchParams, TagParams, TagGetParams, MediaCreateParams, MediaTypes, ChunkUploadParams, ChunkUploadCompleteParams, ThreadParams, 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, ReactionService, ReactionApiClient, ReactionApiClientInterface, GroupCreateParams, GroupFeedParams, GroupService, GroupApiClient, GroupApiClientInterface, EventCreateParams, EventFeedParams, EventSearchParams, EventService, EventApiClient, EventApiClientInterface, LiveStreamService, LiveStreamApiClient, LiveStreamApiClientInterface, LiveStreamCreateParams, LiveStreamSearchParams, LiveStreamRemoveParticipantParams, OnBoardingService, OnBoardingApiClientInterface, OnBoardingApiClient, StartStepParams, OnBoardingStep, CourseCreateParams, CourseSearchParams, CourseInfoParams, CourseInfoViewType, CourseService, CourseApiClientInterface, CourseApiClient, CourseLessonCommentsParams, CourseUserRoleParams, CourseUsersParams, CourseDashboardUsersParams };
63
+ export { http, HttpResponse, HttpMethod, apiRequest, formatHttpError, formatHttpErrorCode, getCancelTokenSourceRequest, generateJWTToken, parseJwt, urlParams, Endpoints, EndpointType, AccountService, AccountApiClient, AccountApiClientInterface, PreferenceService, PreferenceApiClient, PreferenceApiClientInterface, UserService, UserApiClient, UserApiClientInterface, FeatureService, FeatureApiClient, FeatureApiClientInterface, CategoryService, CategoryApiClient, CategoryApiClientInterface, CommentService, CommentApiClient, CommentApiClientInterface, CustomAdvService, CustomAdvApiClient, CustomAdvApiClientInterface, CustomMenuService, CustomMenuApiClient, CustomMenuApiClientInterface, CustomPageService, CustomPageApiClient, CustomPageApiClientInterface, DataPortabilityService, DataPortabilityApiClient, DataPortabilityApiClientInterface, EmbedService, EmbedApiClient, EmbedApiClientInterface, FeedService, FeedApiClient, FeedApiClientInterface, FeedObjectService, FeedObjectApiClient, FeedObjectApiClientInterface, IncubatorService, IncubatorApiClient, IncubatorApiClientInterface, InsightService, InsightApiClient, InsightApiClientInterface, InviteService, InviteApiClient, InviteApiClientInterface, LegalPageService, LegalPageApiClient, LegalPageApiClientInterface, LocalityService, LocalityApiClient, LocalityApiClientInterface, LoyaltyService, LoyaltyApiClient, LoyaltyApiClientInterface, MediaService, MediaApiClient, MediaApiClientInterface, ModerationService, ModerationApiClient, ModerationApiClientInterface, NotificationService, NotificationApiClient, NotificationApiClientInterface, PrivateMessageService, PrivateMessageApiClient, PrivateMessageApiClientInterface, PromoService, PromoApiClient, PromoApiClientInterface, ScoreService, ScoreApiClient, ScoreApiClientInterface, SSOService, SSOApiClient, SSOApiClientInterface, SuggestionService, SuggestionApiClient, SuggestionApiClientInterface, TagService, TagApiClient, TagApiClientInterface, WebhookService, WebhookApiClient, WebhookApiClientInterface, SCPaginatedResponse, WebhookParamType, WebhookEventsType, AccountSearchParams, AccountCreateParams, AccountVerifyParams, AccountResetParams, AccountRecoverParams, CommentCreateParams, IncubatorCreateParams, IncubatorSearchParams, SSOSignUpParams, CommentListParams, LoyaltyPrizeParams, LoyaltyGetPrizeParams, ModerationParams, FlaggedContributionParams, ModerateContributionParams, CustomNotificationParams, UserAutocompleteParams, UserScoreParams, UserSearchParams, TagParams, TagGetParams, MediaCreateParams, MediaTypes, ChunkUploadParams, ChunkUploadCompleteParams, ThreadParams, MessageCreateParams, MessageMediaUploadParams, MessageThumbnailUploadParams, MessageChunkUploadDoneParams, MessageMediaChunksParams, CategoryParams, CustomAdvParams, CustomPageParams, CustomPageSearchParams, EmbedUpdateParams, EmbedSearchParams, BaseGetParams, BaseSearchParams, FeedObjGetParams, FeedObjCreateParams, FeedObjectPollVotesSearch, ScheduledFeedObjParams, FeedParams, LegalPageFilterParams, FeatureParams, ScoreParams, InsightContributionParams, InsightUserParams, InsightEmbedParams, InsightCommonParams, ReactionParams, ReactionService, ReactionApiClient, ReactionApiClientInterface, GroupCreateParams, GroupFeedParams, GroupService, GroupApiClient, GroupApiClientInterface, EventCreateParams, EventFeedParams, EventSearchParams, EventService, EventApiClient, EventApiClientInterface, LiveStreamService, LiveStreamApiClient, LiveStreamApiClientInterface, LiveStreamCreateParams, LiveStreamSearchParams, LiveStreamRemoveParticipantParams, OnBoardingService, OnBoardingApiClientInterface, OnBoardingApiClient, StartStepParams, OnBoardingStep, CourseCreateParams, CourseSearchParams, CourseInfoParams, CourseInfoViewType, CourseService, CourseApiClientInterface, CourseApiClient, CourseLessonCommentsParams, CourseUserRoleParams, CourseUsersParams, CourseDashboardUsersParams, PaymentService, PaymentApiClientInterface, PaymentApiClient, CommunityService, CommunityApiClient, CommunityApiClientInterface, PaymentContentStatusParams, PaymentContentStatus, PaymentProductsParams, CustomerPortalCreateSessionParams, CheckoutSessionParams, CheckoutCreateSessionParams, PaymentOrderParams };
package/lib/esm/index.js CHANGED
@@ -51,6 +51,8 @@ import EventService, { EventApiClient } from './services/event';
51
51
  import LiveStreamService, { LiveStreamApiClient } from './services/live_stream';
52
52
  import OnBoardingService, { OnBoardingApiClient } from './services/onboarding';
53
53
  import CourseService, { CourseApiClient } from './services/course';
54
+ import PaymentService, { PaymentApiClient } from './services/payment';
55
+ import CommunityService, { CommunityApiClient } from './services/community';
54
56
  /**
55
57
  * Types
56
58
  */
@@ -58,4 +60,4 @@ import { MediaTypes, OnBoardingStep, CourseInfoViewType } from './types';
58
60
  /**
59
61
  * Export all
60
62
  */
61
- export { http, apiRequest, formatHttpError, formatHttpErrorCode, getCancelTokenSourceRequest, generateJWTToken, parseJwt, urlParams, Endpoints, AccountService, AccountApiClient, PreferenceService, PreferenceApiClient, UserService, UserApiClient, FeatureService, FeatureApiClient, CategoryService, CategoryApiClient, CommentService, CommentApiClient, CustomAdvService, CustomAdvApiClient, CustomMenuService, CustomMenuApiClient, CustomPageService, CustomPageApiClient, DataPortabilityService, DataPortabilityApiClient, EmbedService, EmbedApiClient, FeedService, FeedApiClient, FeedObjectService, FeedObjectApiClient, IncubatorService, IncubatorApiClient, InsightService, InsightApiClient, InviteService, InviteApiClient, LegalPageService, LegalPageApiClient, LocalityService, LocalityApiClient, LoyaltyService, LoyaltyApiClient, MediaService, MediaApiClient, ModerationService, ModerationApiClient, NotificationService, NotificationApiClient, PrivateMessageService, PrivateMessageApiClient, PromoService, PromoApiClient, ScoreService, ScoreApiClient, SSOService, SSOApiClient, SuggestionService, SuggestionApiClient, TagService, TagApiClient, WebhookService, WebhookApiClient, MediaTypes, ReactionService, ReactionApiClient, GroupService, GroupApiClient, EventService, EventApiClient, LiveStreamService, LiveStreamApiClient, OnBoardingService, OnBoardingApiClient, OnBoardingStep, CourseInfoViewType, CourseService, CourseApiClient };
63
+ export { http, apiRequest, formatHttpError, formatHttpErrorCode, getCancelTokenSourceRequest, generateJWTToken, parseJwt, urlParams, Endpoints, AccountService, AccountApiClient, PreferenceService, PreferenceApiClient, UserService, UserApiClient, FeatureService, FeatureApiClient, CategoryService, CategoryApiClient, CommentService, CommentApiClient, CustomAdvService, CustomAdvApiClient, CustomMenuService, CustomMenuApiClient, CustomPageService, CustomPageApiClient, DataPortabilityService, DataPortabilityApiClient, EmbedService, EmbedApiClient, FeedService, FeedApiClient, FeedObjectService, FeedObjectApiClient, IncubatorService, IncubatorApiClient, InsightService, InsightApiClient, InviteService, InviteApiClient, LegalPageService, LegalPageApiClient, LocalityService, LocalityApiClient, LoyaltyService, LoyaltyApiClient, MediaService, MediaApiClient, ModerationService, ModerationApiClient, NotificationService, NotificationApiClient, PrivateMessageService, PrivateMessageApiClient, PromoService, PromoApiClient, ScoreService, ScoreApiClient, SSOService, SSOApiClient, SuggestionService, SuggestionApiClient, TagService, TagApiClient, WebhookService, WebhookApiClient, MediaTypes, ReactionService, ReactionApiClient, GroupService, GroupApiClient, EventService, EventApiClient, LiveStreamService, LiveStreamApiClient, OnBoardingService, OnBoardingApiClient, OnBoardingStep, CourseInfoViewType, CourseService, CourseApiClient, PaymentService, PaymentApiClient, CommunityService, CommunityApiClient };
@@ -0,0 +1,65 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ import { BaseGetParams, SCPaginatedResponse } from '../../types';
3
+ import { SCCommunityType } from '@selfcommunity/types';
4
+ export interface CommunityApiClientInterface {
5
+ /**
6
+ * Get list of communities. Used to get the payment products related to the community (aka paywalls)
7
+ * @param params
8
+ * @param config
9
+ */
10
+ getCommunities(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCommunityType>>;
11
+ /**
12
+ * Get Community
13
+ * @param id
14
+ * @param config
15
+ */
16
+ getCommunity(id: number | string, config?: AxiosRequestConfig): Promise<SCCommunityType>;
17
+ }
18
+ /**
19
+ * Contains all the endpoints needed to manage payments.
20
+ */
21
+ export declare class CommunityApiClient {
22
+ /**
23
+ * Get list of communities. Used to get the payment products related to the community (aka paywalls)
24
+ * @param params
25
+ * @param config
26
+ */
27
+ static getCommunities(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCommunityType>>;
28
+ /**
29
+ * Get Community
30
+ * @param id
31
+ * @param config
32
+ */
33
+ static getCommunity(id: number | string, config?: AxiosRequestConfig): Promise<SCCommunityType>;
34
+ }
35
+ /**
36
+ *
37
+ :::tip Community service can be used in the following way:
38
+
39
+ ```jsx
40
+ 1. Import the service from our library:
41
+
42
+ import {CommunityService} from "@selfcommunity/api-services";
43
+ ```
44
+ ```jsx
45
+ 2. Create a function and put the service inside it!
46
+ The async function `getCommunities` will return the events matching the search query.
47
+
48
+ async getCommunities() {
49
+ return await CommunityService.getCommunities({...});
50
+ }
51
+ ```
52
+ If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
53
+
54
+ 1. Declare it(or declare them, it is possible to add multiple params)
55
+
56
+ const headers = headers: {Authorization: `Bearer ${yourToken}`}
57
+
58
+ 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
59
+ ```
60
+ :::
61
+ */
62
+ export default class CommunityService {
63
+ static getCommunities(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCCommunityType>>;
64
+ static getPaymentProduct(id: number | string, config?: AxiosRequestConfig): Promise<SCCommunityType>;
65
+ }
@@ -0,0 +1,65 @@
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 CommunityApiClient {
9
+ /**
10
+ * Get list of communities. Used to get the payment products related to the community (aka paywalls)
11
+ * @param params
12
+ * @param config
13
+ */
14
+ static getCommunities(params, config) {
15
+ const p = urlParams(params);
16
+ return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetCommunities.url({})}?${p.toString()}`, method: Endpoints.GetCommunities.method }));
17
+ }
18
+ /**
19
+ * Get Community
20
+ * @param id
21
+ * @param config
22
+ */
23
+ static getCommunity(id, config) {
24
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetCommunity.url({ id }), method: Endpoints.GetCommunity.method }));
25
+ }
26
+ }
27
+ /**
28
+ *
29
+ :::tip Community service can be used in the following way:
30
+
31
+ ```jsx
32
+ 1. Import the service from our library:
33
+
34
+ import {CommunityService} from "@selfcommunity/api-services";
35
+ ```
36
+ ```jsx
37
+ 2. Create a function and put the service inside it!
38
+ The async function `getCommunities` will return the events matching the search query.
39
+
40
+ async getCommunities() {
41
+ return await CommunityService.getCommunities({...});
42
+ }
43
+ ```
44
+ If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
45
+
46
+ 1. Declare it(or declare them, it is possible to add multiple params)
47
+
48
+ const headers = headers: {Authorization: `Bearer ${yourToken}`}
49
+
50
+ 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
51
+ ```
52
+ :::
53
+ */
54
+ export default class CommunityService {
55
+ static getCommunities(params, config) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ return CommunityApiClient.getCommunities(params, config);
58
+ });
59
+ }
60
+ static getPaymentProduct(id, config) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ return CommunityApiClient.getCommunity(id, config);
63
+ });
64
+ }
65
+ }
@@ -1,4 +1,4 @@
1
- import { BaseGetParams, BaseSearchParams, FeedObjCreateParams, FeedObjectPollVotesSearch, FeedObjGetParams, SCPaginatedResponse } from '../../types';
1
+ import { BaseGetParams, BaseSearchParams, FeedObjCreateParams, FeedObjectPollVotesSearch, FeedObjGetParams, SCPaginatedResponse, ScheduledFeedObjParams } from '../../types';
2
2
  import { SCContributionType, SCFeedObjectFollowingStatusType, SCFeedObjectHideStatusType, SCFeedObjectSuspendedStatusType, SCFeedObjectType, SCFlagType, SCFlagTypeEnum, SCPollVoteType, SCUserType, SCVoteType } from '@selfcommunity/types';
3
3
  import { AxiosRequestConfig } from 'axios';
4
4
  export interface FeedObjectApiClientInterface {
@@ -29,6 +29,9 @@ export interface FeedObjectApiClientInterface {
29
29
  feedObjectFlagStatus(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFlagType>>;
30
30
  hideFeedObject(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<any>;
31
31
  feedObjectHideStatus(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCFeedObjectHideStatusType>;
32
+ feedObjectScheduledList(type: Exclude<SCContributionType, SCContributionType.COMMENT>, params?: ScheduledFeedObjParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
33
+ feedObjectDraftedList(type: Exclude<SCContributionType, SCContributionType.COMMENT>, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
34
+ publishFeedObject(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCFeedObjectType>;
32
35
  }
33
36
  /**
34
37
  * Contains all the endpoints needed to manage feed objs (discussions-posts-statuses).
@@ -233,6 +236,27 @@ export declare class FeedObjectApiClient {
233
236
  * @param config
234
237
  */
235
238
  static feedObjectHideStatus(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCFeedObjectHideStatusType>;
239
+ /**
240
+ * This endpoint retrieves the list of scheduled feed objects
241
+ * @param type
242
+ * @param params
243
+ * @param config
244
+ */
245
+ static feedObjectScheduledList(type: Exclude<SCContributionType, SCContributionType.COMMENT>, params?: ScheduledFeedObjParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
246
+ /**
247
+ * This endpoint retrieves the list of drafted feed objects
248
+ * @param type
249
+ * @param params
250
+ * @param config
251
+ */
252
+ static feedObjectDraftedList(type: Exclude<SCContributionType, SCContributionType.COMMENT>, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
253
+ /**
254
+ * This endpoint publishes a drafted or scheduled the feed obj.
255
+ * @param type
256
+ * @param id
257
+ * @param config
258
+ */
259
+ static publishFeedObject(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCFeedObjectType>;
236
260
  }
237
261
  /**
238
262
  *
@@ -290,4 +314,7 @@ export default class FeedObjectService {
290
314
  static feedObjectFlagStatus(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFlagType>>;
291
315
  static hideFeedObject(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<any>;
292
316
  static feedObjectHideStatus(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCFeedObjectHideStatusType>;
317
+ static feedObjectScheduledList(type: Exclude<SCContributionType, SCContributionType.COMMENT>, params?: ScheduledFeedObjParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
318
+ static feedObjectDraftedList(type: Exclude<SCContributionType, SCContributionType.COMMENT>, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedObjectType>>;
319
+ static publishFeedObject(type: Exclude<SCContributionType, SCContributionType.COMMENT>, id: number | string, config?: AxiosRequestConfig): Promise<SCFeedObjectType>;
293
320
  }
@@ -271,6 +271,35 @@ export class FeedObjectApiClient {
271
271
  static feedObjectHideStatus(type, id, config) {
272
272
  return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.FeedObjectHideStatus.url({ type, id }), method: Endpoints.FeedObjectHideStatus.method }));
273
273
  }
274
+ /**
275
+ * This endpoint retrieves the list of scheduled feed objects
276
+ * @param type
277
+ * @param params
278
+ * @param config
279
+ */
280
+ static feedObjectScheduledList(type, params, config) {
281
+ const p = urlParams(params);
282
+ return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetScheduledFeedObjects.url({ type })}?${p.toString()}`, method: Endpoints.GetScheduledFeedObjects.method }));
283
+ }
284
+ /**
285
+ * This endpoint retrieves the list of drafted feed objects
286
+ * @param type
287
+ * @param params
288
+ * @param config
289
+ */
290
+ static feedObjectDraftedList(type, params, config) {
291
+ const p = urlParams(params);
292
+ return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetDraftedFeedObjects.url({ type })}?${p.toString()}`, method: Endpoints.GetDraftedFeedObjects.method }));
293
+ }
294
+ /**
295
+ * This endpoint publishes a drafted or scheduled the feed obj.
296
+ * @param type
297
+ * @param id
298
+ * @param config
299
+ */
300
+ static publishFeedObject(type, id, config) {
301
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.PublishFeedObject.url({ type, id }), method: Endpoints.PublishFeedObject.method }));
302
+ }
274
303
  }
275
304
  /**
276
305
  *
@@ -436,4 +465,19 @@ export default class FeedObjectService {
436
465
  return FeedObjectApiClient.feedObjectHideStatus(type, id, config);
437
466
  });
438
467
  }
468
+ static feedObjectScheduledList(type, params, config) {
469
+ return __awaiter(this, void 0, void 0, function* () {
470
+ return FeedObjectApiClient.feedObjectScheduledList(type, params, config);
471
+ });
472
+ }
473
+ static feedObjectDraftedList(type, params, config) {
474
+ return __awaiter(this, void 0, void 0, function* () {
475
+ return FeedObjectApiClient.feedObjectDraftedList(type, params, config);
476
+ });
477
+ }
478
+ static publishFeedObject(type, id, config) {
479
+ return __awaiter(this, void 0, void 0, function* () {
480
+ return FeedObjectApiClient.publishFeedObject(type, id, config);
481
+ });
482
+ }
439
483
  }