Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions src/gen/feeds/FeedsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import {
AddReactionRequest,
AddReactionResponse,
CastPollVoteRequest,
CreateCollectionsRequest,
CreateCollectionsResponse,
CreateFeedGroupRequest,
CreateFeedGroupResponse,
CreateFeedViewRequest,
Expand All @@ -33,6 +35,7 @@ import {
DeleteActivityResponse,
DeleteBookmarkFolderResponse,
DeleteBookmarkResponse,
DeleteCollectionsResponse,
DeleteCommentReactionResponse,
DeleteCommentResponse,
DeleteFeedGroupResponse,
Expand Down Expand Up @@ -89,6 +92,7 @@ import {
QueryFollowsResponse,
QueryMembershipLevelsRequest,
QueryMembershipLevelsResponse,
ReadCollectionsResponse,
RejectFeedMemberInviteRequest,
RejectFeedMemberInviteResponse,
RejectFollowRequest,
Expand All @@ -107,6 +111,8 @@ import {
UpdateBookmarkFolderResponse,
UpdateBookmarkRequest,
UpdateBookmarkResponse,
UpdateCollectionsRequest,
UpdateCollectionsResponse,
UpdateCommentRequest,
UpdateCommentResponse,
UpdateFeedGroupRequest,
Expand All @@ -125,6 +131,8 @@ import {
UpdateMembershipLevelResponse,
UpsertActivitiesRequest,
UpsertActivitiesResponse,
UpsertCollectionsRequest,
UpsertCollectionsResponse,
} from '../models';
import { decoders } from '../model-decoders/decoders';

Expand All @@ -147,6 +155,7 @@ export class FeedsApi {
visibility: request?.visibility,
visibility_tag: request?.visibility_tag,
attachments: request?.attachments,
collection_refs: request?.collection_refs,
filter_tags: request?.filter_tags,
interest_tags: request?.interest_tags,
mentioned_user_ids: request?.mentioned_user_ids,
Expand Down Expand Up @@ -594,6 +603,7 @@ export class FeedsApi {
user_id: request?.user_id,
visibility: request?.visibility,
attachments: request?.attachments,
collection_refs: request?.collection_refs,
feeds: request?.feeds,
filter_tags: request?.filter_tags,
interest_tags: request?.interest_tags,
Expand Down Expand Up @@ -722,6 +732,113 @@ export class FeedsApi {
return { ...response.body, metadata: response.metadata };
}

async deleteCollections(request: {
collection_refs: string[];
}): Promise<StreamResponse<DeleteCollectionsResponse>> {
const queryParams = {
collection_refs: request?.collection_refs,
};

const response = await this.apiClient.sendRequest<
StreamResponse<DeleteCollectionsResponse>
>('DELETE', '/api/v2/feeds/collections', undefined, queryParams);

decoders.DeleteCollectionsResponse?.(response.body);

return { ...response.body, metadata: response.metadata };
}

async readCollections(request: {
collection_refs: string[];
user_id?: string;
}): Promise<StreamResponse<ReadCollectionsResponse>> {
const queryParams = {
collection_refs: request?.collection_refs,
user_id: request?.user_id,
};

const response = await this.apiClient.sendRequest<
StreamResponse<ReadCollectionsResponse>
>('GET', '/api/v2/feeds/collections', undefined, queryParams);

decoders.ReadCollectionsResponse?.(response.body);

return { ...response.body, metadata: response.metadata };
}

async updateCollections(
request: UpdateCollectionsRequest,
): Promise<StreamResponse<UpdateCollectionsResponse>> {
const body = {
collections: request?.collections,
user_id: request?.user_id,
user: request?.user,
};

const response = await this.apiClient.sendRequest<
StreamResponse<UpdateCollectionsResponse>
>(
'PATCH',
'/api/v2/feeds/collections',
undefined,
undefined,
body,
'application/json',
);

decoders.UpdateCollectionsResponse?.(response.body);

return { ...response.body, metadata: response.metadata };
}

async createCollections(
request: CreateCollectionsRequest,
): Promise<StreamResponse<CreateCollectionsResponse>> {
const body = {
collections: request?.collections,
user_id: request?.user_id,
user: request?.user,
};

const response = await this.apiClient.sendRequest<
StreamResponse<CreateCollectionsResponse>
>(
'POST',
'/api/v2/feeds/collections',
undefined,
undefined,
body,
'application/json',
);

decoders.CreateCollectionsResponse?.(response.body);

return { ...response.body, metadata: response.metadata };
}

async upsertCollections(
request: UpsertCollectionsRequest,
): Promise<StreamResponse<UpsertCollectionsResponse>> {
const body = {
collections: request?.collections,
};

const response = await this.apiClient.sendRequest<
StreamResponse<UpsertCollectionsResponse>
>(
'PUT',
'/api/v2/feeds/collections',
undefined,
undefined,
body,
'application/json',
);

decoders.UpsertCollectionsResponse?.(response.body);

return { ...response.body, metadata: response.metadata };
}

async getComments(request: {
object_id: string;
object_type: string;
Expand Down
48 changes: 48 additions & 0 deletions src/gen/model-decoders/decoders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ decoders.ActivityResponse = (input?: Record<string, any>) => {

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

collections: { type: 'EnrichedCollectionResponse', isSingle: false },

reaction_groups: { type: 'ReactionGroupResponse', isSingle: false },

user: { type: 'UserResponse', isSingle: true },
Expand Down Expand Up @@ -1512,6 +1514,15 @@ decoders.ClosedCaptionEvent = (input?: Record<string, any>) => {
return decode(typeMappings, input);
};

decoders.CollectionResponse = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
created_at: { type: 'DatetimeType', isSingle: true },

updated_at: { type: 'DatetimeType', isSingle: true },
};
return decode(typeMappings, input);
};

decoders.Command = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
created_at: { type: 'DatetimeType', isSingle: true },
Expand Down Expand Up @@ -1671,6 +1682,13 @@ decoders.CreateChannelTypeResponse = (input?: Record<string, any>) => {
return decode(typeMappings, input);
};

decoders.CreateCollectionsResponse = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
collections: { type: 'CollectionResponse', isSingle: false },
};
return decode(typeMappings, input);
};

decoders.CreateCommandResponse = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
command: { type: 'Command', isSingle: true },
Expand Down Expand Up @@ -1857,6 +1875,15 @@ decoders.EgressRTMPResponse = (input?: Record<string, any>) => {
return decode(typeMappings, input);
};

decoders.EnrichedCollectionResponse = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
created_at: { type: 'DatetimeType', isSingle: true },

updated_at: { type: 'DatetimeType', isSingle: true },
};
return decode(typeMappings, input);
};

decoders.EntityCreatorResponse = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
created_at: { type: 'DatetimeType', isSingle: true },
Expand Down Expand Up @@ -3672,6 +3699,13 @@ decoders.ReactivateUserResponse = (input?: Record<string, any>) => {
return decode(typeMappings, input);
};

decoders.ReadCollectionsResponse = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
collections: { type: 'CollectionResponse', isSingle: false },
};
return decode(typeMappings, input);
};

decoders.ReadStateResponse = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
last_read: { type: 'DatetimeType', isSingle: true },
Expand Down Expand Up @@ -4278,6 +4312,13 @@ decoders.UpdateChannelTypeResponse = (input?: Record<string, any>) => {
return decode(typeMappings, input);
};

decoders.UpdateCollectionsResponse = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
collections: { type: 'CollectionResponse', isSingle: false },
};
return decode(typeMappings, input);
};

decoders.UpdateCommandResponse = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
command: { type: 'Command', isSingle: true },
Expand Down Expand Up @@ -4394,6 +4435,13 @@ decoders.UpsertActivitiesResponse = (input?: Record<string, any>) => {
return decode(typeMappings, input);
};

decoders.UpsertCollectionsResponse = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
collections: { type: 'CollectionResponse', isSingle: false },
};
return decode(typeMappings, input);
};

decoders.UpsertConfigResponse = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
config: { type: 'ConfigResponse', isSingle: true },
Expand Down
Loading