Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel-dms
[akkoma] / lib / pleroma / web / api_spec / operations / chat_operation.ex
index 0fe0e07b202116d3359389f40ab6cf93a07ccef8..8ba10c60338eddb338960f2da2c9e64fbe426d57 100644 (file)
@@ -38,6 +38,37 @@ defmodule Pleroma.Web.ApiSpec.ChatOperation do
     }
   end
 
+  def show_operation do
+    %Operation{
+      tags: ["chat"],
+      summary: "Create a chat",
+      operationId: "ChatController.show",
+      parameters: [
+        Operation.parameter(
+          :id,
+          :path,
+          :string,
+          "The id of the chat",
+          required: true,
+          example: "1234"
+        )
+      ],
+      responses: %{
+        200 =>
+          Operation.response(
+            "The existing chat",
+            "application/json",
+            Chat
+          )
+      },
+      security: [
+        %{
+          "oAuth" => ["read"]
+        }
+      ]
+    }
+  end
+
   def create_operation do
     %Operation{
       tags: ["chat"],
@@ -135,6 +166,31 @@ defmodule Pleroma.Web.ApiSpec.ChatOperation do
     }
   end
 
+  def delete_message_operation do
+    %Operation{
+      tags: ["chat"],
+      summary: "delete_message",
+      operationId: "ChatController.delete_message",
+      parameters: [
+        Operation.parameter(:id, :path, :string, "The ID of the Chat"),
+        Operation.parameter(:message_id, :path, :string, "The ID of the message")
+      ],
+      responses: %{
+        200 =>
+          Operation.response(
+            "The deleted ChatMessage",
+            "application/json",
+            ChatMessage
+          )
+      },
+      security: [
+        %{
+          "oAuth" => ["write"]
+        }
+      ]
+    }
+  end
+
   def chats_response do
     %Schema{
       title: "ChatsResponse",
@@ -236,11 +292,13 @@ defmodule Pleroma.Web.ApiSpec.ChatOperation do
       description: "POST body for creating an chat message",
       type: :object,
       properties: %{
-        content: %Schema{type: :string, description: "The content of your message"}
+        content: %Schema{type: :string, description: "The content of your message"},
+        media_id: %Schema{type: :string, description: "The id of an upload"}
       },
       required: [:content],
       example: %{
-        "content" => "Hey wanna buy feet pics?"
+        "content" => "Hey wanna buy feet pics?",
+        "media_id" => "134234"
       }
     }
   end