Skip to content

Commit cd55e36

Browse files
feat: feed counts endpoint (#335)
API endpoint for total count of activities + comments (incl. nested) in a feed
1 parent fd067fc commit cd55e36

5 files changed

Lines changed: 115 additions & 8 deletions

File tree

‎src/gen/chat/ChatApi.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,7 @@ export class ChatApi {
13251325
custom_events: request?.custom_events,
13261326
delivery_events: request?.delivery_events,
13271327
mark_messages_pending: request?.mark_messages_pending,
1328+
message_retention: request?.message_retention,
13281329
mutes: request?.mutes,
13291330
partition_size: request?.partition_size,
13301331
partition_ttl: request?.partition_ttl,

‎src/gen/common/CommonApi.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
CreateImportURLResponse,
2626
CreateImportV2TaskRequest,
2727
CreateImportV2TaskResponse,
28+
CreatePermissionRequest,
2829
CreatePollOptionRequest,
2930
CreatePollRequest,
3031
CreateRoleRequest,
@@ -917,15 +918,16 @@ export class CommonApi {
917918
}
918919

919920
async createPermission(
920-
request: PermissionRequest,
921+
request: CreatePermissionRequest,
921922
): Promise<StreamResponse<Response>> {
922923
const body = {
923924
action: request?.action,
925+
id: request?.id,
924926
name: request?.name,
927+
condition: request?.condition,
925928
description: request?.description,
926929
owner: request?.owner,
927930
same_team: request?.same_team,
928-
condition: request?.condition,
929931
};
930932

931933
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(
@@ -986,10 +988,10 @@ export class CommonApi {
986988
const body = {
987989
action: request?.action,
988990
name: request?.name,
991+
condition: request?.condition,
989992
description: request?.description,
990993
owner: request?.owner,
991994
same_team: request?.same_team,
992-
condition: request?.condition,
993995
};
994996

995997
const response = await this.apiClient.sendRequest<StreamResponse<Response>>(

‎src/gen/feeds/FeedApi.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
ChangeFeedVisibilityRequest,
66
ChangeFeedVisibilityResponse,
77
DeleteFeedResponse,
8+
GetFeedCountsResponse,
89
GetOrCreateFeedRequest,
910
GetOrCreateFeedResponse,
1011
MarkActivityRequest,
@@ -107,6 +108,13 @@ export class FeedApi {
107108
});
108109
}
109110

111+
getFeedCounts(): Promise<StreamResponse<GetFeedCountsResponse>> {
112+
return this.feedsApi.getFeedCounts({
113+
feed_id: this.id,
114+
feed_group_id: this.group,
115+
});
116+
}
117+
110118
updateFeedMembers(
111119
request: UpdateFeedMembersRequest,
112120
): Promise<StreamResponse<UpdateFeedMembersResponse>> {

‎src/gen/feeds/FeedsApi.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import {
6262
GetCommentRepliesResponse,
6363
GetCommentResponse,
6464
GetCommentsResponse,
65+
GetFeedCountsResponse,
6566
GetFeedGroupResponse,
6667
GetFeedViewResponse,
6768
GetFeedVisibilityResponse,
@@ -1985,6 +1986,29 @@ export class FeedsApi {
19851986
return { ...response.body, metadata: response.metadata };
19861987
}
19871988

1989+
async getFeedCounts(request: {
1990+
feed_group_id: string;
1991+
feed_id: string;
1992+
}): Promise<StreamResponse<GetFeedCountsResponse>> {
1993+
const pathParams = {
1994+
feed_group_id: request?.feed_group_id,
1995+
feed_id: request?.feed_id,
1996+
};
1997+
1998+
const response = await this.apiClient.sendRequest<
1999+
StreamResponse<GetFeedCountsResponse>
2000+
>(
2001+
'GET',
2002+
'/api/v2/feeds/feed_groups/{feed_group_id}/feeds/{feed_id}/counts',
2003+
pathParams,
2004+
undefined,
2005+
);
2006+
2007+
decoders['GetFeedCountsResponse']?.(response.body);
2008+
2009+
return { ...response.body, metadata: response.metadata };
2010+
}
2011+
19882012
async updateFeedMembers(
19892013
request: UpdateFeedMembersRequest & {
19902014
feed_group_id: string;

‎src/gen/models/index.ts‎

Lines changed: 77 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5419,6 +5419,8 @@ export interface ChannelConfig {
54195419

54205420
max_message_length: number;
54215421

5422+
message_retention: string;
5423+
54225424
mutes: boolean;
54235425

54245426
name: string;
@@ -5570,6 +5572,8 @@ export interface ChannelConfigWithInfo {
55705572

55715573
max_message_length: number;
55725574

5575+
message_retention: string;
5576+
55735577
mutes: boolean;
55745578

55755579
name: string;
@@ -6571,6 +6575,8 @@ export interface ChannelTypeConfig {
65716575

65726576
max_message_length: number;
65736577

6578+
message_retention: string;
6579+
65746580
mutes: boolean;
65756581

65766582
name: string;
@@ -7382,6 +7388,8 @@ export interface Classification {
73827388

73837389
severity?: string;
73847390

7391+
matched_contributors?: Array<string>;
7392+
73857393
subclassifications?: Array<Classification>;
73867394
}
73877395

@@ -8543,6 +8551,8 @@ export interface CreateChannelTypeResponse {
85438551

85448552
max_message_length: number;
85458553

8554+
message_retention: string;
8555+
85468556
mutes: boolean;
85478557

85488558
name: string;
@@ -8957,6 +8967,43 @@ export interface CreateMembershipLevelResponse {
89578967
membership_level: MembershipLevelResponse;
89588968
}
89598969

8970+
export interface CreatePermissionRequest {
8971+
/**
8972+
* Action name this permission is for (e.g. SendMessage)
8973+
*/
8974+
action: string;
8975+
8976+
/**
8977+
* Unique permission ID
8978+
*/
8979+
id: string;
8980+
8981+
/**
8982+
* Name of the permission
8983+
*/
8984+
name: string;
8985+
8986+
/**
8987+
* MongoDB style condition which decides whether or not the permission is granted
8988+
*/
8989+
condition: Record<string, any>;
8990+
8991+
/**
8992+
* Description of the permission
8993+
*/
8994+
description?: string;
8995+
8996+
/**
8997+
* Whether this permission applies to resource owner or not
8998+
*/
8999+
owner?: boolean;
9000+
9001+
/**
9002+
* Whether this permission applies to teammates (multi-tenancy mode only)
9003+
*/
9004+
same_team?: boolean;
9005+
}
9006+
89609007
export interface CreatePolicyTestSetRequest {
89619008
/**
89629009
* Display name; unique within an app
@@ -12973,6 +13020,8 @@ export interface GetChannelTypeResponse {
1297313020

1297413021
max_message_length: number;
1297513022

13023+
message_retention: string;
13024+
1297613025
mutes: boolean;
1297713026

1297813027
name: string;
@@ -13188,6 +13237,25 @@ export interface GetExternalStorageResponse {
1318813237
gcs?: GetExternalStorageGCSResponse;
1318913238
}
1319013239

13240+
export interface GetFeedCountsResponse {
13241+
/**
13242+
* Number of activities in the feed
13243+
*/
13244+
activity_count: number;
13245+
13246+
/**
13247+
* Total number of comments on those activities, including nested replies
13248+
*/
13249+
comment_count: number;
13250+
13251+
duration: string;
13252+
13253+
/**
13254+
* Sum of activity_count and comment_count
13255+
*/
13256+
total_count: number;
13257+
}
13258+
1319113259
export interface GetFeedGroupResponse {
1319213260
duration: string;
1319313261

@@ -18472,6 +18540,11 @@ export interface PermissionRequest {
1847218540
*/
1847318541
name: string;
1847418542

18543+
/**
18544+
* MongoDB style condition which decides whether or not the permission is granted
18545+
*/
18546+
condition: Record<string, any>;
18547+
1847518548
/**
1847618549
* Description of the permission
1847718550
*/
@@ -18486,11 +18559,6 @@ export interface PermissionRequest {
1848618559
* Whether this permission applies to teammates (multi-tenancy mode only)
1848718560
*/
1848818561
same_team?: boolean;
18489-
18490-
/**
18491-
* MongoDB style condition which decides whether or not the permission is granted
18492-
*/
18493-
condition?: Record<string, any>;
1849418562
}
1849518563

1849618564
export interface PermissionRequestEvent {
@@ -26612,6 +26680,8 @@ export interface UpdateChannelTypeRequest {
2661226680

2661326681
mark_messages_pending?: boolean;
2661426682

26683+
message_retention?: string;
26684+
2661526685
mutes?: boolean;
2661626686

2661726687
partition_size?: number;
@@ -26690,6 +26760,8 @@ export interface UpdateChannelTypeResponse {
2669026760

2669126761
max_message_length: number;
2669226762

26763+
message_retention: string;
26764+
2669326765
mutes: boolean;
2669426766

2669526767
name: string;

0 commit comments

Comments
 (0)