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

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 +92 -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 +92 -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
@@ -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
  */
@@ -10,9 +10,6 @@ const axios_1 = tslib_1.__importDefault(require("axios"));
10
10
  * should we choose to do so in the future, without it breaking our app.
11
11
  */
12
12
  class ApiClient {
13
- createClient(config) {
14
- return axios_1.default.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 }));
15
- }
16
13
  constructor(config) {
17
14
  /**
18
15
  * Set default header
@@ -54,6 +51,9 @@ class ApiClient {
54
51
  this.client = this.createClient(config);
55
52
  this.setDefaultHeader({ name: 'Content-Type', value: 'application/json', methods: ['post'] });
56
53
  }
54
+ createClient(config) {
55
+ return axios_1.default.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 }));
56
+ }
57
57
  /**
58
58
  * Get client instance
59
59
  */
@@ -154,6 +154,22 @@ const Endpoints = {
154
154
  url: (0, utils_1.urlReplacer)('/api/v2/$(type)/$(id)/flag/'),
155
155
  method: 'POST'
156
156
  },
157
+ GetScheduledFeedObjects: {
158
+ url: (0, utils_1.urlReplacer)('/api/v2/$(type)/scheduled/'),
159
+ method: 'GET'
160
+ },
161
+ PublishFeedObject: {
162
+ url: (0, utils_1.urlReplacer)('/api/v2/$(type)/$(id)/publish/'),
163
+ method: 'POST'
164
+ },
165
+ GetDraftedFeedObjects: {
166
+ url: (0, utils_1.urlReplacer)('/api/v2/$(type)/drafted/'),
167
+ method: 'GET'
168
+ },
169
+ GetDownloadCSV: {
170
+ url: (0, utils_1.urlReplacer)('/api/v2/$(type)/$(id)/export/'),
171
+ method: 'GET'
172
+ },
157
173
  /**
158
174
  * Comments
159
175
  */
@@ -521,6 +537,14 @@ const Endpoints = {
521
537
  url: (0, utils_1.urlReplacer)('/api/v2/user/$(id)/live_stream/'),
522
538
  method: 'GET'
523
539
  },
540
+ GetOrderHistory: {
541
+ url: (0, utils_1.urlReplacer)('/api/v2/user/$(id)/order/'),
542
+ method: 'GET'
543
+ },
544
+ GetOrderDetail: {
545
+ url: (0, utils_1.urlReplacer)('/api/v2/user/$(id)/order/$(order)/'),
546
+ method: 'GET'
547
+ },
524
548
  /**
525
549
  * Broadcast Messages
526
550
  */
@@ -1572,6 +1596,73 @@ const Endpoints = {
1572
1596
  GetUserJoinedCourses: {
1573
1597
  url: (0, utils_1.urlReplacer)('/api/v2/user/$(id)/courses/'),
1574
1598
  method: 'GET'
1575
- }
1599
+ },
1600
+ /**
1601
+ * Community
1602
+ */
1603
+ GetCommunities: {
1604
+ url: (0, utils_1.urlReplacer)('/api/v2/community/'),
1605
+ method: 'GET'
1606
+ },
1607
+ GetCommunity: {
1608
+ url: (0, utils_1.urlReplacer)('/api/v2/community/$(id)/'),
1609
+ method: 'GET'
1610
+ },
1611
+ /**
1612
+ * Payments/Paywalls
1613
+ */
1614
+ GetPaymentContentStatus: {
1615
+ url: (0, utils_1.urlReplacer)('/api/v2/payments/content_status/'),
1616
+ method: 'GET'
1617
+ },
1618
+ GetPaywalls: {
1619
+ url: (0, utils_1.urlReplacer)('/api/v2/payments/paywall/'),
1620
+ method: 'GET'
1621
+ },
1622
+ GetPaywall: {
1623
+ url: (0, utils_1.urlReplacer)('/api/v2/payments/paywall/$(id)/'),
1624
+ method: 'GET'
1625
+ },
1626
+ GetPaymentProducts: {
1627
+ url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/'),
1628
+ method: 'GET'
1629
+ },
1630
+ GetPaymentProduct: {
1631
+ url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/$(id)/'),
1632
+ method: 'GET'
1633
+ },
1634
+ GetPaymentProductPrices: {
1635
+ url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/$(id)/'),
1636
+ method: 'GET'
1637
+ },
1638
+ GetCheckoutSession: {
1639
+ url: (0, utils_1.urlReplacer)('/api/v2/payments/checkout_session/'),
1640
+ method: 'GET'
1641
+ },
1642
+ CheckoutCreateSession: {
1643
+ url: (0, utils_1.urlReplacer)('/api/v2/payments/checkout_session/'),
1644
+ method: 'POST'
1645
+ },
1646
+ CheckoutSessionComplete: {
1647
+ url: (0, utils_1.urlReplacer)('/api/v2/payments/checkout_session/complete/'),
1648
+ method: 'POST'
1649
+ },
1650
+ GetPaymentOrders: {
1651
+ url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_order/'),
1652
+ method: 'GET'
1653
+ },
1654
+ GetPaymentOrder: {
1655
+ url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_order/$(id)/'),
1656
+ method: 'GET'
1657
+ },
1658
+ GetPaymentOrderPdf: {
1659
+ url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_order/$(id)/pdf/'),
1660
+ method: 'GET'
1661
+ },
1662
+ CreateCustomerPortalSession: {
1663
+ url: (0, utils_1.urlReplacer)('/api/v2/payments/customer_portal_session/'),
1664
+ method: 'POST'
1665
+ },
1666
+ CreatePaymentProduct: { url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/price/'), method: 'POST' }
1576
1667
  };
1577
1668
  exports.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/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ModerationService = exports.MediaApiClient = exports.MediaService = exports.LoyaltyApiClient = exports.LoyaltyService = exports.LocalityApiClient = exports.LocalityService = exports.LegalPageApiClient = exports.LegalPageService = exports.InviteApiClient = exports.InviteService = exports.InsightApiClient = exports.InsightService = exports.IncubatorApiClient = exports.IncubatorService = exports.FeedObjectApiClient = exports.FeedObjectService = exports.FeedApiClient = exports.FeedService = exports.EmbedApiClient = exports.EmbedService = exports.DataPortabilityApiClient = exports.DataPortabilityService = exports.CustomPageApiClient = exports.CustomPageService = exports.CustomMenuApiClient = exports.CustomMenuService = exports.CustomAdvApiClient = exports.CustomAdvService = exports.CommentApiClient = exports.CommentService = exports.CategoryApiClient = exports.CategoryService = exports.FeatureApiClient = exports.FeatureService = exports.UserApiClient = exports.UserService = exports.PreferenceApiClient = exports.PreferenceService = exports.AccountApiClient = exports.AccountService = exports.Endpoints = exports.urlParams = exports.parseJwt = exports.generateJWTToken = exports.getCancelTokenSourceRequest = exports.formatHttpErrorCode = exports.formatHttpError = exports.apiRequest = exports.http = void 0;
4
- exports.CourseApiClient = exports.CourseService = exports.CourseInfoViewType = exports.OnBoardingStep = exports.OnBoardingApiClient = exports.OnBoardingService = exports.LiveStreamApiClient = exports.LiveStreamService = exports.EventApiClient = exports.EventService = exports.GroupApiClient = exports.GroupService = exports.ReactionApiClient = exports.ReactionService = exports.MediaTypes = exports.WebhookApiClient = exports.WebhookService = exports.TagApiClient = exports.TagService = exports.SuggestionApiClient = exports.SuggestionService = exports.SSOApiClient = exports.SSOService = exports.ScoreApiClient = exports.ScoreService = exports.PromoApiClient = exports.PromoService = exports.PrivateMessageApiClient = exports.PrivateMessageService = exports.NotificationApiClient = exports.NotificationService = exports.ModerationApiClient = void 0;
4
+ exports.CommunityApiClient = exports.CommunityService = exports.PaymentApiClient = exports.PaymentService = exports.CourseApiClient = exports.CourseService = exports.CourseInfoViewType = exports.OnBoardingStep = exports.OnBoardingApiClient = exports.OnBoardingService = exports.LiveStreamApiClient = exports.LiveStreamService = exports.EventApiClient = exports.EventService = exports.GroupApiClient = exports.GroupService = exports.ReactionApiClient = exports.ReactionService = exports.MediaTypes = exports.WebhookApiClient = exports.WebhookService = exports.TagApiClient = exports.TagService = exports.SuggestionApiClient = exports.SuggestionService = exports.SSOApiClient = exports.SSOService = exports.ScoreApiClient = exports.ScoreService = exports.PromoApiClient = exports.PromoService = exports.PrivateMessageApiClient = exports.PrivateMessageService = exports.NotificationApiClient = exports.NotificationService = exports.ModerationApiClient = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  /**
7
7
  * Axios client wrapper
@@ -135,6 +135,12 @@ Object.defineProperty(exports, "OnBoardingApiClient", { enumerable: true, get: f
135
135
  const course_1 = tslib_1.__importStar(require("./services/course"));
136
136
  exports.CourseService = course_1.default;
137
137
  Object.defineProperty(exports, "CourseApiClient", { enumerable: true, get: function () { return course_1.CourseApiClient; } });
138
+ const payment_1 = tslib_1.__importStar(require("./services/payment"));
139
+ exports.PaymentService = payment_1.default;
140
+ Object.defineProperty(exports, "PaymentApiClient", { enumerable: true, get: function () { return payment_1.PaymentApiClient; } });
141
+ const community_1 = tslib_1.__importStar(require("./services/community"));
142
+ exports.CommunityService = community_1.default;
143
+ Object.defineProperty(exports, "CommunityApiClient", { enumerable: true, get: function () { return community_1.CommunityApiClient; } });
138
144
  /**
139
145
  * Types
140
146
  */
@@ -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,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommunityApiClient = 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 CommunityApiClient {
12
+ /**
13
+ * Get list of communities. Used to get the payment products related to the community (aka paywalls)
14
+ * @param params
15
+ * @param config
16
+ */
17
+ static getCommunities(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.GetCommunities.url({})}?${p.toString()}`, method: Endpoints_1.default.GetCommunities.method }));
20
+ }
21
+ /**
22
+ * Get Community
23
+ * @param id
24
+ * @param config
25
+ */
26
+ static getCommunity(id, config) {
27
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetCommunity.url({ id }), method: Endpoints_1.default.GetCommunity.method }));
28
+ }
29
+ }
30
+ exports.CommunityApiClient = CommunityApiClient;
31
+ /**
32
+ *
33
+ :::tip Community service can be used in the following way:
34
+
35
+ ```jsx
36
+ 1. Import the service from our library:
37
+
38
+ import {CommunityService} from "@selfcommunity/api-services";
39
+ ```
40
+ ```jsx
41
+ 2. Create a function and put the service inside it!
42
+ The async function `getCommunities` will return the events matching the search query.
43
+
44
+ async getCommunities() {
45
+ return await CommunityService.getCommunities({...});
46
+ }
47
+ ```
48
+ If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
49
+
50
+ 1. Declare it(or declare them, it is possible to add multiple params)
51
+
52
+ const headers = headers: {Authorization: `Bearer ${yourToken}`}
53
+
54
+ 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
55
+ ```
56
+ :::
57
+ */
58
+ class CommunityService {
59
+ static getCommunities(params, config) {
60
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
61
+ return CommunityApiClient.getCommunities(params, config);
62
+ });
63
+ }
64
+ static getPaymentProduct(id, config) {
65
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
66
+ return CommunityApiClient.getCommunity(id, config);
67
+ });
68
+ }
69
+ }
70
+ exports.default = CommunityService;
@@ -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
  }
