Samuel Newman 2676206e42
Pinned posts (#2771)
* pinned posts lexicon

* codegen

* change lexicon, different approach

* codegen 2

* dataplane db migration

* move pinned post lexicon to right place

* add pinned posts optionally to getAuthorFeed

* remove type modification

* Clarify naming, add viewer state, add tests

* return pinnedPost with profileViewDetailed

* allow pinned replies in `posts_and_author_threads`

* clearer variable naming

* annotate type of `items`

* boolean --> varchar

* reuse authorDid in viewerPinned

* simplify test

* make pinned post not top post in test

* update snapshot

* changeset

---------

Co-authored-by: Eric Bailey <git@esb.lol>
Co-authored-by: dholms <dtholmgren@gmail.com>
2024-09-26 18:26:45 -05:00

291 lines
9.3 KiB
JSON

{
"lexicon": 1,
"id": "app.bsky.feed.defs",
"defs": {
"postView": {
"type": "object",
"required": ["uri", "cid", "author", "record", "indexedAt"],
"properties": {
"uri": { "type": "string", "format": "at-uri" },
"cid": { "type": "string", "format": "cid" },
"author": {
"type": "ref",
"ref": "app.bsky.actor.defs#profileViewBasic"
},
"record": { "type": "unknown" },
"embed": {
"type": "union",
"refs": [
"app.bsky.embed.images#view",
"app.bsky.embed.video#view",
"app.bsky.embed.external#view",
"app.bsky.embed.record#view",
"app.bsky.embed.recordWithMedia#view"
]
},
"replyCount": { "type": "integer" },
"repostCount": { "type": "integer" },
"likeCount": { "type": "integer" },
"quoteCount": { "type": "integer" },
"indexedAt": { "type": "string", "format": "datetime" },
"viewer": { "type": "ref", "ref": "#viewerState" },
"labels": {
"type": "array",
"items": { "type": "ref", "ref": "com.atproto.label.defs#label" }
},
"threadgate": { "type": "ref", "ref": "#threadgateView" }
}
},
"viewerState": {
"type": "object",
"description": "Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests.",
"properties": {
"repost": { "type": "string", "format": "at-uri" },
"like": { "type": "string", "format": "at-uri" },
"threadMuted": { "type": "boolean" },
"replyDisabled": { "type": "boolean" },
"embeddingDisabled": { "type": "boolean" },
"pinned": { "type": "boolean" }
}
},
"feedViewPost": {
"type": "object",
"required": ["post"],
"properties": {
"post": { "type": "ref", "ref": "#postView" },
"reply": { "type": "ref", "ref": "#replyRef" },
"reason": { "type": "union", "refs": ["#reasonRepost", "#reasonPin"] },
"feedContext": {
"type": "string",
"description": "Context provided by feed generator that may be passed back alongside interactions.",
"maxLength": 2000
}
}
},
"replyRef": {
"type": "object",
"required": ["root", "parent"],
"properties": {
"root": {
"type": "union",
"refs": ["#postView", "#notFoundPost", "#blockedPost"]
},
"parent": {
"type": "union",
"refs": ["#postView", "#notFoundPost", "#blockedPost"]
},
"grandparentAuthor": {
"type": "ref",
"ref": "app.bsky.actor.defs#profileViewBasic",
"description": "When parent is a reply to another post, this is the author of that post."
}
}
},
"reasonRepost": {
"type": "object",
"required": ["by", "indexedAt"],
"properties": {
"by": { "type": "ref", "ref": "app.bsky.actor.defs#profileViewBasic" },
"indexedAt": { "type": "string", "format": "datetime" }
}
},
"reasonPin": {
"type": "object",
"properties": {}
},
"threadViewPost": {
"type": "object",
"required": ["post"],
"properties": {
"post": { "type": "ref", "ref": "#postView" },
"parent": {
"type": "union",
"refs": ["#threadViewPost", "#notFoundPost", "#blockedPost"]
},
"replies": {
"type": "array",
"items": {
"type": "union",
"refs": ["#threadViewPost", "#notFoundPost", "#blockedPost"]
}
}
}
},
"notFoundPost": {
"type": "object",
"required": ["uri", "notFound"],
"properties": {
"uri": { "type": "string", "format": "at-uri" },
"notFound": { "type": "boolean", "const": true }
}
},
"blockedPost": {
"type": "object",
"required": ["uri", "blocked", "author"],
"properties": {
"uri": { "type": "string", "format": "at-uri" },
"blocked": { "type": "boolean", "const": true },
"author": { "type": "ref", "ref": "#blockedAuthor" }
}
},
"blockedAuthor": {
"type": "object",
"required": ["did"],
"properties": {
"did": { "type": "string", "format": "did" },
"viewer": { "type": "ref", "ref": "app.bsky.actor.defs#viewerState" }
}
},
"generatorView": {
"type": "object",
"required": ["uri", "cid", "did", "creator", "displayName", "indexedAt"],
"properties": {
"uri": { "type": "string", "format": "at-uri" },
"cid": { "type": "string", "format": "cid" },
"did": { "type": "string", "format": "did" },
"creator": { "type": "ref", "ref": "app.bsky.actor.defs#profileView" },
"displayName": { "type": "string" },
"description": {
"type": "string",
"maxGraphemes": 300,
"maxLength": 3000
},
"descriptionFacets": {
"type": "array",
"items": { "type": "ref", "ref": "app.bsky.richtext.facet" }
},
"avatar": { "type": "string", "format": "uri" },
"likeCount": { "type": "integer", "minimum": 0 },
"acceptsInteractions": { "type": "boolean" },
"labels": {
"type": "array",
"items": { "type": "ref", "ref": "com.atproto.label.defs#label" }
},
"viewer": { "type": "ref", "ref": "#generatorViewerState" },
"indexedAt": { "type": "string", "format": "datetime" }
}
},
"generatorViewerState": {
"type": "object",
"properties": {
"like": { "type": "string", "format": "at-uri" }
}
},
"skeletonFeedPost": {
"type": "object",
"required": ["post"],
"properties": {
"post": { "type": "string", "format": "at-uri" },
"reason": {
"type": "union",
"refs": ["#skeletonReasonRepost", "#skeletonReasonPin"]
},
"feedContext": {
"type": "string",
"description": "Context that will be passed through to client and may be passed to feed generator back alongside interactions.",
"maxLength": 2000
}
}
},
"skeletonReasonRepost": {
"type": "object",
"required": ["repost"],
"properties": {
"repost": { "type": "string", "format": "at-uri" }
}
},
"skeletonReasonPin": {
"type": "object",
"properties": {}
},
"threadgateView": {
"type": "object",
"properties": {
"uri": { "type": "string", "format": "at-uri" },
"cid": { "type": "string", "format": "cid" },
"record": { "type": "unknown" },
"lists": {
"type": "array",
"items": { "type": "ref", "ref": "app.bsky.graph.defs#listViewBasic" }
}
}
},
"interaction": {
"type": "object",
"properties": {
"item": { "type": "string", "format": "at-uri" },
"event": {
"type": "string",
"knownValues": [
"app.bsky.feed.defs#requestLess",
"app.bsky.feed.defs#requestMore",
"app.bsky.feed.defs#clickthroughItem",
"app.bsky.feed.defs#clickthroughAuthor",
"app.bsky.feed.defs#clickthroughReposter",
"app.bsky.feed.defs#clickthroughEmbed",
"app.bsky.feed.defs#interactionSeen",
"app.bsky.feed.defs#interactionLike",
"app.bsky.feed.defs#interactionRepost",
"app.bsky.feed.defs#interactionReply",
"app.bsky.feed.defs#interactionQuote",
"app.bsky.feed.defs#interactionShare"
]
},
"feedContext": {
"type": "string",
"description": "Context on a feed item that was originally supplied by the feed generator on getFeedSkeleton.",
"maxLength": 2000
}
}
},
"requestLess": {
"type": "token",
"description": "Request that less content like the given feed item be shown in the feed"
},
"requestMore": {
"type": "token",
"description": "Request that more content like the given feed item be shown in the feed"
},
"clickthroughItem": {
"type": "token",
"description": "User clicked through to the feed item"
},
"clickthroughAuthor": {
"type": "token",
"description": "User clicked through to the author of the feed item"
},
"clickthroughReposter": {
"type": "token",
"description": "User clicked through to the reposter of the feed item"
},
"clickthroughEmbed": {
"type": "token",
"description": "User clicked through to the embedded content of the feed item"
},
"interactionSeen": {
"type": "token",
"description": "Feed item was seen by user"
},
"interactionLike": {
"type": "token",
"description": "User liked the feed item"
},
"interactionRepost": {
"type": "token",
"description": "User reposted the feed item"
},
"interactionReply": {
"type": "token",
"description": "User replied to the feed item"
},
"interactionQuote": {
"type": "token",
"description": "User quoted the feed item"
},
"interactionShare": {
"type": "token",
"description": "User shared the feed item"
}
}
}