nextcloud_ocs/lib.rs
1//! OCS API envelope and client for the Nextcloud SDK.
2//!
3//! Nextcloud's OCS endpoints answer with an envelope that wraps the payload in
4//! a status block, so decoding an OCS response is two steps: unwrap the
5//! envelope, then read the `data` field.
6//!
7//! - [`OcsEnvelope`] / [`Ocs`] / [`Meta`] — the wire shape of that envelope,
8//! tolerant of the field types Nextcloud actually sends.
9//! - [`OcsStatus`] — the verdict carried by `meta.statuscode`.
10//! - [`Query`] / [`OcsFormat`] — the query string appended to an OCS path,
11//! including the `format=json` selector.
12//! - [`OcsClient`] — executes an OCS call through any
13//! [`Transport`](nextcloud_sdk_core::Transport) and returns the decoded payload.
14//!
15//! OCS requires two request headers that are easy to forget: every call must
16//! send `OCS-APIRequest: true`, and JSON answers require
17//! `Accept: application/json`. [`OcsClient`] sets both.
18#![deny(missing_docs)]
19#![forbid(unsafe_code)]
20
21mod client;
22mod envelope;
23mod error;
24mod query;
25
26pub use client::OcsClient;
27pub use envelope::{Meta, Ocs, OcsEnvelope, OcsStatus};
28pub use query::{OcsFormat, Query};