@@ -274,6 +274,35 @@ class FeedObjectApiClient {
274
274
  static feedObjectHideStatus(type, id, config) {
275
275
  return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.FeedObjectHideStatus.url({ type, id }), method: Endpoints_1.default.FeedObjectHideStatus.method }));
276
276
  }
277
+ /**
278
+ * This endpoint retrieves the list of scheduled feed objects
279
+ * @param type
280
+ * @param params
281
+ * @param config
282
+ */
283
+ static feedObjectScheduledList(type, params, config) {
284
+ const p = (0, url_1.urlParams)(params);
285
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetScheduledFeedObjects.url({ type })}?${p.toString()}`, method: Endpoints_1.default.GetScheduledFeedObjects.method }));
286
+ }
287
+ /**
288
+ * This endpoint retrieves the list of drafted feed objects
289
+ * @param type
290
+ * @param params
291
+ * @param config
292
+ */
293
+ static feedObjectDraftedList(type, params, config) {
294
+ const p = (0, url_1.urlParams)(params);
295
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetDraftedFeedObjects.url({ type })}?${p.toString()}`, method: Endpoints_1.default.GetDraftedFeedObjects.method }));
296
+ }
297
+ /**
298
+ * This endpoint publishes a drafted or scheduled the feed obj.
299
+ * @param type
300
+ * @param id
301
+ * @param config
302
+ */
303
+ static publishFeedObject(type, id, config) {
304
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.PublishFeedObject.url({ type, id }), method: Endpoints_1.default.PublishFeedObject.method }));
305
+ }
277
306
  }
278
307
  exports.FeedObjectApiClient = FeedObjectApiClient;
279
308
  /**
@@ -440,5 +469,20 @@ class FeedObjectService {
440
469
  return FeedObjectApiClient.feedObjectHideStatus(type, id, config);
441
470
  });
442
471
  }
472
+ static feedObjectScheduledList(type, params, config) {
473
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
474
+ return FeedObjectApiClient.feedObjectScheduledList(type, params, config);
475
+ });
476
+ }
477
+ static feedObjectDraftedList(type, params, config) {
478
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
479
+ return FeedObjectApiClient.feedObjectDraftedList(type, params, config);
480
+ });
481
+ }
482
+ static publishFeedObject(type, id, config) {
483
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
484
+ return FeedObjectApiClient.publishFeedObject(type, id, config);
485
+ });
486
+ }
443
487
  }
444
488
  exports.default = FeedObjectService;