@@ -6,6 +6,7 @@ import { StreamChatClient } from './StreamChatClient';
66import { CallTokenPayload , UserTokenPayload } from './types' ;
77import { QueryBannedUsersPayload , UserRequest } from './gen/models' ;
88import { StreamModerationClient } from './StreamModerationClient' ;
9+ import { ApiClient } from './ApiClient' ;
910
1011export interface StreamClientOptions {
1112 timeout ?: number ;
@@ -38,36 +39,30 @@ export class StreamClient extends CommonApi {
3839 const timeout = config ?. timeout ?? StreamClient . DEFAULT_TIMEOUT ;
3940 const chatBaseUrl = config ?. basePath ?? 'https://chat.stream-io-api.com' ;
4041 const videoBaseUrl = config ?. basePath ?? 'https://video.stream-io-api.com' ;
41- super ( {
42+ const chatApiClient = new ApiClient ( {
4243 apiKey,
4344 token,
44- timeout,
4545 baseUrl : chatBaseUrl ,
46+ timeout,
4647 agent : config ?. agent as RequestInit [ 'dispatcher' ] ,
4748 } ) ;
4849
49- this . video = new StreamVideoClient ( {
50- streamClient : this ,
50+ const videoApiClient = new ApiClient ( {
5151 apiKey,
5252 token,
53- timeout,
5453 baseUrl : videoBaseUrl ,
55- agent : config ?. agent as RequestInit [ 'dispatcher' ] ,
56- } ) ;
57- this . chat = new StreamChatClient ( {
58- apiKey,
59- token,
6054 timeout,
61- baseUrl : chatBaseUrl ,
6255 agent : config ?. agent as RequestInit [ 'dispatcher' ] ,
6356 } ) ;
64- this . moderation = new StreamModerationClient ( {
65- apiKey ,
66- token ,
67- timeout ,
68- baseUrl : chatBaseUrl ,
69- agent : config ?. agent as RequestInit [ 'dispatcher' ] ,
57+
58+ super ( chatApiClient ) ;
59+
60+ this . video = new StreamVideoClient ( {
61+ streamClient : this ,
62+ apiClient : videoApiClient ,
7063 } ) ;
64+ this . chat = new StreamChatClient ( this . apiClient ) ;
65+ this . moderation = new StreamModerationClient ( chatApiClient ) ;
7166 }
7267
7368 upsertUsers = ( users : UserRequest [ ] ) => {
0 commit comments