Class: Imagekitio::Resources::Folders

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

Defined Under Namespace

Classes: Job

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Folders

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 Folders.

Parameters:



160
161
162
163
# File 'lib/imagekitio/resources/folders.rb', line 160

def initialize(client:)
  @client = client
  @job = Imagekitio::Resources::Folders::Job.new(client: client)
end

Instance Attribute Details

#jobImagekitio::Resources::Folders::Job (readonly)



7
8
9
# File 'lib/imagekitio/resources/folders.rb', line 7

def job
  @job
end

Instance Method Details

#copy(destination_path:, source_folder_path:, include_versions: nil, request_options: {}) ⇒ Imagekitio::Models::FolderCopyResponse

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

This will copy one folder into another. The selected folder, its nested folders, files, and their versions (in includeVersions is set to true) are copied in this operation. Note: If any file at the destination has the same name as the source file, then the source file and its versions will be appended to the destination file version history.

Parameters:

  • destination_path (String)

    Full path to the destination folder where you want to copy the source folder int

  • source_folder_path (String)

    The full path to the source folder you want to copy.

  • include_versions (Boolean)

    Option to copy all versions of files that are nested inside the selected folder.

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

Returns:

See Also:



85
86
87
88
89
90
91
92
93
94
# File 'lib/imagekitio/resources/folders.rb', line 85

def copy(params)
  parsed, options = Imagekitio::FolderCopyParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/bulkJobs/copyFolder",
    body: parsed,
    model: Imagekitio::Models::FolderCopyResponse,
    options: options
  )
end

#create(folder_name:, parent_folder_path:, request_options: {}) ⇒ Imagekitio::Models::FolderCreateResponse

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

This will create a new folder. You can specify the folder name and location of the parent folder where this new folder should be created.

Parameters:

  • folder_name (String)

    The folder will be created with this name.

  • parent_folder_path (String)

    The folder where the new folder should be created, for root use / else the pat

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

Returns:

See Also:



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

def create(params)
  parsed, options = Imagekitio::FolderCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/folder",
    body: parsed,
    model: Imagekitio::Models::FolderCreateResponse,
    options: options
  )
end

#delete(folder_path:, request_options: {}) ⇒ Imagekitio::Models::FolderDeleteResponse

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

This will delete a folder and all its contents permanently. The API returns an empty response.

Parameters:

  • folder_path (String)

    Full path to the folder you want to delete. For example /folder/to/delete/.

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

Returns:

See Also:



52
53
54
55
56
57
58
59
60
61
# File 'lib/imagekitio/resources/folders.rb', line 52

def delete(params)
  parsed, options = Imagekitio::FolderDeleteParams.dump_request(params)
  @client.request(
    method: :delete,
    path: "v1/folder",
    body: parsed,
    model: Imagekitio::Models::FolderDeleteResponse,
    options: options
  )
end

#move(destination_path:, source_folder_path:, request_options: {}) ⇒ Imagekitio::Models::FolderMoveResponse

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

This will move one folder into another. The selected folder, its nested folders, files, and their versions are moved in this operation. Note: If any file at the destination has the same name as the source file, then the source file and its versions will be appended to the destination file version history.

Parameters:

  • destination_path (String)

    Full path to the destination folder where you want to move the source folder int

  • source_folder_path (String)

    The full path to the source folder you want to move.

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

Returns:

See Also:



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

def move(params)
  parsed, options = Imagekitio::FolderMoveParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/bulkJobs/moveFolder",
    body: parsed,
    model: Imagekitio::Models::FolderMoveResponse,
    options: options
  )
end

#rename(folder_path:, new_folder_name:, purge_cache: nil, request_options: {}) ⇒ Imagekitio::Models::FolderRenameResponse

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

This API allows you to rename an existing folder. The folder and all its nested assets and sub-folders will remain unchanged, but their paths will be updated to reflect the new folder name.

Parameters:

  • folder_path (String)

    The full path to the folder you want to rename.

  • new_folder_name (String)

    The new name for the folder.

  • purge_cache (Boolean)

    Option to purge cache for the old nested files and their versions' URLs.

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

Returns:

See Also:



146
147
148
149
150
151
152
153
154
155
# File 'lib/imagekitio/resources/folders.rb', line 146

def rename(params)
  parsed, options = Imagekitio::FolderRenameParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/bulkJobs/renameFolder",
    body: parsed,
    model: Imagekitio::Models::FolderRenameResponse,
    options: options
  )
end