Package com.cloudinary
Class Api
- java.lang.Object
-
- com.cloudinary.Api
-
public class Api extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Api.HttpMethod
-
Field Summary
Fields Modifier and Type Field Description Cloudinary
cloudinary
static java.util.Map<java.lang.Integer,java.lang.Class<? extends java.lang.Exception>>
CLOUDINARY_API_ERROR_CLASSES
-
Constructor Summary
Constructors Constructor Description Api(Cloudinary cloudinary, AbstractApiStrategy strategy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ApiResponse
addMetadataField(MetadataField field)
Add a new metadata field definitionprotected ApiResponse
callApi(Api.HttpMethod method, java.lang.Iterable<java.lang.String> uri, java.util.Map<java.lang.String,? extends java.lang.Object> params, java.util.Map options)
ApiResponse
createStreamingProfile(java.lang.String name, java.lang.String displayName, java.util.List<java.util.Map> representations)
ApiResponse
createStreamingProfile(java.lang.String name, java.lang.String displayName, java.util.List<java.util.Map> representations, java.util.Map options)
Create a new streaming profileApiResponse
createTransformation(java.lang.String name, java.lang.String definition, java.util.Map options)
ApiResponse
createUploadMapping(java.lang.String name, java.util.Map options)
ApiResponse
createUploadPreset(java.util.Map options)
ApiResponse
deleteAllResources(java.util.Map options)
ApiResponse
deleteDatasourceEntries(java.lang.String fieldExternalId, java.util.List<java.lang.String> entriesExternalId)
Delete data source entries for a given fieldApiResponse
deleteDerivedByTransformation(java.lang.Iterable<java.lang.String> publicIds, java.util.List<Transformation> transformations, java.util.Map options)
ApiResponse
deleteDerivedResources(java.lang.Iterable<java.lang.String> derivedResourceIds, java.util.Map options)
ApiResponse
deleteFolder(java.lang.String folder, java.util.Map options)
Delete a folder (must be empty).ApiResponse
deleteMetadataField(java.lang.String fieldExternalId)
Delete a field definition.ApiResponse
deleteResources(java.lang.Iterable<java.lang.String> publicIds, java.util.Map options)
ApiResponse
deleteResourcesByPrefix(java.lang.String prefix, java.util.Map options)
ApiResponse
deleteResourcesByTag(java.lang.String tag, java.util.Map options)
ApiResponse
deleteStreamingProfile(java.lang.String name)
ApiResponse
deleteStreamingProfile(java.lang.String name, java.util.Map options)
Delete a streaming profile information.ApiResponse
deleteTransformation(java.lang.String transformation, java.util.Map options)
ApiResponse
deleteUploadMapping(java.lang.String name, java.util.Map options)
ApiResponse
deleteUploadPreset(java.lang.String name, java.util.Map options)
AbstractApiStrategy
getStrategy()
ApiResponse
getStreamingProfile(java.lang.String name)
ApiResponse
getStreamingProfile(java.lang.String name, java.util.Map options)
Get a streaming profile informationApiResponse
listMetadataFields()
List all the metadata field definitions (structure, not values)ApiResponse
listStreamingProfiles()
ApiResponse
listStreamingProfiles(java.util.Map options)
List Streaming profilesApiResponse
metadataFieldByFieldId(java.lang.String fieldExternalId)
Get a metadata field definition by idApiResponse
ping(java.util.Map options)
ApiResponse
publishByIds(java.lang.Iterable<java.lang.String> publicIds, java.util.Map options)
ApiResponse
publishByPrefix(java.lang.String prefix, java.util.Map options)
ApiResponse
publishByTag(java.lang.String tag, java.util.Map options)
ApiResponse
resource(java.lang.String public_id, java.util.Map options)
ApiResponse
resources(java.util.Map options)
ApiResponse
resourcesByContext(java.lang.String key, java.lang.String value, java.util.Map options)
ApiResponse
resourcesByContext(java.lang.String key, java.util.Map options)
ApiResponse
resourcesByIds(java.lang.Iterable<java.lang.String> publicIds, java.util.Map options)
ApiResponse
resourcesByModeration(java.lang.String kind, java.lang.String status, java.util.Map options)
ApiResponse
resourcesByTag(java.lang.String tag, java.util.Map options)
ApiResponse
resourceTypes(java.util.Map options)
ApiResponse
restore(java.lang.Iterable<java.lang.String> publicIds, java.util.Map options)
ApiResponse
rootFolders(java.util.Map options)
ApiResponse
subFolders(java.lang.String ofFolderPath, java.util.Map options)
ApiResponse
tags(java.util.Map options)
ApiResponse
transformation(java.lang.String transformation, java.util.Map options)
ApiResponse
transformations(java.util.Map options)
ApiResponse
update(java.lang.String public_id, java.util.Map options)
ApiResponse
updateMetadataField(java.lang.String fieldExternalId, MetadataField field)
Update the definitions of a single metadata field.ApiResponse
updateMetadataFieldDatasource(java.lang.String fieldExternalId, java.util.List<MetadataDataSource.Entry> entries)
Update the datasource entries for a given fieldApiResponse
updateResourcesAccessModeByIds(java.lang.String accessMode, java.lang.Iterable<java.lang.String> publicIds, java.util.Map options)
Update access mode of one or more resources by publicIdsApiResponse
updateResourcesAccessModeByPrefix(java.lang.String accessMode, java.lang.String prefix, java.util.Map options)
Update access mode of one or more resources by prefixApiResponse
updateResourcesAccessModeByTag(java.lang.String accessMode, java.lang.String tag, java.util.Map options)
Update access mode of one or more resources by tagApiResponse
updateStreamingProfile(java.lang.String name, java.lang.String displayName, java.util.List<java.util.Map> representations)
ApiResponse
updateStreamingProfile(java.lang.String name, java.lang.String displayName, java.util.List<java.util.Map> representations, java.util.Map options)
Create a new streaming profileApiResponse
updateTransformation(java.lang.String transformation, java.util.Map updates, java.util.Map options)
ApiResponse
updateUploadMapping(java.lang.String name, java.util.Map options)
ApiResponse
updateUploadPreset(java.lang.String name, java.util.Map options)
ApiResponse
uploadMapping(java.lang.String name, java.util.Map options)
ApiResponse
uploadMappings(java.util.Map options)
ApiResponse
uploadPreset(java.lang.String name, java.util.Map options)
ApiResponse
uploadPresets(java.util.Map options)
ApiResponse
usage(java.util.Map options)
-
-
-
Field Detail
-
CLOUDINARY_API_ERROR_CLASSES
public static final java.util.Map<java.lang.Integer,java.lang.Class<? extends java.lang.Exception>> CLOUDINARY_API_ERROR_CLASSES
-
cloudinary
public final Cloudinary cloudinary
-
-
Constructor Detail
-
Api
public Api(Cloudinary cloudinary, AbstractApiStrategy strategy)
-
-
Method Detail
-
getStrategy
public AbstractApiStrategy getStrategy()
-
callApi
protected ApiResponse callApi(Api.HttpMethod method, java.lang.Iterable<java.lang.String> uri, java.util.Map<java.lang.String,? extends java.lang.Object> params, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
ping
public ApiResponse ping(java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
usage
public ApiResponse usage(java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
resourceTypes
public ApiResponse resourceTypes(java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
resources
public ApiResponse resources(java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
resourcesByTag
public ApiResponse resourcesByTag(java.lang.String tag, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
resourcesByContext
public ApiResponse resourcesByContext(java.lang.String key, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
resourcesByContext
public ApiResponse resourcesByContext(java.lang.String key, java.lang.String value, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
resourcesByIds
public ApiResponse resourcesByIds(java.lang.Iterable<java.lang.String> publicIds, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
resourcesByModeration
public ApiResponse resourcesByModeration(java.lang.String kind, java.lang.String status, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
resource
public ApiResponse resource(java.lang.String public_id, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
update
public ApiResponse update(java.lang.String public_id, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
deleteResources
public ApiResponse deleteResources(java.lang.Iterable<java.lang.String> publicIds, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
deleteDerivedByTransformation
public ApiResponse deleteDerivedByTransformation(java.lang.Iterable<java.lang.String> publicIds, java.util.List<Transformation> transformations, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
deleteResourcesByPrefix
public ApiResponse deleteResourcesByPrefix(java.lang.String prefix, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
deleteResourcesByTag
public ApiResponse deleteResourcesByTag(java.lang.String tag, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
deleteAllResources
public ApiResponse deleteAllResources(java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
deleteDerivedResources
public ApiResponse deleteDerivedResources(java.lang.Iterable<java.lang.String> derivedResourceIds, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
tags
public ApiResponse tags(java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
transformations
public ApiResponse transformations(java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
transformation
public ApiResponse transformation(java.lang.String transformation, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
deleteTransformation
public ApiResponse deleteTransformation(java.lang.String transformation, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
updateTransformation
public ApiResponse updateTransformation(java.lang.String transformation, java.util.Map updates, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createTransformation
public ApiResponse createTransformation(java.lang.String name, java.lang.String definition, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
uploadPresets
public ApiResponse uploadPresets(java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
uploadPreset
public ApiResponse uploadPreset(java.lang.String name, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
deleteUploadPreset
public ApiResponse deleteUploadPreset(java.lang.String name, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
updateUploadPreset
public ApiResponse updateUploadPreset(java.lang.String name, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createUploadPreset
public ApiResponse createUploadPreset(java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
rootFolders
public ApiResponse rootFolders(java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
subFolders
public ApiResponse subFolders(java.lang.String ofFolderPath, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
restore
public ApiResponse restore(java.lang.Iterable<java.lang.String> publicIds, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
uploadMappings
public ApiResponse uploadMappings(java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
uploadMapping
public ApiResponse uploadMapping(java.lang.String name, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
deleteUploadMapping
public ApiResponse deleteUploadMapping(java.lang.String name, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
updateUploadMapping
public ApiResponse updateUploadMapping(java.lang.String name, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createUploadMapping
public ApiResponse createUploadMapping(java.lang.String name, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
publishByPrefix
public ApiResponse publishByPrefix(java.lang.String prefix, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
publishByTag
public ApiResponse publishByTag(java.lang.String tag, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
publishByIds
public ApiResponse publishByIds(java.lang.Iterable<java.lang.String> publicIds, java.util.Map options) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createStreamingProfile
public ApiResponse createStreamingProfile(java.lang.String name, java.lang.String displayName, java.util.List<java.util.Map> representations, java.util.Map options) throws java.lang.Exception
Create a new streaming profile- Parameters:
name
- the of the profiledisplayName
- the display name of the profilerepresentations
- a collection of Maps with a transformation keyoptions
- additional options- Returns:
- the new streaming profile
- Throws:
java.lang.Exception
- an exception
-
createStreamingProfile
public ApiResponse createStreamingProfile(java.lang.String name, java.lang.String displayName, java.util.List<java.util.Map> representations) throws java.lang.Exception
- Throws:
java.lang.Exception
- See Also:
createStreamingProfile(String, String, List, Map)
-
getStreamingProfile
public ApiResponse getStreamingProfile(java.lang.String name, java.util.Map options) throws java.lang.Exception
Get a streaming profile information- Parameters:
name
- the name of the profile to fetchoptions
- additional options- Returns:
- a streaming profile
- Throws:
java.lang.Exception
- an exception
-
getStreamingProfile
public ApiResponse getStreamingProfile(java.lang.String name) throws java.lang.Exception
- Throws:
java.lang.Exception
- See Also:
getStreamingProfile(String, Map)
-
listStreamingProfiles
public ApiResponse listStreamingProfiles(java.util.Map options) throws java.lang.Exception
List Streaming profiles- Parameters:
options
- additional options- Returns:
- a list of all streaming profiles defined for the current cloud
- Throws:
java.lang.Exception
- an exception
-
listStreamingProfiles
public ApiResponse listStreamingProfiles() throws java.lang.Exception
- Throws:
java.lang.Exception
- See Also:
listStreamingProfiles(Map)
-
deleteStreamingProfile
public ApiResponse deleteStreamingProfile(java.lang.String name, java.util.Map options) throws java.lang.Exception
Delete a streaming profile information. Predefined profiles are restored to the default setting.- Parameters:
name
- the name of the profile to deleteoptions
- additional options- Returns:
- a streaming profile
- Throws:
java.lang.Exception
- an exception
-
deleteStreamingProfile
public ApiResponse deleteStreamingProfile(java.lang.String name) throws java.lang.Exception
- Throws:
java.lang.Exception
- See Also:
deleteStreamingProfile(String, Map)
-
updateStreamingProfile
public ApiResponse updateStreamingProfile(java.lang.String name, java.lang.String displayName, java.util.List<java.util.Map> representations, java.util.Map options) throws java.lang.Exception
Create a new streaming profile- Parameters:
name
- the of the profiledisplayName
- the display name of the profilerepresentations
- a collection of Maps with a transformation keyoptions
- additional options- Returns:
- the new streaming profile
- Throws:
java.lang.Exception
- an exception
-
updateStreamingProfile
public ApiResponse updateStreamingProfile(java.lang.String name, java.lang.String displayName, java.util.List<java.util.Map> representations) throws java.lang.Exception
- Throws:
java.lang.Exception
- See Also:
updateStreamingProfile(String, String, List, Map)
-
updateResourcesAccessModeByPrefix
public ApiResponse updateResourcesAccessModeByPrefix(java.lang.String accessMode, java.lang.String prefix, java.util.Map options) throws java.lang.Exception
Update access mode of one or more resources by prefix- Parameters:
accessMode
- The new access mode, "public" or "authenticated"prefix
- The prefix by which to filter applicable resourcesoptions
- additional options- resource_type - (default "image") - the type of resources to modify
- max_results - optional - the maximum resources to process in a single invocation
- next_cursor - optional - provided by a previous call to the method
- Returns:
- a map of the returned values
- updated - an array of resources
- next_cursor - optional - provided if more resources can be processed
- Throws:
ApiException
- an API exceptionjava.lang.Exception
-
updateResourcesAccessModeByTag
public ApiResponse updateResourcesAccessModeByTag(java.lang.String accessMode, java.lang.String tag, java.util.Map options) throws java.lang.Exception
Update access mode of one or more resources by tag- Parameters:
accessMode
- The new access mode, "public" or "authenticated"tag
- The tag by which to filter applicable resourcesoptions
- additional options- resource_type - (default "image") - the type of resources to modify
- max_results - optional - the maximum resources to process in a single invocation
- next_cursor - optional - provided by a previous call to the method
- Returns:
- a map of the returned values
- updated - an array of resources
- next_cursor - optional - provided if more resources can be processed
- Throws:
ApiException
- an API exceptionjava.lang.Exception
-
deleteFolder
public ApiResponse deleteFolder(java.lang.String folder, java.util.Map options) throws java.lang.Exception
Delete a folder (must be empty).- Parameters:
folder
- The full path of the folder to deleteoptions
- additional options.- Returns:
- The operation result.
- Throws:
java.lang.Exception
- When the folder isn't empty or doesn't exist.
-
updateResourcesAccessModeByIds
public ApiResponse updateResourcesAccessModeByIds(java.lang.String accessMode, java.lang.Iterable<java.lang.String> publicIds, java.util.Map options) throws java.lang.Exception
Update access mode of one or more resources by publicIds- Parameters:
accessMode
- The new access mode, "public" or "authenticated"publicIds
- A list of public ids of resources to be updatedoptions
- additional options- resource_type - (default "image") - the type of resources to modify
- max_results - optional - the maximum resources to process in a single invocation
- next_cursor - optional - provided by a previous call to the method
- Returns:
- a map of the returned values
- updated - an array of resources
- next_cursor - optional - provided if more resources can be processed
- Throws:
ApiException
- an API exceptionjava.lang.Exception
-
addMetadataField
public ApiResponse addMetadataField(MetadataField field) throws java.lang.Exception
Add a new metadata field definition- Parameters:
field
- The field to add.- Returns:
- A map representing the newlay added field.
- Throws:
java.lang.Exception
-
listMetadataFields
public ApiResponse listMetadataFields() throws java.lang.Exception
List all the metadata field definitions (structure, not values)- Returns:
- A map containing the list of field definitions maps.
- Throws:
java.lang.Exception
-
metadataFieldByFieldId
public ApiResponse metadataFieldByFieldId(java.lang.String fieldExternalId) throws java.lang.Exception
Get a metadata field definition by id- Parameters:
fieldExternalId
- The id of the field to retrieve- Returns:
- The fields definitions.
- Throws:
java.lang.Exception
-
updateMetadataField
public ApiResponse updateMetadataField(java.lang.String fieldExternalId, MetadataField field) throws java.lang.Exception
Update the definitions of a single metadata field.- Parameters:
fieldExternalId
- The id of the field to updatefield
- The field definition- Returns:
- The updated fields definition.
- Throws:
java.lang.Exception
-
updateMetadataFieldDatasource
public ApiResponse updateMetadataFieldDatasource(java.lang.String fieldExternalId, java.util.List<MetadataDataSource.Entry> entries) throws java.lang.Exception
Update the datasource entries for a given field- Parameters:
fieldExternalId
- The id of the field to updateentries
- A list of datasource entries. Existing entries (according to entry id) will be updated, new entries will be added.- Returns:
- The updated field definition.
- Throws:
java.lang.Exception
-
deleteDatasourceEntries
public ApiResponse deleteDatasourceEntries(java.lang.String fieldExternalId, java.util.List<java.lang.String> entriesExternalId) throws java.lang.Exception
Delete data source entries for a given field- Parameters:
fieldExternalId
- The id of the field to updateentriesExternalId
- The ids of all the entries to delete from the data source- Returns:
- The remaining datasource entries.
- Throws:
java.lang.Exception
-
deleteMetadataField
public ApiResponse deleteMetadataField(java.lang.String fieldExternalId) throws java.lang.Exception
Delete a field definition.- Parameters:
fieldExternalId
- The id of the field to delete- Returns:
- A map with a "message" key. "ok" value indicates a successful deletion.
- Throws:
java.lang.Exception
-
-