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