@selfcommunity/api-services 0.6.6 → 0.6.7-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.
@@ -6,6 +6,9 @@ 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
+ }
9
12
  constructor(config) {
10
13
  /**
11
14
  * Set default header
@@ -47,9 +50,6 @@ export class ApiClient {
47
50
  this.client = this.createClient(config);
48
51
  this.setDefaultHeader({ name: 'Content-Type', value: 'application/json', methods: ['post'] });
49
52
  }
50
- createClient(config) {
51
- return axios.create(Object.assign(Object.assign({}, (config && config.baseURL && { baseURL: config.baseURL })), { responseType: 'json', headers: Object.assign({}, (config && config.accessToken && { Authorization: `Token ${config.accessToken}` })), timeout: ApiClient.DEFAULT_TIMEOUT }));
52
- }
53
53
  /**
54
54
  * Get client instance
55
55
  */
@@ -515,6 +515,10 @@ const Endpoints = {
515
515
  url: urlReplacer('/api/v2/user/$(id)/provider/'),
516
516
  method: 'DELETE'
517
517
  },
518
+ GetLiveStream: {
519
+ url: urlReplacer('/api/v2/user/$(id)/live_stream/'),
520
+ method: 'GET'
521
+ },
518
522
  /**
519
523
  * Broadcast Messages
520
524
  */
@@ -1338,6 +1342,49 @@ const Endpoints = {
1338
1342
  url: urlReplacer('/api/v2/event/$(id)/gallery/'),
1339
1343
  method: 'DELETE'
1340
1344
  },
1345
+ /**
1346
+ * LiveStream
1347
+ */
1348
+ GetLiveStreamInfo: {
1349
+ url: urlReplacer('/api/v2/live_stream/$(id)/'),
1350
+ method: 'GET'
1351
+ },
1352
+ SearchLiveStream: {
1353
+ url: urlReplacer('/api/v2/live_stream/search/'),
1354
+ method: 'GET'
1355
+ },
1356
+ CreateLiveStream: {
1357
+ url: urlReplacer('/api/v2/live_stream/'),
1358
+ method: 'POST'
1359
+ },
1360
+ UpdateLiveStream: {
1361
+ url: urlReplacer('/api/v2/live_stream/$(id)/'),
1362
+ method: 'PUT'
1363
+ },
1364
+ DeleteLiveStream: {
1365
+ url: urlReplacer('/api/v2/live_stream/$(id)/'),
1366
+ method: 'DELETE'
1367
+ },
1368
+ PatchLiveStream: {
1369
+ url: urlReplacer('/api/v2/live_stream/$(id)/'),
1370
+ method: 'PATCH'
1371
+ },
1372
+ CloseLiveStream: {
1373
+ url: urlReplacer('/api/v2/live_stream/$(id)/close/'),
1374
+ method: 'POST'
1375
+ },
1376
+ JoinLiveStream: {
1377
+ url: urlReplacer('/api/v2/live_stream/$(id)/join/'),
1378
+ method: 'POST'
1379
+ },
1380
+ RemoveParticipant: {
1381
+ url: urlReplacer('/api/v2/live_stream/$(id)/remove_participant/'),
1382
+ method: 'POST'
1383
+ },
1384
+ GetLiveStreamMonthlyDuration: {
1385
+ url: urlReplacer('/api/v2/live_stream/monthly_duration/'),
1386
+ method: 'GET'
1387
+ },
1341
1388
  /**
1342
1389
  * OnBoarding
1343
1390
  */
@@ -48,12 +48,13 @@ import WebhookService, { WebhookApiClient, WebhookApiClientInterface } from './s
48
48
  import ReactionService, { ReactionApiClient, ReactionApiClientInterface } from './services/reactions';
49
49
  import GroupService, { GroupApiClient, GroupApiClientInterface } from './services/group';
50
50
  import EventService, { EventApiClient, EventApiClientInterface } from './services/event';
51
+ import LiveStreamService, { LiveStreamApiClient, LiveStreamApiClientInterface } from './services/live_stream';
51
52
  import OnBoardingService, { OnBoardingApiClient, OnBoardingApiClientInterface } from './services/onboarding';
52
53
  /**
53
54
  * Types
54
55
  */
55
- 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, StartStepParams, OnBoardingStep } from './types';
56
+ 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 } from './types';
56
57
  /**
57
58
  * Export all
58
59
  */
