Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F21908537
helpers.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
helpers.ex
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Web.ApiSpec.Helpers
do
alias
OpenApiSpex.Operation
alias
OpenApiSpex.Schema
def
request_body
(
description
,
schema_ref
,
opts
\\
[])
do
media_types
=
[
"application/json"
,
"multipart/form-data"
,
"application/x-www-form-urlencoded"
]
content
=
media_types
|>
Enum
.
map
(
fn
type
->
{
type
,
%
OpenApiSpex.MediaType
{
schema
:
schema_ref
,
example
:
opts
[
:example
],
examples
:
opts
[
:examples
]
}}
end
)
|>
Enum
.
into
(%{})
%
OpenApiSpex.RequestBody
{
description
:
description
,
content
:
content
,
required
:
opts
[
:required
]
||
false
}
end
def
pagination_params
do
[
Operation
.
parameter
(
:max_id
,
:query
,
:string
,
"Return items older than this ID"
),
Operation
.
parameter
(
:min_id
,
:query
,
:string
,
"Return the oldest items newer than this ID"
),
Operation
.
parameter
(
:since_id
,
:query
,
:string
,
"Return the newest items newer than this ID"
),
Operation
.
parameter
(
:limit
,
:query
,
%
Schema
{
type
:
:integer
,
default
:
20
},
"Maximum number of items to return. Will be ignored if it's more than 40"
)
]
end
def
empty_object_response
do
Operation
.
response
(
"Empty object"
,
"application/json"
,
%
Schema
{
type
:
:object
,
example
:
%{}})
end
def
empty_array_response
do
Operation
.
response
(
"Empty array"
,
"application/json"
,
%
Schema
{
type
:
:array
,
example
:
[]})
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Sun, Dec 28, 1:43 AM (3 m, 26 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
769183
Default Alt Text
helpers.ex (1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment