logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

chat_message.ex (2679B)


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