1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ApiSpec.PleromaReportOperation do
6 alias OpenApiSpex.Operation
7 alias OpenApiSpex.Schema
8 alias Pleroma.Web.ApiSpec.Admin.ReportOperation
9 alias Pleroma.Web.ApiSpec.Schemas.Account
10 alias Pleroma.Web.ApiSpec.Schemas.ApiError
11 alias Pleroma.Web.ApiSpec.Schemas.FlakeID
12 alias Pleroma.Web.ApiSpec.Schemas.Status
14 def open_api_operation(action) do
15 operation = String.to_existing_atom("#{action}_operation")
16 apply(__MODULE__, operation, [])
19 def index_operation do
22 summary: "Get a list of your own reports",
23 operationId: "PleromaAPI.ReportController.index",
24 security: [%{"oAuth" => ["read:reports"]}],
29 ReportOperation.report_state(),
30 "Filter by report state"
35 %Schema{type: :integer},
36 "The number of records to retrieve"
41 %Schema{type: :integer, default: 1},
47 %Schema{type: :integer, default: 50},
48 "Number number of log entries per page"
53 Operation.response("Response", "application/json", %Schema{
56 total: %Schema{type: :integer},
63 404 => Operation.response("Not Found", "application/json", ApiError)
71 summary: "Get an individual report",
72 operationId: "PleromaAPI.ReportController.show",
73 parameters: [ReportOperation.id_param()],
74 security: [%{"oAuth" => ["read:reports"]}],
76 200 => Operation.response("Report", "application/json", report()),
77 404 => Operation.response("Not Found", "application/json", ApiError)
82 # Copied from ReportOperation.report with removing notes
88 state: ReportOperation.report_state(),
91 content: %Schema{type: :string},
92 created_at: %Schema{type: :string, format: :"date-time"},
93 statuses: %Schema{type: :array, items: Status}