Skip to content

Commit bbd8333

Browse files
Feeds collections
1 parent ed65ff1 commit bbd8333

File tree

3 files changed

+269
-0
lines changed

3 files changed

+269
-0
lines changed

src/gen/feeds/FeedsApi.ts

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import {
1919
AddReactionRequest,
2020
AddReactionResponse,
2121
CastPollVoteRequest,
22+
CreateCollectionsRequest,
23+
CreateCollectionsResponse,
2224
CreateFeedGroupRequest,
2325
CreateFeedGroupResponse,
2426
CreateFeedViewRequest,
@@ -33,6 +35,7 @@ import {
3335
DeleteActivityResponse,
3436
DeleteBookmarkFolderResponse,
3537
DeleteBookmarkResponse,
38+
DeleteCollectionsResponse,
3639
DeleteCommentReactionResponse,
3740
DeleteCommentResponse,
3841
DeleteFeedGroupResponse,
@@ -89,6 +92,7 @@ import {
8992
QueryFollowsResponse,
9093
QueryMembershipLevelsRequest,
9194
QueryMembershipLevelsResponse,
95+
ReadCollectionsResponse,
9296
RejectFeedMemberInviteRequest,
9397
RejectFeedMemberInviteResponse,
9498
RejectFollowRequest,
@@ -107,6 +111,8 @@ import {
107111
UpdateBookmarkFolderResponse,
108112
UpdateBookmarkRequest,
109113
UpdateBookmarkResponse,
114+
UpdateCollectionsRequest,
115+
UpdateCollectionsResponse,
110116
UpdateCommentRequest,
111117
UpdateCommentResponse,
112118
UpdateFeedGroupRequest,
@@ -125,6 +131,8 @@ import {
125131
UpdateMembershipLevelResponse,
126132
UpsertActivitiesRequest,
127133
UpsertActivitiesResponse,
134+
UpsertCollectionsRequest,
135+
UpsertCollectionsResponse,
128136
} from '../models';
129137
import { decoders } from '../model-decoders/decoders';
130138

@@ -146,6 +154,7 @@ export class FeedsApi {
146154
visibility: request?.visibility,
147155
visibility_tag: request?.visibility_tag,
148156
attachments: request?.attachments,
157+
collection_refs: request?.collection_refs,
149158
filter_tags: request?.filter_tags,
150159
interest_tags: request?.interest_tags,
151160
mentioned_user_ids: request?.mentioned_user_ids,
@@ -592,6 +601,7 @@ export class FeedsApi {
592601
user_id: request?.user_id,
593602
visibility: request?.visibility,
594603
attachments: request?.attachments,
604+
collection_refs: request?.collection_refs,
595605
feeds: request?.feeds,
596606
filter_tags: request?.filter_tags,
597607
interest_tags: request?.interest_tags,
@@ -720,6 +730,113 @@ export class FeedsApi {
720730
return { ...response.body, metadata: response.metadata };
721731
}
722732

733+
async deleteCollections(request: {
734+
collection_refs: string[];
735+
}): Promise<StreamResponse<DeleteCollectionsResponse>> {
736+
const queryParams = {
737+
collection_refs: request?.collection_refs,
738+
};
739+
740+
const response = await this.apiClient.sendRequest<
741+
StreamResponse<DeleteCollectionsResponse>
742+
>('DELETE', '/api/v2/feeds/collections', undefined, queryParams);
743+
744+
decoders.DeleteCollectionsResponse?.(response.body);
745+
746+
return { ...response.body, metadata: response.metadata };
747+
}
748+
749+
async readCollections(request: {
750+
collection_refs: string[];
751+
user_id?: string;
752+
}): Promise<StreamResponse<ReadCollectionsResponse>> {
753+
const queryParams = {
754+
collection_refs: request?.collection_refs,
755+
user_id: request?.user_id,
756+
};
757+
758+
const response = await this.apiClient.sendRequest<
759+
StreamResponse<ReadCollectionsResponse>
760+
>('GET', '/api/v2/feeds/collections', undefined, queryParams);
761+
762+
decoders.ReadCollectionsResponse?.(response.body);
763+
764+
return { ...response.body, metadata: response.metadata };
765+
}
766+
767+
async updateCollections(
768+
request: UpdateCollectionsRequest,
769+
): Promise<StreamResponse<UpdateCollectionsResponse>> {
770+
const body = {
771+
collections: request?.collections,
772+
user_id: request?.user_id,
773+
user: request?.user,
774+
};
775+
776+
const response = await this.apiClient.sendRequest<
777+
StreamResponse<UpdateCollectionsResponse>
778+
>(
779+
'PATCH',
780+
'/api/v2/feeds/collections',
781+
undefined,
782+
undefined,
783+
body,
784+
'application/json',
785+
);
786+
787+
decoders.UpdateCollectionsResponse?.(response.body);
788+
789+
return { ...response.body, metadata: response.metadata };
790+
}
791+
792+
async createCollections(
793+
request: CreateCollectionsRequest,
794+
): Promise<StreamResponse<CreateCollectionsResponse>> {
795+
const body = {
796+
collections: request?.collections,
797+
user_id: request?.user_id,
798+
user: request?.user,
799+
};
800+
801+
const response = await this.apiClient.sendRequest<
802+
StreamResponse<CreateCollectionsResponse>
803+
>(
804+
'POST',
805+
'/api/v2/feeds/collections',
806+
undefined,
807+
undefined,
808+
body,
809+
'application/json',
810+
);
811+
812+
decoders.CreateCollectionsResponse?.(response.body);
813+
814+
return { ...response.body, metadata: response.metadata };
815+
}
816+
817+
async upsertCollections(
818+
request: UpsertCollectionsRequest,
819+
): Promise<StreamResponse<UpsertCollectionsResponse>> {
820+
const body = {
821+
collections: request?.collections,
822+
};
823+
824+
const response = await this.apiClient.sendRequest<
825+
StreamResponse<UpsertCollectionsResponse>
826+
>(
827+
'PUT',
828+
'/api/v2/feeds/collections',
829+
undefined,
830+
undefined,
831+
body,
832+
'application/json',
833+
);
834+
835+
decoders.UpsertCollectionsResponse?.(response.body);
836+
837+
return { ...response.body, metadata: response.metadata };
838+
}
839+
723840
async getComments(request: {
724841
object_id: string;
725842
object_type: string;

src/gen/model-decoders/decoders.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ decoders.ActivityResponse = (input?: Record<string, any>) => {
205205

206206
own_reactions: { type: 'FeedsReactionResponse', isSingle: false },
207207

208+
collections: { type: 'EnrichedCollectionResponse', isSingle: false },
209+
208210
reaction_groups: { type: 'ReactionGroupResponse', isSingle: false },
209211

210212
user: { type: 'UserResponse', isSingle: true },
@@ -1478,6 +1480,15 @@ decoders.ClosedCaptionEvent = (input?: Record<string, any>) => {
14781480
return decode(typeMappings, input);
14791481
};
14801482

1483+
decoders.CollectionResponse = (input?: Record<string, any>) => {
1484+
const typeMappings: TypeMapping = {
1485+
created_at: { type: 'DatetimeType', isSingle: true },
1486+
1487+
updated_at: { type: 'DatetimeType', isSingle: true },
1488+
};
1489+
return decode(typeMappings, input);
1490+
};
1491+
14811492
decoders.Command = (input?: Record<string, any>) => {
14821493
const typeMappings: TypeMapping = {
14831494
created_at: { type: 'DatetimeType', isSingle: true },
@@ -1637,6 +1648,13 @@ decoders.CreateChannelTypeResponse = (input?: Record<string, any>) => {
16371648
return decode(typeMappings, input);
16381649
};
16391650

1651+
decoders.CreateCollectionsResponse = (input?: Record<string, any>) => {
1652+
const typeMappings: TypeMapping = {
1653+
collections: { type: 'CollectionResponse', isSingle: false },
1654+
};
1655+
return decode(typeMappings, input);
1656+
};
1657+
16401658
decoders.CreateCommandResponse = (input?: Record<string, any>) => {
16411659
const typeMappings: TypeMapping = {
16421660
command: { type: 'Command', isSingle: true },
@@ -1823,6 +1841,15 @@ decoders.EgressRTMPResponse = (input?: Record<string, any>) => {
18231841
return decode(typeMappings, input);
18241842
};
18251843

1844+
decoders.EnrichedCollectionResponse = (input?: Record<string, any>) => {
1845+
const typeMappings: TypeMapping = {
1846+
created_at: { type: 'DatetimeType', isSingle: true },
1847+
1848+
updated_at: { type: 'DatetimeType', isSingle: true },
1849+
};
1850+
return decode(typeMappings, input);
1851+
};
1852+
18261853
decoders.EntityCreatorResponse = (input?: Record<string, any>) => {
18271854
const typeMappings: TypeMapping = {
18281855
created_at: { type: 'DatetimeType', isSingle: true },
@@ -3617,6 +3644,13 @@ decoders.ReactivateUserResponse = (input?: Record<string, any>) => {
36173644
return decode(typeMappings, input);
36183645
};
36193646

3647+
decoders.ReadCollectionsResponse = (input?: Record<string, any>) => {
3648+
const typeMappings: TypeMapping = {
3649+
collections: { type: 'CollectionResponse', isSingle: false },
3650+
};
3651+
return decode(typeMappings, input);
3652+
};
3653+
36203654
decoders.ReadStateResponse = (input?: Record<string, any>) => {
36213655
const typeMappings: TypeMapping = {
36223656
last_read: { type: 'DatetimeType', isSingle: true },
@@ -4215,6 +4249,13 @@ decoders.UpdateChannelTypeResponse = (input?: Record<string, any>) => {
42154249
return decode(typeMappings, input);
42164250
};
42174251

4252+
decoders.UpdateCollectionsResponse = (input?: Record<string, any>) => {
4253+
const typeMappings: TypeMapping = {
4254+
collections: { type: 'CollectionResponse', isSingle: false },
4255+
};
4256+
return decode(typeMappings, input);
4257+
};
4258+
42184259
decoders.UpdateCommandResponse = (input?: Record<string, any>) => {
42194260
const typeMappings: TypeMapping = {
42204261
command: { type: 'Command', isSingle: true },
@@ -4324,6 +4365,13 @@ decoders.UpsertActivitiesResponse = (input?: Record<string, any>) => {
43244365
return decode(typeMappings, input);
43254366
};
43264367

4368+
decoders.UpsertCollectionsResponse = (input?: Record<string, any>) => {
4369+
const typeMappings: TypeMapping = {
4370+
collections: { type: 'CollectionResponse', isSingle: false },
4371+
};
4372+
return decode(typeMappings, input);
4373+
};
4374+
43274375
decoders.UpsertConfigResponse = (input?: Record<string, any>) => {
43284376
const typeMappings: TypeMapping = {
43294377
config: { type: 'ConfigResponse', isSingle: true },

0 commit comments

Comments
 (0)