59
- 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, OnBoardingService, OnBoardingApiClientInterface, OnBoardingApiClient, StartStepParams, OnBoardingStep };
60
+ 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 };
package/lib/esm/index.js CHANGED
@@ -48,6 +48,7 @@ import WebhookService, { WebhookApiClient } from './services/webhook';
48
48
  import ReactionService, { ReactionApiClient } from './services/reactions';
49
49
  import GroupService, { GroupApiClient } from './services/group';
50
50
  import EventService, { EventApiClient } from './services/event';
51
+ import LiveStreamService, { LiveStreamApiClient } from './services/live_stream';
51
52
  import OnBoardingService, { OnBoardingApiClient } from './services/onboarding';
52
53
  /**
53
54
  * Types
@@ -56,4 +57,4 @@ import { MediaTypes, OnBoardingStep } from './types';
56
57
  /**
57
58
  * Export all
58
59
  */
59
- 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, OnBoardingService, OnBoardingApiClient, OnBoardingStep };
60
+ 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 };
@@ -0,0 +1,140 @@
1
+ import { SCLiveStreamConnectionDetailsType, SCLiveStreamMonthlyDurationType, SCLiveStreamType } from '@selfcommunity/types';
2
+ import { AxiosRequestConfig } from 'axios';
3
+ import { SCPaginatedResponse } from '../../types';
4
+ import { LiveStreamCreateParams, LiveStreamRemoveParticipantParams, LiveStreamSearchParams } from '../../types/liveStream';
5
+ export interface LiveStreamApiClientInterface {
6
+ search(params?: LiveStreamSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCLiveStreamType>>;
7
+ getSpecificInfo(id: number | string, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
8
+ create(data: LiveStreamCreateParams | FormData, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
9
+ update(id: number | string, data: SCLiveStreamType, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
10
+ patch(id: number | string, data: SCLiveStreamType, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
11
+ delete(id: number | string, config?: AxiosRequestConfig): Promise<any>;
12
+ close(id: number | string, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
13
+ changeCover(id: number | string, data: FormData, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
14
+ join(id: number | string, config?: AxiosRequestConfig): Promise<SCLiveStreamConnectionDetailsType>;
15
+ removeParticipant(id: number | string, data: LiveStreamRemoveParticipantParams | FormData, config?: AxiosRequestConfig): Promise<any>;
16
+ getMonthlyDuration(config?: AxiosRequestConfig): Promise<SCLiveStreamMonthlyDurationType>;
17
+ }
18
+ /**
19
+ * Contains all the endpoints needed to manage LiveStreams.
20
+ */
21
+ export declare class LiveStreamApiClient {
22
+ /**
23
+ * This endpoint performs LiveStreams search
24
+ * @param params
25
+ * @param config
26
+ */
27
+ static search(params?: LiveStreamSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCLiveStreamType>>;
28
+ /**
29
+ * This endpoint retrieves a specific LiveStream.
30
+ * @param id
31
+ * @param config
32
+ */
33
+ static getSpecificInfo(id: number | string, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
34
+ /**
35
+ * This endpoint creates an LiveStream.
36
+ * @param data
37
+ * @param config
38
+ */
39
+ static create(data: LiveStreamCreateParams | FormData, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
40
+ /**
41
+ * This endpoint updates an LiveStream.
42
+ * @param id
43
+ * @param data
44
+ * @param config
45
+ */
46
+ static update(id: number | string, data: SCLiveStreamType, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
47
+ /**
48
+ * This endpoint patches an LiveStream.
49
+ * @param id
50
+ * @param data
51
+ * @param config
52
+ */
53
+ static patch(id: number | string, data: SCLiveStreamType, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
54
+ /**
55
+ * This endpoint deletes an LiveStream.
56
+ * @param id
57
+ * @param config
58
+ */
59
+ static delete(id: number | string, config?: AxiosRequestConfig): Promise<any>;
60
+ /**
61
+ * This endpoint allows to close permanently a room
62
+ * @param id
63
+ * @param config
64
+ */
65
+ static close(id: number | string, config?: AxiosRequestConfig): Promise<any>;
66
+ /**
67
+ * This endpoint changes the LiveStream avatar
68
+ * @param id
69
+ * @param data
70
+ * @param config
71
+ */
72
+ static changeCover(id: number | string, data: FormData, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
73
+ /**
74
+ * This endpoint allows to attend an LiveStream
75
+ * @param id
76
+ * @param config
77
+ */
78
+ static join(id: number | string, config?: AxiosRequestConfig): Promise<SCLiveStreamConnectionDetailsType>;
79
+ /**
80
+ * This endpoint remove participant from the specified live stream.
81
+ * If ban=true in the payload the user can no longer join the meet
82
+ * @param id
83
+ * @param data
84
+ * @param config
85
+ */
86
+ static removeParticipant(id: number | string, data: LiveStreamRemoveParticipantParams | FormData, config?: AxiosRequestConfig): Promise<any>;
87
+ /**
88
+ * This endpoint retrieves LiveStream montlhy duration.
89
+ * @param config
90
+ */
91
+ static getMonthlyDuration(config?: AxiosRequestConfig): Promise<SCLiveStreamMonthlyDurationType>;
92
+ }
93
+ /**
94
+ *
95
+ :::tip LiveStream service can be used in the following way:
96
+
97
+ ```jsx
98
+ 1. Import the service from our library:
99
+
100
+ import {LiveStreamService} from "@selfcommunity/api-services";
101
+ ```
102
+ ```jsx
103
+ 2. Create a function and put the service inside it!
104
+ The async function `search` will return the LiveStreams matching the search query.
105
+
106
+ async searchLiveStreams() {
107
+ return await LiveStreamService.search();
108
+ }
109
+ ```
110
+ ```jsx
111
+ In case of required `params`, just add them inside the brackets.
112
+
113
+ async getSpecificInfo(liveStreamId) {
114
+ return await LiveStreamService.getSpecificInfo(liveStreamId);
115
+ }
116
+ ```
117
+ ```jsx
118
+ If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
119
+
120
+ 1. Declare it(or declare them, it is possible to add multiple params)
121
+
122
+ const headers = headers: {Authorization: `Bearer ${yourToken}`}
123
+
124
+ 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
125
+ ```
126
+ :::
127
+ */
128
+ export default class LiveStreamService {
129
+ static search(params?: LiveStreamSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCLiveStreamType>>;
130
+ static getSpecificInfo(id: number | string, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
131
+ static create(data: LiveStreamCreateParams | FormData, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
132
+ static update(id: number | string, data: SCLiveStreamType, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
133
+ static patch(id: number | string, data: SCLiveStreamType, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
134
+ static delete(id: number | string, config?: AxiosRequestConfig): Promise<any>;
135
+ static close(id: number | string, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
136
+ static changeCover(id: number | string, data: FormData, config?: AxiosRequestConfig): Promise<SCLiveStreamType>;
137
+ static join(id: number | string, config?: AxiosRequestConfig): Promise<SCLiveStreamConnectionDetailsType>;
138
+ static removeParticipant(id: number | string, data: LiveStreamRemoveParticipantParams | FormData, config?: AxiosRequestConfig): Promise<any>;
139
+ static getMonthlyDuration(config?: AxiosRequestConfig): Promise<SCLiveStreamMonthlyDurationType>;
140
+ }
@@ -0,0 +1,194 @@
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 LiveStreams.
7
+ */
8
+ export class LiveStreamApiClient {
9
+ /**
10
+ * This endpoint performs LiveStreams search
11
+ * @param params
12
+ * @param config
13
+ */
14
+ static search(params, config) {
15
+ const p = urlParams(params);
16
+ return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.SearchLiveStream.url({})}?${p.toString()}`, method: Endpoints.SearchLiveStream.method }));
17
+ }
18
+ /**
19
+ * This endpoint retrieves a specific LiveStream.
20
+ * @param id
21
+ * @param config
22
+ */
23
+ static getSpecificInfo(id, config) {
24
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetLiveStreamInfo.url({ id }), method: Endpoints.GetLiveStreamInfo.method }));
25
+ }
26
+ /**
27
+ * This endpoint creates an LiveStream.
28
+ * @param data
29
+ * @param config
30
+ */
31
+ static create(data, config) {
32
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CreateLiveStream.url({}), method: Endpoints.CreateLiveStream.method, data: data }));
33
+ }
34
+ /**
35
+ * This endpoint updates an LiveStream.
36
+ * @param id
37
+ * @param data
38
+ * @param config
39
+ */
40
+ static update(id, data, config) {
41
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.UpdateLiveStream.url({ id }), method: Endpoints.UpdateLiveStream.method, data: data }));
42
+ }
43
+ /**
44
+ * This endpoint patches an LiveStream.
45
+ * @param id
46
+ * @param data
47
+ * @param config
48
+ */
49
+ static patch(id, data, config) {
50
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.PatchLiveStream.url({ id }), method: Endpoints.PatchLiveStream.method, data: data }));
51
+ }
52
+ /**
53
+ * This endpoint deletes an LiveStream.
54
+ * @param id
55
+ * @param config
56
+ */
57
+ static delete(id, config) {
58
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.DeleteLiveStream.url({ id }), method: Endpoints.DeleteLiveStream.method }));
59
+ }
60
+ /**
61
+ * This endpoint allows to close permanently a room
62
+ * @param id
63
+ * @param config
64
+ */
65
+ static close(id, config) {
66
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CloseLiveStream.url({ id }), method: Endpoints.CloseLiveStream.method }));
67
+ }
68
+ /**
69
+ * This endpoint changes the LiveStream avatar
70
+ * @param id
71
+ * @param data
72
+ * @param config
73
+ */
74
+ static changeCover(id, data, config) {
75
+ return apiRequest(Object.assign({ url: Endpoints.PatchLiveStream.url({ id }), method: Endpoints.PatchLiveStream.method, data }, config));
76
+ }
77
+ /**
78
+ * This endpoint allows to attend an LiveStream
79
+ * @param id
80
+ * @param config
81
+ */
82
+ static join(id, config) {
83
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.JoinLiveStream.url({ id }), method: Endpoints.JoinLiveStream.method }));
84
+ }
85
+ /**
86
+ * This endpoint remove participant from the specified live stream.
87
+ * If ban=true in the payload the user can no longer join the meet
88
+ * @param id
89
+ * @param data
90
+ * @param config
91
+ */
92
+ static removeParticipant(id, data, config) {
93
+ return apiRequest(Object.assign({ url: Endpoints.RemoveParticipant.url({ id }), method: Endpoints.RemoveParticipant.method, data }, config));
94
+ }
95
+ /**
96
+ * This endpoint retrieves LiveStream montlhy duration.
97
+ * @param config
98
+ */
99
+ static getMonthlyDuration(config) {
100
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetLiveStreamMonthlyDuration.url({}), method: Endpoints.GetLiveStreamMonthlyDuration.method }));
101
+ }
102
+ }
103
+ /**
104
+ *
105
+ :::tip LiveStream service can be used in the following way:
106
+
107
+ ```jsx
108
+ 1. Import the service from our library:
109
+
110
+ import {LiveStreamService} from "@selfcommunity/api-services";
111
+ ```
112
+ ```jsx
113
+ 2. Create a function and put the service inside it!
114
+ The async function `search` will return the LiveStreams matching the search query.
115
+
116
+ async searchLiveStreams() {
117
+ return await LiveStreamService.search();
118
+ }
119
+ ```
120
+ ```jsx
121
+ In case of required `params`, just add them inside the brackets.
122
+
123
+ async getSpecificInfo(liveStreamId) {
124
+ return await LiveStreamService.getSpecificInfo(liveStreamId);
125
+ }
126
+ ```
127
+ ```jsx
128
+ If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
129
+
130
+ 1. Declare it(or declare them, it is possible to add multiple params)
131
+
132
+ const headers = headers: {Authorization: `Bearer ${yourToken}`}
133
+
134
+ 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
135
+ ```
136
+ :::
137
+ */
138
+ export default class LiveStreamService {
139
+ static search(params, config) {
140
+ return __awaiter(this, void 0, void 0, function* () {
141
+ return LiveStreamApiClient.search(params, config);
142
+ });
143
+ }
144
+ static getSpecificInfo(id, config) {
145
+ return __awaiter(this, void 0, void 0, function* () {
146
+ return LiveStreamApiClient.getSpecificInfo(id, config);
147
+ });
148
+ }
149
+ static create(data, config) {
150
+ return __awaiter(this, void 0, void 0, function* () {
151
+ return LiveStreamApiClient.create(data, config);
152
+ });
153
+ }
154
+ static update(id, data, config) {
155
+ return __awaiter(this, void 0, void 0, function* () {
156
+ return LiveStreamApiClient.update(id, data, config);
157
+ });
158
+ }
159
+ static patch(id, data, config) {
160
+ return __awaiter(this, void 0, void 0, function* () {
161
+ return LiveStreamApiClient.patch(id, data, config);
162
+ });
163
+ }
164
+ static delete(id, config) {
165
+ return __awaiter(this, void 0, void 0, function* () {
166
+ return LiveStreamApiClient.delete(id, config);
167
+ });
168
+ }
169
+ static close(id, config) {
170
+ return __awaiter(this, void 0, void 0, function* () {
171
+ return LiveStreamApiClient.close(id, config);
172
+ });
173
+ }
174
+ static changeCover(id, data, config) {
175
+ return __awaiter(this, void 0, void 0, function* () {
176
+ return LiveStreamApiClient.changeCover(id, data, config);
177
+ });
178
+ }
179
+ static join(id, config) {
180
+ return __awaiter(this, void 0, void 0, function* () {
181
+ return LiveStreamApiClient.join(id, config);
182
+ });
183
+ }
184
+ static removeParticipant(id, data, config) {
185
+ return __awaiter(this, void 0, void 0, function* () {
186
+ return LiveStreamApiClient.removeParticipant(id, data, config);
187
+ });
188
+ }
189
+ static getMonthlyDuration(config) {
190
+ return __awaiter(this, void 0, void 0, function* () {
191
+ return LiveStreamApiClient.getMonthlyDuration(config);
192
+ });
193
+ }
194
+ }
@@ -1,4 +1,4 @@
1
- import { SCAvatarType, SCCategoryType, SCFeedUnitType, SCPlatformType, SCTagType, SCUserAutocompleteType, SCUserAvatarType, SCUserChangeEmailType, SCUserConnectionRequestType, SCUserConnectionStatusType, SCUserCounterType, SCUserEmailTokenType, SCUserFollowedStatusType, SCUserFollowerStatusType, SCUserHiddenByStatusType, SCUserHiddenStatusType, SCUserLoyaltyPointsType, SCUserPermissionType, SCUserProviderAssociationType, SCUserSettingsType, SCUserType } from '@selfcommunity/types';
1
+ import { SCAvatarType, SCCategoryType, SCFeedUnitType, SCLiveStreamType, SCPlatformType, SCTagType, SCUserAutocompleteType, SCUserAvatarType, SCUserChangeEmailType, SCUserConnectionRequestType, SCUserConnectionStatusType, SCUserCounterType, SCUserEmailTokenType, SCUserFollowedStatusType, SCUserFollowerStatusType, SCUserHiddenByStatusType, SCUserHiddenStatusType, SCUserLoyaltyPointsType, SCUserPermissionType, SCUserProviderAssociationType, SCUserSettingsType, SCUserType } from '@selfcommunity/types';
2
2
  import { BaseGetParams, SCPaginatedResponse, UserAutocompleteParams, UserGetParams, UserSearchParams } from '../../types';
3
3
  import { AxiosRequestConfig } from 'axios';
4
4
  import { DeleteProviderAssociation } from '../../types/user';
@@ -54,6 +54,7 @@ export interface UserApiClientInterface {
54
54
  getProviderAssociations(userId: string | number, config?: AxiosRequestConfig): Promise<SCUserProviderAssociationType[]>;
55
55
  createProviderAssociation(data: SCUserProviderAssociationType, config?: AxiosRequestConfig): Promise<SCUserProviderAssociationType>;
56
56
  deleteProviderAssociation(data: DeleteProviderAssociation, config?: AxiosRequestConfig): Promise<any>;
57
+ getUserLiveStream(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCLiveStreamType>>;
57
58
  }
58
59
  /**
59
60
  * Contains all the endpoints needed to manage users.
@@ -384,6 +385,13 @@ export declare class UserApiClient {
384
385
  * @param config
385
386
  */
386
387
  static deleteProviderAssociation(data: DeleteProviderAssociation, config?: AxiosRequestConfig): Promise<any>;
388
+ /**
389
+ * This endpoint retrieves the list of live stream currently started by user identified by ID.
390
+ * @param id
391
+ * @param params
392
+ * @param config
393
+ */
394
+ static getUserLiveStream(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCLiveStreamType>>;
387
395
  }
388
396
  /**
389
397
  *
@@ -474,4 +482,5 @@ export default class UserService {
474
482
  static getProviderAssociations(userId: string | number, config?: AxiosRequestConfig): Promise<SCUserProviderAssociationType[]>;
475
483
  static createProviderAssociation(data: SCUserProviderAssociationType, config?: AxiosRequestConfig): Promise<SCUserProviderAssociationType>;
476
484
  static deleteProviderAssociation(data: DeleteProviderAssociation, config?: AxiosRequestConfig): Promise<any>;
485
+ static getUserLiveStream(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCLiveStreamType>>;
477
486
  }
@@ -448,6 +448,15 @@ export class UserApiClient {
448
448
  static deleteProviderAssociation(data, config) {
449
449
  return apiRequest(Object.assign(Object.assign({}, config), { data, url: Endpoints.DeleteProviderAssociation.url({ id: data.user_id }), method: Endpoints.DeleteProviderAssociation.method }));
450
450
  }
451
+ /**
452
+ * This endpoint retrieves the list of live stream currently started by user identified by ID.
453
+ * @param id
454
+ * @param params
455
+ * @param config
456
+ */
457
+ static getUserLiveStream(id, params, config) {
458
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetLiveStream.url({ id }), method: Endpoints.UserFeed.method, params }));
459
+ }
451
460
  }
452
461
  /**
453
462
  *
@@ -742,4 +751,9 @@ export default class UserService {
742
751
  return UserApiClient.deleteProviderAssociation(data, config);
743
752
  });
744
753
  }
754
+ static getUserLiveStream(id, params, config) {
755
+ return __awaiter(this, void 0, void 0, function* () {
756
+ return UserApiClient.getUserLiveStream(id, params, config);
757
+ });
758
+ }
745
759
  }
@@ -25,5 +25,6 @@ import { InsightCommonParams, InsightEmbedParams, InsightUserParams, InsightCont
25
25
  import { ReactionParams } from './reaction';
26
26
  import { GroupCreateParams, GroupFeedParams } from './group';
27
27
  import { EventCreateParams, EventFeedParams, EventRelatedParams, EventSearchParams } from './event';
28
+ import { LiveStreamCreateParams, LiveStreamSearchParams, LiveStreamRemoveParticipantParams } from './liveStream';
28
29
  import { StartStepParams, OnBoardingStep } from './onBoarding';
29
- export { AccountCreateParams, AccountVerifyParams, AccountRecoverParams, AccountResetParams, AccountSearchParams, SCPaginatedResponse, WebhookParamType, WebhookEventsType, SSOSignUpParams, CommentListParams, CommentCreateParams, IncubatorCreateParams, IncubatorSearchParams, LoyaltyPrizeParams, LoyaltyGetPrizeParams, ModerationParams, ModerateContributionParams, FlaggedContributionParams, CustomNotificationParams, UserGetParams, UserAutocompleteParams, UserScoreParams, UserSearchParams, TagParams, TagGetParams, MediaCreateParams, MediaTypes, ChunkUploadCompleteParams, ChunkUploadParams, ThreadParams, ThreadDeleteParams, MessageCreateParams, MessageMediaUploadParams, MessageThumbnailUploadParams, MessageChunkUploadDoneParams, MessageMediaChunksParams, CategoryParams, CustomAdvParams, CustomPageParams, CustomPageSearchParams, EmbedUpdateParams, EmbedSearchParams, BaseGetParams, BaseSearchParams, FeedObjGetParams, FeedObjCreateParams, FeedObjectPollVotesSearch, FeedParams, LegalPageFilterParams, FeatureParams, ScoreParams, InsightContributionParams, InsightUserParams, InsightEmbedParams, InsightCommonParams, ReactionParams, GroupCreateParams, GroupFeedParams, EventCreateParams, EventFeedParams, EventRelatedParams, EventSearchParams, StartStepParams, OnBoardingStep };
30
+ export { AccountCreateParams, AccountVerifyParams, AccountRecoverParams, AccountResetParams, AccountSearchParams, SCPaginatedResponse, WebhookParamType, WebhookEventsType, SSOSignUpParams, CommentListParams, CommentCreateParams, IncubatorCreateParams, IncubatorSearchParams, LoyaltyPrizeParams, LoyaltyGetPrizeParams, ModerationParams, ModerateContributionParams, FlaggedContributionParams, CustomNotificationParams, UserGetParams, UserAutocompleteParams, UserScoreParams, UserSearchParams, TagParams, TagGetParams, MediaCreateParams, MediaTypes, ChunkUploadCompleteParams, ChunkUploadParams, ThreadParams, ThreadDeleteParams, MessageCreateParams, MessageMediaUploadParams, MessageThumbnailUploadParams, MessageChunkUploadDoneParams, MessageMediaChunksParams, CategoryParams, CustomAdvParams, CustomPageParams, CustomPageSearchParams, EmbedUpdateParams, EmbedSearchParams, BaseGetParams, BaseSearchParams, FeedObjGetParams, FeedObjCreateParams, FeedObjectPollVotesSearch, FeedParams, LegalPageFilterParams, FeatureParams, ScoreParams, InsightContributionParams, InsightUserParams, InsightEmbedParams, InsightCommonParams, ReactionParams, GroupCreateParams, GroupFeedParams, EventCreateParams, EventFeedParams, EventRelatedParams, EventSearchParams, LiveStreamCreateParams, LiveStreamSearchParams, LiveStreamRemoveParticipantParams, StartStepParams, OnBoardingStep };
@@ -0,0 +1,54 @@
1
+ import { BaseSearchParams } from './baseParams';
2
+ /**
3
+ * LiveStreamCreateParams interface
4
+ */
5
+ export interface LiveStreamCreateParams {
6
+ /**
7
+ * A unique name for the live
8
+ */
9
+ name: string;
10
+ /**
11
+ * The livestream description
12
+ */
13
+ description?: string;
14
+ /**
15
+ * The users to invite to the group
16
+ */
17
+ invite_users?: number[];
18
+ /**
19
+ * The liveStream image
20
+ */
21
+ cover?: File;
22
+ /**
23
+ * The liveStream slug
24
+ */
25
+ slug?: string;
26
+ /**
27
+ * The livestream settings
28
+ */
29
+ settings?: Record<string, any>;
30
+ }
31
+ export interface LiveStreamSearchParams extends BaseSearchParams {
32
+ /**
33
+ * Id
34
+ */
35
+ id?: string | number;
36
+ /**
37
+ * Room name
38
+ */
39
+ room_name?: string;
40
+ /**
41
+ * Slug
42
+ */
43
+ slug?: string;
44
+ }
45
+ export interface LiveStreamRemoveParticipantParams {
46
+ /**
47
+ * Participant Id
48
+ */
49
+ participant_id?: string | number;
50
+ /**
51
+ * Ban participant
52
+ */
53
+ ban?: boolean;
54
+ }
@@ -0,0 +1 @@
1
+ export {};