Merge branch 'blocked-muted-swagger' into 'develop'
Use separate schemas for muted/blocked accounts lists See merge request pleroma/pleroma!4359
This commit is contained in:
commit
6b8bc3bb4c
3 changed files with 51 additions and 4 deletions
1
changelog.d/blocked-muted-swagger.change
Normal file
1
changelog.d/blocked-muted-swagger.change
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Use separate schemas for muted/blocked accounts lists
|
||||||
|
|
@ -483,7 +483,7 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
|
||||||
security: [%{"oAuth" => ["follow", "read:mutes"]}],
|
security: [%{"oAuth" => ["follow", "read:mutes"]}],
|
||||||
parameters: [with_relationships_param() | pagination_params()],
|
parameters: [with_relationships_param() | pagination_params()],
|
||||||
responses: %{
|
responses: %{
|
||||||
200 => Operation.response("Accounts", "application/json", array_of_accounts())
|
200 => Operation.response("Accounts", "application/json", array_of_muted_accounts())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
@ -497,7 +497,7 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
|
||||||
security: [%{"oAuth" => ["read:blocks"]}],
|
security: [%{"oAuth" => ["read:blocks"]}],
|
||||||
parameters: [with_relationships_param() | pagination_params()],
|
parameters: [with_relationships_param() | pagination_params()],
|
||||||
responses: %{
|
responses: %{
|
||||||
200 => Operation.response("Accounts", "application/json", array_of_accounts())
|
200 => Operation.response("Accounts", "application/json", array_of_blocked_accounts())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
@ -897,6 +897,54 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def array_of_muted_accounts do
|
||||||
|
%Schema{
|
||||||
|
title: "ArrayOfMutedAccounts",
|
||||||
|
type: :array,
|
||||||
|
items: %Schema{
|
||||||
|
title: "MutedAccount",
|
||||||
|
description: "Response schema for a muted account",
|
||||||
|
allOf: [
|
||||||
|
Account,
|
||||||
|
%Schema{
|
||||||
|
type: :object,
|
||||||
|
properties: %{
|
||||||
|
mute_expires_at: %Schema{type: :string, format: "date-time", nullable: true}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
example: [
|
||||||
|
Account.schema().example
|
||||||
|
|> Map.put("mute_expires_at", "2025-11-29T16:23:13Z")
|
||||||
|
]
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def array_of_blocked_accounts do
|
||||||
|
%Schema{
|
||||||
|
title: "ArrayOfBlockedAccounts",
|
||||||
|
type: :array,
|
||||||
|
items: %Schema{
|
||||||
|
title: "BlockedAccount",
|
||||||
|
description: "Response schema for a blocked account",
|
||||||
|
allOf: [
|
||||||
|
Account,
|
||||||
|
%Schema{
|
||||||
|
type: :object,
|
||||||
|
properties: %{
|
||||||
|
block_expires_at: %Schema{type: :string, format: "date-time", nullable: true}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
example: [
|
||||||
|
Account.schema().example
|
||||||
|
|> Map.put("block_expires_at", "2025-11-29T16:23:13Z")
|
||||||
|
]
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
defp array_of_relationships do
|
defp array_of_relationships do
|
||||||
%Schema{
|
%Schema{
|
||||||
title: "ArrayOfRelationships",
|
title: "ArrayOfRelationships",
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,6 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do
|
||||||
header: %Schema{type: :string, format: :uri},
|
header: %Schema{type: :string, format: :uri},
|
||||||
id: FlakeID,
|
id: FlakeID,
|
||||||
locked: %Schema{type: :boolean},
|
locked: %Schema{type: :boolean},
|
||||||
mute_expires_at: %Schema{type: :string, format: "date-time", nullable: true},
|
|
||||||
block_expires_at: %Schema{type: :string, format: "date-time", nullable: true},
|
|
||||||
note: %Schema{type: :string, format: :html},
|
note: %Schema{type: :string, format: :html},
|
||||||
statuses_count: %Schema{type: :integer},
|
statuses_count: %Schema{type: :integer},
|
||||||
url: %Schema{type: :string, format: :uri},
|
url: %Schema{type: :string, format: :uri},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue