diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-12-17 06:46:16 -0800 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-12-17 06:46:16 -0800 |
commit | 28eab815255e437afb7efabf89b84a74fbc6af71 (patch) | |
tree | 5b46cbc4d9cb615005a437b61609a48e5288056a /addons | |
parent | 547c1bb8d9240ff5a531890bda193ce0a17edff1 (diff) |
adding a new addon "get"
Diffstat (limited to 'addons')
-rw-r--r-- | addons/get/content.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/addons/get/content.go b/addons/get/content.go new file mode 100644 index 0000000..3d16b3a --- /dev/null +++ b/addons/get/content.go @@ -0,0 +1,28 @@ +package get + +import ( + "bytes" + "fmt" + "log" + "net/http" +) + +// ContentAll retrives all items from the HTTP API within the provided namespace +func ContentAll(namespace string) []byte { + endpoint := "http://0.0.0.0:8080/api/contents?type=" + buf := []byte{} + r := bytes.NewReader(buf) + req, err := http.NewRequest(http.MethodGet, endpoint+namespace, r) + if err != nil { + log.Println("Error creating request for reference from:", namespace) + return nil + } + + c := http.Client{} + res, err := c.Do(req) + defer res.Body.Close() + + fmt.Println(res, string(buf)) + + return buf +} |