Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/helixspiral/apod
Golang wrapper for the Astronomy Picture of the Day API from NASA
https://github.com/helixspiral/apod
api apod apod-api astronomy astronomy-picture astronomy-picture-of-the-day easy-to-use go golang nasa nasa-api nasa-apod nasa-apod-api nasa-astronomy-picture nasa-astronomy-picture-of-the-day nasa-data space space-api wrapper wrapper-api
Last synced: about 1 month ago
JSON representation
Golang wrapper for the Astronomy Picture of the Day API from NASA
- Host: GitHub
- URL: https://github.com/helixspiral/apod
- Owner: HelixSpiral
- License: gpl-3.0
- Created: 2022-02-11T23:48:53.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-11-26T01:03:42.000Z (about 1 month ago)
- Last Synced: 2024-11-26T02:18:22.424Z (about 1 month ago)
- Topics: api, apod, apod-api, astronomy, astronomy-picture, astronomy-picture-of-the-day, easy-to-use, go, golang, nasa, nasa-api, nasa-apod, nasa-apod-api, nasa-astronomy-picture, nasa-astronomy-picture-of-the-day, nasa-data, space, space-api, wrapper, wrapper-api
- Language: Go
- Homepage: https://helixspiral.github.io/posts/2022-02-28-system-scalability-and-microservices/
- Size: 21.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
Astronomy Picture of the Day API Wrapper
---This is a API wrapper written in Golang for the [Astronomy Picture of the Day](https://apod.nasa.gov/apod/astropix.html) service that NASA hosts.
Usage
---Basic date query:
```go
apodInput := &apod.NewAPODInput{
APIKey: "DEMO_KEY",
}Apod := apod.NewAPOD(apodInput)
date, _ := time.Parse("2006-01-02", "2022-02-11")
queryInput := &apod.ApodQueryInput{
Date: date,
}resp, err := Apod.Query(queryInput)
if err != nil {
panic(err)
}fmt.Println(resp)
```You can provide a start and end date, with end date defaulting to the current date
```go
apodInput := &apod.NewAPODInput{
APIKey: "DEMO_KEY",
}Apod := apod.NewAPOD(apodInput)
date, _ := time.Parse("2006-01-02", "2022-02-01")
queryInput := &apod.ApodQueryInput{
StartDate: date,
EndDate: date.Add((time.Hour*24) * 5),
}
resp, err := Apod.Query(queryInput)
if err != nil {
panic(err)
}fmt.Println(resp)
```Providing a count gives you that many random selections
```go
apodInput := &apod.NewAPODInput{
APIKey: "DEMO_KEY",
}Apod := apod.NewAPOD(apodInput)
queryInput := &apod.ApodQueryInput{
Count: 5,
}
resp, err := Apod.Query(queryInput)
if err != nil {
panic(err)
}fmt.Println(resp)
```