public class CDAClient
extends java.lang.Object
builder()
to create a new client instance.Modifier and Type | Class and Description |
---|---|
static class |
CDAClient.Builder
This builder will be used to configure and then create a
CDAClient . |
Modifier and Type | Method and Description |
---|---|
static CDAClient.Builder |
builder() |
CDAClient |
clearCache()
Clear the java internal cache.
|
<T extends CDAResource> |
fetch(java.lang.Class<T> type)
Returns a
FetchQuery for a given type , which can be used to fulfill the
request synchronously or asynchronously when a callback is provided. |
CDASpace |
fetchSpace() |
<C extends CDACallback<CDASpace>> |
fetchSpace(C callback)
Asynchronously fetch the space.
|
<T extends CDAResource> |
observe(java.lang.Class<T> type)
Returns an
ObserveQuery for a given type , which can be used to return
an Flowable that fetches the desired resources. |
<T> TransformQuery<T> |
observeAndTransform(java.lang.Class<T> type)
Returns a
TransformQuery to transform the default contentful response into a specific
custom model type. |
io.reactivex.Flowable<java.lang.Integer> |
observeContentTypeCachePopulation()
Populate the content type cache with _all_ available content types.
|
io.reactivex.Flowable<java.lang.Integer> |
observeContentTypeCachePopulation(int limit)
Populate the content type cache with _all_ available content types.
|
io.reactivex.Flowable<CDASpace> |
observeSpace() |
int |
populateContentTypeCache()
Populate the content type cache with _all_ available content types.
|
int |
populateContentTypeCache(int limit)
Populate the content type cache with _all_ available content types.
|
SyncQuery |
sync()
Returns a
SyncQuery for initial synchronization via the Sync API. |
SyncQuery |
sync(java.lang.String syncToken)
Returns a
SyncQuery for synchronization with the provided syncToken via
the Sync API. |
SyncQuery |
sync(SynchronizedSpace synchronizedSpace)
Returns a
SyncQuery for synchronization with an existing space. |
SyncQuery |
sync(SyncType type)
Returns a
SyncQuery for synchronization with the provided syncToken via
the Sync API. |
public <T extends CDAResource> FetchQuery<T> fetch(java.lang.Class<T> type)
FetchQuery
for a given type
, which can be used to fulfill the
request synchronously or asynchronously when a callback is provided.T
- type for avoiding casting on calling side.type
- resource type. This can be either a CDALocale
, a CDAEntry
,
a CDAAsset
, or a CDAContentType
FetchQuery.all()
or FetchQuery.one(String)
on it.fetchSpace()
public <T> TransformQuery<T> observeAndTransform(java.lang.Class<T> type)
TransformQuery
to transform the default contentful response into a specific
custom model type.
This functionality is considered as beta and might or might not be stable. Please use at own risk and report behaviour back.
T
- An annotated custom TransformQuery.ContentfulEntryModel
model.TransformQuery.ContentfulEntryModel
,
TransformQuery.ContentfulField
,
TransformQuery.ContentfulSystemField
public <T extends CDAResource> ObserveQuery<T> observe(java.lang.Class<T> type)
ObserveQuery
for a given type
, which can be used to return
an Flowable
that fetches the desired resources.T
- type for avoiding casting on calling side.type
- resource type. This can be either a CDALocale
, a CDAEntry
,
a CDAAsset
, or a CDAContentType
ObserveQuery.all()
or ObserveQuery.one(String)
on it.observeSpace()
public int populateContentTypeCache()
This method will run through all the content types, saving them in the process and also takes care of paging.
This method is synchronous.
public int populateContentTypeCache(int limit)
This method is synchronous.
limit
- the number of content types per page.java.lang.IllegalArgumentException
- if limit is less or equal to 0.java.lang.IllegalArgumentException
- if limit is more then 1_000.populateContentTypeCache()
public io.reactivex.Flowable<java.lang.Integer> observeContentTypeCachePopulation()
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.
public io.reactivex.Flowable<java.lang.Integer> observeContentTypeCachePopulation(int limit)
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.
limit
- the number of content types per page.java.lang.IllegalArgumentException
- if limit is less or equal to 0.java.lang.IllegalArgumentException
- if limit is more then 1_000.public SyncQuery sync()
SyncQuery
for initial synchronization via the Sync API.public SyncQuery sync(SyncType type)
SyncQuery
for synchronization with the provided syncToken
via
the Sync API.
If called from a preview
client, this will always do an initial sync.
type
- the type to be sync'ed.public SyncQuery sync(java.lang.String syncToken)
SyncQuery
for synchronization with the provided syncToken
via
the Sync API.
If called from a preview
client, this will always do an initial sync.
syncToken
- sync token.public SyncQuery sync(SynchronizedSpace synchronizedSpace)
SyncQuery
for synchronization with an existing space.
If called from a preview
client, this will always do an initial sync.
synchronizedSpace
- space to sync.public CDASpace fetchSpace()
public <C extends CDACallback<CDASpace>> C fetchSpace(C callback)
C
- the type of the callback to be used.callback
- the value of the callback to be called back.public io.reactivex.Flowable<CDASpace> observeSpace()
Flowable
that fetches the space for this client.public CDAClient clearCache()
public static CDAClient.Builder builder()
CDAClient
builder.Copyright © 2019 Contentful, GmbH.. All Rights Reserved.