geocaching

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2025 License: GPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConfig

type APIConfig struct {
	// The URL of the Geocaching API.
	GeocachingAPIURL string
	HTTPProxyURL     string
	UnThrottle       bool // Should we disable rate-limiting for this API?
}

type Attribute added in v0.2.5

type Attribute int
const (
	Dogs                  Attribute = 1
	AccessOrParkingFee    Attribute = 2
	ClimbingGear          Attribute = 3
	Boat                  Attribute = 4
	ScubaGear             Attribute = 5
	RecommendedForKids    Attribute = 6
	TakesLessThanAnHour   Attribute = 7
	ScenicView            Attribute = 8
	SignificantHike       Attribute = 9
	DifficultClimbing     Attribute = 10
	MayRequireWading      Attribute = 11
	MayRequireSwimming    Attribute = 12
	AvailableAtAllTimes   Attribute = 13
	RecommendedAtNight    Attribute = 14
	AvailableDuringWinter Attribute = 15
	CactiNearby           Attribute = 16
	PoisonPlants          Attribute = 17
	DangerousAnimals      Attribute = 18
	Ticks                 Attribute = 19
	AbandonedMines        Attribute = 20
	CliffsFallingRocks    Attribute = 21
	Hunting               Attribute = 22
	DangerousArea         Attribute = 23
	WheelchairAccessible  Attribute = 24
	ParkingAvailable      Attribute = 25
	PublicTransportation  Attribute = 26
	DrinkingWaterNearby   Attribute = 27
	PublicRestroomsNearby Attribute = 28
	TelephoneNearby       Attribute = 29
	PicnicTablesNearby    Attribute = 30
	CampingAvailable      Attribute = 31
	Bicycles              Attribute = 32
	Motorcycles           Attribute = 33
	Quads                 Attribute = 34
	OffRoadVehicles       Attribute = 35
	Snowmobiles           Attribute = 36
	Horses                Attribute = 37
	Campfires             Attribute = 38
	Thorns                Attribute = 39
	StealthRequired       Attribute = 40
	StrollerAccessible    Attribute = 41
	NeedsMaintenance      Attribute = 42
	WatchForLivestock     Attribute = 43
	FlashlightRequired    Attribute = 44
	LostAndFoundTour      Attribute = 45
	TruckDriverRV         Attribute = 46
	FieldPuzzle           Attribute = 47
	UVLightRequired       Attribute = 48
	Snowshoes             Attribute = 49
	CrossCountrySkis      Attribute = 50
	SpecialToolRequired   Attribute = 51
	NightCache            Attribute = 52
	ParkAndGrab           Attribute = 53
	AbandonedStructure    Attribute = 54
	ShortHike             Attribute = 55
	MediumHike            Attribute = 56
	LongHike              Attribute = 57
	FuelNearby            Attribute = 58
	FoodNearby            Attribute = 59
	WirelessBeacon        Attribute = 60
	PartnershipCache      Attribute = 61
	SeasonalAccess        Attribute = 62
	TouristFriendly       Attribute = 63
	TreeClimbing          Attribute = 64
	FrontYard             Attribute = 65
	TeamworkRequired      Attribute = 66
	GeoTour               Attribute = 67
	BonusCache            Attribute = 69
	PowerTrail            Attribute = 70
	ChallengeCache        Attribute = 71
	SolutionChecker       Attribute = 72
)

type CacheSize added in v0.2.5

type CacheSize int
const (
	NotChosen   CacheSize = 1
	Micro       CacheSize = 2
	Regular     CacheSize = 3
	Large       CacheSize = 4
	VirtualSize CacheSize = 5
	Other       CacheSize = 6
	Small       CacheSize = 8
)

type CacheType added in v0.2.5

type CacheType int
const (
	Traditional    CacheType = 2
	Multi          CacheType = 3
	Virtual        CacheType = 4
	Letterbox      CacheType = 5
	Event          CacheType = 6
	Unknown        CacheType = 8
	APE            CacheType = 9
	Webcam         CacheType = 11
	Locationless   CacheType = 12
	CITO           CacheType = 13
	Earthcache     CacheType = 137
	Mega           CacheType = 453
	GPSMaze        CacheType = 1304
	Wherigo        CacheType = 1858
	CommunityEvent CacheType = 3653
	HQCache        CacheType = 3773
	HQCelebration  CacheType = 3774
	BlockParty     CacheType = 4738
	Giga           CacheType = 7005
)

type Difficulty added in v0.2.5

type Difficulty float32
const (
	Difficulty1   Difficulty = 1.0
	Difficulty1_5 Difficulty = 1.5
	Difficulty2   Difficulty = 2.0
	Difficulty2_5 Difficulty = 2.5
	Difficulty3   Difficulty = 3.0
	Difficulty3_5 Difficulty = 3.5
	Difficulty4   Difficulty = 4.0
	Difficulty4_5 Difficulty = 4.5
	Difficulty5   Difficulty = 5.0
)

type Geocache

