1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
//! Functionality to utilise OData entity model code generated by the `odata_client_codegen` crate. //! //! Re-exports from third-party crates are presented here so that users of generated code need not //! add those crates to their own `Cargo.toml`. mod client; pub use chrono; pub use iso8601; pub use serde; pub use serde_with; pub use uuid; pub use odata_client_derive::odata_client; pub use odata_client_util::deserialize_with; pub use client::{Entity, EntityLink, EntityLinkStub, EntitySetEndpoint, SingletonEndpoint}; use serde::Deserialize; /// Represents an `$expand` query for types implementing [`EntityProperties`]. pub enum ExpandQuery { Expand(&'static str), None, } /// Implemented by types which represent an Entity Type included in generated code from an OData /// Entity Data Model document. pub trait EntityProperties: for<'de> Deserialize<'de> { /// Contents of the `$expand` query to use when fetching this entity: a comma-separated list /// that sufficiently specifies all navigation properties to be expanded. /// /// For non-containment navigation properties (i.e. the [`EntityLink`]/[`EntityLinkStub`] fields /// in the Rust type), a segment of the form `PropName/$ref` should be added. /// /// For containment navigation properties (i.e. those where `ContainsTarget="true"` in the EDM /// document), a segment of the form `PropName` should be added, or /// `PropName($expand=[target entity expand query])`, if the target entity has navigation /// properties itself. /// /// Should be set to [`ExpandQuery::None`] if there are no required segments. // TODO: Navigation properties are allowed within complex types. How are these addressed in an // `$expand` query? const EXPAND_QUERY: ExpandQuery; }