Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F21968023
follow_request_operation.ex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
follow_request_operation.ex
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Web.ApiSpec.FollowRequestOperation
do
alias
OpenApiSpex.Operation
alias
OpenApiSpex.Schema
alias
Pleroma.Web.ApiSpec.Schemas.Account
alias
Pleroma.Web.ApiSpec.Schemas.AccountRelationship
def
open_api_operation
(
action
)
do
operation
=
String
.
to_existing_atom
(
"
#{
action
}
_operation"
)
apply
(
__MODULE__
,
operation
,
[])
end
def
index_operation
do
%
Operation
{
tags
:
[
"Follow requests"
],
summary
:
"Retrieve follow requests"
,
security
:
[%{
"oAuth"
=>
[
"read:follows"
,
"follow"
]}],
operationId
:
"FollowRequestController.index"
,
responses
:
%{
200
=>
Operation
.
response
(
"Array of Account"
,
"application/json"
,
%
Schema
{
type
:
:array
,
items
:
Account
,
example
:
[
Account
.
schema
()
.
example
]
})
}
}
end
def
authorize_operation
do
%
Operation
{
tags
:
[
"Follow requests"
],
summary
:
"Accept follow request"
,
operationId
:
"FollowRequestController.authorize"
,
parameters
:
[
id_param
()],
security
:
[%{
"oAuth"
=>
[
"follow"
,
"write:follows"
]}],
responses
:
%{
200
=>
Operation
.
response
(
"Relationship"
,
"application/json"
,
AccountRelationship
)
}
}
end
def
reject_operation
do
%
Operation
{
tags
:
[
"Follow requests"
],
summary
:
"Reject follow request"
,
operationId
:
"FollowRequestController.reject"
,
parameters
:
[
id_param
()],
security
:
[%{
"oAuth"
=>
[
"follow"
,
"write:follows"
]}],
responses
:
%{
200
=>
Operation
.
response
(
"Relationship"
,
"application/json"
,
AccountRelationship
)
}
}
end
defp
id_param
do
Operation
.
parameter
(
:id
,
:path
,
:string
,
"Conversation ID"
,
example
:
"123"
,
required
:
true
)
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Sun, Dec 28, 3:24 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
725803
Default Alt Text
follow_request_operation.ex (1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment