Class: Imagekitio::Resources::CustomMetadataFields

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

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:



128
129
130
# File 'lib/imagekitio/resources/custom_metadata_fields.rb', line 128

def initialize(client:)
  @client = client
end

Instance Method Details

#create(label: , name: , schema: , 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:

Returns:

See Also:



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

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:



116
117
118
119
120
121
122
123
# File 'lib/imagekitio/resources/custom_metadata_fields.rb', line 116

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:



90
91
92
93
94
95
96
97
98
99
# File 'lib/imagekitio/resources/custom_metadata_fields.rb', line 90

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

#update(id, 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 or schema of an existing custom metadata field.

Parameters:

Returns:

See Also:



56
57
58
59
60
61
62
63
64
65
# File 'lib/imagekitio/resources/custom_metadata_fields.rb', line 56

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