From 3ab9e59961bfce1cdc013927bc6169233ff11620 Mon Sep 17 00:00:00 2001 From: Michael-Andrew Keays Date: Sat, 14 Dec 2024 22:20:36 -0500 Subject: [PATCH 1/8] define poll and pollAnswer lexicons --- lexicons/app/bsky/embed/poll.json | 29 ++++++++++++++++++++++++++ lexicons/app/bsky/feed/pollAnswer.json | 25 ++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 lexicons/app/bsky/embed/poll.json create mode 100644 lexicons/app/bsky/feed/pollAnswer.json diff --git a/lexicons/app/bsky/embed/poll.json b/lexicons/app/bsky/embed/poll.json new file mode 100644 index 00000000000..754978c3120 --- /dev/null +++ b/lexicons/app/bsky/embed/poll.json @@ -0,0 +1,29 @@ +{ + "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": 2, + "maxLength": 4 + } + } + } + } +} diff --git a/lexicons/app/bsky/feed/pollAnswer.json b/lexicons/app/bsky/feed/pollAnswer.json new file mode 100644 index 00000000000..bb8a5f6c001 --- /dev/null +++ b/lexicons/app/bsky/feed/pollAnswer.json @@ -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": 0, + "maximum": 3, + "description": "The index of the option selected by the user." + } + } + } + } + } +} From f5a65ae98b16702b55c1bfb15ef1473411b38910 Mon Sep 17 00:00:00 2001 From: Michael-Andrew Keays Date: Sun, 15 Dec 2024 01:08:59 -0500 Subject: [PATCH 2/8] lexicon: Add poll info to posts --- lexicons/app/bsky/embed/poll.json | 23 +++++++++++++++++++++++ lexicons/app/bsky/feed/defs.json | 8 +++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/lexicons/app/bsky/embed/poll.json b/lexicons/app/bsky/embed/poll.json index 754978c3120..1030e95c117 100644 --- a/lexicons/app/bsky/embed/poll.json +++ b/lexicons/app/bsky/embed/poll.json @@ -24,6 +24,29 @@ "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 + } + } } } } diff --git a/lexicons/app/bsky/feed/defs.json b/lexicons/app/bsky/feed/defs.json index 341f7fbd02b..6b727120b9f 100644 --- a/lexicons/app/bsky/feed/defs.json +++ b/lexicons/app/bsky/feed/defs.json @@ -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": { From 054029f7d4006e40fa96a89f718c5a023f2fd961 Mon Sep 17 00:00:00 2001 From: Michael-Andrew Keays <25709557+keaysma@users.noreply.github.com> Date: Mon, 16 Dec 2024 20:56:26 -0500 Subject: [PATCH 3/8] Update lexicons/app/bsky/embed/poll.json Co-authored-by: Tamme Schichler --- lexicons/app/bsky/embed/poll.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lexicons/app/bsky/embed/poll.json b/lexicons/app/bsky/embed/poll.json index 1030e95c117..e8b8b239082 100644 --- a/lexicons/app/bsky/embed/poll.json +++ b/lexicons/app/bsky/embed/poll.json @@ -20,7 +20,7 @@ "maxGraphemes": 300, "description": "The options available for the poll." }, - "minLength": 2, + "minLength": 1, "maxLength": 4 } } From 35994dbde62290b8e7c3cc4ea72efe3c2d69b269 Mon Sep 17 00:00:00 2001 From: Michael-Andrew Keays <25709557+keaysma@users.noreply.github.com> Date: Mon, 16 Dec 2024 20:56:51 -0500 Subject: [PATCH 4/8] Update lexicons/app/bsky/embed/poll.json Co-authored-by: Tamme Schichler --- lexicons/app/bsky/embed/poll.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lexicons/app/bsky/embed/poll.json b/lexicons/app/bsky/embed/poll.json index e8b8b239082..9b6a5e5262a 100644 --- a/lexicons/app/bsky/embed/poll.json +++ b/lexicons/app/bsky/embed/poll.json @@ -43,7 +43,7 @@ "maxGraphemes": 300, "description": "The options available for the poll." }, - "minLength": 2, + "minLength": 1, "maxLength": 4 } } From 7a4afbec2cc6b939c58c33ededc96da609e87398 Mon Sep 17 00:00:00 2001 From: Michael-Andrew Keays Date: Mon, 23 Dec 2024 12:15:51 -0500 Subject: [PATCH 5/8] pollAnswer lexicon: Fix answer value min/max --- lexicons/app/bsky/feed/pollAnswer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lexicons/app/bsky/feed/pollAnswer.json b/lexicons/app/bsky/feed/pollAnswer.json index bb8a5f6c001..9e434da7cfc 100644 --- a/lexicons/app/bsky/feed/pollAnswer.json +++ b/lexicons/app/bsky/feed/pollAnswer.json @@ -14,8 +14,8 @@ "createdAt": { "type": "string", "format": "datetime" }, "answer": { "type": "integer", - "minimum": 0, - "maximum": 3, + "minimum": 1, + "maximum": 15, "description": "The index of the option selected by the user." } } From 3025274672e477fafdcfde95dc548128419341ec Mon Sep 17 00:00:00 2001 From: Michael-Andrew Keays Date: Sun, 15 Dec 2024 01:08:59 -0500 Subject: [PATCH 6/8] lexicon: Add poll info to posts --- lexicons/app/bsky/embed/poll.json | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lexicons/app/bsky/embed/poll.json b/lexicons/app/bsky/embed/poll.json index 9b6a5e5262a..b05ec7cca80 100644 --- a/lexicons/app/bsky/embed/poll.json +++ b/lexicons/app/bsky/embed/poll.json @@ -47,6 +47,29 @@ "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 + } + } } } } From be6662f8a965e15ffc9039736604868cbef726c0 Mon Sep 17 00:00:00 2001 From: Michael-Andrew Keays Date: Sun, 15 Dec 2024 00:46:38 -0500 Subject: [PATCH 7/8] getPollAnswers lexicon --- lexicons/app/bsky/feed/getPollAnswers.json | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 lexicons/app/bsky/feed/getPollAnswers.json diff --git a/lexicons/app/bsky/feed/getPollAnswers.json b/lexicons/app/bsky/feed/getPollAnswers.json new file mode 100644 index 00000000000..a64f3cbb69f --- /dev/null +++ b/lexicons/app/bsky/feed/getPollAnswers.json @@ -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 likes." + }, + "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" + } + } + } + } +} From 521e4a610e0f9c93bdfc50bf02bb02a2a65ff679 Mon Sep 17 00:00:00 2001 From: Michael-Andrew Keays <25709557+keaysma@users.noreply.github.com> Date: Mon, 16 Dec 2024 21:24:00 -0500 Subject: [PATCH 8/8] Update lexicons/app/bsky/feed/getPollAnswers.json Co-authored-by: Tamme Schichler --- lexicons/app/bsky/feed/getPollAnswers.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lexicons/app/bsky/feed/getPollAnswers.json b/lexicons/app/bsky/feed/getPollAnswers.json index a64f3cbb69f..6ba6afcc06b 100644 --- a/lexicons/app/bsky/feed/getPollAnswers.json +++ b/lexicons/app/bsky/feed/getPollAnswers.json @@ -17,7 +17,7 @@ "cid": { "type": "string", "format": "cid", - "description": "CID of the subject record (aka, specific version of record), to filter likes." + "description": "CID of the subject record (aka, specific version of record), to filter poll answers." }, "limit": { "type": "integer",