Skip to content

Commit

Permalink
codegen: Add poll info to posts
Browse files Browse the repository at this point in the history
  • Loading branch information
keaysma committed Dec 15, 2024
1 parent 70552ed commit d99fb68
Show file tree
Hide file tree
Showing 12 changed files with 216 additions and 0 deletions.
33 changes: 33 additions & 0 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5210,6 +5210,29 @@ export const schemaDict = {
},
},
},
view: {
type: 'object',
required: ['question', 'options'],
properties: {
question: {
type: 'string',
maxLength: 3000,
maxGraphemes: 300,
description: 'The question being asked.',
},
options: {
type: 'array',
items: {
type: 'string',
maxLength: 3000,
maxGraphemes: 300,
description: 'The options available for the poll.',
},
minLength: 2,
maxLength: 4,
},
},
},
},
},
AppBskyEmbedRecord: {
Expand Down Expand Up @@ -5507,6 +5530,7 @@ export const schemaDict = {
'lex:app.bsky.embed.external#view',
'lex:app.bsky.embed.record#view',
'lex:app.bsky.embed.recordWithMedia#view',
'lex:app.bsky.embed.poll#view',
],
},
replyCount: {
Expand All @@ -5521,6 +5545,15 @@ export const schemaDict = {
quoteCount: {
type: 'integer',
},
pollAnswerCount: {
type: 'integer',
},
pollAnswers: {
type: 'array',
items: {
type: 'integer',
},
},
indexedAt: {
type: 'string',
format: 'datetime',
Expand Down
17 changes: 17 additions & 0 deletions packages/api/src/client/types/app/bsky/embed/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,20 @@ export function isMain(v: unknown): v is Main {
export function validateMain(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.embed.poll#main', v)
}

export interface View {
/** The question being asked. */
question: string
options: string[]
[k: string]: unknown
}

export function isView(v: unknown): v is View {
return (
isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.embed.poll#view'
)
}

export function validateView(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.embed.poll#view', v)
}
4 changes: 4 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 @@ -11,6 +11,7 @@ import * as AppBskyEmbedVideo from '../embed/video'
import * as AppBskyEmbedExternal from '../embed/external'
import * as AppBskyEmbedRecord from '../embed/record'
import * as AppBskyEmbedRecordWithMedia from '../embed/recordWithMedia'
import * as AppBskyEmbedPoll from '../embed/poll'
import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
import * as AppBskyRichtextFacet from '../richtext/facet'
import * as AppBskyGraphDefs from '../graph/defs'
Expand All @@ -26,11 +27,14 @@ export interface PostView {
| AppBskyEmbedExternal.View
| AppBskyEmbedRecord.View
| AppBskyEmbedRecordWithMedia.View
| AppBskyEmbedPoll.View
| { $type: string; [k: string]: unknown }
replyCount?: number
repostCount?: number
likeCount?: number
quoteCount?: number
pollAnswerCount?: number
pollAnswers?: number[]
indexedAt: string
viewer?: ViewerState
labels?: ComAtprotoLabelDefs.Label[]
Expand Down
33 changes: 33 additions & 0 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5210,6 +5210,29 @@ export const schemaDict = {
},
},
},
view: {
type: 'object',
required: ['question', 'options'],
properties: {
question: {
type: 'string',
maxLength: 3000,
maxGraphemes: 300,
description: 'The question being asked.',
},
options: {
type: 'array',
items: {
type: 'string',
maxLength: 3000,
maxGraphemes: 300,
description: 'The options available for the poll.',
},
minLength: 2,
maxLength: 4,
},
},
},
},
},
AppBskyEmbedRecord: {
Expand Down Expand Up @@ -5507,6 +5530,7 @@ export const schemaDict = {
'lex:app.bsky.embed.external#view',
'lex:app.bsky.embed.record#view',
'lex:app.bsky.embed.recordWithMedia#view',
'lex:app.bsky.embed.poll#view',
],
},
replyCount: {
Expand All @@ -5521,6 +5545,15 @@ export const schemaDict = {
quoteCount: {
type: 'integer',
},
pollAnswerCount: {
type: 'integer',
},
pollAnswers: {
type: 'array',
items: {
type: 'integer',
},
},
indexedAt: {
type: 'string',
format: 'datetime',
Expand Down
17 changes: 17 additions & 0 deletions packages/bsky/src/lexicon/types/app/bsky/embed/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,20 @@ export function isMain(v: unknown): v is Main {
export function validateMain(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.embed.poll#main', v)
}

export interface View {
/** The question being asked. */
question: string
options: string[]
[k: string]: unknown
}

export function isView(v: unknown): v is View {
return (
isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.embed.poll#view'
)
}

export function validateView(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.embed.poll#view', v)
}
4 changes: 4 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 @@ -11,6 +11,7 @@ import * as AppBskyEmbedVideo from '../embed/video'
import * as AppBskyEmbedExternal from '../embed/external'
import * as AppBskyEmbedRecord from '../embed/record'
import * as AppBskyEmbedRecordWithMedia from '../embed/recordWithMedia'
import * as AppBskyEmbedPoll from '../embed/poll'
import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
import * as AppBskyRichtextFacet from '../richtext/facet'
import * as AppBskyGraphDefs from '../graph/defs'
Expand All @@ -26,11 +27,14 @@ export interface PostView {
| AppBskyEmbedExternal.View
| AppBskyEmbedRecord.View
| AppBskyEmbedRecordWithMedia.View
| AppBskyEmbedPoll.View
| { $type: string; [k: string]: unknown }
replyCount?: number
repostCount?: number
likeCount?: number
quoteCount?: number
pollAnswerCount?: number
pollAnswers?: number[]
indexedAt: string
viewer?: ViewerState
labels?: ComAtprotoLabelDefs.Label[]
Expand Down
33 changes: 33 additions & 0 deletions packages/ozone/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5210,6 +5210,29 @@ export const schemaDict = {
},
},
},
view: {
type: 'object',
required: ['question', 'options'],
properties: {
question: {
type: 'string',
maxLength: 3000,
maxGraphemes: 300,
description: 'The question being asked.',
},
options: {
type: 'array',
items: {
type: 'string',
maxLength: 3000,
maxGraphemes: 300,
description: 'The options available for the poll.',
},
minLength: 2,
maxLength: 4,
},
},
},
},
},
AppBskyEmbedRecord: {
Expand Down Expand Up @@ -5507,6 +5530,7 @@ export const schemaDict = {
'lex:app.bsky.embed.external#view',
'lex:app.bsky.embed.record#view',
'lex:app.bsky.embed.recordWithMedia#view',
'lex:app.bsky.embed.poll#view',
],
},
replyCount: {
Expand All @@ -5521,6 +5545,15 @@ export const schemaDict = {
quoteCount: {
type: 'integer',
},
pollAnswerCount: {
type: 'integer',
},
pollAnswers: {
type: 'array',
items: {
type: 'integer',
},
},
indexedAt: {
type: 'string',
format: 'datetime',
Expand Down
17 changes: 17 additions & 0 deletions packages/ozone/src/lexicon/types/app/bsky/embed/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,20 @@ export function isMain(v: unknown): v is Main {
export function validateMain(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.embed.poll#main', v)
}

export interface View {
/** The question being asked. */
question: string
options: string[]
[k: string]: unknown
}

export function isView(v: unknown): v is View {
return (
isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.embed.poll#view'
)
}

export function validateView(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.embed.poll#view', v)
}
4 changes: 4 additions & 0 deletions packages/ozone/src/lexicon/types/app/bsky/feed/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as AppBskyEmbedVideo from '../embed/video'
import * as AppBskyEmbedExternal from '../embed/external'
import * as AppBskyEmbedRecord from '../embed/record'
import * as AppBskyEmbedRecordWithMedia from '../embed/recordWithMedia'
import * as AppBskyEmbedPoll from '../embed/poll'
import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
import * as AppBskyRichtextFacet from '../richtext/facet'
import * as AppBskyGraphDefs from '../graph/defs'
Expand All @@ -26,11 +27,14 @@ export interface PostView {
| AppBskyEmbedExternal.View
| AppBskyEmbedRecord.View
| AppBskyEmbedRecordWithMedia.View
| AppBskyEmbedPoll.View
| { $type: string; [k: string]: unknown }
replyCount?: number
repostCount?: number
likeCount?: number
quoteCount?: number
pollAnswerCount?: number
pollAnswers?: number[]
indexedAt: string
viewer?: ViewerState
labels?: ComAtprotoLabelDefs.Label[]
Expand Down
33 changes: 33 additions & 0 deletions packages/pds/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5210,6 +5210,29 @@ export const schemaDict = {
},
},
},
view: {
type: 'object',
required: ['question', 'options'],
properties: {
question: {
type: 'string',
maxLength: 3000,
maxGraphemes: 300,
description: 'The question being asked.',
},
options: {
type: 'array',
items: {
type: 'string',
maxLength: 3000,
maxGraphemes: 300,
description: 'The options available for the poll.',
},
minLength: 2,
maxLength: 4,
},
},
},
},
},
AppBskyEmbedRecord: {
Expand Down Expand Up @@ -5507,6 +5530,7 @@ export const schemaDict = {
'lex:app.bsky.embed.external#view',
'lex:app.bsky.embed.record#view',
'lex:app.bsky.embed.recordWithMedia#view',
'lex:app.bsky.embed.poll#view',
],
},
replyCount: {
Expand All @@ -5521,6 +5545,15 @@ export const schemaDict = {
quoteCount: {
type: 'integer',
},
pollAnswerCount: {
type: 'integer',
},
pollAnswers: {
type: 'array',
items: {
type: 'integer',
},
},
indexedAt: {
type: 'string',
format: 'datetime',
Expand Down
17 changes: 17 additions & 0 deletions packages/pds/src/lexicon/types/app/bsky/embed/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,20 @@ export function isMain(v: unknown): v is Main {
export function validateMain(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.embed.poll#main', v)
}

export interface View {
/** The question being asked. */
question: string
options: string[]
[k: string]: unknown
}

export function isView(v: unknown): v is View {
return (
isObj(v) && hasProp(v, '$type') && v.$type === 'app.bsky.embed.poll#view'
)
}

export function validateView(v: unknown): ValidationResult {
return lexicons.validate('app.bsky.embed.poll#view', v)
}
4 changes: 4 additions & 0 deletions packages/pds/src/lexicon/types/app/bsky/feed/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as AppBskyEmbedVideo from '../embed/video'
import * as AppBskyEmbedExternal from '../embed/external'
import * as AppBskyEmbedRecord from '../embed/record'
import * as AppBskyEmbedRecordWithMedia from '../embed/recordWithMedia'
import * as AppBskyEmbedPoll from '../embed/poll'
import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs'
import * as AppBskyRichtextFacet from '../richtext/facet'
import * as AppBskyGraphDefs from '../graph/defs'
Expand All @@ -26,11 +27,14 @@ export interface PostView {
| AppBskyEmbedExternal.View
| AppBskyEmbedRecord.View
| AppBskyEmbedRecordWithMedia.View
| AppBskyEmbedPoll.View
| { $type: string; [k: string]: unknown }
replyCount?: number
repostCount?: number
likeCount?: number
quoteCount?: number
pollAnswerCount?: number
pollAnswers?: number[]
indexedAt: string
viewer?: ViewerState
labels?: ComAtprotoLabelDefs.Label[]
Expand Down

0 comments on commit d99fb68

Please sign in to comment.