open_notify

package module
v0.0.0-...-b24db5c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2023 License: MIT Imports: 5 Imported by: 0

README

Open Notify API - Go

Open Nofity API client for Go

Open Notify is an open source project to provide a simple programming interface for some of NASA’s awesome data.

For other languages, see Open Notify API clients

Installation


Examples

Number of People in Space:

ppl, err := GetPeopleInSpace()
fmt.Println("People in space right now:")
for _, v := range ppl.People {
    fmt.Printf("Craft: %s, Name: %s\n", v.Craft, v.Name)
}
fmt.Printf("Number of people in space: %d\n", ppl.Number)

Current Location of the International Space Station:

iss, err := GetISSLocation()
fmt.Println("current location of ISS:")
fmt.Printf("latitude: %f\n", iss.Location.Latitude)
fmt.Printf("longitude: %f\n", iss.Location.Longitude)

References

Open Notify Website

Official API documentation

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var URLS = struct{ PEOPLE, ISS_NOW string }{
	"http://api.open-notify.org/astros.json",
	"http://api.open-notify.org/iss-now.json",
}

Functions

This section is empty.

Types

type ISSLocation

type ISSLocation struct {
	Message  string
	DateTime time.Time
	Location struct {
		Latitude  float64
		Longitude float64
	}
}

func GetISSLocation

func GetISSLocation() (*ISSLocation, error)

Gets the current location of ISS (International Space Station)

type PeopleInSpace

type PeopleInSpace struct {
	Number  uint   `json:"number"`
	Message string `json:"message"`
	People  []struct {
		Name  string `json:"name"`
		Craft string `json:"craft"`
	} `json:"people"`
}

func GetPeopleInSpace

func GetPeopleInSpace() (*PeopleInSpace, error)

Get the current number of people in space. It also returns the names and spacecraft those people are on.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL