Class Api

java.lang.Object
com.cloudinary.Api

public class Api
extends java.lang.Object
  • Field Details

  • Constructor Details

  • Method Details

    • 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
    • visualSearch

      public ApiResponse visualSearch​(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
    • resourceByAssetID

      public ApiResponse resourceByAssetID​(java.lang.String assetId, java.util.Map options) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • resourcesByAssetIDs

      public ApiResponse resourcesByAssetIDs​(java.lang.Iterable<java.lang.String> assetIds, java.util.Map options) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • resourcesByAssetFolder

      public ApiResponse resourcesByAssetFolder​(java.lang.String assetFolder, 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
    • createFolder

      public ApiResponse createFolder​(java.lang.String folderName, 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 profile
      displayName - the display name of the profile
      representations - a collection of Maps with a transformation key
      options - 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 fetch
      options - 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 delete
      options - 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 profile
      displayName - the display name of the profile
      representations - a collection of Maps with a transformation key
      options - 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 resources
      options - 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 exception
      java.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 resources
      options - 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 exception
      java.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 delete
      options - 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 updated
      options - 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 exception
      java.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 newly 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 update
      field - 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 update
      entries - 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 update
      entriesExternalId - The ids of all the entries to delete from the data source
      Returns:
      The remaining datasource entries.
      Throws:
      java.lang.Exception
    • restoreDatasourceEntries

      public ApiResponse restoreDatasourceEntries​(java.lang.String fieldExternalId, java.util.List<java.lang.String> entriesExternalId) throws java.lang.Exception
      Restore deleted data source entries for a given field
      Parameters:
      fieldExternalId - The id of the field to operate
      entriesExternalId - The ids of all the entries to restore from the data source
      Returns:
      The datasource entries state after restore
      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
    • reorderMetadataFields

      public ApiResponse reorderMetadataFields​(java.lang.String orderBy, java.lang.String direction, java.util.Map options) throws java.lang.Exception
      Reorders metadata fields.
      Parameters:
      orderBy - Criteria for the order (one of the fields 'label', 'external_id', 'created_at')
      direction - Optional (gets either asc or desc)
      options - Additional options
      Returns:
      List of metadata fields in their new order
      Throws:
      java.lang.Exception