Class ModuleLocales.Async

  • Enclosing class:
    ModuleLocales

    public class ModuleLocales.Async
    extends java.lang.Object
    Handler for asynchronous requests.
    • Constructor Detail

      • Async

        public Async()
    • Method Detail

      • fetchOne

        public CMACallback<CMALocale> fetchOne​(java.lang.String spaceId,
                                               java.lang.String environmentId,
                                               java.lang.String localeId,
                                               CMACallback<CMALocale> callback)
        Fetches one locale by its id and the given space and environment, asynchronously.

        This method will override the configuration specified through CMAClient.Builder.setSpaceId(String) and CMAClient.Builder.setEnvironmentId(String).

        Parameters:
        spaceId - the space the given environment is hosted in.
        environmentId - the environment this locale is hosted in.
        localeId - the id of the locale to be found.
        callback - a callback to be called, once the results are present.
        Returns:
        a callback handling the response.
        Throws:
        java.lang.IllegalArgumentException - if space id is null.
        java.lang.IllegalArgumentException - if locale id is null.
        See Also:
        ModuleLocales.fetchOne(String, String, String)
      • update

        public CMACallback<CMALocale> update​(CMALocale locale,
                                             CMACallback<CMALocale> callback)
        Update the given locale instance on Contentful, asynchronously.

        Please make sure that the instance provided is fetched from Contentful. Otherwise you will get an exception thrown.

        Parameters:
        locale - the locale fetched from Contentful, updated by caller, to be updated.
        callback - a callback to be called, once the results are present.
        Returns:
        the updated locale callback.
        Throws:
        java.lang.IllegalArgumentException - if space id is null.
        java.lang.IllegalArgumentException - if locale is null.
        java.lang.IllegalArgumentException - if locale id is null.
        java.lang.IllegalArgumentException - if locale does not have a version attached.
        See Also:
        ModuleLocales.update(CMALocale)
      • delete

        public CMACallback<java.lang.Integer> delete​(CMALocale locale,
                                                     CMACallback<java.lang.Integer> callback)
        Delete the given locale instance asynchronously.

        Please make sure that the instance provided is fetched from Contentful. Otherwise you will get an exception thrown.

        Parameters:
        locale - the locale fetched from Contentful, updated by caller, to be deleted.
        callback - a callback to be called, once the results are present.
        Returns:
        a callback for asynchronous interaction.
        Throws:
        java.lang.IllegalArgumentException - if space id is null.
        java.lang.IllegalArgumentException - if locale id is null.
        See Also:
        ModuleLocales.delete(CMALocale)