type Geocache struct {
	ID                       int                  `json:"id" fake:"{number:1,100000}"`
	Name                     string               `json:"name" fake:"{loremipsumword:1}"`
	Code                     string               `json:"code" fake:"{regex:GC[1-9]{5}}"` // GC12345
	PremiumOnly              bool                 `json:"premiumOnly" fake:"{bool}"`
	FavoritePoints           int                  `json:"favoritePoints" fake:"{number:1,1000}"`
	GeocacheType             int                  `json:"geocacheType" fake:"{number:1,10}"`
	ContainerType            int                  `json:"containerType" fake:"{number:1,10}"`
	Difficulty               float64              `json:"difficulty" fake:"{number:1,5}"`
	Terrain                  float64              `json:"terrain" fake:"{number:1,5}"`
	UserFound                bool                 `json:"userFound" fake:"{bool}"`
	CacheStatus              int                  `json:"cacheStatus" fake:"{number:1,10}"`
	PostedCoordinates        GeocacheCoordinates  `json:"postedCoordinates"`
	UserCorrectedCoordinates GeocacheCoordinates  `json:"userCorrectedCoordinates"`
	DetailsURL               string               `json:"detailsUrl" fake:"{url}"`
	HasGeotour               bool                 `json:"hasGeotour" fake:"{bool}"`
	PlacedDate               string               `json:"placedDate" fake:"{date}"`
	Owner                    GeocacheOwner        `json:"owner"`
	LastFoundDate            string               `json:"lastFoundDate" fake:"{date}"`
	TrackableCount           int                  `json:"trackableCount" fake:"{number:1,100}"`
	Region                   string               `json:"region" fake:"{city}"`
	Country                  string               `json:"country" fake:"{country}"`
	Attributes               []GeocacheAttributes `json:"attributes"`
	HasCallerNote            bool                 `json:"hasCallerNote" fake:"{bool}"`
	Distance                 string               `json:"distance" fake:"{number:1,100}"`
	Bearing                  string               `json:"bearing" fake:"{number:1,100}"`

	LastFoundTime time.Time // This is a parsed version of LastFoundDate
	GUID          string    `fake:"{UUID}"` // We read this ourselves from the geocache's page
}

type GeocacheAttributes

type GeocacheAttributes struct {
	ID           int    `json:"id" fake:"{number:1,100}"`
	Name         string `json:"name" fake:"{loremipsumword:1}"`
	IsApplicable bool   `json:"isApplicable" fake:"{bool}"`
}

type GeocacheCoordinates added in v0.2.5

type GeocacheCoordinates struct {
	Latitude  float64 `json:"latitude" fake:"{number:1,180}"`
	Longitude float64 `json:"longitude" fake:"{number:1,180}"`
}

type GeocacheLog

type GeocacheLog struct {
	LogID               int    `json:"LogID"`
	CacheID             int    `json:"CacheID"`
	LogGUID             string `json:"LogGuid"`
	Latitude            any    `json:"Latitude"`
	Longitude           any    `json:"Longitude"`
	LatLonString        string `json:"LatLonString"`
	LogTypeID           int    `json:"LogTypeID"`
	LogType             string `json:"LogType"`
	LogTypeImage        string `json:"LogTypeImage"`
	LogText             string `json:"LogText"`
	Created             string `json:"Created"`
	Visited             string `json:"Visited"`
	UserName            string `json:"UserName"`
	MembershipLevel     int    `json:"MembershipLevel"`
	AccountID           int    `json:"AccountID"`
	AccountGUID         string `json:"AccountGuid"`
	Email               string `json:"Email"`
	AvatarImage         string `json:"AvatarImage"`
	GeocacheFindCount   int    `json:"GeocacheFindCount"`
	GeocacheHideCount   int    `json:"GeocacheHideCount"`
	ChallengesCompleted int    `json:"ChallengesCompleted"`
	IsEncoded           bool   `json:"IsEncoded"`
	Creator             struct {
		GroupTitle    string `json:"GroupTitle"`
		GroupImageURL string `json:"GroupImageUrl"`
	} `json:"creator"`
	Images []any `json:"Images"`
}

type GeocacheLogSearchResponse

type GeocacheLogSearchResponse struct {
	Status   string        `json:"status"`
	Data     []GeocacheLog `json:"data"`
	PageInfo struct {
		Idx        int `json:"idx"`
		Size       int `json:"size"`
		TotalRows  int `json:"totalRows"`
		TotalPages int `json:"totalPages"`
		Rows       int `json:"rows"`
	} `json:"pageInfo"`
}

type GeocacheOwner

type GeocacheOwner struct {
	Code     string `json:"code" fake:"{regex:GC[1-9]{5}}"`
	Username string `json:"username" fake:"{username}"`
}

type GeocacheSearchResponse

type GeocacheSearchResponse struct {
	Results []Geocache `json:"results"`
	Total   int        `json:"total"`
}

type GeocachingAPI

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

func NewGeocachingAPI

