rocketapi

Crates.iorocketapi
lib.rsrocketapi
version0.1.0
sourcesrc
created_at2024-09-12 19:13:12.355586
updated_at2024-09-12 19:13:12.355586
descriptionUnofficial RocketAPI Rust SDK for Instagram & Threads Private API 2024
homepage
repositoryhttps://github.com/Allespro/rocketapi-rust
max_upload_size
id1373067
size37,661
Fabeni (Allespro)

documentation

README

Introduction

This library provides a pure Rust interface for the RocketAPI.

Installing

To install rocketapi add in Cargo.toml


Examples

InstagramAPI example

use rocketapi::instagramapi::InstagramAPI;
use rocketapi::errors::RocketAPIError;

#[tokio::main]
async fn main() {
    let mut instagram_api: InstagramAPI = InstagramAPI::new(
        "Your API key".to_string(),
        std::time::Duration::from_secs(30)
    );
    let username:&str = "kanyewest";
    match instagram_api.get_user_info(username).await {
        Ok(result) => {
            println!("Response: {:?}", result)
        }
        Err(RocketAPIError::BadResponse(msg)) => println!("{}", msg),
        Err(RocketAPIError::NotFound(msg)) => println!("{}", msg),
        Err(RocketAPIError::RequestError(msg)) => println!("{}", msg),
    }
}

ThreadsAPI example

use rocketapi::threadsapi::ThreadsAPI;
use rocketapi::errors::RocketAPIError;

#[tokio::main]
async fn main() {
    let mut threads_api: ThreadsAPI = ThreadsAPI::new(
        "Your API key".to_string(),
        std::time::Duration::from_secs(30)
    );
    let user_id: u64 = 65107478842;
    match threads_api.get_user_feed(&user_id, None).await {
        Ok(result) => {
            println!("Response: {:?}", result)
        }
        Err(RocketAPIError::BadResponse(msg)) => println!("{}", msg),
        Err(RocketAPIError::NotFound(msg)) => println!("{}", msg),
        Err(RocketAPIError::RequestError(msg)) => println!("{}", msg),
    }
}

Usage

See the documentation for more information.

Commit count: 0

cargo fmt