diff --git a/docs/openapi.json b/docs/openapi.json index a648cf5..4255570 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -3692,6 +3692,53 @@ } ] }, + "/users/{username}/avatar": { + "get": { + "tags": [ + "ActivityPub" + ], + "summary": "Profile image", + "description": "The user's profile image, which their actor document names as its `icon`. Only served when the user shares and has chosen to share their image.", + "operationId": "federation_actor_avatar", + "responses": { + "200": { + "description": "A JPEG, PNG or WebP image", + "content": { + "image/*": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "404": { + "description": "Unknown, or not sharing (the two are indistinguishable)" + } + }, + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ] + }, + "parameters": [ + { + "in": "path", + "name": "username", + "required": true, + "schema": { + "type": "string", + "minLength": 1 + } + } + ] + }, "/users/{username}/followers": { "get": { "tags": [ diff --git a/src/scrobbler/federation/openapi.py b/src/scrobbler/federation/openapi.py index 7d109fb..af2b073 100644 --- a/src/scrobbler/federation/openapi.py +++ b/src/scrobbler/federation/openapi.py @@ -130,6 +130,20 @@ _OPERATIONS = { "404": {"description": "Not found, not listed, or deleted"}, }, ), + "federation.actor_avatar": ( + "get", + "Profile image", + "The user's profile image, which their actor document names as its `icon`. Only " + "served when the user shares and has chosen to share their image.", + [_USERNAME], + { + "200": { + "description": "A JPEG, PNG or WebP image", + "content": {"image/*": {"schema": {"type": "string", "format": "binary"}}}, + }, + "404": _NOT_FOUND, + }, + ), "federation.followers": ( "get", "Followers", diff --git a/tests/test_openapi.py b/tests/test_openapi.py index a71b154..61cf0ab 100644 --- a/tests/test_openapi.py +++ b/tests/test_openapi.py @@ -77,6 +77,7 @@ def test_ui_routes_declare_bearer_auth(fed_spec): ("/api/v1/auth/login", "post"), ("/api/v1/auth/register", "post"), ("/api/v1/federation/profiles/{username}", "get"), + ("/api/v1/federation/profiles/{username}/avatar", "get"), ("/api/v1/federation/profiles/{username}/posts/{post_uuid}", "get"), } for path, operations in spec["paths"].items():