Class: Imagekitio::Resources::CustomMetadataFields

Inherits:
Object
  • Object
show all
Defined in:
lib/imagekitio/resources/custom_metadata_fields.rb,
sig/imagekitio/resources/custom_metadata_fields.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ CustomMetadataFields

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CustomMetadataFields.

Parameters:



134
135
136
# File 'lib/imagekitio/resources/custom_metadata_fields.rb', line 134

def initialize(client:)
  @client = client
end

Instance Method Details

#create(label:, name:, schema:, description: nil, request_options: {}) ⇒ Imagekitio::Models::CustomMetadataField

Some parameter documentations has been truncated, see Models::CustomMetadataFieldCreateParams for more details.

This API creates a new custom metadata field. Once a custom metadata field is created either through this API or using the dashboard UI, its value can be set on the assets. The value of a field for an asset can be set using the media library UI or programmatically through upload or update assets API.

Parameters:

  • label (String)

    Human readable name of the custom metadata field. This should be unique across a

  • name (String)

    API name of the custom metadata field. This should be unique across all (includi

  • schema (Imagekitio::Models::CustomMetadataFieldCreateParams::Schema)
  • description (String)

    Optional description for the custom metadata field. Can be up to 500 characters.

  • request_options (Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



29
30
31
32
33
34
35
36
37
38
# File 'lib/imagekitio/resources/custom_metadata_fields.rb', line 29

def create(params)
  parsed, options = Imagekitio::CustomMetadataFieldCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/customMetadataFields",
    body: parsed,
    model: Imagekitio::CustomMetadataField,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ Imagekitio::Models::CustomMetadataFieldDeleteResponse

Some parameter documentations has been truncated, see Models::CustomMetadataFieldDeleteParams for more details.

This API deletes a custom metadata field. Even after deleting a custom metadata field, you cannot create any new custom metadata field with the same name.

Parameters:

  • id (String)

    Should be a valid custom metadata field id.

  • request_options (Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



122
123
124
125
126
127
128
129
# File 'lib/imagekitio/resources/custom_metadata_fields.rb', line 122

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["v1/customMetadataFields/%1$s", id],
    model: Imagekitio::Models::CustomMetadataFieldDeleteResponse,
    options: params[:request_options]
  )
end

#list(folder_path: nil, include_deleted: nil, request_options: {}) ⇒ Array<Imagekitio::Models::CustomMetadataField>

Some parameter documentations has been truncated, see Models::CustomMetadataFieldListParams for more details.

This API returns the array of created custom metadata field objects. By default the API returns only non deleted field objects, but you can include deleted fields in the API response.

You can also filter results by a specific folder path to retrieve custom metadata fields applicable at that location. This path-specific filtering is useful when using the Path policy feature to determine which custom metadata fields are selected for a given path.

Parameters:

  • folder_path (String)

    The folder path (e.g., /path/to/folder) for which to retrieve applicable custo

  • include_deleted (Boolean)

    Set it to true to include deleted field objects in the API response.

  • request_options (Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



95
96
97
98
99
100
101
102
103
104
105
# File 'lib/imagekitio/resources/custom_metadata_fields.rb', line 95

def list(params = {})
  parsed, options = Imagekitio::CustomMetadataFieldListParams.dump_request(params)
  query = Imagekitio::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "v1/customMetadataFields",
    query: query.transform_keys(folder_path: "folderPath", include_deleted: "includeDeleted"),
    model: Imagekitio::Internal::Type::ArrayOf[Imagekitio::CustomMetadataField],
    options: options
  )
end

#update(id, description: nil, label: nil, schema: nil, request_options: {}) ⇒ Imagekitio::Models::CustomMetadataField

Some parameter documentations has been truncated, see Models::CustomMetadataFieldUpdateParams for more details.

This API updates the label, description, or schema of an existing custom metadata field.

Parameters:

  • id (String)

    Should be a valid custom metadata field id.

  • description (String)

    Optional description for the custom metadata field. Can be up to 500 characters.

  • label (String)

    Human readable name of the custom metadata field. This should be unique across a

  • schema (Imagekitio::Models::CustomMetadataFieldUpdateParams::Schema)

    An object that describes the rules for the custom metadata key. This parameter i

  • request_options (Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



61
62
63
64
65
66
67
68
69
70
# File 'lib/imagekitio/resources/custom_metadata_fields.rb', line 61

def update(id, params = {})
  parsed, options = Imagekitio::CustomMetadataFieldUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["v1/customMetadataFields/%1$s", id],
    body: parsed,
    model: Imagekitio::CustomMetadataField,
    options: options
  )
end