prepare_items_for_bulk_import {sevenbridges2}R Documentation

Prepare items for bulk import

Description

Utility function to prepare the items parameter, a list of elements containing information about each file or folder to be imported using the bulk_submit_import() method.

Usage

prepare_items_for_bulk_import(
  volume_items,
  destination_project = NULL,
  destination_parent = NULL,
  autorename = FALSE,
  preserve_folder_structure = TRUE
)

Arguments

volume_items

A list of VolumeFile or VolumePrefix objects to be imported.

destination_project

Destination project ID or Project object. Not required, but either destination_project or destination_parent directory must be provided.

destination_parent

Folder ID or File object (with type = 'FOLDER'). Not required, but either
destination_project or destination_parent directory must be provided.

autorename

Logical indicating whether to autorename conflicting files (default is FALSE). Set to TRUE if you want to automatically rename the item (by prefixing its name with an underscore and number) if another one with the same name already exists at the destination. Bear in mind that if used with folders import, the folder content will be renamed, not the whole folder. Keep in mind that the same autorename option will be applied to all items.

preserve_folder_structure

Logical indicating whether to preserve folder structure. Set to TRUE if you want to keep the exact source folder structure. The default value is TRUE if the item being imported is a folder. Should not be used if you are importing a file. Bear in mind that if you use preserve_folder_structure = FALSE, the response will be the parent folder object containing imported files alongside with other files if they exist. Keep in mind that the same preserve_folder_structure option will be applied to all folders.

Details

Based on the provided list of VolumeFile or VolumePrefix objects, this function allows you to set the following fields for each item:

However, keep in mind that there are certain constraints:

Value

A list of elements containing information about each file/folder to be imported.

See Also

Imports, VolumeFile, VolumePrefix

Examples

## Not run: 
# Example 1: Prepare 2 items for bulk import action - provide destination
# project
volume_obj_1 <- a$volumes$get
volume_obj_2 <- a$volumes$get

volumes_to_import <- list(volume_obj_1, volume_obj_2)

destination_project <- a$projects$get(id = "project_id")

prepare_items_for_bulk_import(
  volume_items = volumes_to_import,
  destination_project = destination_project
)

## End(Not run)
## Not run: 
# Example 2: Prepare 2 items for bulk import action - provide destination
# parent
volume_obj_1 <- a$volumes$get
volume_obj_2 <- a$volumes$get

volumes_to_import <- list(volume_obj_1, volume_obj_2)

destination_parent <- a$files$get(id = "folder_id")

prepare_items_for_bulk_import(
  volume_items = volumes_to_import,
  destination_parent = destination_parent
)

## End(Not run)


[Package sevenbridges2 version 0.2.0 Index]