Skip to content

Commit 7c58c64

Browse files
authored
feat: new endpoint GetOrCreateFeedGroup (#127)
1 parent 40a65d2 commit 7c58c64

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

src/gen/feeds/FeedsApi.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ import {
4545
GetFeedGroupResponse,
4646
GetFeedViewResponse,
4747
GetFollowSuggestionsResponse,
48+
GetOrCreateFeedGroupRequest,
49+
GetOrCreateFeedGroupResponse,
4850
GetOrCreateFeedRequest,
4951
GetOrCreateFeedResponse,
5052
GetOrCreateFeedViewRequest,
@@ -1046,6 +1048,35 @@ export class FeedsApi {
10461048
return { ...response.body, metadata: response.metadata };
10471049
}
10481050

1051+
async getOrCreateFeedGroup(
1052+
request: GetOrCreateFeedGroupRequest & { feed_group_id: string },
1053+
): Promise<StreamResponse<GetOrCreateFeedGroupResponse>> {
1054+
const pathParams = {
1055+
feed_group_id: request?.feed_group_id,
1056+
};
1057+
const body = {
1058+
default_view_id: request?.default_view_id,
1059+
default_visibility: request?.default_visibility,
1060+
custom: request?.custom,
1061+
notification: request?.notification,
1062+
};
1063+
1064+
const response = await this.apiClient.sendRequest<
1065+
StreamResponse<GetOrCreateFeedGroupResponse>
1066+
>(
1067+
'POST',
1068+
'/api/v2/feeds/feed_groups/{feed_group_id}',
1069+
pathParams,
1070+
undefined,
1071+
body,
1072+
'application/json',
1073+
);
1074+
1075+
decoders.GetOrCreateFeedGroupResponse?.(response.body);
1076+
1077+
return { ...response.body, metadata: response.metadata };
1078+
}
1079+
10491080
async updateFeedGroup(
10501081
request: UpdateFeedGroupRequest & { feed_group_id: string },
10511082
): Promise<StreamResponse<UpdateFeedGroupResponse>> {

src/gen/model-decoders/decoders.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,6 +2273,13 @@ decoders.GetOrCreateCallResponse = (input?: Record<string, any>) => {
22732273
return decode(typeMappings, input);
22742274
};
22752275

2276+
decoders.GetOrCreateFeedGroupResponse = (input?: Record<string, any>) => {
2277+
const typeMappings: TypeMapping = {
2278+
feed_group: { type: 'FeedGroupResponse', isSingle: true },
2279+
};
2280+
return decode(typeMappings, input);
2281+
};
2282+
22762283
decoders.GetOrCreateFeedResponse = (input?: Record<string, any>) => {
22772284
const typeMappings: TypeMapping = {
22782285
activities: { type: 'ActivityResponse', isSingle: false },

src/gen/models/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6035,6 +6035,29 @@ export interface GetOrCreateCallResponse {
60356035
call: CallResponse;
60366036
}
60376037

6038+
export interface GetOrCreateFeedGroupRequest {
6039+
default_view_id?: string;
6040+
6041+
default_visibility?:
6042+
| 'public'
6043+
| 'visible'
6044+
| 'followers'
6045+
| 'members'
6046+
| 'private';
6047+
6048+
custom?: Record<string, any>;
6049+
6050+
notification?: NotificationConfig;
6051+
}
6052+
6053+
export interface GetOrCreateFeedGroupResponse {
6054+
duration: string;
6055+
6056+
was_created: boolean;
6057+
6058+
feed_group: FeedGroupResponse;
6059+
}
6060+
60386061
export interface GetOrCreateFeedRequest {
60396062
limit?: number;
60406063

0 commit comments

Comments
 (0)