Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lexicon: Poll, Poll Answer #3298

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
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
75 changes: 75 additions & 0 deletions lexicons/app/bsky/embed/poll.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"lexicon": 1,
"id": "app.bsky.embed.poll",
"defs": {
"main": {
"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": 1,
"maxLength": 4
}
}
},
"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": 1,
"maxLength": 4
}
}
},
"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
}
}
}
}
}
8 changes: 7 additions & 1 deletion lexicons/app/bsky/feed/defs.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@
"app.bsky.embed.video#view",
"app.bsky.embed.external#view",
"app.bsky.embed.record#view",
"app.bsky.embed.recordWithMedia#view"
"app.bsky.embed.recordWithMedia#view",
"app.bsky.embed.poll#view"
]
},
"replyCount": { "type": "integer" },
"repostCount": { "type": "integer" },
"likeCount": { "type": "integer" },
"quoteCount": { "type": "integer" },
"pollAnswerCount": { "type": "integer" },
"pollAnswers": {
"type": "array",
"items": { "type": "integer" }
},
"indexedAt": { "type": "string", "format": "datetime" },
"viewer": { "type": "ref", "ref": "#viewerState" },
"labels": {
Expand Down
83 changes: 83 additions & 0 deletions lexicons/app/bsky/feed/getPollAnswers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"lexicon": 1,
"id": "app.bsky.feed.getPollAnswers",
"defs": {
"main": {
"type": "query",
"description": "Get poll answers for a given poll which reference a post.",
"parameters": {
"type": "params",
"required": ["uri"],
"properties": {
"uri": {
"type": "string",
"format": "at-uri",
"description": "AT-URI of the subject (eg, a post record)."
},
"cid": {
"type": "string",
"format": "cid",
"description": "CID of the subject record (aka, specific version of record), to filter poll answers."
},
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 50
},
"cursor": {
"type": "string"
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["uri"],
"properties": {
"uri": {
"type": "string",
"format": "at-uri"
},
"cid": {
"type": "string",
"format": "cid"
},
"cursor": {
"type": "string"
},
"pollAnswers": {
"type": "array",
"items": {
"type": "ref",
"ref": "#pollAnswer"
}
}
}
}
}
},
"pollAnswer": {
"type": "object",
"required": ["indexedAt", "createdAt", "actor", "answer"],
"properties": {
"indexedAt": {
"type": "string",
"format": "datetime"
},
"createdAt": {
"type": "string",
"format": "datetime"
},
"actor": {
"type": "ref",
"ref": "app.bsky.actor.defs#profileView"
},
"answer": {
"type": "integer"
}
}
}
}
}
25 changes: 25 additions & 0 deletions lexicons/app/bsky/feed/pollAnswer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"lexicon": 1,
"id": "app.bsky.feed.pollAnswer",
"defs": {
"main": {
"type": "record",
"description": "Record declaring a user's answer to a poll.",
"key": "tid",
"record": {
"type": "object",
"required": ["subject", "answer", "createdAt"],
"properties": {
"subject": { "type": "ref", "ref": "com.atproto.repo.strongRef" },
"createdAt": { "type": "string", "format": "datetime" },
"answer": {
"type": "integer",
"minimum": 1,
"maximum": 15,
"description": "The index of the option selected by the user."
}
}
}
}
}
}