public class ModuleRoles
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
ModuleRoles.Async
Handler for asynchronous requests.
|
Constructor and Description |
---|
ModuleRoles(retrofit2.Retrofit retrofit,
java.util.concurrent.Executor callbackExecutor,
java.lang.String spaceId,
java.lang.String environmentId,
boolean environmentIdConfigured)
Create a new role module.
|
Modifier and Type | Method and Description |
---|---|
ModuleRoles.Async |
async()
Use all functionalities of this module asynchronously.
|
CMARole |
create(CMARole role)
Create a new role.
|
CMARole |
create(java.lang.String spaceId,
CMARole role)
Create a new role.
|
protected ServiceRoles |
createService(retrofit2.Retrofit retrofit)
Initialize retrofit with the current service.
|
int |
delete(CMARole role)
Delete the given role instance.
|
CMAArray<CMARole> |
fetchAll()
Fetch all roles of the configured space.
|
CMAArray<CMARole> |
fetchAll(java.util.Map<java.lang.String,java.lang.String> query)
Fetch specific roles of the configured space.
|
CMAArray<CMARole> |
fetchAll(java.lang.String spaceId)
Fetch all roles of this space.
|
CMAArray<CMARole> |
fetchAll(java.lang.String spaceId,
java.util.Map<java.lang.String,java.lang.String> query)
Fetch specific roles of this space.
|
CMARole |
fetchOne(java.lang.String roleId)
Fetches one role by its id from Contentful.
|
CMARole |
fetchOne(java.lang.String spaceId,
java.lang.String roleId)
Fetches one role by its id from Contentful.
|
CMARole |
update(CMARole role)
Update the given role instance on Contentful.
|
public ModuleRoles(retrofit2.Retrofit retrofit, java.util.concurrent.Executor callbackExecutor, java.lang.String spaceId, java.lang.String environmentId, boolean environmentIdConfigured)
retrofit
- the retrofit instance to be used to create the service.callbackExecutor
- to tell on which thread it should run.spaceId
- id of the space to be configured.environmentId
- id of the environment to be configured.environmentIdConfigured
- internal helper to see if environment was set.protected ServiceRoles createService(retrofit2.Retrofit retrofit)
retrofit
- the instance to use the service with.public ModuleRoles.Async async()
public CMAArray<CMARole> fetchAll()
java.lang.IllegalArgumentException
- if configured spaceId is null.CMANotWithEnvironmentsException
- if environmentId was set using
CMAClient.Builder.setEnvironmentId(String)
.CMAClient.Builder.setSpaceId(String)
public CMAArray<CMARole> fetchAll(java.lang.String spaceId)
This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)
and will ignore
CMAClient.Builder.setEnvironmentId(String)
.
spaceId
- the space identifier identifying the space.java.lang.IllegalArgumentException
- if spaceId is null.public CMAArray<CMARole> fetchAll(java.util.Map<java.lang.String,java.lang.String> query)
query
- the search criteria to search for.java.lang.IllegalArgumentException
- if configured spaceId is null.CMANotWithEnvironmentsException
- if environmentId was set using
CMAClient.Builder.setEnvironmentId(String)
.CMAClient.Builder.setSpaceId(String)
public CMAArray<CMARole> fetchAll(java.lang.String spaceId, java.util.Map<java.lang.String,java.lang.String> query)
This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)
and will ignore
CMAClient.Builder.setEnvironmentId(String)
.
spaceId
- the space identifier identifying the space.query
- the search criteria to search for.java.lang.IllegalArgumentException
- if spaceId is null.public CMARole fetchOne(java.lang.String roleId)
roleId
- the id of the role to be found.java.lang.IllegalArgumentException
- if configured space id is null.java.lang.IllegalArgumentException
- if role id is null.CMANotWithEnvironmentsException
- if environmentId was set using
CMAClient.Builder.setEnvironmentId(String)
.CMAClient.Builder.setSpaceId(String)
public CMARole fetchOne(java.lang.String spaceId, java.lang.String roleId)
This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)
and will ignore
CMAClient.Builder.setEnvironmentId(String)
.
spaceId
- the space this role is hosted by.roleId
- the id of the role to be found.java.lang.IllegalArgumentException
- if space id is null.java.lang.IllegalArgumentException
- if role id is null.public CMARole create(CMARole role)
role
- the new role to be created.java.lang.IllegalArgumentException
- if the configured space id is null.java.lang.IllegalArgumentException
- if role is null.CMANotWithEnvironmentsException
- if environmentId was set using
CMAClient.Builder.setEnvironmentId(String)
.CMAClient.Builder.setSpaceId(String)
public CMARole create(java.lang.String spaceId, CMARole role)
This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)
and will ignore
CMAClient.Builder.setEnvironmentId(String)
.
spaceId
- the space id to host the role.role
- the new role to be created.java.lang.IllegalArgumentException
- if space id is null.java.lang.IllegalArgumentException
- if role is null.public CMARole update(CMARole role)
Please make sure that the instance provided is fetched from Contentful. Otherwise you will get an exception thrown.
role
- the role fetched from Contentful, updated by caller, to be updated.java.lang.IllegalArgumentException
- if space id is null.java.lang.IllegalArgumentException
- if role is null.java.lang.IllegalArgumentException
- if role id is null.java.lang.IllegalArgumentException
- if role does not have a version attached.public int delete(CMARole role)
Please make sure that the instance provided is fetched from Contentful. Otherwise you will get an exception thrown.
role
- the role fetched from Contentful, updated by caller, to be deleted.java.lang.IllegalArgumentException
- if space id is null.java.lang.IllegalArgumentException
- if role id is null.Copyright © 2019 Contentful, GmbH.. All Rights Reserved.