aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2022-03-31 08:59:14 -0500
committerAnthony Wang2022-03-31 09:02:56 -0500
commitc9517a2a3aaf20ee3b9d64f4aee6097c54055047 (patch)
tree25c018428e2a2a124b68b1510ec7880517c29c1b
parent7ea5e108a58540a07390a26d40d9e36db8781ec2 (diff)
Add API path for outbox
-rw-r--r--routers/api/v1/activitypub/person.go23
-rw-r--r--routers/api/v1/api.go1
-rw-r--r--templates/swagger/v1_json.tmpl30
3 files changed, 51 insertions, 3 deletions
diff --git a/routers/api/v1/activitypub/person.go b/routers/api/v1/activitypub/person.go
index 4be076a9c..3d9c9b0bb 100644
--- a/routers/api/v1/activitypub/person.go
+++ b/routers/api/v1/activitypub/person.go
@@ -109,8 +109,29 @@ func PersonInbox(ctx *context.APIContext) {
// required: true
// responses:
// responses:
- // "204":
+ // "200":
// "$ref": "#/responses/empty"
ctx.Status(http.StatusNoContent)
}
+
+// PersonOutbox function
+func PersonOutbox(ctx *context.APIContext) {
+ // swagger:operation GET /activitypub/user/{username}/outbox activitypub activitypubPersonOutbox
+ // ---
+ // summary: Returns the outbox
+ // produces:
+ // - application/json
+ // parameters:
+ // - name: username
+ // in: path
+ // description: username of the user
+ // type: string
+ // required: true
+ // responses:
+ // responses:
+ // "200":
+ // "$ref": "#/responses/empty"
+
+ ctx.Status(http.StatusNoContent)
+} \ No newline at end of file
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index fb1af75ec..ea0109bfe 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -601,6 +601,7 @@ func Routes(sessioner func(http.Handler) http.Handler) *web.Route {
m.Group("/activitypub", func() {
m.Get("/user/{username}", activitypub.Person)
m.Post("/user/{username}/inbox", activitypub.ReqSignature(), activitypub.PersonInbox)
+ m.Get("/user/{username}/outbox", activitypub.ReqSignature(), activitypub.PersonOutbox)
})
}
m.Get("/signing-key.gpg", misc.SigningKey)
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl
index c068612f5..fdefee778 100644
--- a/templates/swagger/v1_json.tmpl
+++ b/templates/swagger/v1_json.tmpl
@@ -69,8 +69,34 @@
}
],
"responses": {
- "204": {
- "$ref": "#/responses/empty"
+ "200": {
+ "$ref": "#/responses/ActivityPub"
+ }
+ }
+ }
+ },
+ "/activitypub/user/{username}/outbox": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "activitypub"
+ ],
+ "summary": "Returns the outbox",
+ "operationId": "activitypubPersonOutbox",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "username of the user",
+ "name": "username",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/ActivityPub"
}
}
}