@stream-io/node-sdk 0.4.18 → 0.4.20

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.
@@ -12,11 +12,7 @@ import {
12
12
  FlagRequest,
13
13
  FlagResponse,
14
14
  GetConfigResponse,
15
- GetModerationAnalyticsRequest,
16
- GetModerationAnalyticsResponse,
17
15
  GetReviewQueueItemResponse,
18
- GetUserModerationReportResponse,
19
- ModeratorStatsResponse,
20
16
  MuteRequest,
21
17
  MuteResponse,
22
18
  QueryFeedModerationTemplatesResponse,
@@ -26,9 +22,6 @@ import {
26
22
  QueryModerationLogsResponse,
27
23
  QueryReviewQueueRequest,
28
24
  QueryReviewQueueResponse,
29
- QueryUsageStatsRequest,
30
- QueryUsageStatsResponse,
31
- QueueStatsResponse,
32
25
  SubmitActionRequest,
33
26
  SubmitActionResponse,
34
27
  UnbanRequest,
@@ -43,23 +36,6 @@ import {
43
36
  import { decoders } from '../model-decoders';
44
37
 
45
38
  export class ModerationApi extends BaseApi {
46
- getModerationAnalytics = async (
47
- request?: GetModerationAnalyticsRequest,
48
- ): Promise<StreamResponse<GetModerationAnalyticsResponse>> => {
49
- const body = {
50
- end_date: request?.end_date,
51
- start_date: request?.start_date,
52
- };
53
-
54
- const response = await this.sendRequest<
55
- StreamResponse<GetModerationAnalyticsResponse>
56
- >('POST', '/api/v2/moderation/analytics', undefined, undefined, body);
57
-
58
- decoders.GetModerationAnalyticsResponse?.(response.body);
59
-
60
- return { ...response.body, metadata: response.metadata };
61
- };
62
-
63
39
  ban = async (request: BanRequest): Promise<StreamResponse<BanResponse>> => {
64
40
  const body = {
65
41
  target_user_id: request?.target_user_id,
@@ -339,18 +315,6 @@ export class ModerationApi extends BaseApi {
339
315
  return { ...response.body, metadata: response.metadata };
340
316
  };
341
317
 
342
- getModeratorStats = async (): Promise<
343
- StreamResponse<ModeratorStatsResponse>
344
- > => {
345
- const response = await this.sendRequest<
346
- StreamResponse<ModeratorStatsResponse>
347
- >('GET', '/api/v2/moderation/moderator_stats', undefined, undefined);
348
-
349
- decoders.ModeratorStatsResponse?.(response.body);
350
-
351
- return { ...response.body, metadata: response.metadata };
352
- };
353
-
354
318
  mute = async (
355
319
  request: MuteRequest,
356
320
  ): Promise<StreamResponse<MuteResponse>> => {
@@ -374,19 +338,6 @@ export class ModerationApi extends BaseApi {
374
338
  return { ...response.body, metadata: response.metadata };
375
339
  };
376
340
 
377
- getQueueStats = async (): Promise<StreamResponse<QueueStatsResponse>> => {
378
- const response = await this.sendRequest<StreamResponse<QueueStatsResponse>>(
379
- 'GET',
380
- '/api/v2/moderation/queue_stats',
381
- undefined,
382
- undefined,
383
- );
384
-
385
- decoders.QueueStatsResponse?.(response.body);
386
-
387
- return { ...response.body, metadata: response.metadata };
388
- };
389
-
390
341
  queryReviewQueue = async (
391
342
  request?: QueryReviewQueueRequest,
392
343
  ): Promise<StreamResponse<QueryReviewQueueResponse>> => {
@@ -507,48 +458,4 @@ export class ModerationApi extends BaseApi {
507
458
 
508
459
  return { ...response.body, metadata: response.metadata };
509
460
  };
510
-
511
- queryUsageStats = async (
512
- request?: QueryUsageStatsRequest,
513
- ): Promise<StreamResponse<QueryUsageStatsResponse>> => {
514
- const body = {
515
- limit: request?.limit,
516
- next: request?.next,
517
- prev: request?.prev,
518
- user_id: request?.user_id,
519
- sort: request?.sort,
520
- filter: request?.filter,
521
- user: request?.user,
522
- };
523
-
524
- const response = await this.sendRequest<
525
- StreamResponse<QueryUsageStatsResponse>
526
- >('POST', '/api/v2/moderation/usage_stats', undefined, undefined, body);
527
-
528
- decoders.QueryUsageStatsResponse?.(response.body);
529
-
530
- return { ...response.body, metadata: response.metadata };
531
- };
532
-
533
- getUserReport = async (request: {
534
- user_id: string;
535
- create_user_if_not_exists?: boolean;
536
- include_user_mutes?: boolean;
537
- include_user_blocks?: boolean;
538
- }): Promise<StreamResponse<GetUserModerationReportResponse>> => {
539
- const queryParams = {
540
- user_id: request?.user_id,
541
- create_user_if_not_exists: request?.create_user_if_not_exists,
542
- include_user_mutes: request?.include_user_mutes,
543
- include_user_blocks: request?.include_user_blocks,
544
- };
545
-
546
- const response = await this.sendRequest<
547
- StreamResponse<GetUserModerationReportResponse>
548
- >('GET', '/api/v2/moderation/user_report', undefined, queryParams);
549
-
550
- decoders.GetUserModerationReportResponse?.(response.body);
551
-
552
- return { ...response.body, metadata: response.metadata };
553
- };
554
461
  }
package/src/types.ts CHANGED
@@ -1,10 +1,14 @@
1
+ import { Agent } from 'undici';
2
+
1
3
  export type OmitTypeId<T> = Omit<T, 'type' | 'id' | 'connection_id'>;
2
4
 
3
5
  export interface ApiConfig {
4
6
  apiKey: string;
5
7
  token: string;
6
8
  baseUrl: string;
9
+ /** The timeout for requests in milliseconds. The default is 3000. */
7
10
  timeout: number;
11
+ agent: Agent;
8
12
  }
9
13
 
10
14
  export interface RequestMetadata {