summaryrefslogtreecommitdiff
path: root/internal/api/client/accounts/accounts.go
diff options
context:
space:
mode:
authorLibravatar Vyr Cossont <VyrCossont@users.noreply.github.com>2024-05-29 03:57:44 -0700
committerLibravatar GitHub <noreply@github.com>2024-05-29 12:57:44 +0200
commit975e92b7f1fb92c2c0475e9ec65fd2521625252c (patch)
tree0621f1f2ed6d1846e1edae6551d5a2e158b758ca /internal/api/client/accounts/accounts.go
parent[feature] Debug admin endpoint to clear caches (#2940) (diff)
downloadgotosocial-975e92b7f1fb92c2c0475e9ec65fd2521625252c.tar.xz
[feature] Implement profile API (#2926)
* Implement profile API This Mastodon 4.2 extension provides capabilities missing from the existing Mastodon account update API: deleting an account's avatar or header. See: https://docs.joinmastodon.org/methods/profile/ * Move profile media methods to media processor * Remove check for moved account
Diffstat (limited to 'internal/api/client/accounts/accounts.go')
-rw-r--r--internal/api/client/accounts/accounts.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/api/client/accounts/accounts.go b/internal/api/client/accounts/accounts.go
index 8b92bd7a5..61fdc41ad 100644
--- a/internal/api/client/accounts/accounts.go
+++ b/internal/api/client/accounts/accounts.go
@@ -56,6 +56,11 @@ const (
MovePath = BasePath + "/move"
AliasPath = BasePath + "/alias"
ThemesPath = BasePath + "/themes"
+
+ // ProfileBasePath for the profile API, an extension of the account update API with a different path.
+ ProfileBasePath = "/v1/profile"
+ AvatarPath = ProfileBasePath + "/avatar"
+ HeaderPath = ProfileBasePath + "/header"
)
type Module struct {
@@ -84,6 +89,10 @@ func (m *Module) Route(attachHandler func(method string, path string, f ...gin.H
// modify account
attachHandler(http.MethodPatch, UpdatePath, m.AccountUpdateCredentialsPATCHHandler)
+ // modify account profile media
+ attachHandler(http.MethodDelete, AvatarPath, m.AccountAvatarDELETEHandler)
+ attachHandler(http.MethodDelete, HeaderPath, m.AccountHeaderDELETEHandler)
+
// get account's statuses
attachHandler(http.MethodGet, StatusesPath, m.AccountStatusesGETHandler)