func NewGeocachingAPI(c APIConfig) (*GeocachingAPI, error)

func (*GeocachingAPI) GetCacheNoteForGeocache added in v0.2.5

func (g *GeocachingAPI) GetCacheNoteForGeocache(geocache Geocache) (string, error)

GetCacheNoteForGeocache fetches the contents of the <div id="srOnlyCacheNote">...</div> for a given geocache.

func (*GeocachingAPI) GetGUIDForGeocache

func (g *GeocachingAPI) GetGUIDForGeocache(geocache *Geocache) error

This sets the GUID field on the geocache.

func (*GeocachingAPI) GetLogs

func (g *GeocachingAPI) GetLogs(geocache *Geocache) ([]GeocacheLog, error)

func (*GeocachingAPI) SanitiseLogText

func (g *GeocachingAPI) SanitiseLogText(text string) (result string)

func (*GeocachingAPI) Search

func (g *GeocachingAPI) Search(st SearchTerms) ([]Geocache, error)

This finds all geocaches

type OriginType added in v0.2.5

type OriginType string
const (
	City           OriginType = "city"
	Region         OriginType = "region"
	Country        OriginType = "country"
	GeocacheOrigin OriginType = "geocache"
	Coords         OriginType = "coords"
	Query          OriginType = "query"
)

type RLHTTPClient

type RLHTTPClient struct {
	Ratelimiter *rate.Limiter
	// contains filtered or unexported fields
}

RLHTTPClient Rate Limited HTTP Client

func (*RLHTTPClient) Do

func (c *RLHTTPClient) Do(req *http.Request) (*http.Response, error)

Do dispatches the HTTP request to the network

type SearchTerms

type SearchTerms struct {
	Latitude       float32      `json:"lat,omitempty"`
	Longitude      float32      `json:"lon,omitempty"`
	RadiusMeters   int          `json:"r,omitempty"`
	IgnorePremium  bool         // deprecated: use ShowPremium
	ShowPremium    *bool        `json:"sp,omitempty"`
	ShowDisabled   *bool        `json:"sd,omitempty"`
	ShowArchived   *bool        `json:"sa,omitempty"`
	SearchTerm     string       `json:"st,omitempty"`
	SortAsc        *bool        `json:"asc,omitempty"`
	OriginType     OriginType   `json:"op,omitempty"`
	OriginID       string       `json:"oid,omitempty"`
	HideOwned      *bool        `json:"ho,omitempty"`
	HideFound      *bool        `json:"hf,omitempty"`
	FillGrid       []string     `json:"m,omitempty"`
	NotFoundBy     []string     `json:"nfb,omitempty"`
	CacheName      string       `json:"cn,omitempty"`
	CacheSize      []CacheSize  `json:"cs,omitempty"`
	CacheType      []CacheType  `json:"ct,omitempty"`
	Difficulty     []Difficulty `json:"d,omitempty"`
	Terrain        []Terrain    `json:"t,omitempty"`
	FoundAfter     string       `json:"fad,omitempty"`
	FoundBefore    string       `json:"fbd,omitempty"`
	FoundEnd       string       `json:"fed,omitempty"`
	FoundStart     string       `json:"fsd,omitempty"`
	FoundOn        string       `json:"fod,omitempty"`
	PlacedAfter    string       `json:"pad,omitempty"`
	PlacedBefore   string       `json:"pbd,omitempty"`
	PlacedEnd      string       `json:"ped,omitempty"`
	PlacedStart    string       `json:"psd,omitempty"`
	PlacedOn       string       `json:"pod,omitempty"`
	FoundBy        []string     `json:"fb,omitempty"`
	HiddenBy       string       `json:"hb,omitempty"`
	Attributes     []Attribute  `json:"att,omitempty"`
	Sort           SortType     `json:"sort,omitempty"`
	Corrected      *bool        `json:"cc,omitempty"`
	FavouriteCount int          `json:"fp,omitempty"`
	PersonalNote   *bool        `json:"pn,omitempty"`
}

type SortType added in v0.2.5

type SortType string
const (
	Distance       SortType = "distance"
	GeocacheName   SortType = "geocacheName"
	FavouritePoint SortType = "favoritePoint"
	ContainerSize  SortType = "containerSize"
	DifficultySort SortType = "difficulty"
	TerrainSort    SortType = "terrain"
	TrackableCount SortType = "trackableCount"
	FoundDate      SortType = "foundDate"
	PlacedDate     SortType = "placedDate"
)

type Terrain added in v0.2.5

type Terrain float32
const (
	Terrain1   Terrain = 1.0
	Terrain1_5 Terrain = 1.5
	Terrain2   Terrain = 2.0
	Terrain2_5 Terrain = 2.5
	Terrain3   Terrain = 3.0
	Terrain3_5 Terrain = 3.5
	Terrain4   Terrain = 4.0
	Terrain4_5 Terrain = 4.5
	Terrain5   Terrain = 5.0
)

Jump to

Keyboard shortcuts

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