Class CDAClient


  • public class CDAClient
    extends java.lang.Object
    Client to be used when requesting information from the Delivery API. Every client is associated with exactly one Space, but there is no limit to the concurrent number of clients existing at any one time. Avoid creating multiple clients for the same Space. Use builder() to create a new client instance.
    • Method Detail

      • populateContentTypeCache

        public int populateContentTypeCache()
        Populate the content type cache with _all_ available content types.

        This method will run through all the content types, saving them in the process and also takes care of paging.

        This method is synchronous.

        Returns:
        the number of content types cached.
      • populateContentTypeCache

        public int populateContentTypeCache​(int limit)
        Populate the content type cache with _all_ available content types.

        This method is synchronous.

        Parameters:
        limit - the number of content types per page.
        Returns:
        the number of content types cached.
        Throws:
        java.lang.IllegalArgumentException - if limit is less or equal to 0.
        java.lang.IllegalArgumentException - if limit is more then 1_000.
        See Also:
        populateContentTypeCache()
      • observeContentTypeCachePopulation

        public io.reactivex.rxjava3.core.Flowable<java.lang.Integer> observeContentTypeCachePopulation()
        Populate the content type cache with _all_ available content types.

        This method will run through all the content types, saving them in the process and also takes care of paging.

        This method is asynchronous and needs to be subscribed to.

        Returns:
        the flowable representing the asynchronous call.
      • observeContentTypeCachePopulation

        public io.reactivex.rxjava3.core.Flowable<java.lang.Integer> observeContentTypeCachePopulation​(int limit)
        Populate the content type cache with _all_ available content types.

        This method will run through all the content types, saving them in the process and also takes care of paging.

        This method is asynchronous and needs to be subscribed to.

        Parameters:
        limit - the number of content types per page.
        Returns:
        the flowable representing the asynchronous call.
        Throws:
        java.lang.IllegalArgumentException - if limit is less or equal to 0.
        java.lang.IllegalArgumentException - if limit is more then 1_000.
      • sync

        public SyncQuery sync()
        Returns a SyncQuery for initial synchronization via the Sync API.
        Returns:
        query instance.
      • sync

        public SyncQuery sync​(SyncType type)
        Returns a SyncQuery for synchronization with the provided syncToken via the Sync API.

        If called from a preview client, this will always do an initial sync.

        Parameters:
        type - the type to be sync'ed.
        Returns:
        query instance.
      • sync

        public SyncQuery sync​(java.lang.String syncToken)
        Returns a SyncQuery for synchronization with the provided syncToken via the Sync API.

        If called from a preview client, this will always do an initial sync.

        Parameters:
        syncToken - sync token.
        Returns:
        query instance.
      • sync

        public SyncQuery sync​(SynchronizedSpace synchronizedSpace)
        Returns a SyncQuery for synchronization with an existing space.

        If called from a preview client, this will always do an initial sync.

        Parameters:
        synchronizedSpace - space to sync.
        Returns:
        query instance.
      • fetchSpace

        public CDASpace fetchSpace()
        Returns:
        the space for this client (synchronously).
      • fetchSpace

        public <C extends CDACallback<CDASpace>> C fetchSpace​(C callback)
        Asynchronously fetch the space.
        Type Parameters:
        C - the type of the callback to be used.
        Parameters:
        callback - the value of the callback to be called back.
        Returns:
        the space for this client (asynchronously).
      • observeSpace

        public io.reactivex.rxjava3.core.Flowable<CDASpace> observeSpace()
        Returns:
        an Flowable that fetches the space for this client.
      • clearCache

        public CDAClient clearCache()
        Clear the java internal cache.
        Returns:
        this client for chaining.