Merge branch 'chores/bump-copyright' into 'develop'
[akkoma] / lib / pleroma / web / api_spec / schemas / push_subscription.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.ApiSpec.Schemas.PushSubscription do
6 alias OpenApiSpex.Schema
7
8 require OpenApiSpex
9
10 OpenApiSpex.schema(%{
11 title: "PushSubscription",
12 description: "Response schema for a push subscription",
13 type: :object,
14 properties: %{
15 id: %Schema{
16 anyOf: [%Schema{type: :string}, %Schema{type: :integer}],
17 description: "The id of the push subscription in the database."
18 },
19 endpoint: %Schema{type: :string, description: "Where push alerts will be sent to."},
20 server_key: %Schema{type: :string, description: "The streaming server's VAPID key."},
21 alerts: %Schema{
22 type: :object,
23 description: "Which alerts should be delivered to the endpoint.",
24 properties: %{
25 follow: %Schema{
26 type: :boolean,
27 description: "Receive a push notification when someone has followed you?"
28 },
29 favourite: %Schema{
30 type: :boolean,
31 description:
32 "Receive a push notification when a status you created has been favourited by someone else?"
33 },
34 reblog: %Schema{
35 type: :boolean,
36 description:
37 "Receive a push notification when a status you created has been boosted by someone else?"
38 },
39 mention: %Schema{
40 type: :boolean,
41 description:
42 "Receive a push notification when someone else has mentioned you in a status?"
43 },
44 poll: %Schema{
45 type: :boolean,
46 description:
47 "Receive a push notification when a poll you voted in or created has ended? "
48 }
49 }
50 }
51 },
52 example: %{
53 "id" => "328_183",
54 "endpoint" => "https://yourdomain.example/listener",
55 "alerts" => %{
56 "follow" => true,
57 "favourite" => true,
58 "reblog" => true,
59 "mention" => true,
60 "poll" => true
61 },
62 "server_key" =>
63 "BCk-QqERU0q-CfYZjcuB6lnyyOYfJ2AifKqfeGIm7Z-HiTU5T9eTG5GxVA0_OH5mMlI4UkkDTpaZwozy0TzdZ2M="
64 }
65 })
66 end