#firebase #storage #sdk #bucket

firebase-storage

Firebase-Storage Rust Sdk

1 unstable release

0.1.0 Jun 23, 2023

#39 in #firebase

MIT license

9KB
65 lines

Firebase Storage Rust SDK

The Firebase Storage Rust SDK provides a convenient way to interact with Firebase Storage in Rust applications. It utilizes the Firebase App SDK and API Request Utils crate to handle authentication and make API requests to Firebase Storage.

Usage

Here's an example of how to use the Firebase Storage Rust SDK:

use firebase_app_sdk::App;
use firebase_storage_sdk::Storage;
use api_request_utils_rs::StatusCode;
#[tokio::main]
async fn main() -> std::result::Result<(), StatusCode> {
    // Initialize the Firebase app
    let app = App::initialize().await?;

    // Create a Firebase Storage instance
    let storage = Storage::new(&app);

    // Add a linked storage bucket to the Firebase project
    let bucket = storage.add_firebase().await?;
    println!("Bucket name: {}", bucket.name);

    // Remove the linked storage bucket from the Firebase project
    storage.remove_firebase().await?;
    println!("Bucket unlinked successfully.");

    // List the linked storage buckets for the Firebase project
    let result = storage.list("", 10).await?;
    println!("Buckets:");
    for bucket in result.buckets {
        println!("Bucket name: {}", bucket.name);
    }
    if let Some(next_page_token) = result.next_page_token {
        println!("Next page token: {}", next_page_token);
    }

    Ok(())
}

Dependencies

~4–17MB
~214K SLoC