# support.supper.poll.getVotes

> Published by [supper.support](https://lexicon.garden/identity/did:plc:mcsqdltevtjpu26xthzzmm2l)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:mcsqdltevtjpu26xthzzmm2l/support.supper.poll.getVotes)
- [Documentation](https://lexicon.garden/lexicon/did:plc:mcsqdltevtjpu26xthzzmm2l/support.supper.poll.getVotes/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:mcsqdltevtjpu26xthzzmm2l/support.supper.poll.getVotes/examples)

## Definitions

### `support.supper.poll.getVotes`

**Type**: `query`

Read public vote totals for an exact Supper poll URI and CID. No authentication is required. Optional viewer is a public actor DID, not authentication, and adds that actor latest valid vote. Only support.supper.poll.vote records on support.supper.poll.poll are included. Member-only polls and votes are never exposed.

#### Parameters

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `viewer` | `string` (did) | No | Optional public actor DID whose currently selected vote is requested. |
| `subject` | `string` (at-uri) | Yes | Public support.supper.poll.poll AT URI. |
| `subjectCid` | `string` (cid) | Yes | CID of the exact poll revision whose choices are being tallied. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `total` | `integer` | Yes | Number of distinct actors with a valid surviving vote on this exact revision. |
| `counts` | `array` | Yes | One count per poll option in its original order, including zero-vote options. Counts sum to total. |
| `subject` | `string` (at-uri) | Yes | Exact public poll URI requested. |
| `subjectCid` | `string` (cid) | Yes | Exact public poll revision requested. |
| `viewerVote` | `ref` → `#viewerVote` | No | Requested actor latest valid surviving vote, omitted if none exists. |

#### Errors

- **InvalidRequest**: The subject, revision or viewer is invalid.
- **NotFound**: The exact public poll revision is unavailable.

### `support.supper.poll.getVotes#viewerVote`

**Type**: `object`

Public record identity of the requested actor latest valid vote.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `cid` | `string` (cid) | Yes | CID of that vote record. |
| `uri` | `string` (at-uri) | Yes | AT URI of the actor-owned support.supper.poll.vote record. |
| `option` | `integer` | Yes | Zero-based selected option. |

## Raw Schema

```json
{
  "id": "support.supper.poll.getVotes",
  "defs": {
    "main": {
      "type": "query",
      "errors": [
        {
          "name": "InvalidRequest",
          "description": "The subject, revision or viewer is invalid."
        },
        {
          "name": "NotFound",
          "description": "The exact public poll revision is unavailable."
        }
      ],
      "output": {
        "schema": {
          "type": "object",
          "required": [
            "subject",
            "subjectCid",
            "counts",
            "total"
          ],
          "properties": {
            "total": {
              "type": "integer",
              "minimum": 0,
              "description": "Number of distinct actors with a valid surviving vote on this exact revision."
            },
            "counts": {
              "type": "array",
              "items": {
                "type": "integer",
                "minimum": 0
              },
              "maxLength": 10,
              "minLength": 2,
              "description": "One count per poll option in its original order, including zero-vote options. Counts sum to total."
            },
            "subject": {
              "type": "string",
              "format": "at-uri",
              "description": "Exact public poll URI requested."
            },
            "subjectCid": {
              "type": "string",
              "format": "cid",
              "description": "Exact public poll revision requested."
            },
            "viewerVote": {
              "ref": "#viewerVote",
              "type": "ref",
              "description": "Requested actor latest valid surviving vote, omitted if none exists."
            }
          }
        },
        "encoding": "application/json"
      },
      "parameters": {
        "type": "params",
        "required": [
          "subject",
          "subjectCid"
        ],
        "properties": {
          "viewer": {
            "type": "string",
            "format": "did",
            "description": "Optional public actor DID whose currently selected vote is requested."
          },
          "subject": {
            "type": "string",
            "format": "at-uri",
            "description": "Public support.supper.poll.poll AT URI."
          },
          "subjectCid": {
            "type": "string",
            "format": "cid",
            "description": "CID of the exact poll revision whose choices are being tallied."
          }
        }
      },
      "description": "Read public vote totals for an exact Supper poll URI and CID. No authentication is required. Optional viewer is a public actor DID, not authentication, and adds that actor latest valid vote. Only support.supper.poll.vote records on support.supper.poll.poll are included. Member-only polls and votes are never exposed."
    },
    "viewerVote": {
      "type": "object",
      "required": [
        "uri",
        "cid",
        "option"
      ],
      "properties": {
        "cid": {
          "type": "string",
          "format": "cid",
          "description": "CID of that vote record."
        },
        "uri": {
          "type": "string",
          "format": "at-uri",
          "description": "AT URI of the actor-owned support.supper.poll.vote record."
        },
        "option": {
          "type": "integer",
          "maximum": 9,
          "minimum": 0,
          "description": "Zero-based selected option."
        }
      },
      "description": "Public record identity of the requested actor latest valid vote."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
