client

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AvailabilityResponse

type AvailabilityResponse struct {
	Campsites map[string]*models.Campsite `json:"campsites"`
	Count     int                         `json:"count"`
}

type Client

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

Client is an HTTP client that interacts with the recreation.gov API.

func New

func New(l log15.Logger, timeout time.Duration) *Client

func (*Client) Availability

func (c *Client) Availability(campgroundID string, start, end time.Time) (models.Campsites, error)

func (*Client) Do

func (c *Client) Do(path string, queryParams url.Values) (*http.Response, error)

func (*Client) Poll

func (c *Client) Poll(ctx context.Context, campgroundID string, start, end time.Time, interval time.Duration) (models.Campsites, error)

Poll is a blocking operation. To poll multiple campgrounds call this method in its own goroutine.

func (*Client) SearchByID added in v0.2.0

func (c *Client) SearchByID(campgroundID string) (*models.Campground, error)

func (*Client) Suggest added in v0.2.0

func (c *Client) Suggest(query string) ([]*models.Campground, error)

type SearchResponse

type SearchResponse struct {
	Campgrounds           []*models.Campground `json:"results"`
	Size                  int                  `json:"size"`
	SpellingAutocorrected bool                 `json:"spelling_autocorrected"`
	Start                 string               `json:"start"`
	Total                 int                  `json:"total"`
}

type SuggestResponse added in v0.2.0

type SuggestResponse struct {
	Campgrounds []*models.Campground `json:"inventory_suggestions"`
}

Jump to

Keyboard shortcuts

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