Interface IAPI<T extends IMapRouletteObject>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      T create​(T object)
      Creates an object in MapRoulette.
      default T createUpdate​(T object)
      Will create a challenge if it has not already been created.
      boolean delete​(long identifier)
      Deletes an object in MapRoulette based on the provided identifier
      java.util.List<T> find​(java.lang.String matcher, long parent, int limit, int page)
      Finds a list of elements
      boolean forceDelete​(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 name
      T update​(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 object
        name - 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 names
        parent - The parent identifier, use -1 if want to ignore it.
        limit - How many elements to limit the results by
        page - 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 MapRouletteException
        Deletes 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 MapRouletteException
        By 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