Merge branch 'instance-v2' into 'develop'
Implement api/v2/instance route See merge request pleroma/pleroma!3939
This commit is contained in:
commit
bd50892c25
7 changed files with 296 additions and 23 deletions
|
|
@ -23,6 +23,18 @@ defmodule Pleroma.Web.ApiSpec.InstanceOperation do
|
|||
}
|
||||
end
|
||||
|
||||
def show2_operation do
|
||||
%Operation{
|
||||
tags: ["Instance misc"],
|
||||
summary: "Retrieve instance information",
|
||||
description: "Information about the server",
|
||||
operationId: "InstanceController.show2",
|
||||
responses: %{
|
||||
200 => Operation.response("Instance", "application/json", instance2())
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def peers_operation do
|
||||
%Operation{
|
||||
tags: ["Instance misc"],
|
||||
|
|
@ -165,6 +177,166 @@ defmodule Pleroma.Web.ApiSpec.InstanceOperation do
|
|||
}
|
||||
end
|
||||
|
||||
defp instance2 do
|
||||
%Schema{
|
||||
type: :object,
|
||||
properties: %{
|
||||
domain: %Schema{type: :string, description: "The domain name of the instance"},
|
||||
title: %Schema{type: :string, description: "The title of the website"},
|
||||
version: %Schema{
|
||||
type: :string,
|
||||
description: "The version of Pleroma installed on the instance"
|
||||
},
|
||||
source_url: %Schema{
|
||||
type: :string,
|
||||
description: "The version of Pleroma installed on the instance"
|
||||
},
|
||||
description: %Schema{
|
||||
type: :string,
|
||||
description: "Admin-defined description of the Pleroma site"
|
||||
},
|
||||
usage: %Schema{
|
||||
type: :object,
|
||||
description: "Instance usage statistics",
|
||||
properties: %{
|
||||
users: %Schema{
|
||||
type: :object,
|
||||
description: "User count statistics",
|
||||
properties: %{
|
||||
active_month: %Schema{
|
||||
type: :integer,
|
||||
description: "Monthly active users"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
email: %Schema{
|
||||
type: :string,
|
||||
description: "An email that may be contacted for any inquiries",
|
||||
format: :email
|
||||
},
|
||||
urls: %Schema{
|
||||
type: :object,
|
||||
description: "URLs of interest for clients apps",
|
||||
properties: %{}
|
||||
},
|
||||
stats: %Schema{
|
||||
type: :object,
|
||||
description: "Statistics about how much information the instance contains",
|
||||
properties: %{
|
||||
user_count: %Schema{
|
||||
type: :integer,
|
||||
description: "Users registered on this instance"
|
||||
},
|
||||
status_count: %Schema{
|
||||
type: :integer,
|
||||
description: "Statuses authored by users on instance"
|
||||
},
|
||||
domain_count: %Schema{
|
||||
type: :integer,
|
||||
description: "Domains federated with this instance"
|
||||
}
|
||||
}
|
||||
},
|
||||
thumbnail: %Schema{
|
||||
type: :object,
|
||||
properties: %{
|
||||
url: %Schema{
|
||||
type: :string,
|
||||
description: "Banner image for the website",
|
||||
nullable: true
|
||||
}
|
||||
}
|
||||
},
|
||||
languages: %Schema{
|
||||
type: :array,
|
||||
items: %Schema{type: :string},
|
||||
description: "Primary langauges of the website and its staff"
|
||||
},
|
||||
registrations: %Schema{
|
||||
type: :object,
|
||||
description: "Registrations-related configuration",
|
||||
properties: %{
|
||||
enabled: %Schema{
|
||||
type: :boolean,
|
||||
description: "Whether registrations are enabled"
|
||||
},
|
||||
approval_required: %Schema{
|
||||
type: :boolean,
|
||||
description: "Whether users need to be manually approved by admin"
|
||||
}
|
||||
}
|
||||
},
|
||||
configuration: %Schema{
|
||||
type: :object,
|
||||
description: "Instance configuration",
|
||||
properties: %{
|
||||
urls: %Schema{
|
||||
type: :object,
|
||||
properties: %{
|
||||
streaming: %Schema{
|
||||
type: :string,
|
||||
description: "Websockets address for push streaming"
|
||||
}
|
||||
}
|
||||
},
|
||||
statuses: %Schema{
|
||||
type: :object,
|
||||
description: "A map with poll limits for local statuses",
|
||||
properties: %{
|
||||
max_characters: %Schema{
|
||||
type: :integer,
|
||||
description: "Posts character limit (CW/Subject included in the counter)"
|
||||
},
|
||||
max_media_attachments: %Schema{
|
||||
type: :integer,
|
||||
description: "Media attachment limit"
|
||||
}
|
||||
}
|
||||
},
|
||||
media_attachments: %Schema{
|
||||
type: :object,
|
||||
description: "A map with poll limits for media attachments",
|
||||
properties: %{
|
||||
image_size_limit: %Schema{
|
||||
type: :integer,
|
||||
description: "File size limit of uploaded images"
|
||||
},
|
||||
video_size_limit: %Schema{
|
||||
type: :integer,
|
||||
description: "File size limit of uploaded videos"
|
||||
}
|
||||
}
|
||||
},
|
||||
polls: %Schema{
|
||||
type: :object,
|
||||
description: "A map with poll limits for local polls",
|
||||
properties: %{
|
||||
max_options: %Schema{
|
||||
type: :integer,
|
||||
description: "Maximum number of options."
|
||||
},
|
||||
max_characters_per_option: %Schema{
|
||||
type: :integer,
|
||||
description: "Maximum number of characters per option."
|
||||
},
|
||||
min_expiration: %Schema{
|
||||
type: :integer,
|
||||
description: "Minimum expiration time (in seconds)."
|
||||
},
|
||||
max_expiration: %Schema{
|
||||
type: :integer,
|
||||
description: "Maximum expiration time (in seconds)."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
defp array_of_domains do
|
||||
%Schema{
|
||||
type: :array,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue