public class ModuleRoles extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
ModuleRoles.Async
Handler for asynchronous requests.
|
| Constructor and Description |
|---|
ModuleRoles(retrofit2.Retrofit retrofit,
Executor callbackExecutor,
String spaceId,
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(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(Map<String,String> query)
Fetch specific roles of the configured space.
|
CMAArray<CMARole> |
fetchAll(String spaceId)
Fetch all roles of this space.
|
CMAArray<CMARole> |
fetchAll(String spaceId,
Map<String,String> query)
Fetch specific roles of this space.
|
CMARole |
fetchOne(String roleId)
Fetches one role by its id from Contentful.
|
CMARole |
fetchOne(String spaceId,
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,
Executor callbackExecutor,
String spaceId,
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()
IllegalArgumentException - if configured spaceId is null.CMANotWithEnvironmentsException - if environmentId was set using
CMAClient.Builder.setEnvironmentId(String).CMAClient.Builder.setSpaceId(String)public CMAArray<CMARole> fetchAll(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.IllegalArgumentException - if spaceId is null.public CMAArray<CMARole> fetchAll(Map<String,String> query)
query - the search criteria to search for.IllegalArgumentException - if configured spaceId is null.CMANotWithEnvironmentsException - if environmentId was set using
CMAClient.Builder.setEnvironmentId(String).CMAClient.Builder.setSpaceId(String)public CMAArray<CMARole> fetchAll(String spaceId, Map<String,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.IllegalArgumentException - if spaceId is null.public CMARole fetchOne(String roleId)
roleId - the id of the role to be found.IllegalArgumentException - if configured space id is null.IllegalArgumentException - if role id is null.CMANotWithEnvironmentsException - if environmentId was set using
CMAClient.Builder.setEnvironmentId(String).CMAClient.Builder.setSpaceId(String)public CMARole fetchOne(String spaceId, 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.IllegalArgumentException - if space id is null.IllegalArgumentException - if role id is null.public CMARole create(CMARole role)
role - the new role to be created.IllegalArgumentException - if the configured space id is null.IllegalArgumentException - if role is null.CMANotWithEnvironmentsException - if environmentId was set using
CMAClient.Builder.setEnvironmentId(String).CMAClient.Builder.setSpaceId(String)public CMARole create(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.IllegalArgumentException - if space id is null.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.IllegalArgumentException - if space id is null.IllegalArgumentException - if role is null.IllegalArgumentException - if role id is null.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.IllegalArgumentException - if space id is null.IllegalArgumentException - if role id is null.Copyright © 2026 Contentful, GmbH.. All rights reserved.