@xylink/xy-rtc-sdk 3.9.0 → 3.9.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,11 +6,11 @@
6
6
  * @email luojinghui424@gmail.com
7
7
  *
8
8
  * Created at : 2021-01-05 17:24:07
9
- * Last modified : 2023-06-16 16:53:23
9
+ * Last modified : 2023-07-07 16:49:48
10
10
  */
11
- import Logger from '../tools/logger';
12
- import { ILayout, IVideoRenders, IRoster, ITemplateObj, IScreenInfo, IMode, IOutputCustomLayout, ILayoutRoster, IConfInfo, IPageInfo, IReqInfo, VideoQuality, StreamResolutionLevel, TLayoutMap } from '../type/index';
13
- import Client from './client';
11
+ import Logger from '../../tools/logger';
12
+ import { ILayout, IVideoRenders, IRoster, IScreenInfo, IOutputCustomLayout, ILayoutRoster, IConfInfo, IPageInfo, IReqInfo, VideoQuality, StreamResolutionLevel, TLayoutMap, TemplateMode, ContentTemplateMode, IMode, LayoutOrientationType } from '../../type/index';
13
+ import Client from '../client';
14
14
  export default class LayoutManager {
15
15
  logger: Logger;
16
16
  client: Client;
@@ -34,6 +34,9 @@ export default class LayoutManager {
34
34
  private confInfo;
35
35
  private pageInfo;
36
36
  private isLocalShareContent;
37
+ private templateManager;
38
+ private focusViewConfig;
39
+ private layoutOrientation;
37
40
  constructor(client: Client);
38
41
  static getCustomLayoutItem(item: ILayout, resolution: StreamResolutionLevel, quality: VideoQuality): {
39
42
  pid: number;
@@ -55,99 +58,122 @@ export default class LayoutManager {
55
58
  getScreenInfo(): IScreenInfo;
56
59
  getVideoManagers(): IVideoRenders;
57
60
  getForceFullScreenId(): string;
58
- getTemplateMode(): IMode;
61
+ getTemplateMode(): TemplateMode | ContentTemplateMode;
59
62
  getConfInfo(): IConfInfo;
60
63
  getInternalsLayout(): IOutputCustomLayout;
61
64
  getLocalShareState(): boolean;
62
65
  setOrderRosterList(orderRosterList: IRoster[]): void;
63
66
  setOriginOrderRosters(originOrderRosters: IRoster[]): void;
67
+ /**
68
+ * 维护 Local roster 状态
69
+ *
70
+ * @param { Partial<IRoster> } data - 需要更新的roster数据
71
+ */
72
+ setLocalStatus(data: Partial<IRoster>): void;
64
73
  /**
65
74
  * 设置发布全屏layout id
66
75
  *
67
- * @param { string } id forceLayout roster id
76
+ * @param { string } id - forceLayout roster id
68
77
  */
69
78
  setForceFullScreenId(id?: string): void;
79
+ /**
80
+ * 设置content信息
81
+ *
82
+ * @param { IRoster | null } content - 共享内容
83
+ */
70
84
  setContentRosterItem(content: IRoster | null): void;
85
+ /**
86
+ * 设置confInfo
87
+ *
88
+ * @param { IConfInfo } confInfo - Conf Change消息
89
+ */
71
90
  setConfInfo(confInfo: IConfInfo): void;
72
91
  /**
73
- * 本地分享content, 设置对应布局、页码
92
+ * [AUTO] 分页
74
93
  *
75
- * @public
76
- * @param { boolean } is 本地是否分享content
94
+ * @param { number } currentPage - 请求某一页数据
77
95
  */
78
- setLocalShareContent(is: boolean): void;
96
+ setPageInfo(currentPage?: number): void;
79
97
  /**
80
- * 计算显示模板数据
98
+ * 本地分享content, 设置对应布局、页码
81
99
  *
82
- * @public
83
- * @returns
100
+ * @param { boolean } is - 本地是否分享content
84
101
  */
85
- calcTemplate(): {
86
- tempLayout: ITemplateObj[];
87
- templateRate: number;
88
- };
89
- initLayoutManager(): void;
102
+ setLocalShareContent(is: boolean): void;
90
103
  /**
91
104
  * 回调 video 状态
105
+ * state === (roster当前状态 + 上一次的status)
92
106
  *
93
- * @param key endpointId + mediagroupId 组成的id
94
- * @param data 最新的会议状态 status === video track / video标签 监听到的状态
95
- *
96
- * state === roster 当前状态 + 上一次的status
107
+ * @param { string } key - endpointId + mediagroupId 组成的id
108
+ * @param { status: string; error?: any } data - 最新的会议状态 status === video track / video标签 监听到的状态
97
109
  */
98
110
  private onVideoStatusChange;
99
111
  /**
100
112
  * 使用wrap element元素更新 videoManagers 数据,并绑定视频流信息
101
113
  *
102
- * @param key endpointId + mediagroupId 组成的id
103
- * @param wrapEleId wrap video element id
114
+ * @param { string } key - endpointId + mediagroupId 组成的id
115
+ * @param { string } wrapEleId - wrap video element id
104
116
  */
105
117
  setVideoRenderer(key: string, wrapEleId: string): void;
118
+ /**
119
+ * videoManagers 移除key对应的元素
120
+ *
121
+ * @param { string } key - endpointId + mediagroupId 组成的id
122
+ * @param { string } wrapEleId - wrap video element id
123
+ */
106
124
  removeVideoRenderer(key: string, wrapEleId: string): void;
125
+ /**
126
+ * 播放本地画面
127
+ */
107
128
  playLocalVideo(): Promise<void>;
108
- playVideo(keys?: string[]): Promise<void>;
109
- updateLocalTrack(): void;
110
129
  /**
111
- * 使用最新的 videoTrackList 和 layoutResults 数据更新 layout 内容
130
+ * 播放对应画面
131
+ *
132
+ * @param { string[] } keys - videoID list
112
133
  */
113
- updateStreams(isAutoSendLayout?: boolean): void;
134
+ playVideo(keys?: string[]): Promise<void>;
114
135
  /**
115
- * 清理失效的 video manager 数据
136
+ * 切换布局方向
137
+ *
138
+ * @param { LayoutOrientationType } layoutOrientation - 布局方向: MOBILE_HORIZONTAL-横屏;MOBILE_VERTICAL-竖屏
116
139
  */
117
- clearInvalidVideoManagers(): void;
140
+ setLayoutOrientation(layoutOrientation: LayoutOrientationType): void;
118
141
  /**
119
- * [AUTO] 重新计算页码信息、模板类型
142
+ * [AUTO] 切换布局
120
143
  *
121
- * @public
144
+ * @param { IMode } templateMode - 指定要切换的布局模式
145
+ * @returns { Promise<IMode> } - 切换后的布局模式
122
146
  */
123
- calcPageInfo(confInfo?: IConfInfo): void;
147
+ switchLayout(templateMode?: IMode): "SPEAKER" | "GALLERY" | "MULTI_PIC_CONTENT_HIGH_PRIORITY" | "MULTI_PIC_ACTIVE_HIGH_PRIORITY" | "TWO_PIC_PIP" | "CONTENT_ONLY" | "TWO_PIC_SYMMETRIC";
124
148
  /**
125
- * [AUTO] 分页
149
+ * 切换主画面, GALLERY布局不支持
126
150
  *
127
- * @public
128
- * @param { number } currentPage 请求某一页数据
151
+ * @param { string } id - 指定切换到主画面的LayoutId
152
+ * @returns { string } id
129
153
  */
130
- setPageInfo(currentPage?: number): void;
154
+ setFocusView(id: string): string;
131
155
  /**
132
- * [AUTO] 全屏请流
156
+ * 更新Local video track
157
+ */
158
+ updateLocalTrack(): void;
159
+ /**
160
+ * [AUTO] 重新计算页码信息、模板类型
133
161
  *
134
- * @public
162
+ * @param { IConfInfo } confInfo - confChange信息
135
163
  */
136
- calcForceFullScreenRequestLayout(): void;
164
+ calcPageInfo(confInfo?: IConfInfo): void;
137
165
  /**
138
166
  * [AUTO] 请流
139
167
  *
140
- * @public
141
- * @param { IPageInfo } pageInfo 页码信息
168
+ * @param { IPageInfo } pageInfo - 页码信息
142
169
  */
143
170
  calcRequestNewLayout(pageInfo?: IPageInfo): void;
144
171
  /**
145
- * [AUTO] : 基于 new layout result 消息生成 customLayoutMap 数据,并diff对比更新数据
172
+ * [AUTO] 设置模版类型
146
173
  *
147
- * @public
148
- * @param { ILayoutRoster[] } totalLayoutResultList
174
+ * @param { boolean } isReset - 是否重置模版
149
175
  */
150
- createAutoLayout(totalLayoutResultList: ILayoutRoster[]): void;
176
+ setTemplateMode(isReset?: boolean): void;
151
177
  /**
152
178
  * 重置templateMode
153
179
  * 本地共享,则显示对称布局四画面
@@ -157,63 +183,106 @@ export default class LayoutManager {
157
183
  /**
158
184
  * 创建排好序的roster数据
159
185
  *
160
- * @private
161
- * @param { ILayoutRoster[] } totalLayoutResultList
186
+ * @param { ILayoutRoster[] } totalLayoutResultList - layout数据
162
187
  */
163
188
  private createOrderRoster;
189
+ /**
190
+ * [CUSTOM] 基于 new layout result 消息生成 customLayoutMap 数据,并diff对比更新数据
191
+ *
192
+ * @param { ILayoutRoster[] } totalLayoutResultList - layout数据
193
+ */
164
194
  createCustomLayout(totalLayoutResultList: ILayoutRoster[]): void;
165
195
  /**
166
- * 根据 reqList 计算最新的 layout 数据(2.0.2以前的版本方法)
196
+ * [AUTO] : 基于 new layout result 消息生成 customLayoutMap 数据,并diff对比更新数据
167
197
  *
168
- * @param reqList
198
+ * @param { ILayoutRoster[] } totalLayoutResultList - layout数据
199
+ */
200
+ createAutoLayout(totalLayoutResultList: ILayoutRoster[]): void;
201
+ /**
202
+ * 创建Layout
169
203
  */
170
- requestLayout(reqList: IReqInfo[]): void;
171
- calculatePosition(): void;
172
- calculateRotate(): void;
173
- getVideoStreamByTrackId(videoTrackId: string): {
174
- videoStream: MediaStream | null;
175
- track: MediaStreamTrack | null;
176
- };
177
- calculateNewLayoutList(): {
178
- roster: IRoster;
179
- position: number[];
180
- zIndex: number;
181
- }[];
182
- calculateScreenInfo(): {
183
- width: number;
184
- height: number;
185
- rateHeight: number;
186
- rateWidth: number;
187
- } | undefined;
188
204
  createLayout(): void;
205
+ /**
206
+ * roster 排序
207
+ */
189
208
  calculateOrderRosterList(): IRoster[];
190
209
  /**
191
- * [auto] 切换布局
210
+ * 缓存主画面信息
192
211
  *
193
- * @param { IMode } templateMode 指定要切换的布局模式
194
- * @returns { Promise<IMode> } 切换后的布局模式
212
+ * @param { string } id - 指定切换到主画面的LayoutId
195
213
  */
196
- switchLayout(templateMode?: IMode): IMode;
214
+ private handleFocusViewConfig;
197
215
  /**
198
- * 【内部方法】停止轮询时,清理无效的 videoManager 数据
216
+ * 计算 custom layout 数据
217
+ */
218
+ private customLayoutCalculator;
219
+ /**
220
+ * [AUTO] 1. 初始化Layout数据
221
+ */
222
+ initLayoutManager(): void;
223
+ /**
224
+ * 计算显示模板数据
199
225
  *
200
- * @param monitoryList callUri list 数据
226
+ * @param { number } currentCount - 模版画面数量
227
+ * @param { TemplateType } templateType 是否是全屏模版
201
228
  */
202
- clearVideoManagersUseMonitorList(monitoryList: string[]): void;
229
+ private calcTemplate;
203
230
  /**
204
- * 维护 Local roster 状态
205
- * @param data
231
+ * 根据模版匹配roster信息,生产newLayout数据
232
+ */
233
+ calculateNewLayoutList(): ILayout[];
234
+ /**
235
+ * 计算Layout Container的容器信息
236
+ */
237
+ calculateScreenInfo(): void;
238
+ /**
239
+ * 计算Layout Container的容器信息
240
+ *
241
+ * @param { number } rate - 容器比例
242
+ * @returns { IScreenInfo } screenInfo
206
243
  */
207
- setLocalStatus(data: any): void;
244
+ private getTemplateScreenInfo;
245
+ /**
246
+ * [AUTO] 2.创建LayoutMap, 移除无效Layout
247
+ */
248
+ private createBaseLayout;
208
249
  /**
209
250
  * 清理无效的 layout 数据,重置状态
210
251
  */
211
252
  private clearInvalidLayout;
212
- private createBaseLayout;
213
253
  /**
214
- * 计算 custom layout 数据
254
+ * [AUTO | CUSTOM] 使用最新的 videoTrackList 和 layoutResults 数据更新 layout 内容
255
+ *
256
+ * @param { boolean } isAutoSendLayout - 是否上报Layout信息
215
257
  */
216
- private customLayoutCalculator;
258
+ updateStreams(isAutoSendLayout?: boolean): void;
259
+ /**
260
+ * 清理失效的 video manager 数据
261
+ */
262
+ clearInvalidVideoManagers(): void;
263
+ private getVideoStreamByTrackId;
264
+ /**
265
+ * [AUTO] 计算位置信息
266
+ */
267
+ calculatePosition(): void;
268
+ /**
269
+ * 计算位置信息
270
+ *
271
+ * @param { ILayout } item - 需要计算位置信息的layout信息
272
+ * @param { IScreenInfo } screenInfo
273
+ * @returns
274
+ */
275
+ private getTemplatePosition;
276
+ /**
277
+ * [AUTO] 计算旋转信息
278
+ */
279
+ calculateRotate(): void;
280
+ /**
281
+ * 【内部方法】停止轮询时,清理无效的 videoManager 数据
282
+ *
283
+ * @param monitoryList callUri list 数据
284
+ */
285
+ clearVideoManagersUseMonitorList(monitoryList: string[]): void;
217
286
  /**
218
287
  * 通过旋转信息获取在layout中的位置
219
288
  *
@@ -221,6 +290,21 @@ export default class LayoutManager {
221
290
  * @param mediagroupid type
222
291
  */
223
292
  private getLayoutKeyByRotateInfo;
293
+ /**
294
+ * 获取最终请流分辨率
295
+ * 1. 根据是否启用低性能模式
296
+ * 2. 根据企业配置转换请流分辨率
297
+ *
298
+ * @param { ITemplateResolution } resolution - layout模版分辨率
299
+ * @returns { resolutionLevel }
300
+ */
301
+ private convertResolutionLevel;
302
+ /**
303
+ * 是否是主会场模式(远端设置为主会场)
304
+ *
305
+ * @returns
306
+ */
307
+ private isChairmanMode;
224
308
  /**
225
309
  * 镜像显示Local画面
226
310
  */
@@ -233,12 +317,25 @@ export default class LayoutManager {
233
317
  */
234
318
  private getLayoutTextAvatar;
235
319
  /**
236
- * 获取最终请流分辨率
237
- * 1. 根据是否启用低性能模式
238
- * 2. 根据企业配置转换请流分辨率
320
+ * [AUTO] 全屏请流
321
+ */
322
+ private calcForceFullScreenRequestLayout;
323
+ /**
324
+ * 退出全屏
325
+ */
326
+ private exitFullScreen;
327
+ /**
328
+ * 查找对应的roster
239
329
  *
240
- * @param { ITemplateResolution } resolution - layout模版分辨率
241
- * @returns { resolutionLevel }
330
+ * @param { string } id - LayoutId
331
+ * @param { ILayoutRoster[]} list - layout list
332
+ * @returns
242
333
  */
243
- private convertResolutionLevel;
334
+ private findRosterById;
335
+ /**
336
+ * 根据 reqList 计算最新的 layout 数据(2.0.2以前的版本方法)
337
+ *
338
+ * @param { IReqInfo[] } reqList - 请流数据
339
+ */
340
+ requestLayout(reqList: IReqInfo[]): void;
244
341
  }
@@ -0,0 +1,64 @@
1
+ import { TemplateInfo, TemplateParams } from '../../type';
2
+ declare class TemplateManager {
3
+ private templates;
4
+ private commonTemplates;
5
+ private contentTemplates;
6
+ constructor();
7
+ /**
8
+ * 获取对应的模版
9
+ *
10
+ * @param { TemplateMode } modeType 模版类型
11
+ * @param { number } currentCount 画面数量
12
+ * @param { number } participantCount 会议总人数
13
+ * @param { boolean } isLocalHide 是否隐藏Local, 默认:false
14
+ * @param { boolean } isChairmanMode 是否有主会场, 默认:false
15
+ * @param { TemplateType } templateType 全屏画面类型
16
+ * @param { LayoutOrientationType } orientation 移动端方向,默认 'NONE':PC端
17
+ * @returns
18
+ */
19
+ getTemplate({ modeType, currentCount, participantCount, isLocalHide, isChairmanMode, templateType, orientation, focusViewConfig }: TemplateParams): TemplateInfo;
20
+ /**
21
+ * 处理指定的主画面模版信息
22
+ *
23
+ * @param { ITemplateObj[] } newTemplate 模版信息
24
+ * @param { FocusViewConfig } focusViewConfig 指定的主画面的信息
25
+ */
26
+ private handleForceView;
27
+ /**
28
+ * 获取不同平台,不同方向 对应的所有模版类型数据
29
+ *
30
+ * @param { LayoutOrientationType } orientation
31
+ * @returns { ITemplate }
32
+ */
33
+ private getAllTemplates;
34
+ /**
35
+ * 初始化content模版数据
36
+ */
37
+ private getContentTemplates;
38
+ /**
39
+ * 初始化 移动端 模版数据
40
+ */
41
+ private getMobileTemplates;
42
+ /**
43
+ * 获取全屏模版
44
+ *
45
+ * @param { TemplateType } type - 全屏对象的类型, PEOPLE/CONTENT等
46
+ * @returns { TemplateInfo }
47
+ */
48
+ private getFullLayoutTemplate;
49
+ /**
50
+ * [content]缩略视图: 和演讲者布局一样,但是主画面显示content,分辨率请1080P
51
+ *
52
+ * @param { TemplateInfos } template
53
+ * @returns
54
+ */
55
+ private getMultiPicContentHighPriority;
56
+ /**
57
+ * [content] 缩略共享: 和演讲者布局一样, 但是左列第二画面小窗口显示content, 分辨率请720P
58
+ *
59
+ * @param { TemplateInfos } template
60
+ * @returns
61
+ */
62
+ private getMultiPicActiveHighPriority;
63
+ }
64
+ export default TemplateManager;
@@ -2,9 +2,9 @@
2
2
  * Meeting Info Control
3
3
  *
4
4
  * Created at : 2022-10-27 13:58:22
5
- * Last modified : 2023-07-11 10:11:00
5
+ * Last modified : 2023-07-27 10:02:44
6
6
  */
7
- import { IRecordPermission, IConfMgmtUrl, ILayout, IMediaConfig, IReqInfo, LayoutAvatarType, TLayoutMap } from '../type';
7
+ import { IRecordPermission, IConfMgmtUrl, ILayout, IMediaConfig, IReqInfo, LayoutAvatarType, TLayoutMap, InviteInfo } from '../type';
8
8
  import Client from './client';
9
9
  import Logger from '../tools/logger';
10
10
  declare class Meeting {
@@ -119,8 +119,9 @@ declare class Meeting {
119
119
  *
120
120
  * TODO: 2022-10-27,携带meetingId的Info接口调用失败,原因是dcs(大数据当前服务)接口在入会后存在15s延迟,导致info返回403错误;
121
121
  * TODO:2022-10-27,此处使用inviteUrl地址,暂时不使用微信邀请链接地址,原因是会议号获取的微信邀请链接页面访问失效,需要提供MeetingId字段才行;
122
+ * 2023-8-3 鉴于安全考虑,此接口需提供MeetingId字段;
122
123
  */
123
- private getMeetingInviteInfo;
124
+ getMeetingInviteInfo(): Promise<InviteInfo>;
124
125
  /**
125
126
  * 企业配置信息
126
127
  *
@@ -1,55 +1,64 @@
1
1
  /**
2
2
  * Browser version tools
3
+ * platform/browser/version
3
4
  *
4
5
  * @authors Luo-jinghui (luojinghui424@gmail.com)
5
6
  * @date 2020-02-21 16:29:12
6
7
  */
7
- export declare const platform: () => {
8
- isTablet: boolean;
9
- isPhone: boolean;
10
- isAndroid: boolean;
11
- isPc: boolean;
12
- isMac: boolean;
13
- isWindows: boolean;
14
- isIPad: boolean;
15
- isChrome: boolean;
16
- isLinux: boolean;
17
- isFirefox: boolean;
18
- isBaidu: boolean;
19
- isQQ: boolean;
20
- isOpera: boolean;
21
- isZhazha: boolean;
22
- isEdge: boolean;
23
- isSafari: boolean;
24
- isHuaweiBrowser: boolean;
25
- };
26
- export declare const getChromeVersion: () => {
27
- major: any;
28
- minor: any;
29
- build: any;
30
- patch: any;
31
- } | undefined;
32
- export declare const getEdgeVersion: () => {
33
- major: any;
34
- minor: any;
35
- build: any;
36
- } | undefined;
37
- export declare const getSafariVersion: () => {
38
- major: any;
39
- minor: any;
40
- } | undefined;
41
- export declare const getFirefoxVersion: () => {
42
- major: any;
43
- minor: any;
44
- } | undefined;
45
- export declare const getAndroidVersion: () => {
46
- major: any;
47
- minor: any;
48
- } | undefined;
49
- export declare const getIOSVersion: () => {
50
- major: any;
51
- minor: any;
52
- } | undefined;
53
- export declare const getVersion: () => number;
54
- export declare const isPC: boolean;
55
- export declare const isMobile: boolean;
8
+ declare class BrowserDetector {
9
+ static getPlatform(): {
10
+ isTablet: boolean;
11
+ isPhone: boolean;
12
+ isAndroid: boolean;
13
+ isPc: boolean;
14
+ isMac: boolean;
15
+ isWindows: boolean;
16
+ isIPad: boolean;
17
+ isChrome: boolean;
18
+ isLinux: boolean;
19
+ isFirefox: boolean;
20
+ isBaidu: boolean;
21
+ isQQ: boolean;
22
+ isOpera: boolean;
23
+ isZhazha: boolean;
24
+ isEdge: boolean;
25
+ isSafari: boolean;
26
+ isHuaweiBrowser: boolean;
27
+ isWeixin: boolean;
28
+ iswxwork: boolean;
29
+ isMiniProgram: boolean;
30
+ isWindowsWxWechat: boolean;
31
+ isWindowsWechat: boolean;
32
+ };
33
+ static getOperationSystem(): "" | "Windows WXWechat" | "Windows Wechat" | "Windows" | "iPhone" | "Android" | "iPad" | "Mac" | "Linux" | "MiniProgram";
34
+ static getChromeVersion(): {
35
+ major: any;
36
+ minor: any;
37
+ build: any;
38
+ patch: any;
39
+ } | undefined;
40
+ static getEdgeVersion(): {
41
+ major: any;
42
+ minor: any;
43
+ build: any;
44
+ } | undefined;
45
+ static getSafariVersion(): {
46
+ major: any;
47
+ minor: any;
48
+ } | undefined;
49
+ static getFirefoxVersion(): {
50
+ major: any;
51
+ minor: any;
52
+ } | undefined;
53
+ static getAndroidVersion(): {
54
+ major: any;
55
+ minor: any;
56
+ } | undefined;
57
+ static getIOSVersion(): {
58
+ major: any;
59
+ minor: any;
60
+ } | undefined;
61
+ static getWeixinVersion(): string | undefined;
62
+ static getWXWeixinVersion(): string | undefined;
63
+ }
64
+ export default BrowserDetector;
@@ -4,7 +4,11 @@
4
4
  * @authors Luo-jinghui (luojinghui424@gmail.com)
5
5
  * @date 2019-10-24 14:06:05
6
6
  */
7
- export declare const version: any;
7
+ export declare const SDKVersion: {
8
+ version: any;
9
+ createTime: any;
10
+ };
11
+ export declare const version: string;
8
12
  export declare const serverProtocolMap: Record<string, string>;
9
13
  export declare const proxy: {
10
14
  wssProtocol: string;
@@ -6,7 +6,8 @@
6
6
  */
7
7
  import { AxiosRequestConfig, AxiosInstance } from 'axios';
8
8
  import Logger from './logger';
9
- import { IToken, ISignParams } from '../type';
9
+ import { IToken } from '../type';
10
+ import XyApiGatewaySDK from '@xylink/xy_api_gateway';
10
11
  export interface IResponseSuccess {
11
12
  code: number;
12
13
  data: any;
@@ -21,39 +22,30 @@ export interface IAxiosRequestConfig extends AxiosRequestConfig {
21
22
  clientId?: string;
22
23
  }
23
24
  declare class HttpClient {
24
- commonOption: AxiosRequestConfig;
25
+ commonOption: IAxiosRequestConfig;
25
26
  axios: AxiosInstance;
26
27
  tokenInfo: any;
27
28
  logger: Logger | null;
28
- private baseUrl;
29
29
  private clientId;
30
30
  private clientSecret;
31
31
  private retryCount;
32
+ xyApiGatewaySDK: XyApiGatewaySDK | null;
32
33
  constructor(commonOption: IAxiosRequestConfig);
33
- refreshToken({ baseURL, refresh_token }: {
34
- baseURL?: string | undefined;
35
- refresh_token?: string | undefined;
36
- }): Promise<any>;
34
+ getTokenInfo(): any;
35
+ setTokenInfo(tokenInfo: IToken | null): void;
37
36
  setLogger(logger: Logger): void;
38
37
  setBaseUrl(url: string): void;
39
38
  setClientInfo({ clientId, clientSecret }: {
40
39
  clientId: string;
41
40
  clientSecret: string;
42
41
  }): void;
43
- setHttpConfig(config: IAxiosRequestConfig): void;
44
- getApiHeader(params: ISignParams): {
45
- Authorization?: string | undefined;
46
- 'x-xy-clientid': string;
47
- 'x-xy-clienttype': string;
48
- 'x-xy-nonce': number;
49
- 'x-xy-timestamp': number;
50
- 'x-xy-signtype': string;
51
- 'x-xy-sign': string;
52
- 'x-xy-signatureversion': string;
53
- };
54
- setTokenInfo(tokenInfo: IToken | null): void;
55
- getTokenInfo(): any;
56
- assignOptions: (option?: AxiosRequestConfig) => AxiosRequestConfig & {
42
+ initXyApiGatewaySDK(): XyApiGatewaySDK;
43
+ setSignHeader(config: any): Promise<any>;
44
+ refreshToken({ baseURL, refresh_token }: {
45
+ baseURL?: string | undefined;
46
+ refresh_token?: string | undefined;
47
+ }): Promise<any>;
48
+ assignOptions: (option?: AxiosRequestConfig) => IAxiosRequestConfig & AxiosRequestConfig & {
57
49
  params: any;
58
50
  };
59
51
  get: (url: string, option?: IAxiosRequestConfig) => any;