src/expandable.rs

async-stripe · async-stripe-types/src/expandable.rs · rust · Apache-2.0
payments

Generic enum for Stripe expandable objects with custom serialization.

// Source: https://github.com/arlyon/async-stripe | License: Apache-2.0 | Copyright 2019 Wyyerd Group
// Provided via justclaw.it.com; keep this notice with the code.
use serde::Serialize;

use crate::Object;

/// An id or object.
///
/// By default stripe will return an id for most fields, but if more detail is
/// necessary the `expand` parameter can be provided to ask for the id to be
/// loaded as an object instead.
///
/// For more details see <https://stripe.com/docs/api/expanding_objects>.
#[derive(Clone, Debug, Serialize)] // TODO: Implement deserialize by hand for better error messages with `serde` enabled
#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
#[serde(untagged)]
pub enum Expandable<T: Object> {
    /// Just the object id.
    Id(T::Id),
    /// The entir

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key