client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CapabilityFeedMETARs uint = 1 << 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Type    string         `json:"type"`
	Message string         `json:"message"`
	Details map[string]any `json:"details"`
}

APIError represents a single error present in an APIErrorResponse

type APIErrorResponse

type APIErrorResponse struct {
	Status int         `json:"status"`
	Errors []*APIError `json:"errors"`
}

APIErrorResponse represents an error response following the error structure of the data server

func (*APIErrorResponse) Error

func (resp *APIErrorResponse) Error() string

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents the data API client to use for feeding

func New

func New(address, key string) *Client

New creates a new data API client

func (*Client) FeedMETARs

func (client *Client) FeedMETARs(metars []string) ([]int, error)

FeedMETARs feeds METARs into the data server

func (*Client) FeedMETARsRelaxed

func (client *Client) FeedMETARsRelaxed(metars []string) error

FeedMETARsRelaxed works the same as FeedMETARs with the exception that it simply skips METARs with an invalid format

func (*Client) GetKeyInfo

func (client *Client) GetKeyInfo() (*KeyInfo, error)

GetKeyInfo retrieves the KeyInfo about the currently used API key

type KeyInfo

type KeyInfo struct {
	Quota        int64 `json:"quota"`
	RateLimit    int   `json:"rate_limit"`
	Capabilities uint  `json:"capabilities"`
}

KeyInfo represents the important information of a data API key

Jump to

Keyboard shortcuts

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