2020-05-26 09:13:39 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2023-01-02 20:38:50 +00:00
|
|
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
2020-05-26 09:13:39 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-05-26 11:21:33 +00:00
|
|
|
defmodule Pleroma.Web.ApiSpec.Admin.InviteOperation do
|
2020-05-26 09:13:39 +00:00
|
|
|
alias OpenApiSpex.Operation
|
|
|
|
alias OpenApiSpex.Schema
|
|
|
|
alias Pleroma.Web.ApiSpec.Schemas.ApiError
|
|
|
|
|
|
|
|
import Pleroma.Web.ApiSpec.Helpers
|
|
|
|
|
|
|
|
def open_api_operation(action) do
|
|
|
|
operation = String.to_existing_atom("#{action}_operation")
|
|
|
|
apply(__MODULE__, operation, [])
|
|
|
|
end
|
|
|
|
|
|
|
|
def index_operation do
|
|
|
|
%Operation{
|
2021-02-03 12:38:59 +00:00
|
|
|
tags: ["Invites"],
|
2020-05-26 11:02:51 +00:00
|
|
|
summary: "Get a list of generated invites",
|
2020-05-26 11:21:33 +00:00
|
|
|
operationId: "AdminAPI.InviteController.index",
|
2021-02-17 17:56:13 +00:00
|
|
|
security: [%{"oAuth" => ["admin:read:invites"]}],
|
2020-07-14 16:31:05 +00:00
|
|
|
parameters: admin_api_params(),
|
2020-05-26 09:13:39 +00:00
|
|
|
responses: %{
|
|
|
|
200 =>
|
2020-05-27 10:42:21 +00:00
|
|
|
Operation.response("Invites", "application/json", %Schema{
|
2020-05-26 11:02:51 +00:00
|
|
|
type: :object,
|
|
|
|
properties: %{
|
|
|
|
invites: %Schema{type: :array, items: invite()}
|
|
|
|
},
|
|
|
|
example: %{
|
|
|
|
"invites" => [
|
|
|
|
%{
|
|
|
|
"id" => 123,
|
|
|
|
"token" => "kSQtDj_GNy2NZsL9AQDFIsHN5qdbguB6qRg3WHw6K1U=",
|
|
|
|
"used" => true,
|
|
|
|
"expires_at" => nil,
|
|
|
|
"uses" => 0,
|
|
|
|
"max_use" => nil,
|
|
|
|
"invite_type" => "one_time"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2020-05-26 09:13:39 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2020-05-26 11:02:51 +00:00
|
|
|
def create_operation do
|
2020-05-26 09:13:39 +00:00
|
|
|
%Operation{
|
2021-02-03 12:38:59 +00:00
|
|
|
tags: ["Invites"],
|
2020-05-26 11:02:51 +00:00
|
|
|
summary: "Create an account registration invite token",
|
2020-05-26 11:21:33 +00:00
|
|
|
operationId: "AdminAPI.InviteController.create",
|
2021-02-17 17:56:13 +00:00
|
|
|
security: [%{"oAuth" => ["admin:write:invites"]}],
|
2020-07-14 16:31:05 +00:00
|
|
|
parameters: admin_api_params(),
|
2020-05-26 11:02:51 +00:00
|
|
|
requestBody:
|
|
|
|
request_body("Parameters", %Schema{
|
|
|
|
type: :object,
|
|
|
|
properties: %{
|
|
|
|
max_use: %Schema{type: :integer},
|
|
|
|
expires_at: %Schema{type: :string, format: :date, example: "2020-04-20"}
|
|
|
|
}
|
|
|
|
}),
|
2020-05-26 09:13:39 +00:00
|
|
|
responses: %{
|
2020-05-26 11:02:51 +00:00
|
|
|
200 => Operation.response("Invite", "application/json", invite())
|
2020-05-26 09:13:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2020-05-26 11:02:51 +00:00
|
|
|
def revoke_operation do
|
2020-05-26 09:13:39 +00:00
|
|
|
%Operation{
|
2021-02-03 12:38:59 +00:00
|
|
|
tags: ["Invites"],
|
2020-05-26 11:02:51 +00:00
|
|
|
summary: "Revoke invite by token",
|
2020-05-26 11:21:33 +00:00
|
|
|
operationId: "AdminAPI.InviteController.revoke",
|
2021-02-17 17:56:13 +00:00
|
|
|
security: [%{"oAuth" => ["admin:write:invites"]}],
|
2020-07-14 16:31:05 +00:00
|
|
|
parameters: admin_api_params(),
|
2020-05-26 11:02:51 +00:00
|
|
|
requestBody:
|
|
|
|
request_body(
|
|
|
|
"Parameters",
|
|
|
|
%Schema{
|
|
|
|
type: :object,
|
Pleroma.Web.AdminAPI.InviteController: dialyzer errors
lib/pleroma/web/admin_api/controllers/invite_controller.ex:46:call
The function call will not succeed.
Phoenix.Controller.render(
_conn :: %{:body_params => %{:token => _, _ => _}, _ => _},
<<115, 104, 111, 119, 46, 106, 115, 111, 110>>,
[
{:invite,
%Pleroma.UserInviteToken{
:__meta__ => _,
:expires_at => _,
:id => _,
:inserted_at => _,
:invite_type => _,
:max_use => _,
:token => _,
:updated_at => _,
:used => _,
:uses => _
}},
...
]
)
will never return since the success typing is:
(
%Plug.Conn{
:adapter => {atom(), _},
:assigns => %{atom() => _},
:body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:halted => boolean(),
:host => binary(),
:method => binary(),
:owner => pid(),
:params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:path_info => [binary()],
:path_params => %{binary() => binary() | [any()] | map()},
:port => char(),
:private => %{atom() => _},
:query_params => %Plug.Conn.Unfetched{
:aspect => atom(),
binary() => binary() | [any()] | map()
},
:query_string => binary(),
:remote_ip =>
{byte(), byte(), byte(), byte()}
| {char(), char(), char(), char(), char(), char(), char(), char()},
:req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
:req_headers => [{_, _}],
:request_path => binary(),
:resp_body =>
nil
| binary()
| maybe_improper_list(
binary() | maybe_improper_list(any(), binary() | []) | byte(),
binary() | []
),
:resp_cookies => %{binary() => map()},
:resp_headers => [{_, _}],
:scheme => :http | :https,
:script_name => [binary()],
:secret_key_base => nil | binary(),
:state =>
:chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
:status => nil | non_neg_integer()
},
atom() | binary(),
atom() | binary() | [{_, _}] | map()
) :: %Plug.Conn{
:adapter => {atom(), _},
:assigns => %{atom() => _},
:body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:halted => boolean(),
:host => binary(),
:method => binary(),
:owner => pid(),
:params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:path_info => [binary()],
:path_params => %{binary() => binary() | [any()] | map()},
:port => char(),
:private => %{atom() => _},
:query_params => %Plug.Conn.Unfetched{
:aspect => atom(),
binary() => binary() | [any()] | map()
},
:query_string => binary(),
:remote_ip =>
{byte(), byte(), byte(), byte()}
| {char(), char(), char(), char(), char(), char(), char(), char()},
:req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
:req_headers => [{_, _}],
:request_path => binary(),
:resp_body =>
nil
| binary()
| maybe_improper_list(
binary() | maybe_improper_list(any(), binary() | []) | byte(),
binary() | []
),
:resp_cookies => %{binary() => map()},
:resp_headers => [{_, _}],
:scheme => :http | :https,
:script_name => [binary()],
:secret_key_base => nil | binary(),
:state => :sent,
:status => nil | non_neg_integer()
}
and the contract is
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/invite_controller.ex:66:call
The function call will not succeed.
Pleroma.Web.ControllerHelper.json_response(
_conn :: %{
:assigns => %{:user => _, _ => _},
:body_params => %{:email => _, _ => _},
_ => _
},
:no_content,
<<>>
)
will never return since the 1st arguments differ
from the success typing arguments:
(
%Plug.Conn{
:adapter => {atom(), _},
:assigns => %{atom() => _},
:body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:halted => boolean(),
:host => binary(),
:method => binary(),
:owner => pid(),
:params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:path_info => [binary()],
:path_params => %{
binary() =>
binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
},
:port => char(),
:private => %{atom() => _},
:query_params => %Plug.Conn.Unfetched{
:aspect => atom(),
binary() =>
binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
},
:query_string => binary(),
:remote_ip =>
{byte(), byte(), byte(), byte()}
| {char(), char(), char(), char(), char(), char(), char(), char()},
:req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
:req_headers => [{binary(), binary()}],
:request_path => binary(),
:resp_body =>
nil
| binary()
| maybe_improper_list(
binary() | maybe_improper_list(any(), binary() | []) | byte(),
binary() | []
),
:resp_cookies => %{binary() => map()},
:resp_headers => [{binary(), binary()}],
:scheme => :http | :https,
:script_name => [binary()],
:secret_key_base => nil | binary(),
:state =>
:chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
:status => nil | non_neg_integer()
},
atom() | 1..1_114_111,
any()
)
2024-01-28 20:48:49 +00:00
|
|
|
required: ["token"],
|
2020-05-26 11:02:51 +00:00
|
|
|
properties: %{
|
Pleroma.Web.AdminAPI.InviteController: dialyzer errors
lib/pleroma/web/admin_api/controllers/invite_controller.ex:46:call
The function call will not succeed.
Phoenix.Controller.render(
_conn :: %{:body_params => %{:token => _, _ => _}, _ => _},
<<115, 104, 111, 119, 46, 106, 115, 111, 110>>,
[
{:invite,
%Pleroma.UserInviteToken{
:__meta__ => _,
:expires_at => _,
:id => _,
:inserted_at => _,
:invite_type => _,
:max_use => _,
:token => _,
:updated_at => _,
:used => _,
:uses => _
}},
...
]
)
will never return since the success typing is:
(
%Plug.Conn{
:adapter => {atom(), _},
:assigns => %{atom() => _},
:body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:halted => boolean(),
:host => binary(),
:method => binary(),
:owner => pid(),
:params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:path_info => [binary()],
:path_params => %{binary() => binary() | [any()] | map()},
:port => char(),
:private => %{atom() => _},
:query_params => %Plug.Conn.Unfetched{
:aspect => atom(),
binary() => binary() | [any()] | map()
},
:query_string => binary(),
:remote_ip =>
{byte(), byte(), byte(), byte()}
| {char(), char(), char(), char(), char(), char(), char(), char()},
:req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
:req_headers => [{_, _}],
:request_path => binary(),
:resp_body =>
nil
| binary()
| maybe_improper_list(
binary() | maybe_improper_list(any(), binary() | []) | byte(),
binary() | []
),
:resp_cookies => %{binary() => map()},
:resp_headers => [{_, _}],
:scheme => :http | :https,
:script_name => [binary()],
:secret_key_base => nil | binary(),
:state =>
:chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
:status => nil | non_neg_integer()
},
atom() | binary(),
atom() | binary() | [{_, _}] | map()
) :: %Plug.Conn{
:adapter => {atom(), _},
:assigns => %{atom() => _},
:body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:halted => boolean(),
:host => binary(),
:method => binary(),
:owner => pid(),
:params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:path_info => [binary()],
:path_params => %{binary() => binary() | [any()] | map()},
:port => char(),
:private => %{atom() => _},
:query_params => %Plug.Conn.Unfetched{
:aspect => atom(),
binary() => binary() | [any()] | map()
},
:query_string => binary(),
:remote_ip =>
{byte(), byte(), byte(), byte()}
| {char(), char(), char(), char(), char(), char(), char(), char()},
:req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
:req_headers => [{_, _}],
:request_path => binary(),
:resp_body =>
nil
| binary()
| maybe_improper_list(
binary() | maybe_improper_list(any(), binary() | []) | byte(),
binary() | []
),
:resp_cookies => %{binary() => map()},
:resp_headers => [{_, _}],
:scheme => :http | :https,
:script_name => [binary()],
:secret_key_base => nil | binary(),
:state => :sent,
:status => nil | non_neg_integer()
}
and the contract is
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/invite_controller.ex:66:call
The function call will not succeed.
Pleroma.Web.ControllerHelper.json_response(
_conn :: %{
:assigns => %{:user => _, _ => _},
:body_params => %{:email => _, _ => _},
_ => _
},
:no_content,
<<>>
)
will never return since the 1st arguments differ
from the success typing arguments:
(
%Plug.Conn{
:adapter => {atom(), _},
:assigns => %{atom() => _},
:body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:halted => boolean(),
:host => binary(),
:method => binary(),
:owner => pid(),
:params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:path_info => [binary()],
:path_params => %{
binary() =>
binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
},
:port => char(),
:private => %{atom() => _},
:query_params => %Plug.Conn.Unfetched{
:aspect => atom(),
binary() =>
binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
},
:query_string => binary(),
:remote_ip =>
{byte(), byte(), byte(), byte()}
| {char(), char(), char(), char(), char(), char(), char(), char()},
:req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
:req_headers => [{binary(), binary()}],
:request_path => binary(),
:resp_body =>
nil
| binary()
| maybe_improper_list(
binary() | maybe_improper_list(any(), binary() | []) | byte(),
binary() | []
),
:resp_cookies => %{binary() => map()},
:resp_headers => [{binary(), binary()}],
:scheme => :http | :https,
:script_name => [binary()],
:secret_key_base => nil | binary(),
:state =>
:chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
:status => nil | non_neg_integer()
},
atom() | 1..1_114_111,
any()
)
2024-01-28 20:48:49 +00:00
|
|
|
"token" => %Schema{type: :string}
|
2020-05-26 11:02:51 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
required: true
|
|
|
|
),
|
2020-05-26 09:13:39 +00:00
|
|
|
responses: %{
|
2020-05-26 11:02:51 +00:00
|
|
|
200 => Operation.response("Invite", "application/json", invite()),
|
|
|
|
400 => Operation.response("Bad Request", "application/json", ApiError),
|
|
|
|
404 => Operation.response("Not Found", "application/json", ApiError)
|
2020-05-26 09:13:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2020-05-26 11:02:51 +00:00
|
|
|
def email_operation do
|
2020-05-26 09:13:39 +00:00
|
|
|
%Operation{
|
2021-02-03 12:38:59 +00:00
|
|
|
tags: ["Invites"],
|
2020-05-26 11:02:51 +00:00
|
|
|
summary: "Sends registration invite via email",
|
2020-05-26 11:21:33 +00:00
|
|
|
operationId: "AdminAPI.InviteController.email",
|
2021-02-17 17:56:13 +00:00
|
|
|
security: [%{"oAuth" => ["admin:write:invites"]}],
|
2020-07-14 16:31:05 +00:00
|
|
|
parameters: admin_api_params(),
|
2020-05-26 11:02:51 +00:00
|
|
|
requestBody:
|
|
|
|
request_body(
|
|
|
|
"Parameters",
|
|
|
|
%Schema{
|
|
|
|
type: :object,
|
Pleroma.Web.AdminAPI.InviteController: dialyzer errors
lib/pleroma/web/admin_api/controllers/invite_controller.ex:46:call
The function call will not succeed.
Phoenix.Controller.render(
_conn :: %{:body_params => %{:token => _, _ => _}, _ => _},
<<115, 104, 111, 119, 46, 106, 115, 111, 110>>,
[
{:invite,
%Pleroma.UserInviteToken{
:__meta__ => _,
:expires_at => _,
:id => _,
:inserted_at => _,
:invite_type => _,
:max_use => _,
:token => _,
:updated_at => _,
:used => _,
:uses => _
}},
...
]
)
will never return since the success typing is:
(
%Plug.Conn{
:adapter => {atom(), _},
:assigns => %{atom() => _},
:body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:halted => boolean(),
:host => binary(),
:method => binary(),
:owner => pid(),
:params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:path_info => [binary()],
:path_params => %{binary() => binary() | [any()] | map()},
:port => char(),
:private => %{atom() => _},
:query_params => %Plug.Conn.Unfetched{
:aspect => atom(),
binary() => binary() | [any()] | map()
},
:query_string => binary(),
:remote_ip =>
{byte(), byte(), byte(), byte()}
| {char(), char(), char(), char(), char(), char(), char(), char()},
:req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
:req_headers => [{_, _}],
:request_path => binary(),
:resp_body =>
nil
| binary()
| maybe_improper_list(
binary() | maybe_improper_list(any(), binary() | []) | byte(),
binary() | []
),
:resp_cookies => %{binary() => map()},
:resp_headers => [{_, _}],
:scheme => :http | :https,
:script_name => [binary()],
:secret_key_base => nil | binary(),
:state =>
:chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
:status => nil | non_neg_integer()
},
atom() | binary(),
atom() | binary() | [{_, _}] | map()
) :: %Plug.Conn{
:adapter => {atom(), _},
:assigns => %{atom() => _},
:body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:halted => boolean(),
:host => binary(),
:method => binary(),
:owner => pid(),
:params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:path_info => [binary()],
:path_params => %{binary() => binary() | [any()] | map()},
:port => char(),
:private => %{atom() => _},
:query_params => %Plug.Conn.Unfetched{
:aspect => atom(),
binary() => binary() | [any()] | map()
},
:query_string => binary(),
:remote_ip =>
{byte(), byte(), byte(), byte()}
| {char(), char(), char(), char(), char(), char(), char(), char()},
:req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
:req_headers => [{_, _}],
:request_path => binary(),
:resp_body =>
nil
| binary()
| maybe_improper_list(
binary() | maybe_improper_list(any(), binary() | []) | byte(),
binary() | []
),
:resp_cookies => %{binary() => map()},
:resp_headers => [{_, _}],
:scheme => :http | :https,
:script_name => [binary()],
:secret_key_base => nil | binary(),
:state => :sent,
:status => nil | non_neg_integer()
}
and the contract is
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/invite_controller.ex:66:call
The function call will not succeed.
Pleroma.Web.ControllerHelper.json_response(
_conn :: %{
:assigns => %{:user => _, _ => _},
:body_params => %{:email => _, _ => _},
_ => _
},
:no_content,
<<>>
)
will never return since the 1st arguments differ
from the success typing arguments:
(
%Plug.Conn{
:adapter => {atom(), _},
:assigns => %{atom() => _},
:body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:halted => boolean(),
:host => binary(),
:method => binary(),
:owner => pid(),
:params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:path_info => [binary()],
:path_params => %{
binary() =>
binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
},
:port => char(),
:private => %{atom() => _},
:query_params => %Plug.Conn.Unfetched{
:aspect => atom(),
binary() =>
binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
},
:query_string => binary(),
:remote_ip =>
{byte(), byte(), byte(), byte()}
| {char(), char(), char(), char(), char(), char(), char(), char()},
:req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
:req_headers => [{binary(), binary()}],
:request_path => binary(),
:resp_body =>
nil
| binary()
| maybe_improper_list(
binary() | maybe_improper_list(any(), binary() | []) | byte(),
binary() | []
),
:resp_cookies => %{binary() => map()},
:resp_headers => [{binary(), binary()}],
:scheme => :http | :https,
:script_name => [binary()],
:secret_key_base => nil | binary(),
:state =>
:chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
:status => nil | non_neg_integer()
},
atom() | 1..1_114_111,
any()
)
2024-01-28 20:48:49 +00:00
|
|
|
required: ["email"],
|
2020-05-26 11:02:51 +00:00
|
|
|
properties: %{
|
Pleroma.Web.AdminAPI.InviteController: dialyzer errors
lib/pleroma/web/admin_api/controllers/invite_controller.ex:46:call
The function call will not succeed.
Phoenix.Controller.render(
_conn :: %{:body_params => %{:token => _, _ => _}, _ => _},
<<115, 104, 111, 119, 46, 106, 115, 111, 110>>,
[
{:invite,
%Pleroma.UserInviteToken{
:__meta__ => _,
:expires_at => _,
:id => _,
:inserted_at => _,
:invite_type => _,
:max_use => _,
:token => _,
:updated_at => _,
:used => _,
:uses => _
}},
...
]
)
will never return since the success typing is:
(
%Plug.Conn{
:adapter => {atom(), _},
:assigns => %{atom() => _},
:body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:halted => boolean(),
:host => binary(),
:method => binary(),
:owner => pid(),
:params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:path_info => [binary()],
:path_params => %{binary() => binary() | [any()] | map()},
:port => char(),
:private => %{atom() => _},
:query_params => %Plug.Conn.Unfetched{
:aspect => atom(),
binary() => binary() | [any()] | map()
},
:query_string => binary(),
:remote_ip =>
{byte(), byte(), byte(), byte()}
| {char(), char(), char(), char(), char(), char(), char(), char()},
:req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
:req_headers => [{_, _}],
:request_path => binary(),
:resp_body =>
nil
| binary()
| maybe_improper_list(
binary() | maybe_improper_list(any(), binary() | []) | byte(),
binary() | []
),
:resp_cookies => %{binary() => map()},
:resp_headers => [{_, _}],
:scheme => :http | :https,
:script_name => [binary()],
:secret_key_base => nil | binary(),
:state =>
:chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
:status => nil | non_neg_integer()
},
atom() | binary(),
atom() | binary() | [{_, _}] | map()
) :: %Plug.Conn{
:adapter => {atom(), _},
:assigns => %{atom() => _},
:body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:halted => boolean(),
:host => binary(),
:method => binary(),
:owner => pid(),
:params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:path_info => [binary()],
:path_params => %{binary() => binary() | [any()] | map()},
:port => char(),
:private => %{atom() => _},
:query_params => %Plug.Conn.Unfetched{
:aspect => atom(),
binary() => binary() | [any()] | map()
},
:query_string => binary(),
:remote_ip =>
{byte(), byte(), byte(), byte()}
| {char(), char(), char(), char(), char(), char(), char(), char()},
:req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
:req_headers => [{_, _}],
:request_path => binary(),
:resp_body =>
nil
| binary()
| maybe_improper_list(
binary() | maybe_improper_list(any(), binary() | []) | byte(),
binary() | []
),
:resp_cookies => %{binary() => map()},
:resp_headers => [{_, _}],
:scheme => :http | :https,
:script_name => [binary()],
:secret_key_base => nil | binary(),
:state => :sent,
:status => nil | non_neg_integer()
}
and the contract is
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/invite_controller.ex:66:call
The function call will not succeed.
Pleroma.Web.ControllerHelper.json_response(
_conn :: %{
:assigns => %{:user => _, _ => _},
:body_params => %{:email => _, _ => _},
_ => _
},
:no_content,
<<>>
)
will never return since the 1st arguments differ
from the success typing arguments:
(
%Plug.Conn{
:adapter => {atom(), _},
:assigns => %{atom() => _},
:body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:halted => boolean(),
:host => binary(),
:method => binary(),
:owner => pid(),
:params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:path_info => [binary()],
:path_params => %{
binary() =>
binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
},
:port => char(),
:private => %{atom() => _},
:query_params => %Plug.Conn.Unfetched{
:aspect => atom(),
binary() =>
binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
},
:query_string => binary(),
:remote_ip =>
{byte(), byte(), byte(), byte()}
| {char(), char(), char(), char(), char(), char(), char(), char()},
:req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
:req_headers => [{binary(), binary()}],
:request_path => binary(),
:resp_body =>
nil
| binary()
| maybe_improper_list(
binary() | maybe_improper_list(any(), binary() | []) | byte(),
binary() | []
),
:resp_cookies => %{binary() => map()},
:resp_headers => [{binary(), binary()}],
:scheme => :http | :https,
:script_name => [binary()],
:secret_key_base => nil | binary(),
:state =>
:chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
:status => nil | non_neg_integer()
},
atom() | 1..1_114_111,
any()
)
2024-01-28 20:48:49 +00:00
|
|
|
"email" => %Schema{type: :string, format: :email},
|
|
|
|
"name" => %Schema{type: :string}
|
2020-05-26 11:02:51 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
required: true
|
|
|
|
),
|
2020-05-26 09:13:39 +00:00
|
|
|
responses: %{
|
2020-05-26 11:02:51 +00:00
|
|
|
204 => no_content_response(),
|
|
|
|
400 => Operation.response("Bad Request", "application/json", ApiError),
|
|
|
|
403 => Operation.response("Forbidden", "application/json", ApiError)
|
2020-05-26 09:13:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2020-05-26 11:02:51 +00:00
|
|
|
defp invite do
|
2020-05-26 09:13:39 +00:00
|
|
|
%Schema{
|
2020-05-26 11:02:51 +00:00
|
|
|
title: "Invite",
|
2020-05-26 09:13:39 +00:00
|
|
|
type: :object,
|
|
|
|
properties: %{
|
2020-05-26 11:02:51 +00:00
|
|
|
id: %Schema{type: :integer},
|
|
|
|
token: %Schema{type: :string},
|
|
|
|
used: %Schema{type: :boolean},
|
|
|
|
expires_at: %Schema{type: :string, format: :date, nullable: true},
|
|
|
|
uses: %Schema{type: :integer},
|
|
|
|
max_use: %Schema{type: :integer, nullable: true},
|
|
|
|
invite_type: %Schema{
|
|
|
|
type: :string,
|
|
|
|
enum: ["one_time", "reusable", "date_limited", "reusable_date_limited"]
|
|
|
|
}
|
2020-05-26 09:13:39 +00:00
|
|
|
},
|
|
|
|
example: %{
|
2020-05-26 11:02:51 +00:00
|
|
|
"id" => 123,
|
|
|
|
"token" => "kSQtDj_GNy2NZsL9AQDFIsHN5qdbguB6qRg3WHw6K1U=",
|
|
|
|
"used" => true,
|
|
|
|
"expires_at" => nil,
|
|
|
|
"uses" => 0,
|
|
|
|
"max_use" => nil,
|
|
|
|
"invite_type" => "one_time"
|
2020-05-26 09:13:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|