summary refs log tree commit diff stats
path: root/pkg/wallhaven/wallhaven.go
blob: 25af77c4f8187cb189ddf70664c9a047bd6444dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
}