2020-04-21 09:51:06 -06:00
|
|
|
# Pleroma: A lightweight social networking server
|
2022-02-25 23:11:42 -07:00
|
|
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
2020-04-21 09:51:06 -06:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-05-04 03:08:00 -06:00
|
|
|
defmodule Pleroma.Web.ApiSpec.Schemas.ChatMessage do
|
2020-04-21 09:51:06 -06:00
|
|
|
alias OpenApiSpex.Schema
|
2020-09-18 15:50:00 -06:00
|
|
|
alias Pleroma.Web.ApiSpec.Schemas.Emoji
|
2020-04-21 09:51:06 -06:00
|
|
|
|
|
|
|
require OpenApiSpex
|
|
|
|
|
|
|
|
OpenApiSpex.schema(%{
|
2020-05-04 03:08:00 -06:00
|
|
|
title: "ChatMessage",
|
2020-04-21 09:51:06 -06:00
|
|
|
description: "Response schema for a ChatMessage",
|
2020-05-10 05:26:14 -06:00
|
|
|
nullable: true,
|
2020-04-21 09:51:06 -06:00
|
|
|
type: :object,
|
|
|
|
properties: %{
|
|
|
|
id: %Schema{type: :string},
|
2020-04-27 09:48:34 -06:00
|
|
|
account_id: %Schema{type: :string, description: "The Mastodon API id of the actor"},
|
2020-04-21 09:51:06 -06:00
|
|
|
chat_id: %Schema{type: :string},
|
2020-05-13 07:31:28 -06:00
|
|
|
content: %Schema{type: :string, nullable: true},
|
2020-04-29 13:49:13 -06:00
|
|
|
created_at: %Schema{type: :string, format: :"date-time"},
|
2020-09-18 15:50:00 -06:00
|
|
|
emojis: %Schema{type: :array, items: Emoji},
|
2020-07-30 11:57:45 -06:00
|
|
|
attachment: %Schema{type: :object, nullable: true},
|
|
|
|
card: %Schema{
|
|
|
|
type: :object,
|
|
|
|
nullable: true,
|
|
|
|
description: "Preview card for links included within status content",
|
|
|
|
required: [:url, :title, :description, :type],
|
|
|
|
properties: %{
|
|
|
|
type: %Schema{
|
|
|
|
type: :string,
|
|
|
|
enum: ["link", "photo", "video", "rich"],
|
|
|
|
description: "The type of the preview card"
|
|
|
|
},
|
|
|
|
provider_name: %Schema{
|
|
|
|
type: :string,
|
|
|
|
nullable: true,
|
|
|
|
description: "The provider of the original resource"
|
|
|
|
},
|
|
|
|
provider_url: %Schema{
|
|
|
|
type: :string,
|
|
|
|
format: :uri,
|
|
|
|
description: "A link to the provider of the original resource"
|
|
|
|
},
|
|
|
|
url: %Schema{type: :string, format: :uri, description: "Location of linked resource"},
|
|
|
|
image: %Schema{
|
|
|
|
type: :string,
|
|
|
|
nullable: true,
|
|
|
|
format: :uri,
|
|
|
|
description: "Preview thumbnail"
|
|
|
|
},
|
|
|
|
title: %Schema{type: :string, description: "Title of linked resource"},
|
|
|
|
description: %Schema{type: :string, description: "Description of preview"}
|
|
|
|
}
|
2021-02-16 12:41:06 -07:00
|
|
|
},
|
|
|
|
unread: %Schema{type: :boolean, description: "Whether a message has been marked as read."}
|
2020-04-21 09:51:06 -06:00
|
|
|
},
|
|
|
|
example: %{
|
2020-04-27 09:48:34 -06:00
|
|
|
"account_id" => "someflakeid",
|
2020-04-21 09:51:06 -06:00
|
|
|
"chat_id" => "1",
|
|
|
|
"content" => "hey you again",
|
|
|
|
"created_at" => "2020-04-21T15:06:45.000Z",
|
2020-07-30 11:57:45 -06:00
|
|
|
"card" => nil,
|
2020-04-21 09:51:06 -06:00
|
|
|
"emojis" => [
|
|
|
|
%{
|
|
|
|
"static_url" => "https://dontbulling.me/emoji/Firefox.gif",
|
|
|
|
"visible_in_picker" => false,
|
|
|
|
"shortcode" => "firefox",
|
|
|
|
"url" => "https://dontbulling.me/emoji/Firefox.gif"
|
|
|
|
}
|
|
|
|
],
|
2020-05-06 08:12:36 -06:00
|
|
|
"id" => "14",
|
2021-02-16 12:41:06 -07:00
|
|
|
"attachment" => nil,
|
|
|
|
"unread" => false
|
2020-04-21 09:51:06 -06:00
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|