Merge remote-tracking branch 'upstream/develop' into restrict-domain
[akkoma] / lib / pleroma / web / api_spec / schemas / chat_message.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.ChatMessage do
6 alias OpenApiSpex.Schema
7
8 require OpenApiSpex
9
10 OpenApiSpex.schema(%{
11 title: "ChatMessage",
12 description: "Response schema for a ChatMessage",
13 nullable: true,
14 type: :object,
15 properties: %{
16 id: %Schema{type: :string},
17 account_id: %Schema{type: :string, description: "The Mastodon API id of the actor"},
18 chat_id: %Schema{type: :string},
19 content: %Schema{type: :string, nullable: true},
20 created_at: %Schema{type: :string, format: :"date-time"},
21 emojis: %Schema{type: :array},
22 attachment: %Schema{type: :object, nullable: true},
23 card: %Schema{
24 type: :object,
25 nullable: true,
26 description: "Preview card for links included within status content",
27 required: [:url, :title, :description, :type],
28 properties: %{
29 type: %Schema{
30 type: :string,
31 enum: ["link", "photo", "video", "rich"],
32 description: "The type of the preview card"
33 },
34 provider_name: %Schema{
35 type: :string,
36 nullable: true,
37 description: "The provider of the original resource"
38 },
39 provider_url: %Schema{
40 type: :string,
41 format: :uri,
42 description: "A link to the provider of the original resource"
43 },
44 url: %Schema{type: :string, format: :uri, description: "Location of linked resource"},
45 image: %Schema{
46 type: :string,
47 nullable: true,
48 format: :uri,
49 description: "Preview thumbnail"
50 },
51 title: %Schema{type: :string, description: "Title of linked resource"},
52 description: %Schema{type: :string, description: "Description of preview"}
53 }
54 }
55 },
56 example: %{
57 "account_id" => "someflakeid",
58 "chat_id" => "1",
59 "content" => "hey you again",
60 "created_at" => "2020-04-21T15:06:45.000Z",
61 "card" => nil,
62 "emojis" => [
63 %{
64 "static_url" => "https://dontbulling.me/emoji/Firefox.gif",
65 "visible_in_picker" => false,
66 "shortcode" => "firefox",
67 "url" => "https://dontbulling.me/emoji/Firefox.gif"
68 }
69 ],
70 "id" => "14",
71 "attachment" => nil
72 }
73 })
74 end