Documentation
¶
Overview ¶
Package nasadonki exposes the NASA DONKI space weather API as a kit Domain driver.
A multi-domain host (ant) enables it with a single blank import:
import _ "github.com/tamnd/nasadonki-cli/nasadonki"
The same Domain also builds the standalone donki binary (see cli.NewApp).
Package nasadonki is the library behind the donki command line: the HTTP client, request shaping, and typed data models for NASA's DONKI (Space Weather Database Of Notifications, Knowledge, Information) API (api.nasa.gov/DONKI).
Index ¶
- Constants
- type CME
- type Client
- func (c *Client) CMEs(ctx context.Context, start, end string) ([]CME, error)
- func (c *Client) Flares(ctx context.Context, start, end string) ([]Flare, error)
- func (c *Client) HSSs(ctx context.Context, start, end string) ([]HSS, error)
- func (c *Client) Notifications(ctx context.Context, start, end string) ([]Notification, error)
- func (c *Client) SEPs(ctx context.Context, start, end string) ([]SEP, error)
- type Config
- type Domain
- type Flare
- type HSS
- type Notification
- type SEP
Constants ¶
const Host = "api.nasa.gov"
Host is the API host this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CME ¶
type CME struct {
ID string `json:"id"`
StartTime string `json:"start_time"`
SourceLocation string `json:"source_location"`
Instruments []string `json:"instruments"`
}
CME is a coronal mass ejection event from NASA DONKI.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the NASA DONKI API over HTTP.
func (*Client) Notifications ¶
Notifications fetches all DONKI notifications for a date range.
type Config ¶
type Config struct {
BaseURL string
APIKey string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds all tunable parameters for the Client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Domain ¶
type Domain struct{}
Domain is the nasadonki driver.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type Flare ¶
type Flare struct {
ID string `json:"id"`
BeginTime string `json:"begin_time"`
PeakTime string `json:"peak_time"`
EndTime string `json:"end_time"`
ClassType string `json:"class_type"`
SourceLocation string `json:"source_location"`
LinkedEvents []string `json:"linked_events"`
}
Flare is a solar flare event from NASA DONKI.
type Notification ¶
type Notification struct {
MessageType string `json:"message_type"`
MessageID string `json:"message_id"`
MessageURL string `json:"message_url"`
MessageBody string `json:"message_body"`
MessageIssueTime string `json:"message_issue_time"`
}
Notification is a DONKI alert/notification message.