27 releases

0.8.0 Oct 25, 2023
0.7.7 Jul 19, 2023
0.7.6 Feb 11, 2023
0.7.5 Apr 18, 2022
0.3.0 Nov 26, 2020

#1172 in Web programming

Download history 12/week @ 2024-07-18 105/week @ 2024-07-25 13/week @ 2024-08-22 2/week @ 2024-08-29

192 downloads per month
Used in wccg-models

MIT license

33KB
813 lines

contentful-rs   Latest Version Docs

Contentful API Rust Client

Usage example

let contentful_client = ContentfulClient::new("<access_token>", "<space_id>");
let product = contentful_client.get_entry::<Product>("<entry_id>").await?;

if let Some(product) = product {
    let name = product.name;
    //..
}

For more examples, please see the tests folder

Querying for content

Get a single entry

To get a single entry use the get_entry method.

let product = contentful_client.get_entry::<Product>("<entry_id>").await?;

Get multiple entries

There are several methods to retrieve multiple entries available in the SDK.

Get and filter entries

let builder = QueryBuilder::new()
        .content_type_is("product")
        .field_equals("fields.name", name);
let products = contentful_client
        .get_entries::<Product>(Some(builder))
        .await?

Dependencies

~4–16MB
~227K SLoC