apod

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeMessage added in v0.5.2

func MakeMessage(data *nasaapod.Response) string

Types

type APOD

type APOD struct {
	APIKey string `json:"api_key"`
	// contains filtered or unexported fields
}

APOD is configuration for NASA API and APOD

func New

func New(ctx context.Context, path, cacheDir string, logger *log.ZapEventLogger) (*APOD, error)

New functions creates new APOD instance from file.

func Register

func Register(apiKey, cacheDir string, logger *log.ZapEventLogger) *APOD

Register function makes configuration for APOD operations

func (*APOD) Export

func (cfg *APOD) Export(path string) error

Export methods exports configuration to config file.

func (*APOD) Logger

func (cfg *APOD) Logger() *zap.Logger

Logger method returns zap.Logger instance.

func (*APOD) Lookup

func (cfg *APOD) Lookup(ctx context.Context, date values.Date, utcFlag, saveFlag bool) (*nasaapod.Response, error)

Lookup method gets APOD data from cache. If no data in cache, getting from NASA API.

func (*APOD) LookupWithoutCache

func (cfg *APOD) LookupWithoutCache(ctx context.Context, date values.Date, utcFlag, forceFlag bool) (*nasaapod.Response, error)

Lookup method gets APOD data from NASA API and save cache. If exist data in cache, returns ErrExistAPODData error.

Jump to

Keyboard shortcuts

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