@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.
- package/lib/cjs/client/index.d.ts +3 -3
- package/lib/cjs/client/index.js +3 -3
- package/lib/cjs/constants/Endpoints.js +88 -1
- package/lib/cjs/index.d.ts +4 -2
- package/lib/cjs/index.js +7 -1
- package/lib/cjs/services/community/index.d.ts +65 -0
- package/lib/cjs/services/community/index.js +70 -0
- package/lib/cjs/services/feed_object/index.d.ts +28 -1
- package/lib/cjs/services/feed_object/index.js +44 -0
- package/lib/cjs/services/payment/index.d.ts +219 -0
- package/lib/cjs/services/payment/index.js +218 -0
- package/lib/cjs/services/user/index.d.ts +21 -1
- package/lib/cjs/services/user/index.js +30 -0
- package/lib/cjs/types/feedObject.d.ts +17 -0
- package/lib/cjs/types/index.d.ts +3 -2
- package/lib/cjs/types/payment.d.ts +137 -0
- package/lib/cjs/types/payment.js +2 -0
- package/lib/esm/client/index.d.ts +3 -3
- package/lib/esm/client/index.js +3 -3
- package/lib/esm/constants/Endpoints.js +88 -1
- package/lib/esm/index.d.ts +4 -2
- package/lib/esm/index.js +3 -1
- package/lib/esm/services/community/index.d.ts +65 -0
- package/lib/esm/services/community/index.js +65 -0
- package/lib/esm/services/feed_object/index.d.ts +28 -1
- package/lib/esm/services/feed_object/index.js +44 -0
- package/lib/esm/services/payment/index.d.ts +219 -0
- package/lib/esm/services/payment/index.js +213 -0
- package/lib/esm/services/user/index.d.ts +21 -1
- package/lib/esm/services/user/index.js +30 -0
- package/lib/esm/types/feedObject.d.ts +17 -0
- package/lib/esm/types/index.d.ts +3 -2
- package/lib/esm/types/payment.d.ts +137 -0
- package/lib/esm/types/payment.js +1 -0
- package/lib/umd/740.js +2 -0
- package/lib/umd/api-services.js +1 -1
- package/package.json +4 -4
- package/lib/umd/956.js +0 -2
- /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
|
*/
|
package/lib/cjs/client/index.js
CHANGED
|
@@ -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,18 @@ 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
|
+
},
|
|
157
169
|
/**
|
|
158
170
|
* Comments
|
|
159
171
|
*/
|
|
@@ -521,6 +533,14 @@ const Endpoints = {
|
|
|
521
533
|
url: (0, utils_1.urlReplacer)('/api/v2/user/$(id)/live_stream/'),
|
|
522
534
|
method: 'GET'
|
|
523
535
|
},
|
|
536
|
+
GetOrderHistory: {
|
|
537
|
+
url: (0, utils_1.urlReplacer)('/api/v2/user/$(id)/order/'),
|
|
538
|
+
method: 'GET'
|
|
539
|
+
},
|
|
540
|
+
GetOrderDetail: {
|
|
541
|
+
url: (0, utils_1.urlReplacer)('/api/v2/user/$(id)/order/$(order)/'),
|
|
542
|
+
method: 'GET'
|
|
543
|
+
},
|
|
524
544
|
/**
|
|
525
545
|
* Broadcast Messages
|
|
526
546
|
*/
|
|
@@ -1572,6 +1592,73 @@ const Endpoints = {
|
|
|
1572
1592
|
GetUserJoinedCourses: {
|
|
1573
1593
|
url: (0, utils_1.urlReplacer)('/api/v2/user/$(id)/courses/'),
|
|
1574
1594
|
method: 'GET'
|
|
1575
|
-
}
|
|
1595
|
+
},
|
|
1596
|
+
/**
|
|
1597
|
+
* Community
|
|
1598
|
+
*/
|
|
1599
|
+
GetCommunities: {
|
|
1600
|
+
url: (0, utils_1.urlReplacer)('/api/v2/community/'),
|
|
1601
|
+
method: 'GET'
|
|
1602
|
+
},
|
|
1603
|
+
GetCommunity: {
|
|
1604
|
+
url: (0, utils_1.urlReplacer)('/api/v2/community/$(id)/'),
|
|
1605
|
+
method: 'GET'
|
|
1606
|
+
},
|
|
1607
|
+
/**
|
|
1608
|
+
* Payments/Paywalls
|
|
1609
|
+
*/
|
|
1610
|
+
GetPaymentContentStatus: {
|
|
1611
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/content_status/'),
|
|
1612
|
+
method: 'GET'
|
|
1613
|
+
},
|
|
1614
|
+
GetPaywalls: {
|
|
1615
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/paywall/'),
|
|
1616
|
+
method: 'GET'
|
|
1617
|
+
},
|
|
1618
|
+
GetPaywall: {
|
|
1619
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/paywall/$(id)/'),
|
|
1620
|
+
method: 'GET'
|
|
1621
|
+
},
|
|
1622
|
+
GetPaymentProducts: {
|
|
1623
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/'),
|
|
1624
|
+
method: 'GET'
|
|
1625
|
+
},
|
|
1626
|
+
GetPaymentProduct: {
|
|
1627
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/$(id)/'),
|
|
1628
|
+
method: 'GET'
|
|
1629
|
+
},
|
|
1630
|
+
GetPaymentProductPrices: {
|
|
1631
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/$(id)/'),
|
|
1632
|
+
method: 'GET'
|
|
1633
|
+
},
|
|
1634
|
+
GetCheckoutSession: {
|
|
1635
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/checkout_session/'),
|
|
1636
|
+
method: 'GET'
|
|
1637
|
+
},
|
|
1638
|
+
CheckoutCreateSession: {
|
|
1639
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/checkout_session/'),
|
|
1640
|
+
method: 'POST'
|
|
1641
|
+
},
|
|
1642
|
+
CheckoutSessionComplete: {
|
|
1643
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/checkout_session/complete/'),
|
|
1644
|
+
method: 'POST'
|
|
1645
|
+
},
|
|
1646
|
+
GetPaymentOrders: {
|
|
1647
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_order/'),
|
|
1648
|
+
method: 'GET'
|
|
1649
|
+
},
|
|
1650
|
+
GetPaymentOrder: {
|
|
1651
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_order/$(id)/'),
|
|
1652
|
+
method: 'GET'
|
|
1653
|
+
},
|
|
1654
|
+
GetPaymentOrderPdf: {
|
|
1655
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_order/$(id)/pdf/'),
|
|
1656
|
+
method: 'GET'
|
|
1657
|
+
},
|
|
1658
|
+
CreateCustomerPortalSession: {
|
|
1659
|
+
url: (0, utils_1.urlReplacer)('/api/v2/payments/customer_portal_session/'),
|
|
1660
|
+
method: 'POST'
|
|
1661
|
+
},
|
|
1662
|
+
CreatePaymentProduct: { url: (0, utils_1.urlReplacer)('/api/v2/payments/payment_product/price/'), method: 'POST' }
|
|
1576
1663
|
};
|
|
1577
1664
|
exports.default = Endpoints;
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -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;
|