-
Notifications
You must be signed in to change notification settings - Fork 3
/
doc.go
39 lines (39 loc) · 1.03 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Package nasa provides Go structs and functions for accessing the NASA API
//
// Queries are made with Go types as arguments and responses returned as valid Go types.
// For best experience, grap NASA API key from api.nasa.gov and set it to the environment variable NASAKEY
// export NASAKEY=Your-NASA-API_KEY
//
// Example Usage
//
// package main
//
// import (
// "fmt"
// "log"
// "time"
//
// "github.com/peteretelej/nasa"
// )
//
// func main() {
// apod, err := nasa.ApodImage(time.Now())
// handle(err)
// fmt.Println(apod)
//
// // apod has structure of nasa.Image, hence get details with:
// // apod.Date, apod.Title, apod.Explanation, apod.URL, apod.HDURL etc
// fmt.Printf("Today's APOD is %s, available at %s", apod.Title, apod.HDURL)
//
// lastweek := time.Now().Add(-(7 * 24 * time.Hour))
// apod, err = nasa.ApodImage(lastweek)
// handle(err)
// fmt.Printf("APOD for 1 week ago:\n%s\n", apod)
// }
// func handle(err error) {
// if err != nil {
// log.Fatal(err)
// }
// }
//
package nasa