@selfcommunity/api-services 0.5.0-live.79 → 0.5.0-live.80
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/constants/Endpoints.js +31 -0
- package/lib/cjs/index.d.ts +3 -2
- package/lib/cjs/index.js +4 -1
- package/lib/cjs/services/livestream/index.d.ts +115 -0
- package/lib/cjs/services/livestream/index.js +159 -0
- package/lib/cjs/types/index.d.ts +2 -1
- package/lib/cjs/types/liveStream.d.ts +29 -0
- package/lib/cjs/types/liveStream.js +2 -0
- package/lib/esm/constants/Endpoints.js +31 -0
- package/lib/esm/index.d.ts +3 -2
- package/lib/esm/index.js +2 -1
- package/lib/esm/services/livestream/index.d.ts +115 -0
- package/lib/esm/services/livestream/index.js +154 -0
- package/lib/esm/types/index.d.ts +2 -1
- package/lib/esm/types/liveStream.d.ts +29 -0
- package/lib/esm/types/liveStream.js +1 -0
- package/lib/umd/api-services.js +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,154 @@
|
|
|
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.SearchEvents.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 changes the LiveStream avatar
|
|
62
|
+
* @param id
|
|
63
|
+
* @param data
|
|
64
|
+
* @param config
|
|
65
|
+
*/
|
|
66
|
+
static changeCover(id, data, config) {
|
|
67
|
+
return apiRequest(Object.assign({ url: Endpoints.PatchLiveStream.url({ id }), method: Endpoints.PatchLiveStream.method, data }, config));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* This endpoint allows to attend an LiveStream
|
|
71
|
+
* @param id
|
|
72
|
+
* @param config
|
|
73
|
+
*/
|
|
74
|
+
static join(id, config) {
|
|
75
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.JoinLiveStream.url({ id }), method: Endpoints.JoinLiveStream.method }));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
*
|
|
80
|
+
:::tip LiveStream service can be used in the following way:
|
|
81
|
+
|
|
82
|
+
```jsx
|
|
83
|
+
1. Import the service from our library:
|
|
84
|
+
|
|
85
|
+
import {LiveStreamService} from "@selfcommunity/api-services";
|
|
86
|
+
```
|
|
87
|
+
```jsx
|
|
88
|
+
2. Create a function and put the service inside it!
|
|
89
|
+
The async function `search` will return the LiveStreams matching the search query.
|
|
90
|
+
|
|
91
|
+
async searchLiveStreams() {
|
|
92
|
+
return await LiveStreamService.search();
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
```jsx
|
|
96
|
+
In case of required `params`, just add them inside the brackets.
|
|
97
|
+
|
|
98
|
+
async getSpecificInfo(liveStreamId) {
|
|
99
|
+
return await LiveStreamService.getSpecificInfo(liveStreamId);
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
```jsx
|
|
103
|
+
If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
104
|
+
|
|
105
|
+
1. Declare it(or declare them, it is possible to add multiple params)
|
|
106
|
+
|
|
107
|
+
const headers = headers: {Authorization: `Bearer ${yourToken}`}
|
|
108
|
+
|
|
109
|
+
2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
110
|
+
```
|
|
111
|
+
:::
|
|
112
|
+
*/
|
|
113
|
+
export default class LiveStreamService {
|
|
114
|
+
static search(params, config) {
|
|
115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
return LiveStreamApiClient.search(params, config);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
static getSpecificInfo(id, config) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
return LiveStreamApiClient.getSpecificInfo(id, config);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
static create(data, config) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
return LiveStreamApiClient.create(data, config);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
static update(id, data, config) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
return LiveStreamApiClient.update(id, data, config);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
static patch(id, data, config) {
|
|
135
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
return LiveStreamApiClient.patch(id, data, config);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
static delete(id, config) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
return LiveStreamApiClient.delete(id, config);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
static changeCover(id, data, config) {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
return LiveStreamApiClient.changeCover(id, data, config);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
static join(id, config) {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
151
|
+
return LiveStreamApiClient.join(id, config);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
package/lib/esm/types/index.d.ts
CHANGED
|
@@ -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 } 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, StartStepParams, OnBoardingStep };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LiveStreamCreateParams interface
|
|
3
|
+
*/
|
|
4
|
+
export interface LiveStreamCreateParams {
|
|
5
|
+
/**
|
|
6
|
+
* A unique name for the live
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* The livestream description
|
|
11
|
+
*/
|
|
12
|
+
description?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The users to invite to the group
|
|
15
|
+
*/
|
|
16
|
+
invite_users?: number[];
|
|
17
|
+
/**
|
|
18
|
+
* The liveStream image
|
|
19
|
+
*/
|
|
20
|
+
cover?: File;
|
|
21
|
+
/**
|
|
22
|
+
* The liveStream slug
|
|
23
|
+
*/
|
|
24
|
+
slug?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The livestream settings
|
|
27
|
+
*/
|
|
28
|
+
settings?: Record<string, any>;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|