Skip to main content

Crate ghost_io_api

Crate ghost_io_api 

Source
Expand description

§ghost-io-api

A strongly-typed, async Rust client for the Ghost CMS Content API.

§Modules

  • auth — API key types and validation
  • client — HTTP clients for each Ghost API
  • errorGhostError enum and Result alias
  • models — serde-annotated structs for every Ghost resource
  • params — fluent query-parameter builders

§Quick start

use ghost_io_api::auth::content::ContentApiKey;
use ghost_io_api::client::content::{BrowsePostsParams, GhostContentClient};
use ghost_io_api::error::Result;

#[tokio::main]
async fn main() -> Result<()> {
    let key = ContentApiKey::new("22444f78447824223cefc48062")?;
    let client = GhostContentClient::new("https://demo.ghost.io", key)?;

    let response = client.browse_posts(BrowsePostsParams::default()).await?;
    for post in &response.posts {
        println!("{} — {}", post.title, post.slug);
    }
    Ok(())
}

Modules§

auth
Authentication modules for Ghost API.
client
API client implementations for Ghost.
error
Error types for the Ghost API client.
models
Data models for Ghost API resources.
params
Query parameter builders for Ghost API requests.