Skip to content
Open
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
4 changes: 2 additions & 2 deletions generate-openapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ CHAT_DIR="../chat"

rm -rf $OUTPUT_DIR

( cd $CHAT_DIR ; make openapi ; go run ./cmd/chat-manager openapi generate-client --language ts --spec ./releases/v2/serverside-api.yaml --output $OUTPUT_DIR )
( cd $CHAT_DIR ; make openapi ; ./build/chat-manager openapi generate-client --language ts --spec ./releases/v2/serverside-api.yaml --output $OUTPUT_DIR )

yarn lint:gen
yarn lint:gen
63 changes: 63 additions & 0 deletions src/gen/feeds/FeedsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ import {
GetOrCreateFeedResponse,
GetOrCreateFeedViewRequest,
GetOrCreateFeedViewResponse,
GetOrCreateFollowResponse,
GetOrCreateUnfollowRequest,
GetOrCreateUnfollowResponse,
ListFeedGroupsResponse,
ListFeedViewsResponse,
ListFeedVisibilitiesResponse,
Expand Down Expand Up @@ -2568,6 +2571,39 @@ export class FeedsApi {
return { ...response.body, metadata: response.metadata };
}

async getOrCreateFollow(
request: FollowRequest,
): Promise<StreamResponse<GetOrCreateFollowResponse>> {
const body = {
source: request?.source,
target: request?.target,
activity_copy_limit: request?.activity_copy_limit,
copy_custom_to_notification: request?.copy_custom_to_notification,
create_notification_activity: request?.create_notification_activity,
create_users: request?.create_users,
enrich_own_fields: request?.enrich_own_fields,
push_preference: request?.push_preference,
skip_push: request?.skip_push,
status: request?.status,
custom: request?.custom,
};

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

decoders.GetOrCreateFollowResponse?.(response.body);

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

async unfollow(request: {
source: string;
target: string;
Expand Down Expand Up @@ -2804,6 +2840,33 @@ export class FeedsApi {
return { ...response.body, metadata: response.metadata };
}

async getOrCreateUnfollow(
request: GetOrCreateUnfollowRequest,
): Promise<StreamResponse<GetOrCreateUnfollowResponse>> {
const body = {
source: request?.source,
target: request?.target,
delete_notification_activity: request?.delete_notification_activity,
enrich_own_fields: request?.enrich_own_fields,
keep_history: request?.keep_history,
};

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

decoders.GetOrCreateUnfollowResponse?.(response.body);

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

async deleteFeedUserData(
request: DeleteFeedUserDataRequest & { user_id: string },
): Promise<StreamResponse<DeleteFeedUserDataResponse>> {
Expand Down
14 changes: 14 additions & 0 deletions src/gen/model-decoders/decoders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2767,6 +2767,20 @@ decoders.GetOrCreateFeedViewResponse = (input?: Record<string, any>) => {
return decode(typeMappings, input);
};

decoders.GetOrCreateFollowResponse = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
follow: { type: 'FollowResponse', isSingle: true },
};
return decode(typeMappings, input);
};

decoders.GetOrCreateUnfollowResponse = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
follow: { type: 'FollowResponse', isSingle: true },
};
return decode(typeMappings, input);
};

decoders.GetPushTemplatesResponse = (input?: Record<string, any>) => {
const typeMappings: TypeMapping = {
templates: { type: 'PushTemplateResponse', isSingle: false },
Expand Down
54 changes: 54 additions & 0 deletions src/gen/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11165,6 +11165,60 @@ export interface GetOrCreateFeedViewResponse {
feed_view: FeedViewResponse;
}

export interface GetOrCreateFollowResponse {
/**
* True if the follow was newly created by this request; false if it already existed
*/
created: boolean;

duration: string;

follow: FollowResponse;

/**
* Whether a notification activity was successfully created (only set when the follow was newly created)
*/
notification_created?: boolean;
}

export interface GetOrCreateUnfollowRequest {
/**
* Fully qualified ID of the source feed
*/
source: string;

/**
* Fully qualified ID of the target feed
*/
target: string;

/**
* Whether to delete the corresponding notification activity (default: false)
*/
delete_notification_activity?: boolean;

/**
* If true, enriches the follow's source_feed and target_feed with own_* fields (own_follows, own_followings, own_capabilities, own_membership). Defaults to false for performance.
*/
enrich_own_fields?: boolean;

/**
* When true, activities from the unfollowed feed will remain in the source feed's timeline (default: false)
*/
keep_history?: boolean;
}

export interface GetOrCreateUnfollowResponse {
/**
* True if a follow was found and removed by this request; false if no follow existed
*/
deleted: boolean;

duration: string;

follow?: FollowResponse;
}

export interface GetPushTemplatesResponse {
/**
* Duration of the request in milliseconds
Expand Down
Loading