Chats: Add API specs.
[akkoma] / lib / pleroma / web / api_spec / schemas / chat_response.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.ChatResponse do
6 alias OpenApiSpex.Schema
7
8 require OpenApiSpex
9
10 OpenApiSpex.schema(%{
11 title: "ChatResponse",
12 description: "Response schema for a Chat",
13 type: :object,
14 properties: %{
15 id: %Schema{type: :string},
16 recipient: %Schema{type: :string},
17 # TODO: Make this reference the account structure.
18 recipient_account: %Schema{type: :object},
19 unread: %Schema{type: :integer}
20 },
21 example: %{
22 "recipient" => "https://dontbulling.me/users/lain",
23 "recipient_account" => %{
24 "pleroma" => %{
25 "is_admin" => false,
26 "confirmation_pending" => false,
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 "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 }
72 })
73 end