com.arcao.geocaching.api
Class GeocachingApi

java.lang.Object
  extended by com.arcao.geocaching.api.GeocachingApi
Direct Known Subclasses:
LiveGeocachingApi

public abstract class GeocachingApi
extends Object

Abstract class of Geocaching API

Since:
1.0
Author:
arcao

Field Summary
protected  String session
           
 
Constructor Summary
GeocachingApi()
           
 
Method Summary
abstract  void closeSession()
          Close current used session
 CacheLog createFieldNoteAndPublish(FieldNote fieldNote, boolean publish, ImageData imageData, boolean favoriteThisCache)
          Create field note and publish them or store them to list of Field notes on Geocaching site.
abstract  CacheLog createFieldNoteAndPublish(String cacheCode, LogType logType, Date dateLogged, String note, boolean publish, ImageData imageData, boolean favoriteThisCache)
          Create field note and publish them or store them to list of Field notes on Geocaching site.
 Geocache getCache(String cacheCode, int cacheLogCount, int trackableCount)
          Get a full information about cache.
abstract  List<CacheLog> getCacheLogsByCacheCode(String cacheCode, int startIndex, int maxPerPage)
          Get a list of cache logs in given cache.
 SimpleGeocache getCacheSimple(String cacheCode)
          Get a basic information about cache.
abstract  List<SimpleGeocache> getMoreGeocaches(boolean isLite, int startIndex, int maxPerPage, int geocacheLogCount, int trackableLogCount)
           
 String getSession()
          Gets a session id for current logged user
abstract  Trackable getTrackable(String trackableCode, int trackableLogCount)
          Get a trackable object for given trackable code.
abstract  List<Trackable> getTrackablesByCacheCode(String cacheCode, int startIndex, int maxPerPage, int trackableLogCount)
          Get a list of trackables which is currently placed in a cache.
abstract  UserProfile getYourUserProfile(boolean favoritePointData, boolean geocacheData, boolean publicProfileData, boolean souvenirData, boolean trackableData)
          Get a information about user
abstract  boolean isSessionValid()
          Check if current used session is still valid
 void openSession(String session)
          Open a session with giving session id of already logged-in user
abstract  void openSession(String userName, String password)
          Open a new session and log-in user
abstract  List<SimpleGeocache> searchForGeocaches(boolean isLite, int maxPerPage, int geocacheLogCount, int trackableLogCount, Filter[] filters)
          Search for geocaches and return list of found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected String session
Constructor Detail

GeocachingApi

public GeocachingApi()
Method Detail

getSession

public String getSession()
Gets a session id for current logged user

Returns:
session id
Since:
1.0

openSession

public void openSession(String session)
                 throws GeocachingApiException
Open a session with giving session id of already logged-in user

Parameters:
session - session id
Throws:
GeocachingApiException - If Geocaching API error occurs
Since:
1.0

openSession

public abstract void openSession(String userName,
                                 String password)
                          throws GeocachingApiException
Open a new session and log-in user

Parameters:
userName - user name
password - password
Throws:
GeocachingApiException - If Geocaching API error occurs
Since:
1.0

closeSession

public abstract void closeSession()
Close current used session

Since:
1.0

isSessionValid

public abstract boolean isSessionValid()
Check if current used session is still valid

Returns:
true if is valid otherwise false
Since:
1.0

getTrackable

public abstract Trackable getTrackable(String trackableCode,
                                       int trackableLogCount)
                                throws GeocachingApiException
Get a trackable object for given trackable code. This method works for public trackable code and also for private (secret) trackable code.

Parameters:
trackableCode - trackable code
trackableLogCount - count of trackable logs to get
Returns:
information about trackable
Throws:
GeocachingApiException - If error occurs during getting information
Since:
1.1

getTrackablesByCacheCode

public abstract List<Trackable> getTrackablesByCacheCode(String cacheCode,
                                                         int startIndex,
                                                         int maxPerPage,
                                                         int trackableLogCount)
                                                  throws GeocachingApiException
Get a list of trackables which is currently placed in a cache.

Parameters:
cacheCode - cache code
startIndex - count of trackables to skip
maxPerPage - count of trackables to get
trackableLogCount - count of trackable logs to get
Returns:
list of trackables
Throws:
GeocachingApiException - If error occurs during getting information
Since:
1.1

getCacheLogsByCacheCode

