summaryrefslogtreecommitdiff
path: root/internal/api/client/accounts
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-11-27 14:00:57 +0000
committerLibravatar GitHub <noreply@github.com>2023-11-27 14:00:57 +0000
commit74700cc8034980334e7df466f313287a41d2b8a6 (patch)
tree63ab8912c813eefba8a492e0d0489f4e5fe59446 /internal/api/client/accounts
parent[chore]: Bump codeberg.org/gruf/go-mutexes from 1.3.0 to 1.3.1 (#2387) (diff)
downloadgotosocial-74700cc8034980334e7df466f313287a41d2b8a6.tar.xz
[performance] http response encoding / writing improvements (#2374)
Diffstat (limited to 'internal/api/client/accounts')
-rw-r--r--internal/api/client/accounts/accountcreate.go2
-rw-r--r--internal/api/client/accounts/accountdelete.go4
-rw-r--r--internal/api/client/accounts/accountget.go2
-rw-r--r--internal/api/client/accounts/accountupdate.go2
-rw-r--r--internal/api/client/accounts/accountverify.go2
-rw-r--r--internal/api/client/accounts/block.go2
-rw-r--r--internal/api/client/accounts/follow.go2
-rw-r--r--internal/api/client/accounts/followers.go2
-rw-r--r--internal/api/client/accounts/following.go2
-rw-r--r--internal/api/client/accounts/lists.go2
-rw-r--r--internal/api/client/accounts/lookup.go2
-rw-r--r--internal/api/client/accounts/note.go2
-rw-r--r--internal/api/client/accounts/relationships.go2
-rw-r--r--internal/api/client/accounts/search.go2
-rw-r--r--internal/api/client/accounts/statuses.go3
-rw-r--r--internal/api/client/accounts/unblock.go3
-rw-r--r--internal/api/client/accounts/unfollow.go2
17 files changed, 21 insertions, 17 deletions
diff --git a/internal/api/client/accounts/accountcreate.go b/internal/api/client/accounts/accountcreate.go
index 473000f6d..061c66b57 100644
--- a/internal/api/client/accounts/accountcreate.go
+++ b/internal/api/client/accounts/accountcreate.go
@@ -107,7 +107,7 @@ func (m *Module) AccountCreatePOSTHandler(c *gin.Context) {
return
}
- c.JSON(http.StatusOK, ti)
+ apiutil.JSON(c, http.StatusOK, ti)
}
// validateNormalizeCreateAccount checks through all the necessary prerequisites for creating a new account,
diff --git a/internal/api/client/accounts/accountdelete.go b/internal/api/client/accounts/accountdelete.go
index 242902cab..947634f70 100644
--- a/internal/api/client/accounts/accountdelete.go
+++ b/internal/api/client/accounts/accountdelete.go
@@ -96,5 +96,7 @@ func (m *Module) AccountDeletePOSTHandler(c *gin.Context) {
return
}
- c.JSON(http.StatusAccepted, gin.H{"message": "accepted"})
+ apiutil.JSON(c, http.StatusAccepted, map[string]string{
+ "message": "accepted",
+ })
}
diff --git a/internal/api/client/accounts/accountget.go b/internal/api/client/accounts/accountget.go
index 300efe46e..4c1b66a20 100644
--- a/internal/api/client/accounts/accountget.go
+++ b/internal/api/client/accounts/accountget.go
@@ -90,5 +90,5 @@ func (m *Module) AccountGETHandler(c *gin.Context) {
return
}
- c.JSON(http.StatusOK, acctInfo)
+ apiutil.JSON(c, http.StatusOK, acctInfo)
}
diff --git a/internal/api/client/accounts/accountupdate.go b/internal/api/client/accounts/accountupdate.go
index 9c51f5924..ab731bd7e 100644
--- a/internal/api/client/accounts/accountupdate.go
+++ b/internal/api/client/accounts/accountupdate.go
@@ -170,7 +170,7 @@ func (m *Module) AccountUpdateCredentialsPATCHHandler(c *gin.Context) {
return
}
- c.JSON(http.StatusOK, acctSensitive)
+ apiutil.JSON(c, http.StatusOK, acctSensitive)
}
// fieldsAttributesFormBinding satisfies gin's binding.Binding interface.
diff --git a/internal/api/client/accounts/accountverify.go b/internal/api/client/accounts/accountverify.go
index 97a21e0d8..1799089ab 100644
--- a/internal/api/client/accounts/accountverify.go
+++ b/internal/api/client/accounts/accountverify.go
@@ -73,5 +73,5 @@ func (m *Module) AccountVerifyGETHandler(c *gin.Context) {
return
}
- c.JSON(http.StatusOK, acctSensitive)
+ apiutil.JSON(c, http.StatusOK, acctSensitive)
}
diff --git a/internal/api/client/accounts/block.go b/internal/api/client/accounts/block.go
index ccf781849..24ff099a7 100644
--- a/internal/api/client/accounts/block.go
+++ b/internal/api/client/accounts/block.go
@@ -90,5 +90,5 @@ func (m *Module) AccountBlockPOSTHandler(c *gin.Context) {
return
}
- c.JSON(http.StatusOK, relationship)
+ apiutil.JSON(c, http.StatusOK, relationship)
}
diff --git a/internal/api/client/accounts/follow.go b/internal/api/client/accounts/follow.go
index 260f647cc..2e6e79964 100644
--- a/internal/api/client/accounts/follow.go
+++ b/internal/api/client/accounts/follow.go
@@ -122,5 +122,5 @@ func (m *Module) AccountFollowPOSTHandler(c *gin.Context) {
return
}
- c.JSON(http.StatusOK, relationship)
+ apiutil.JSON(c, http.StatusOK, relationship)
}
diff --git a/internal/api/client/accounts/followers.go b/internal/api/client/accounts/followers.go
index 2448bc50a..bedbcef24 100644
--- a/internal/api/client/accounts/followers.go
+++ b/internal/api/client/accounts/followers.go
@@ -151,5 +151,5 @@ func (m *Module) AccountFollowersGETHandler(c *gin.Context) {
c.Header("Link", resp.LinkHeader)
}
- c.JSON(http.StatusOK, resp.Items)
+ apiutil.JSON(c, http.StatusOK, resp.Items)
}
diff --git a/internal/api/client/accounts/following.go b/internal/api/client/accounts/following.go
index d106d6ea6..9a8e488b2 100644
--- a/internal/api/client/accounts/following.go
+++ b/internal/api/client/accounts/following.go
@@ -151,5 +151,5 @@ func (m *Module) AccountFollowingGETHandler(c *gin.Context) {
c.Header("Link", resp.LinkHeader)
}
- c.JSON(http.StatusOK, resp.Items)
+ apiutil.JSON(c, http.StatusOK, resp.Items)
}
diff --git a/internal/api/client/accounts/lists.go b/internal/api/client/accounts/lists.go
index 4ce1bf729..d42fdd3f9 100644
--- a/internal/api/client/accounts/lists.go
+++ b/internal/api/client/accounts/lists.go
@@ -93,5 +93,5 @@ func (m *Module) AccountListsGETHandler(c *gin.Context) {
return
}
- c.JSON(http.StatusOK, lists)
+ apiutil.JSON(c, http.StatusOK, lists)
}
diff --git a/internal/api/client/accounts/lookup.go b/internal/api/client/accounts/lookup.go
index 4b31ea6cc..f6bd97657 100644
--- a/internal/api/client/accounts/lookup.go
+++ b/internal/api/client/accounts/lookup.go
@@ -89,5 +89,5 @@ func (m *Module) AccountLookupGETHandler(c *gin.Context) {
return
}
- c.JSON(http.StatusOK, account)
+ apiutil.JSON(c, http.StatusOK, account)
}
diff --git a/internal/api/client/accounts/note.go b/internal/api/client/accounts/note.go
index 9a0667875..29ea01c9a 100644
--- a/internal/api/client/accounts/note.go
+++ b/internal/api/client/accounts/note.go
@@ -104,5 +104,5 @@ func (m *Module) AccountNotePOSTHandler(c *gin.Context) {
return
}
- c.JSON(http.StatusOK, relationship)
+ apiutil.JSON(c, http.StatusOK, relationship)
}
diff --git a/internal/api/client/accounts/relationships.go b/internal/api/client/accounts/relationships.go
index 591ae7684..dfe8c1721 100644
--- a/internal/api/client/accounts/relationships.go
+++ b/internal/api/client/accounts/relationships.go
@@ -106,5 +106,5 @@ func (m *Module) AccountRelationshipsGETHandler(c *gin.Context) {
relationships = append(relationships, *r)
}
- c.JSON(http.StatusOK, relationships)
+ apiutil.JSON(c, http.StatusOK, relationships)
}
diff --git a/internal/api/client/accounts/search.go b/internal/api/client/accounts/search.go
index c10fb2960..183fc1347 100644
--- a/internal/api/client/accounts/search.go
+++ b/internal/api/client/accounts/search.go
@@ -162,5 +162,5 @@ func (m *Module) AccountSearchGETHandler(c *gin.Context) {
return
}
- c.JSON(http.StatusOK, results)
+ apiutil.JSON(c, http.StatusOK, results)
}
diff --git a/internal/api/client/accounts/statuses.go b/internal/api/client/accounts/statuses.go
index 867788501..870a96891 100644
--- a/internal/api/client/accounts/statuses.go
+++ b/internal/api/client/accounts/statuses.go
@@ -241,5 +241,6 @@ func (m *Module) AccountStatusesGETHandler(c *gin.Context) {
if resp.LinkHeader != "" {
c.Header("Link", resp.LinkHeader)
}
- c.JSON(http.StatusOK, resp.Items)
+
+ apiutil.JSON(c, http.StatusOK, resp.Items)
}
diff --git a/internal/api/client/accounts/unblock.go b/internal/api/client/accounts/unblock.go
index 882a3b2f1..e8144711e 100644
--- a/internal/api/client/accounts/unblock.go
+++ b/internal/api/client/accounts/unblock.go
@@ -91,5 +91,6 @@ func (m *Module) AccountUnblockPOSTHandler(c *gin.Context) {
return
}
- c.JSON(http.StatusOK, relationship)
+ apiutil.JSON(c, http.StatusOK, relationship)
+
}
diff --git a/internal/api/client/accounts/unfollow.go b/internal/api/client/accounts/unfollow.go
index 4edc9ccea..9eb66aed3 100644
--- a/internal/api/client/accounts/unfollow.go
+++ b/internal/api/client/accounts/unfollow.go
@@ -91,5 +91,5 @@ func (m *Module) AccountUnfollowPOSTHandler(c *gin.Context) {
return
}
- c.JSON(http.StatusOK, relationship)
+ apiutil.JSON(c, http.StatusOK, relationship)
}