summaryrefslogtreecommitdiff
path: root/internal/api/client/instance/instanceget.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-05-09 14:06:06 +0200
committerLibravatar GitHub <noreply@github.com>2021-05-09 14:06:06 +0200
commit3363e0ebdd2ad8bde458037b82432bc3dd93adde (patch)
tree3b105083f75aa47f3872b588403d9e5cf2f45d14 /internal/api/client/instance/instanceget.go
parentLetsencrypt (#17) (diff)
downloadgotosocial-3363e0ebdd2ad8bde458037b82432bc3dd93adde.tar.xz
add api/v1/instance info handler + instance model (#18)
Diffstat (limited to 'internal/api/client/instance/instanceget.go')
-rw-r--r--internal/api/client/instance/instanceget.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/api/client/instance/instanceget.go b/internal/api/client/instance/instanceget.go
new file mode 100644
index 000000000..f8e82c096
--- /dev/null
+++ b/internal/api/client/instance/instanceget.go
@@ -0,0 +1,20 @@
+package instance
+
+import (
+ "net/http"
+
+ "github.com/gin-gonic/gin"
+)
+
+func (m *Module) InstanceInformationGETHandler(c *gin.Context) {
+ l := m.log.WithField("func", "InstanceInformationGETHandler")
+
+ instance, err := m.processor.InstanceGet(m.config.Host)
+ if err != nil {
+ l.Debugf("error getting instance from processor: %s", err)
+ c.JSON(http.StatusInternalServerError, gin.H{"error": "internal server error"})
+ return
+ }
+
+ c.JSON(http.StatusOK, instance)
+}