Add OpenAPI spec for FilterController
[akkoma] / lib / pleroma / web / api_spec / schemas / filter_update_request.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.FilterUpdateRequest do
6 alias OpenApiSpex.Schema
7 require OpenApiSpex
8
9 OpenApiSpex.schema(%{
10 title: "FilterUpdateRequest",
11 type: :object,
12 properties: %{
13 phrase: %Schema{type: :string, description: "The text to be filtered"},
14 context: %Schema{
15 type: :array,
16 items: %Schema{type: :string, enum: ["home", "notifications", "public", "thread"]},
17 description:
18 "Array of enumerable strings `home`, `notifications`, `public`, `thread`. At least one context must be specified."
19 },
20 irreversible: %Schema{
21 type: :bolean,
22 description:
23 "Should the server irreversibly drop matching entities from home and notifications?"
24 },
25 whole_word: %Schema{type: :bolean, description: "Consider word boundaries?", default: true}
26 # TODO: probably should implement filter expiration
27 # expires_in: %Schema{
28 # type: :string,
29 # format: :"date-time",
30 # description:
31 # "ISO 8601 Datetime for when the filter expires. Otherwise,
32 # null for a filter that doesn't expire."
33 # }
34 },
35 required: [:phrase, :context],
36 example: %{
37 "phrase" => "knights",
38 "context" => ["home"]
39 }
40 })
41 end