odoo-api

Crates.ioodoo-api
lib.rsodoo-api
version0.2.5
sourcesrc
created_at2022-12-22 03:46:26.028025
updated_at2023-02-24 02:23:04.88088
descriptionType-safe and full-coverage implementation of the Odoo JSON-RPC API, including ORM and Web methods. Supports sessioning, multi-database, async and blocking via reqwest, and bring-your-own requests.
homepagehttps://github.com/ryanc-me/odoo-api-rs
repositoryhttps://github.com/ryanc-me/odoo-api-rs
max_upload_size
id743656
size226,377
Ryan Cole (ryanc-me)

documentation

https://docs.rs/odoo-api

README

odoo-api

github crates.io docs.rs docs.rs

odoo_api

The odoo_api crate provides a type-safe and full-coverage implementation of the Odoo JSON-RPC API, including ORM and Web methods. It supports sessioning, multi-database, async and blocking via reqwest, and bring-your-own requests.

API Methods

For a full list of supported API methods, see odoo_api::service.

Bring your own requests

By default, odoo_api uses reqwest as its HTTP implementation. It is also possible to provide your own HTTP implementation (see OdooClient for more info).

Example

To use the default reqwest implementation, add this to your Cargo.toml:

[dependencies]
odoo_api = "0.2"

Then make your requests:

use odoo_api::{OdooClient, jvec, jmap};

// build the client and authenticate
let url = "https://demo.odoo.com";
let client = OdooClient::new_reqwest_async(url)?
    .authenticate(
        "some-database",
        "admin",
        "password",
    ).await?;

// fetch a list of users
let users = client.execute(
    "res.users",
    "search",
    jvec![]
).send().await?;

// fetch the login and partner_id fields from user id=1
let info = client.execute_kw(
    "res.users",
    "read",
    jvec![[1]],
    jmap!{
        "fields": ["login", "partner_id"]
    }
).send().await?;

// fetch a list of databases
let databases = client.db_list(false).send().await?;

// fetch server version info
let version_info = client.common_version().send().await?;
Commit count: 140

cargo fmt