Skip to content

Commit

Permalink
feed generator content mode (#3389)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelbsky authored Jan 17, 2025
1 parent 9c01281 commit cbf1706
Show file tree
Hide file tree
Showing 22 changed files with 320 additions and 16 deletions.
6 changes: 6 additions & 0 deletions .changeset/dull-zebras-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@atproto/bsky": patch
"@atproto/api": patch
---

add feedgen content mode lexicon spec
15 changes: 15 additions & 0 deletions lexicons/app/bsky/feed/defs.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@
"items": { "type": "ref", "ref": "com.atproto.label.defs#label" }
},
"viewer": { "type": "ref", "ref": "#generatorViewerState" },
"contentMode": {
"type": "string",
"knownValues": [
"app.bsky.feed.defs#contentModeUnspecified",
"app.bsky.feed.defs#contentModeVideo"
]
},
"indexedAt": { "type": "string", "format": "datetime" }
}
},
Expand Down Expand Up @@ -262,6 +269,14 @@
"type": "token",
"description": "User clicked through to the embedded content of the feed item"
},
"contentModeUnspecified": {
"type": "token",
"description": "Declares the feed generator returns any types of posts."
},
"contentModeVideo": {
"type": "token",
"description": "Declares the feed generator returns posts containing app.bsky.embed.video embeds."
},
"interactionSeen": {
"type": "token",
"description": "Feed item was seen by user"
Expand Down
7 changes: 7 additions & 0 deletions lexicons/app/bsky/feed/generator.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@
"description": "Self-label values",
"refs": ["com.atproto.label.defs#selfLabels"]
},
"contentMode": {
"type": "string",
"knownValues": [
"app.bsky.feed.defs#contentModeUnspecified",
"app.bsky.feed.defs#contentModeVideo"
]
},
"createdAt": { "type": "string", "format": "datetime" }
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/api/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ export const APP_BSKY_FEED = {
DefsClickthroughAuthor: 'app.bsky.feed.defs#clickthroughAuthor',
DefsClickthroughReposter: 'app.bsky.feed.defs#clickthroughReposter',
DefsClickthroughEmbed: 'app.bsky.feed.defs#clickthroughEmbed',
DefsContentModeUnspecified: 'app.bsky.feed.defs#contentModeUnspecified',
DefsContentModeVideo: 'app.bsky.feed.defs#contentModeVideo',
DefsInteractionSeen: 'app.bsky.feed.defs#interactionSeen',
DefsInteractionLike: 'app.bsky.feed.defs#interactionLike',
DefsInteractionRepost: 'app.bsky.feed.defs#interactionRepost',
Expand Down
23 changes: 23 additions & 0 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5778,6 +5778,13 @@ export const schemaDict = {
type: 'ref',
ref: 'lex:app.bsky.feed.defs#generatorViewerState',
},
contentMode: {
type: 'string',
knownValues: [
'app.bsky.feed.defs#contentModeUnspecified',
'app.bsky.feed.defs#contentModeVideo',
],
},
indexedAt: {
type: 'string',
format: 'datetime',
Expand Down Expand Up @@ -5912,6 +5919,15 @@ export const schemaDict = {
description:
'User clicked through to the embedded content of the feed item',
},
contentModeUnspecified: {
type: 'token',
description: 'Declares the feed generator returns any types of posts.',
},
contentModeVideo: {
type: 'token',
description:
'Declares the feed generator returns posts containing app.bsky.embed.video embeds.',
},
interactionSeen: {
type: 'token',
description: 'Feed item was seen by user',
Expand Down Expand Up @@ -6043,6 +6059,13 @@ export const schemaDict = {
description: 'Self-label values',
refs: ['lex:com.atproto.label.defs#selfLabels'],
},
contentMode: {
type: 'string',
knownValues: [
'app.bsky.feed.defs#contentModeUnspecified',
'app.bsky.feed.defs#contentModeVideo',
],
},
createdAt: {
type: 'string',
format: 'datetime',
Expand Down
9 changes: 9 additions & 0 deletions packages/api/src/client/types/app/bsky/feed/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ export interface GeneratorView {
acceptsInteractions?: boolean
labels?: ComAtprotoLabelDefs.Label[]
viewer?: GeneratorViewerState
contentMode?:
| 'app.bsky.feed.defs#contentModeUnspecified'
| 'app.bsky.feed.defs#contentModeVideo'
| (string & {})
indexedAt: string
[k: string]: unknown
}
Expand Down Expand Up @@ -401,6 +405,11 @@ export const CLICKTHROUGHAUTHOR = 'app.bsky.feed.defs#clickthroughAuthor'
export const CLICKTHROUGHREPOSTER = 'app.bsky.feed.defs#clickthroughReposter'
/** User clicked through to the embedded content of the feed item */
export const CLICKTHROUGHEMBED = 'app.bsky.feed.defs#clickthroughEmbed'
/** Declares the feed generator returns any types of posts. */
export const CONTENTMODEUNSPECIFIED =
'app.bsky.feed.defs#contentModeUnspecified'
/** Declares the feed generator returns posts containing app.bsky.embed.video embeds. */
export const CONTENTMODEVIDEO = 'app.bsky.feed.defs#contentModeVideo'
/** Feed item was seen by user */
export const INTERACTIONSEEN = 'app.bsky.feed.defs#interactionSeen'
/** User liked the feed item */
Expand Down
4 changes: 4 additions & 0 deletions packages/api/src/client/types/app/bsky/feed/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export interface Record {
labels?:
| ComAtprotoLabelDefs.SelfLabels
| { $type: string; [k: string]: unknown }
contentMode?:
| 'app.bsky.feed.defs#contentModeUnspecified'
| 'app.bsky.feed.defs#contentModeVideo'
| (string & {})
createdAt: string
[k: string]: unknown
}
Expand Down
2 changes: 2 additions & 0 deletions packages/bsky/src/lexicon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ export const APP_BSKY_FEED = {
DefsClickthroughAuthor: 'app.bsky.feed.defs#clickthroughAuthor',
DefsClickthroughReposter: 'app.bsky.feed.defs#clickthroughReposter',
DefsClickthroughEmbed: 'app.bsky.feed.defs#clickthroughEmbed',
DefsContentModeUnspecified: 'app.bsky.feed.defs#contentModeUnspecified',
DefsContentModeVideo: 'app.bsky.feed.defs#contentModeVideo',
DefsInteractionSeen: 'app.bsky.feed.defs#interactionSeen',
DefsInteractionLike: 'app.bsky.feed.defs#interactionLike',
DefsInteractionRepost: 'app.bsky.feed.defs#interactionRepost',
Expand Down
23 changes: 23 additions & 0 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5778,6 +5778,13 @@ export const schemaDict = {
type: 'ref',
ref: 'lex:app.bsky.feed.defs#generatorViewerState',
},
contentMode: {
type: 'string',
knownValues: [
'app.bsky.feed.defs#contentModeUnspecified',
'app.bsky.feed.defs#contentModeVideo',
],
},
indexedAt: {
type: 'string',
format: 'datetime',
Expand Down Expand Up @@ -5912,6 +5919,15 @@ export const schemaDict = {
description:
'User clicked through to the embedded content of the feed item',
},
contentModeUnspecified: {
type: 'token',
description: 'Declares the feed generator returns any types of posts.',
},
contentModeVideo: {
type: 'token',
description:
'Declares the feed generator returns posts containing app.bsky.embed.video embeds.',
},
interactionSeen: {
type: 'token',
description: 'Feed item was seen by user',
Expand Down Expand Up @@ -6043,6 +6059,13 @@ export const schemaDict = {
description: 'Self-label values',
refs: ['lex:com.atproto.label.defs#selfLabels'],
},
contentMode: {
type: 'string',
knownValues: [
'app.bsky.feed.defs#contentModeUnspecified',
'app.bsky.feed.defs#contentModeVideo',
],
},
createdAt: {
type: 'string',
format: 'datetime',
Expand Down
9 changes: 9 additions & 0 deletions packages/bsky/src/lexicon/types/app/bsky/feed/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ export interface GeneratorView {
acceptsInteractions?: boolean
labels?: ComAtprotoLabelDefs.Label[]
viewer?: GeneratorViewerState
contentMode?:
| 'app.bsky.feed.defs#contentModeUnspecified'
| 'app.bsky.feed.defs#contentModeVideo'
| (string & {})
indexedAt: string
[k: string]: unknown
}
Expand Down Expand Up @@ -401,6 +405,11 @@ export const CLICKTHROUGHAUTHOR = 'app.bsky.feed.defs#clickthroughAuthor'
export const CLICKTHROUGHREPOSTER = 'app.bsky.feed.defs#clickthroughReposter'
/** User clicked through to the embedded content of the feed item */
export const CLICKTHROUGHEMBED = 'app.bsky.feed.defs#clickthroughEmbed'
/** Declares the feed generator returns any types of posts. */
export const CONTENTMODEUNSPECIFIED =
'app.bsky.feed.defs#contentModeUnspecified'
/** Declares the feed generator returns posts containing app.bsky.embed.video embeds. */
export const CONTENTMODEVIDEO = 'app.bsky.feed.defs#contentModeVideo'
/** Feed item was seen by user */
export const INTERACTIONSEEN = 'app.bsky.feed.defs#interactionSeen'
/** User liked the feed item */
Expand Down
4 changes: 4 additions & 0 deletions packages/bsky/src/lexicon/types/app/bsky/feed/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export interface Record {
labels?:
| ComAtprotoLabelDefs.SelfLabels
| { $type: string; [k: string]: unknown }
contentMode?:
| 'app.bsky.feed.defs#contentModeUnspecified'
| 'app.bsky.feed.defs#contentModeVideo'
| (string & {})
createdAt: string
[k: string]: unknown
}
Expand Down
1 change: 1 addition & 0 deletions packages/bsky/src/views/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ export class Views {
like: viewer.like,
}
: undefined,
contentMode: feedgen.record.contentMode,
indexedAt: this.indexedAt(feedgen).toISOString(),
}
}
Expand Down
Loading

0 comments on commit cbf1706

Please sign in to comment.