Crates.io | mediaflow |
lib.rs | mediaflow |
version | 0.9.0 |
source | src |
created_at | 2022-05-02 07:48:23.70928 |
updated_at | 2022-09-26 20:27:19.172028 |
description | Unofficial SDK to interact with the Mediaflow Pro API |
homepage | https://github.com/jacobsvante/mediaflow |
repository | https://github.com/jacobsvante/mediaflow |
max_upload_size | |
id | 578925 |
size | 80,737 |
This is an unofficial Rust SDK for Mediaflow.
API documentation can be found here: https://static.mediaflowpro.com/doc/
Supports both programmatic and CLI usage (via cli
feature).
The project's API is still very much in fluctuation. Pin your dependency to the current minor version to avoid breaking changes. From 1.0 and forward we will keep a stable API.
This is the easiest way to get started. To find out what you can do with the CLI, just append --help
or -h
to the installed mediaflow
command.
Please note that you need to add the cli
feature for CLI access. Using cargo-edit you can do this by calling: cargo add mediaflow --features cli
It's recommended to create an INI config file before using the CLI (see previous section on setup), to avoid having to provide all OAuth 2 details with every command execution.
You can use mediaflow default-ini-path
to find the default INI config location.
mediaflow default-ini-path
Write your settings to the file, in this example using heredoc syntax:
cat <<EOF >"$(mediaflow default-ini-path)"
[sandbox]
client_id = 2tGLiKv
client_secret = eu9ZIGXcGNFY8bw0gjQYeNuNoBmk7G
username = email@example.com
password = myPassword
EOF
After this you just have to provide the section name to start using the CLI:
mediaflow rest-api folder-files --full --recursive 123456
As an alternative you can provide environment variables directly. For example:
export CLIENT_ID=2tGLiKv
export CLIENT_SECRET=eu9ZIGXcGNFY8bw0gjQYeNuNoBmk7G
export USERNAME=email@example.com
export PASSWORD=myPassword
mediaflow rest-api folder-files -F -r 567890
See example below on how to integrate into your code.
use mediaflow::{Config, RestApi, FileFull};
let config = Config::new(
"2tGLiKv",
"eu9ZIGXcGNFY8bw0gjQYeNuNoBmk7G",
"email@example.com",
"myPassword",
);
let api = RestApi::new(config);
let files = api.get_folder_files_recursive(123456).await?;
println!("Folder with ID 123456 contains {} files", files.len());