Crate surge_sdk

Crate surge_sdk 

Source
Expand description

ยงSurge SDK for Rust

A type-safe Rust interface for the Surge.sh API, enabling programmatic management of static site deployments, domains, SSL certificates, and DNS records.

ยงKey Features

  • ๐Ÿš€ Zero-config publishing to .surge.sh domains
  • ๐Ÿ”’ SSL certificate management (requires Pro account)
  • ๐ŸŒ DNS and domain zone configuration
  • ๐Ÿ“Š Real-time deployment event streaming
  • ๐Ÿ› ๏ธ Async-first design using reqwest and tokio

ยงQuick Start

use surge_sdk::{Config, SurgeSdk, Auth, SURGE_API};
use std::path::Path;

#[tokio::main]
async fn main() -> Result<(), surge_sdk::SurgeError> {
    let config = Config::new(SURGE_API, "0.1.0")?;
    let sdk = SurgeSdk::new(config)?;
    let auth = Auth::Token("your-api-token".into());
     
    sdk.publish(Path::new("./dist"), "your-domain.surge.sh", &auth, None, None).await?;
    Ok(())
}

Re-exportsยง

pub use config::Config;
pub use error::SurgeError;
pub use sdk::SurgeSdk;
pub use stream::calculate_metadata;
pub use stream::publish;
pub use types::Auth;
pub use types::Event;
pub use utils::generate_domain;
pub use utils::json_to_argv;
pub use responses::*;

Modulesยง

config
Configuration module for the Surge SDK.
error
Error handling module for the Surge SDK.
responses
Response Types for Surge API
sdk
Surge SDK for interacting with the Surge API.
stream
Module for streaming project publishing functionality in the Surge SDK.
types
Module defining core data types for the Surge SDK.
utils
Module for utility functions in the Surge SDK.

Constantsยง

SURGE_API
The default Surge.sh API endpoint