Merge branch 'develop' into 'remove-twitter-api'
[akkoma] / lib / pleroma / web / api_spec / schemas / conversation.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.ApiSpec.Schemas.Conversation do
6 alias OpenApiSpex.Schema
7 alias Pleroma.Web.ApiSpec.Schemas.Account
8 alias Pleroma.Web.ApiSpec.Schemas.Status
9
10 require OpenApiSpex
11
12 OpenApiSpex.schema(%{
13 title: "Conversation",
14 description: "Represents a conversation with \"direct message\" visibility.",
15 type: :object,
16 required: [:id, :accounts, :unread],
17 properties: %{
18 id: %Schema{type: :string},
19 accounts: %Schema{
20 type: :array,
21 items: Account,
22 description: "Participants in the conversation"
23 },
24 unread: %Schema{
25 type: :boolean,
26 description: "Is the conversation currently marked as unread?"
27 },
28 # last_status: Status
29 last_status: %Schema{
30 allOf: [Status],
31 description: "The last status in the conversation, to be used for optional display"
32 }
33 },
34 example: %{
35 "id" => "418450",
36 "unread" => true,
37 "accounts" => [Account.schema().example],
38 "last_status" => Status.schema().example
39 }
40 })
41 end