public abstract List<CacheLog> getCacheLogsByCacheCode(String cacheCode,
                                                       int startIndex,
                                                       int maxPerPage)
                                                throws GeocachingApiException
Get a list of cache logs in given cache.

Parameters:
cacheCode - cache code
startIndex - count of logs to skip
maxPerPage - count of logs to get
Returns:
list of cache logs
Throws:
GeocachingApiException - If error occurs during getting information
Since:
1.1

getCacheSimple

public SimpleGeocache getCacheSimple(String cacheCode)
                              throws GeocachingApiException
Get a basic information about cache.

Parameters:
cacheCode - cache code
Returns:
basic cache information
Throws:
GeocachingApiException - If error occurs during getting information
Since:
1.0

getCache

public Geocache getCache(String cacheCode,
                         int cacheLogCount,
                         int trackableCount)
                  throws GeocachingApiException
Get a full information about cache.

Parameters:
cacheCode - cache code
cacheLogCount - count of logs to get
trackableCount - count of trackables to get
Returns:
full cache information
Throws:
GeocachingApiException - If error occurs during getting information
Since:
1.0

searchForGeocaches

public abstract List<SimpleGeocache> searchForGeocaches(boolean isLite,
                                                        int maxPerPage,
                                                        int geocacheLogCount,
                                                        int trackableLogCount,
                                                        Filter[] filters)
                                                 throws GeocachingApiException
Search for geocaches and return list of found.

Parameters:
isLite - true if return a basic information about caches or fales for full information about caches
maxPerPage - count of caches to get
geocacheLogCount - count of logs to get
trackableLogCount - count of trackables to get
filters - used filters while searching
Returns:
list of found caches
Throws:
GeocachingApiException - If error occurs during searching caches
Since:
1.1

getMoreGeocaches

public abstract List<SimpleGeocache> getMoreGeocaches(boolean isLite,
                                                      int startIndex,
                                                      int maxPerPage,
                                                      int geocacheLogCount,
                                                      int trackableLogCount)
                                               throws GeocachingApiException
Parameters:
isLite - true if return a basic information about caches or fales for full information about caches
startIndex - count of caches to skip
maxPerPage - count of caches to get
geocacheLogCount - count of caches to get
trackableLogCount - count of trackables to get
Returns:
list of found caches
Throws:
GeocachingApiException - If error occurs during searching caches
Since:
1.1

getYourUserProfile

public abstract UserProfile getYourUserProfile(boolean favoritePointData,
                                               boolean geocacheData,
                                               boolean publicProfileData,
                                               boolean souvenirData,
                                               boolean trackableData)
                                        throws GeocachingApiException
Get a information about user

Parameters:
favoritePointData - include favorites points
geocacheData - include information about caches
publicProfileData - include public profile information
souvenirData - include souvenirs
trackableData - include trackables
Returns:
UserProfile object with selected information
Throws:
GeocachingApiException - If error occurs during getting information
Since:
1.2

createFieldNoteAndPublish

public abstract CacheLog createFieldNoteAndPublish(String cacheCode,
                                                   LogType logType,
                                                   Date dateLogged,
                                                   String note,
                                                   boolean publish,
                                                   ImageData imageData,
                                                   boolean favoriteThisCache)
                                            throws GeocachingApiException
Create field note and publish them or store them to list of Field notes on Geocaching site.

Parameters:
cacheCode - geocache which can own this field note
logType - type of log
dateLogged - when cache was found
note - text of field note
publish - true if publish log to cache or false to add to Field note list on Geocaching site
imageData - data about image to publish together or null to not publish any image
favoriteThisCache - true if add cache to favorite list otherwise false
Returns:
cache log
Throws:
GeocachingApiException - If error occurs during sending field note
Since:
1.1

createFieldNoteAndPublish

public CacheLog createFieldNoteAndPublish(FieldNote fieldNote,
                                          boolean publish,
                                          ImageData imageData,
                                          boolean favoriteThisCache)
                                   throws GeocachingApiException
Create field note and publish them or store them to list of Field notes on Geocaching site.

Parameters:
fieldNote - Field note object
publish - true if publish log to cache or false to add to Field note list on Geocaching site
imageData - data about image to publish together or null to not publish any image
favoriteThisCache - true if add cache to favorite list otherwise false
Returns:
cache log
Throws:
GeocachingApiException - If error occurs during sending field note
Since:
1.1


Copyright © 2012. All Rights Reserved.