summary refs log tree commit diff stats
path: root/pkg/nasa
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-03-18 23:04:21 +0530
committerAndinus <andinus@nand.sh>2020-03-18 23:04:21 +0530
commit052140fb3ccd4b386d8d98ba7355d676c1e0693d (patch)
tree13a01d6c98e1e4875b4fba4fc12d67814b2a23d2 /pkg/nasa
parent2f15edf548ec131d2eb97bd5338a1adef768acea (diff)
downloadcetus-052140fb3ccd4b386d8d98ba7355d676c1e0693d.tar.gz
Initial commit for Cetus v0.5.0 v0.5.0
Diffstat (limited to 'pkg/nasa')
-rw-r--r--pkg/nasa/apod.go44
1 files changed, 0 insertions, 44 deletions
diff --git a/pkg/nasa/apod.go b/pkg/nasa/apod.go
deleted file mode 100644
index 606bbdf..0000000
--- a/pkg/nasa/apod.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package nasa
-
-import (
-	"fmt"
-	"math/rand"
-	"regexp"
-	"time"
-
-	"framagit.org/andinus/cetus/pkg/cetus"
-)
-
-// RandDate returns a random date between 1995-06-16 & today
-func RandDate() string {
-	var (
-		min   int64
-		max   int64
-		sec   int64
-		delta int64
-		date  string
-	)
-	min = time.Date(1995, 6, 16, 0, 0, 0, 0, time.UTC).Unix()
-	max = time.Now().UTC().Unix()
-	delta = max - min
-
-	sec = rand.Int63n(delta) + min
-	date = time.Unix(sec, 0).Format("2006-01-02")
-
-	return date
-}
-
-// GetApodJson returns json response received from the api
-func GetApodJson(reqInfo map[string]string, t time.Duration) (string, error) {
-	re := regexp.MustCompile("((19|20)\\d\\d)-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])")
-	if !re.MatchString(reqInfo["date"]) {
-		return "", fmt.Errorf("%s does not match format 'YYYY-MM-DD'", reqInfo["date"])
-	}
-
-	params := make(map[string]string)
-	params["api_key"] = reqInfo["apiKey"]
-	params["date"] = reqInfo["date"]
-
-	body, err := cetus.GetRes(reqInfo["api"], params, t)
-	return string(body), err
-}