summary refs log tree commit diff stats
path: root/pkg/wallhaven
diff options
context:
space:
mode:
authorAndinus <andinus@inventati.org>2020-03-16 04:00:15 +0530
committerAndinus <andinus@inventati.org>2020-03-16 04:00:15 +0530
commit4e85eb3c7cb9d9edf3161f3efaa9031860514b92 (patch)
treef612951920a792bf73982233082269604f96e37c /pkg/wallhaven
parent799b7030fc6e2d5f6de4181948a308a1ae36c0ef (diff)
downloadcetus-4e85eb3c7cb9d9edf3161f3efaa9031860514b92.tar.gz
Add Wallhaven support
Diffstat (limited to 'pkg/wallhaven')
-rw-r--r--pkg/wallhaven/wallhaven.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/pkg/wallhaven/wallhaven.go b/pkg/wallhaven/wallhaven.go
new file mode 100644
index 0000000..25af77c
--- /dev/null
+++ b/pkg/wallhaven/wallhaven.go
@@ -0,0 +1,20 @@
+package wallhaven
+
+import (
+	"time"
+
+	"framagit.org/andinus/cetus/pkg/cetus"
+)
+
+// GetWhJson returns json response received from the api
+func GetWhJson(reqInfo map[string]string, t time.Duration) (string, error) {
+	params := make(map[string]string)
+	params["apikey"] = reqInfo["apiKey"]
+	if reqInfo["random"] == "true" {
+		params["sorting"] = "random"
+
+	}
+
+	body, err := cetus.GetRes(reqInfo["api"], params, t)
+	return string(body), err
+}