Struct algorithmia::data::DataDir [] [src]

pub struct DataDir { /* fields omitted */ }

Algorithmia Data Directory

Methods

impl DataDir
[src]

Display Directory details if it exists

Examples

let client = Algorithmia::client("111112222233333444445555566");
let my_dir = client.dir(".my/my_dir");
let dir_list = my_dir.list();
for entry in dir_list {
    match entry {
        Ok(DataItem::File(f)) => println!("File: {}", f.to_data_uri()),
        Ok(DataItem::Dir(d)) => println!("Dir: {}", d.to_data_uri()),
        Err(err) => { println!("Error: {}", err); break; },
    }
};

Create a Directory

Use DataAcl::default() or the ReadAcl enum to set the ACL

Examples

let client = Algorithmia::client("111112222233333444445555566");
let my_dir = client.dir(".my/my_dir");
match my_dir.create(DataAcl::default()) {
  Ok(_) => println!("Successfully created Directory"),
  Err(e) => println!("Error created directory: {}", e),
};

Delete a Directory

Examples

let client = Algorithmia::client("111112222233333444445555566");
let my_dir = client.dir(".my/my_dir");
match my_dir.delete(false) {
  Ok(_) => println!("Successfully deleted Directory"),
  Err(err) => println!("Error deleting directory: {}", err),
};

Upload a file to an existing Directory

Examples

let client = Algorithmia::client("111112222233333444445555566");
let my_dir = client.dir(".my/my_dir");

match my_dir.put_file("/path/to/file") {
  Ok(_) => println!("Successfully uploaded to: {}", my_dir.to_data_uri()),
  Err(err) => println!("Error uploading file: {}", err),
};

Instantiate DataFile or DataDir as a child of this DataDir

Trait Implementations

impl HasDataPath for DataDir
[src]

Get the API Endpoint URL for a particular data URI

Get the Algorithmia data URI a given Data Object Read more

Get the parent off a given Data Object Read more

Get the basename from the Data Object's path (i.e. unix basename) Read more

Determine if a file or directory exists for a particular data URI Read more

impl From<DataObject> for DataDir
[src]

Performs the conversion.