Class ModuleApiKeys
- java.lang.Object
-
- com.contentful.java.cma.ModuleApiKeys
-
public class ModuleApiKeys extends java.lang.ObjectApi Keys Module.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classModuleApiKeys.AsyncAsync module.
-
Constructor Summary
Constructors Constructor Description ModuleApiKeys(retrofit2.Retrofit retrofit, java.util.concurrent.Executor callbackExecutor, java.lang.String spaceId, java.lang.String environmentId, boolean environmentIdConfigured)Create api keys module.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ModuleApiKeys.Asyncasync()CMAApiKeycreate(CMAApiKey key)Create a new delivery api key from the configured space.CMAApiKeycreate(java.lang.String spaceId, CMAApiKey key)Create a new delivery api key.protected com.contentful.java.cma.ServiceApiKeyscreateService(retrofit2.Retrofit retrofit)intdelete(CMAApiKey key)Delete a given api key from the configured space.CMAArray<CMAApiKey>fetchAll()Fetch all delivery API keys from the configured space.CMAArray<CMAApiKey>fetchAll(java.lang.String spaceId)Fetch all delivery api keys from the given space.CMAArray<CMAApiKey>fetchAll(java.lang.String spaceId, java.util.Map<java.lang.String,java.lang.String> query)Query for specific api keys, overriding the configuration set.CMAArray<CMAApiKey>fetchAll(java.util.Map<java.lang.String,java.lang.String> query)Query for specific api keys from the configured space.CMAApiKeyfetchOne(java.lang.String keyId)Fetch only one delivery api key from the configured space.CMAApiKeyfetchOne(java.lang.String spaceId, java.lang.String keyId)Fetch only one delivery api key.CMAApiKeyupdate(CMAApiKey key)Updates a delivery api key from the configured space.
-
-
-
Constructor Detail
-
ModuleApiKeys
public ModuleApiKeys(retrofit2.Retrofit retrofit, java.util.concurrent.Executor callbackExecutor, java.lang.String spaceId, java.lang.String environmentId, boolean environmentIdConfigured)Create api keys module.- Parameters:
retrofit- the retrofit instance to be used to create the service.callbackExecutor- to tell on which thread it should run.spaceId- the space to be used when not given.environmentId- the environment to be used when not given.environmentIdConfigured- internal helper to see if environment was set.
-
-
Method Detail
-
createService
protected com.contentful.java.cma.ServiceApiKeys createService(retrofit2.Retrofit retrofit)
-
fetchAll
public CMAArray<CMAApiKey> fetchAll()
Fetch all delivery API keys from the configured space.- Returns:
- a list of delivery api keys.
- Throws:
java.lang.IllegalArgumentException- if configured space Id is null.CMANotWithEnvironmentsException- if environmentId was set usingCMAClient.Builder.setEnvironmentId(String).- See Also:
CMAClient.Builder.setSpaceId(String)
-
fetchAll
public CMAArray<CMAApiKey> fetchAll(java.lang.String spaceId)
Fetch all delivery api keys from the given space.This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)and will ignoreCMAClient.Builder.setEnvironmentId(String).- Parameters:
spaceId- the id of the space to host the api keys.- Returns:
- a list of delivery api keys.
- Throws:
java.lang.IllegalArgumentException- if spaceId is null.
-
fetchAll
public CMAArray<CMAApiKey> fetchAll(java.util.Map<java.lang.String,java.lang.String> query)
Query for specific api keys from the configured space.- Parameters:
query- the terms to query for specific keys.- Returns:
- a list of delivery api keys.
- Throws:
java.lang.IllegalArgumentException- if configured space Id is null.CMANotWithEnvironmentsException- if environmentId was set usingCMAClient.Builder.setEnvironmentId(String).- See Also:
CMAClient.Builder.setSpaceId(String)
-
fetchAll
public CMAArray<CMAApiKey> fetchAll(java.lang.String spaceId, java.util.Map<java.lang.String,java.lang.String> query)
Query for specific api keys, overriding the configuration set.This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)and will ignoreCMAClient.Builder.setEnvironmentId(String).- Parameters:
spaceId- the id of the space to host the api keys.query- the terms to query for specific keys.- Returns:
- a list of delivery api keys.
- Throws:
java.lang.IllegalArgumentException- if spaceId is null.
-
fetchOne
public CMAApiKey fetchOne(java.lang.String keyId)
Fetch only one delivery api key from the configured space.This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)and will ignoreCMAClient.Builder.setEnvironmentId(String).- Parameters:
keyId- the id of the key itself.- Returns:
- one delivery api key.
- Throws:
java.lang.IllegalArgumentException- if configured spaceId is null.java.lang.IllegalArgumentException- if keyId is null.CMANotWithEnvironmentsException- if environmentId was set usingCMAClient.Builder.setEnvironmentId(String).- See Also:
CMAClient.Builder.setSpaceId(String)
-
fetchOne
public CMAApiKey fetchOne(java.lang.String spaceId, java.lang.String keyId)
Fetch only one delivery api key.This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)and will ignoreCMAClient.Builder.setEnvironmentId(String).- Parameters:
spaceId- the id of the space this is valid on.keyId- the id of the key itself.- Returns:
- one delivery api key.
- Throws:
java.lang.IllegalArgumentException- if spaceId is null.java.lang.IllegalArgumentException- if keyId is null.
-
create
public CMAApiKey create(CMAApiKey key)
Create a new delivery api key from the configured space.This method will override the configuration specified through
CMAClient.Builder.setSpaceId(String)and will ignoreCMAClient.Builder.setEnvironmentId(String).- Parameters:
key- the key to be created.- Returns:
- the just created key, containing the delivery token.
- Throws:
java.lang.IllegalArgumentException- if configured spaceId is null.java.lang.IllegalArgumentException- if key is null.CMANotWithEnvironmentsException- if environmentId was set usingCMAClient.Builder.setEnvironmentId(String).- See Also:
CMAClient.Builder.setSpaceId(String)
-
update
public CMAApiKey update(CMAApiKey key)
Updates a delivery api key from the configured space.- Parameters:
key- the key to be updated.- Returns:
- the just updated key.
- Throws:
java.lang.IllegalArgumentException- if key is null.java.lang.IllegalArgumentException- if keys id is null.java.lang.IllegalArgumentException- if keys spaceId is null.
-
create
public CMAApiKey create(java.lang.String spaceId, CMAApiKey key)
Create a new delivery api key.- Parameters:
spaceId- the id of the space this is valid on.key- the key to be created.- Returns:
- the just created key, containing the delivery token.
- Throws:
java.lang.IllegalArgumentException- if spaceId is null.java.lang.IllegalArgumentException- if key is null.
-
delete
public int delete(CMAApiKey key)
Delete a given api key from the configured space.- Parameters:
key- the key to be deleted.- Returns:
- 204 upon success.
- Throws:
java.lang.IllegalArgumentException- if key is null.java.lang.IllegalArgumentException- if key's spaceId is null.
-
async
public ModuleApiKeys.Async async()
- Returns:
- a module with a set of asynchronous methods.
-
-