spacex

package
v0.0.0-...-95589b7 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      error = errors.New("launchpad not found")
	ErrBadStatusCode error = errors.New("invalid status code from spacex")
)

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(opts ...Option) *Client

func (*Client) CheckLaunchConflict

func (c *Client) CheckLaunchConflict(ctx context.Context, launchpadID string, ts time.Time) (bool, error)

func (*Client) GetLaunchPadById

func (c *Client) GetLaunchPadById(ctx context.Context, launchpadID string) (LaunchPad, error)

func (*Client) GetUpcomingLaunchesLaunchPad

func (c *Client) GetUpcomingLaunchesLaunchPad(ctx context.Context, launchpadID string) ([]Launch, error)

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

type Launch

type Launch struct {
	LaunchPadID   string `json:"launchpad"`
	Date          int64  `json:"date_unix"`
	DatePrecision string `json:"date_precision"`
}

func (*Launch) IsDayAvailable

func (l *Launch) IsDayAvailable(t time.Time) (bool, error)

type LaunchPad

type LaunchPad struct {
	Id     string `json:"id"`
	Status string `json:"status"`
}

func (*LaunchPad) IsActive

func (o *LaunchPad) IsActive() bool

type LaunchesResponse

type LaunchesResponse struct {
	Launches []Launch `json:"docs"`
}

type Option

type Option func(*Client)

func WithBaseURL

func WithBaseURL(url string) Option

func WithHTTPClient

func WithHTTPClient(httpClient HTTPClient) Option

type SearchQuery

type SearchQuery struct {
	Query   map[string]interface{} `json:"query"`
	Options map[string]interface{} `json:"options"`
}

Jump to

Keyboard shortcuts

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