First
[anni] / lib / pleroma / web / api_spec / schemas / chat.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.ApiSpec.Schemas.Chat do
6   alias OpenApiSpex.Schema
7   alias Pleroma.Web.ApiSpec.Schemas.ChatMessage
8
9   require OpenApiSpex
10
11   OpenApiSpex.schema(%{
12     title: "Chat",
13     description: "Response schema for a Chat",
14     type: :object,
15     properties: %{
16       id: %Schema{type: :string},
17       account: %Schema{type: :object},
18       unread: %Schema{type: :integer},
19       last_message: ChatMessage,
20       updated_at: %Schema{type: :string, format: :"date-time"}
21     },
22     example: %{
23       "account" => %{
24         "pleroma" => %{
25           "is_admin" => false,
26           "is_confirmed" => true,
27           "hide_followers_count" => false,
28           "is_moderator" => false,
29           "hide_favorites" => true,
30           "ap_id" => "https://dontbulling.me/users/lain",
31           "hide_follows_count" => false,
32           "hide_follows" => false,
33           "background_image" => nil,
34           "skip_thread_containment" => false,
35           "hide_followers" => false,
36           "relationship" => %{},
37           "tags" => []
38         },
39         "avatar" =>
40           "https://dontbulling.me/media/065a4dd3c6740dab13ff9c71ec7d240bb9f8be9205c9e7467fb2202117da1e32.jpg",
41         "following_count" => 0,
42         "header_static" => "https://originalpatchou.li/images/banner.png",
43         "source" => %{
44           "sensitive" => false,
45           "note" => "lain",
46           "pleroma" => %{
47             "discoverable" => false,
48             "actor_type" => "Person"
49           },
50           "fields" => []
51         },
52         "statuses_count" => 1,
53         "is_locked" => false,
54         "created_at" => "2020-04-16T13:40:15.000Z",
55         "display_name" => "lain",
56         "fields" => [],
57         "acct" => "lain@dontbulling.me",
58         "id" => "9u6Qw6TAZANpqokMkK",
59         "emojis" => [],
60         "avatar_static" =>
61           "https://dontbulling.me/media/065a4dd3c6740dab13ff9c71ec7d240bb9f8be9205c9e7467fb2202117da1e32.jpg",
62         "username" => "lain",
63         "followers_count" => 0,
64         "header" => "https://originalpatchou.li/images/banner.png",
65         "bot" => false,
66         "note" => "lain",
67         "url" => "https://dontbulling.me/users/lain"
68       },
69       "id" => "1",
70       "unread" => 2,
71       "last_message" => ChatMessage.schema().example(),
72       "updated_at" => "2020-04-21T15:06:45.000Z"
73     }
74   })
75 end