Skip to content

Commit

Permalink
Merge pull request #2008 from bluesky-social/appview-v2-proto-cids
Browse files Browse the repository at this point in the history
Appview v2 proto update to use record refs, add interaction methods
  • Loading branch information
devinivy authored Jan 2, 2024
2 parents c67e1f1 + 36b72bf commit dd6fe98
Show file tree
Hide file tree
Showing 12 changed files with 364 additions and 68 deletions.
51 changes: 42 additions & 9 deletions packages/bsky/proto/bsky.proto
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ message GetFollowersRequest {

message FollowInfo {
string uri = 1;
string did = 2;
string actor_did = 2;
string subject_did = 3;
}

message GetFollowersResponse {
Expand Down Expand Up @@ -230,24 +231,47 @@ message GetActorLikesResponse {
// - return number of likes on subjects A, B, C...
// - post or feed generator hydration `likeCount` field
message GetLikeCountsRequest {
repeated string uris = 1;
repeated RecordRef refs = 1;
}

message GetLikeCountsResponse {
repeated int32 counts = 1;
}

//
// Interactions
//
message GetInteractionCountsRequest {
repeated RecordRef refs = 1;
}

message GetInteractionCountsResponse {
repeated int32 likes = 1;
repeated int32 reposts = 2;
repeated int32 replies = 3;
}

message GetCountsForUsersRequest {
repeated string dids = 1;
}

message GetCountsForUsersResponse {
repeated int32 posts = 1;
repeated int32 reposts = 2;
repeated int32 following = 3;
repeated int32 followers = 4;
}

//
// Reposts
//

// - return repost uris where subject uri is subject A
// - `getReposts` list for a post
message GetRepostsBySubjectRequest {
string subject_uri = 1;
optional string subject_cid = 2;
int32 limit = 3;
string cursor = 4;
RecordRef subject = 1;
int32 limit = 2;
string cursor = 3;
}

message GetRepostsBySubjectResponse {
Expand Down Expand Up @@ -287,7 +311,7 @@ message GetActorRepostsResponse {
// - return number of reposts on subject A
// - post or feed generator hydration `repostCount` field
message GetRepostCountsRequest {
repeated string uris = 1;
repeated RecordRef refs = 1;
}

message GetRepostCountsResponse {
Expand Down Expand Up @@ -726,7 +750,9 @@ message GetTimelineResponse {

message FeedItem {
string uri = 1;
string repost = 2;
string cid = 2;
string repost = 3;
string repost_cid = 4;
}

// - Return recent post uris from users in list A
Expand Down Expand Up @@ -813,7 +839,7 @@ message GetFollowSuggestionsResponse {
// - Return post reply count with uris A, B, C…
// - All feed hydration
message GetPostReplyCountsRequest {
repeated string uris = 1;
repeated RecordRef refs = 1;
}

message GetPostReplyCountsResponse {
Expand Down Expand Up @@ -883,10 +909,13 @@ message UpdateTakedownRequest {

message UpdateTakedownResponse {}


// Ping
message PingRequest {}
message PingResponse {}



service Service {
// Records
rpc GetBlockRecords(GetBlockRecordsRequest) returns (GetBlockRecordsResponse);
Expand Down Expand Up @@ -920,6 +949,10 @@ service Service {
rpc GetActorReposts(GetActorRepostsRequest) returns (GetActorRepostsResponse);
rpc GetRepostCounts(GetRepostCountsRequest) returns (GetRepostCountsResponse);

// Interaction Counts
rpc GetInteractionCounts(GetInteractionCountsRequest) returns (GetInteractionCountsResponse);
rpc GetCountsForUsers(GetCountsForUsersRequest) returns (GetCountsForUsersResponse);

// Profile
rpc GetActors(GetActorsRequest) returns (GetActorsResponse);
rpc GetDidsByHandles(GetDidsByHandlesRequest) returns (GetDidsByHandlesResponse);
Expand Down
2 changes: 1 addition & 1 deletion packages/bsky/src/api/app/bsky/feed/getRepostedBy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const skeleton = async (inputs: {
}): Promise<Skeleton> => {
const { ctx, params } = inputs
const res = await ctx.hydrator.dataplane.getRepostsBySubject({
subjectUri: params.uri,
subject: { uri: params.uri, cid: params.cid },
cursor: params.cursor,
limit: params.limit,
})
Expand Down
22 changes: 21 additions & 1 deletion packages/bsky/src/data-plane/gen/bsky_connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* eslint-disable */
// @ts-nocheck

import { GetActorFeedsRequest, GetActorFeedsResponse, GetActorFollowsActorsRequest, GetActorFollowsActorsResponse, GetActorLikesRequest, GetActorLikesResponse, GetActorListsRequest, GetActorListsResponse, GetActorMutesActorRequest, GetActorMutesActorResponse, GetActorMutesActorViaListRequest, GetActorMutesActorViaListResponse, GetActorRepostsRequest, GetActorRepostsResponse, GetActorsRequest, GetActorsResponse, GetAuthorFeedRequest, GetAuthorFeedResponse, GetBidirectionalBlockRequest, GetBidirectionalBlockResponse, GetBidirectionalBlockViaListRequest, GetBidirectionalBlockViaListResponse, GetBlobTakedownRequest, GetBlobTakedownResponse, GetBlockExistenceRequest, GetBlockExistenceResponse, GetBlocklistSubscriptionRequest, GetBlocklistSubscriptionResponse, GetBlocklistSubscriptionsRequest, GetBlocklistSubscriptionsResponse, GetBlockRecordsRequest, GetBlockRecordsResponse, GetBlocksRequest, GetBlocksResponse, GetDidsByHandlesRequest, GetDidsByHandlesResponse, GetFeedGeneratorRecordsRequest, GetFeedGeneratorRecordsResponse, GetFeedGeneratorStatusRequest, GetFeedGeneratorStatusResponse, GetFollowCountsRequest, GetFollowCountsResponse, GetFollowerCountsRequest, GetFollowerCountsResponse, GetFollowersRequest, GetFollowersResponse, GetFollowRecordsRequest, GetFollowRecordsResponse, GetFollowsRequest, GetFollowsResponse, GetFollowSuggestionsRequest, GetFollowSuggestionsResponse, GetLabelsRequest, GetLabelsResponse, GetLatestRevRequest, GetLatestRevResponse, GetLikeCountsRequest, GetLikeCountsResponse, GetLikeRecordsRequest, GetLikeRecordsResponse, GetLikesByActorAndSubjectsRequest, GetLikesByActorAndSubjectsResponse, GetLikesBySubjectRequest, GetLikesBySubjectResponse, GetListBlockRecordsRequest, GetListBlockRecordsResponse, GetListCountRequest, GetListCountResponse, GetListFeedRequest, GetListFeedResponse, GetListItemRecordsRequest, GetListItemRecordsResponse, GetListMembershipRequest, GetListMembershipResponse, GetListMembersRequest, GetListMembersResponse, GetListRecordsRequest, GetListRecordsResponse, GetMutelistSubscriptionRequest, GetMutelistSubscriptionResponse, GetMutelistSubscriptionsRequest, GetMutelistSubscriptionsResponse, GetMutesRequest, GetMutesResponse, GetNotificationSeenRequest, GetNotificationSeenResponse, GetNotificationsRequest, GetNotificationsResponse, GetPostCountsRequest, GetPostCountsResponse, GetPostRecordsRequest, GetPostRecordsResponse, GetPostReplyCountsRequest, GetPostReplyCountsResponse, GetProfileRecordsRequest, GetProfileRecordsResponse, GetRelationshipsRequest, GetRelationshipsResponse, GetRepostCountsRequest, GetRepostCountsResponse, GetRepostRecordsRequest, GetRepostRecordsResponse, GetRepostsByActorAndSubjectsRequest, GetRepostsByActorAndSubjectsResponse, GetRepostsBySubjectRequest, GetRepostsBySubjectResponse, GetSuggestedFeedsRequest, GetSuggestedFeedsResponse, GetThreadGateRecordsRequest, GetThreadGateRecordsResponse, GetThreadRequest, GetThreadResponse, GetTimelineRequest, GetTimelineResponse, GetUnreadNotificationCountRequest, GetUnreadNotificationCountResponse, MuteActorListRequest, MuteActorListResponse, MuteActorRequest, MuteActorResponse, PingRequest, PingResponse, SearchActorsRequest, SearchActorsResponse, SearchPostsRequest, SearchPostsResponse, UnmuteActorListRequest, UnmuteActorListResponse, UnmuteActorRequest, UnmuteActorResponse, UpdateNotificationSeenRequest, UpdateNotificationSeenResponse, UpdateTakedownRequest, UpdateTakedownResponse } from "./bsky_pb.ts";
import { GetActorFeedsRequest, GetActorFeedsResponse, GetActorFollowsActorsRequest, GetActorFollowsActorsResponse, GetActorLikesRequest, GetActorLikesResponse, GetActorListsRequest, GetActorListsResponse, GetActorMutesActorRequest, GetActorMutesActorResponse, GetActorMutesActorViaListRequest, GetActorMutesActorViaListResponse, GetActorRepostsRequest, GetActorRepostsResponse, GetActorsRequest, GetActorsResponse, GetAuthorFeedRequest, GetAuthorFeedResponse, GetBidirectionalBlockRequest, GetBidirectionalBlockResponse, GetBidirectionalBlockViaListRequest, GetBidirectionalBlockViaListResponse, GetBlobTakedownRequest, GetBlobTakedownResponse, GetBlockExistenceRequest, GetBlockExistenceResponse, GetBlocklistSubscriptionRequest, GetBlocklistSubscriptionResponse, GetBlocklistSubscriptionsRequest, GetBlocklistSubscriptionsResponse, GetBlockRecordsRequest, GetBlockRecordsResponse, GetBlocksRequest, GetBlocksResponse, GetCountsForUsersRequest, GetCountsForUsersResponse, GetDidsByHandlesRequest, GetDidsByHandlesResponse, GetFeedGeneratorRecordsRequest, GetFeedGeneratorRecordsResponse, GetFeedGeneratorStatusRequest, GetFeedGeneratorStatusResponse, GetFollowCountsRequest, GetFollowCountsResponse, GetFollowerCountsRequest, GetFollowerCountsResponse, GetFollowersRequest, GetFollowersResponse, GetFollowRecordsRequest, GetFollowRecordsResponse, GetFollowsRequest, GetFollowsResponse, GetFollowSuggestionsRequest, GetFollowSuggestionsResponse, GetInteractionCountsRequest, GetInteractionCountsResponse, GetLabelsRequest, GetLabelsResponse, GetLatestRevRequest, GetLatestRevResponse, GetLikeCountsRequest, GetLikeCountsResponse, GetLikeRecordsRequest, GetLikeRecordsResponse, GetLikesByActorAndSubjectsRequest, GetLikesByActorAndSubjectsResponse, GetLikesBySubjectRequest, GetLikesBySubjectResponse, GetListBlockRecordsRequest, GetListBlockRecordsResponse, GetListCountRequest, GetListCountResponse, GetListFeedRequest, GetListFeedResponse, GetListItemRecordsRequest, GetListItemRecordsResponse, GetListMembershipRequest, GetListMembershipResponse, GetListMembersRequest, GetListMembersResponse, GetListRecordsRequest, GetListRecordsResponse, GetMutelistSubscriptionRequest, GetMutelistSubscriptionResponse, GetMutelistSubscriptionsRequest, GetMutelistSubscriptionsResponse, GetMutesRequest, GetMutesResponse, GetNotificationSeenRequest, GetNotificationSeenResponse, GetNotificationsRequest, GetNotificationsResponse, GetPostCountsRequest, GetPostCountsResponse, GetPostRecordsRequest, GetPostRecordsResponse, GetPostReplyCountsRequest, GetPostReplyCountsResponse, GetProfileRecordsRequest, GetProfileRecordsResponse, GetRelationshipsRequest, GetRelationshipsResponse, GetRepostCountsRequest, GetRepostCountsResponse, GetRepostRecordsRequest, GetRepostRecordsResponse, GetRepostsByActorAndSubjectsRequest, GetRepostsByActorAndSubjectsResponse, GetRepostsBySubjectRequest, GetRepostsBySubjectResponse, GetSuggestedFeedsRequest, GetSuggestedFeedsResponse, GetThreadGateRecordsRequest, GetThreadGateRecordsResponse, GetThreadRequest, GetThreadResponse, GetTimelineRequest, GetTimelineResponse, GetUnreadNotificationCountRequest, GetUnreadNotificationCountResponse, MuteActorListRequest, MuteActorListResponse, MuteActorRequest, MuteActorResponse, PingRequest, PingResponse, SearchActorsRequest, SearchActorsResponse, SearchPostsRequest, SearchPostsResponse, UnmuteActorListRequest, UnmuteActorListResponse, UnmuteActorRequest, UnmuteActorResponse, UpdateNotificationSeenRequest, UpdateNotificationSeenResponse, UpdateTakedownRequest, UpdateTakedownResponse } from "./bsky_pb.ts";
import { MethodKind } from "@bufbuild/protobuf";

/**
Expand Down Expand Up @@ -236,6 +236,26 @@ export const Service = {
O: GetRepostCountsResponse,
kind: MethodKind.Unary,
},
/**
* Interaction Counts
*
* @generated from rpc bsky.Service.GetInteractionCounts
*/
getInteractionCounts: {
name: "GetInteractionCounts",
I: GetInteractionCountsRequest,
O: GetInteractionCountsResponse,
kind: MethodKind.Unary,
},
/**
* @generated from rpc bsky.Service.GetCountsForUsers
*/
getCountsForUsers: {
name: "GetCountsForUsers",
I: GetCountsForUsersRequest,
O: GetCountsForUsersResponse,
kind: MethodKind.Unary,
},
/**
* Profile
*
Expand Down
Loading

0 comments on commit dd6fe98

Please sign in to comment.