aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/api_spec/schemas/poll.ex
blob: 0474b550b8c2962633fb64b70ccc21a8f02c8ed2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Pleroma: A lightweight social networking server
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only

defmodule Pleroma.Web.ApiSpec.Schemas.Poll do
  alias OpenApiSpex.Schema
  alias Pleroma.Web.ApiSpec.Schemas.Emoji
  alias Pleroma.Web.ApiSpec.Schemas.FlakeID

  require OpenApiSpex

  OpenApiSpex.schema(%{
    title: "Poll",
    description: "Response schema for account custom fields",
    type: :object,
    properties: %{
      id: FlakeID,
      expires_at: %Schema{type: :string, format: "date-time"},
      expired: %Schema{type: :boolean},
      multiple: %Schema{type: :boolean},
      votes_count: %Schema{type: :integer},
      voted: %Schema{type: :boolean},
      emojis: %Schema{type: :array, items: Emoji},
      options: %Schema{
        type: :array,
        items: %Schema{
          type: :object,
          properties: %{
            title: %Schema{type: :string},
            votes_count: %Schema{type: :integer}
          }
        }
      }
    }
  })
end