Package org.maproulette.client.api
Interface IAPI<T extends IMapRouletteObject>
-
- All Known Implementing Classes:
ChallengeAPI,ProjectAPI,TaskAPI
public interface IAPI<T extends IMapRouletteObject>The service interface
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Tcreate(T object)Creates an object in MapRoulette.default TcreateUpdate(T object)Will create a challenge if it has not already been created.booleandelete(long identifier)Deletes an object in MapRoulette based on the provided identifierjava.util.List<T>find(java.lang.String matcher, long parent, int limit, int page)Finds a list of elementsbooleanforceDelete(long identifier)By default MapRoulette will not actually delete any object, but rather flag the object for deletion.java.util.Optional<T>get(long identifier)Gets the object type associated with the service.java.util.Optional<T>get(long identifier, java.lang.String name)Gets the object type associated with the service based on the object nameTupdate(T object)Updates an object in MapRoulette.
-
-
-
Method Detail
-
get
java.util.Optional<T> get(long identifier, java.lang.String name) throws MapRouletteException
Gets the object type associated with the service based on the object name- Parameters:
identifier- The identifier of parent of the objectname- The name of the object- Returns:
- The object of Optional if not found
- Throws:
MapRouletteException- If there are any exceptions while retrieving the object
-
get
java.util.Optional<T> get(long identifier) throws MapRouletteException
Gets the object type associated with the service.- Parameters:
identifier- The identifier of the object- Returns:
- The object or Optional if not found
- Throws:
MapRouletteException- If there are any exceptions while retrieving the object
-
find
java.util.List<T> find(java.lang.String matcher, long parent, int limit, int page) throws MapRouletteException
Finds a list of elements- Parameters:
matcher- A string query to match based on namesparent- The parent identifier, use -1 if want to ignore it.limit- How many elements to limit the results bypage- For paging the limited results- Returns:
- A list of elements
- Throws:
MapRouletteException- Any API exceptions
-
create
T create(T object) throws MapRouletteException
Creates an object in MapRoulette. For creation if the object is in the cache it will just respond with the cached object.- Parameters:
object- The object to create of type T- Returns:
- The newly created identifier of the object
- Throws:
MapRouletteException- If there are any exceptions while creating/updating or retrieving the objects
-
update
T update(T object) throws MapRouletteException
Updates an object in MapRoulette.- Parameters:
object- The object to update of type T- Returns:
- Whether the update succeeded or not
- Throws:
MapRouletteException- If there are any exceptions while creating/updating or retrieving the objects
-
createUpdate
default T createUpdate(T object) throws MapRouletteException
Will create a challenge if it has not already been created. This function will also check to see if the object exists first and if it does it will attempt to update it.- Parameters:
object- The object to create or update- Returns:
- The id of the created or updated object
- Throws:
MapRouletteException- If there are any exceptions while creating/updating or retrieving the objects
-
delete
boolean delete(long identifier) throws MapRouletteExceptionDeletes an object in MapRoulette based on the provided identifier- Parameters:
identifier- The identifier for the object to delete- Returns:
- true if object was deleted
- Throws:
MapRouletteException- If there are any exceptions while deleting the object
-
forceDelete
boolean forceDelete(long identifier) throws MapRouletteExceptionBy default MapRoulette will not actually delete any object, but rather flag the object for deletion. This function will add a flag to the URI that will force the deletion of an object.- Parameters:
identifier- The identifier for the object to delete- Returns:
- true if object was deleted
- Throws:
MapRouletteException- if there are any exceptions while deleting the object
-
-