summaryrefslogtreecommitdiff
path: root/lib/pleroma/web/api_spec/schemas/conversation.ex
blob: 7c609965f3c42e73e5c90bc886aa4e525463e1d8 (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
37
38
39
40
41
# Pleroma: A lightweight social networking server
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only

defmodule Pleroma.Web.ApiSpec.Schemas.Conversation do
  alias OpenApiSpex.Schema
  alias Pleroma.Web.ApiSpec.Schemas.Account
  alias Pleroma.Web.ApiSpec.Schemas.Status

  require OpenApiSpex

  OpenApiSpex.schema(%{
    title: "Conversation",
    description: "Represents a conversation with \"direct message\" visibility.",
    type: :object,
    required: [:id, :accounts, :unread],
    properties: %{
      id: %Schema{type: :string},
      accounts: %Schema{
        type: :array,
        items: Account,
        description: "Participants in the conversation"
      },
      unread: %Schema{
        type: :boolean,
        description: "Is the conversation currently marked as unread?"
      },
      # last_status: Status
      last_status: %Schema{
        allOf: [Status],
        description: "The last status in the conversation, to be used for optional display"
      }
    },
    example: %{
      "id" => "418450",
      "unread" => true,
      "accounts" => [Account.schema().example],
      "last_status" => Status.schema().example
    }
  })
end