Enum seamless::ApiBodyType[][src]

pub enum ApiBodyType {
    String,
    Number,
    Boolean,
    Null,
    Any,
    ArrayOf {
        value: Box<ApiBodyInfo>,
    },
    TupleOf {
        values: Vec<ApiBodyInfo>,
    },
    ObjectOf {
        value: Box<ApiBodyInfo>,
    },
    Object {
        keys: HashMap<String, ApiBodyInfo>,
    },
    OneOf {
        values: Vec<ApiBodyInfo>,
    },
    StringLiteral {
        literal: String,
    },
    Optional {
        value: Box<ApiBodyInfo>,
    },
}

An enum representing the shape of the JSON that is provided or output from the API. There is a straightforward mapping from this to TypeScript types.

Variants

String

Corresponds to the TypeScript type string.

Number

Corresponds to the TypeScript type number.

Boolean

Corresponds to the TypeScript type boolean.

Null

Corresponds to the TypeScript type null.

Any

Corresponds to the TypeScript type any.

This is used when the shape cannot be statically determined for one reason or another.

ArrayOf

An array of values of one type, where each value has the type value, eg string[] or number[].

Fields of ArrayOf

value: Box<ApiBodyInfo>

The type of all of the values in the array.

TupleOf

A fixed length array of values that can be of mixed types, eg [string, number, Foo].

Fields of TupleOf

values: Vec<ApiBodyInfo>

A list of each of the types in this fixed length array.

ObjectOf

An object where the keys are strings and the values are all of the same type, eg { [key: string]: Foo }.

Fields of ObjectOf

value: Box<ApiBodyInfo>

The type of all of the values in the object/map.

Object

An object whose keys and value types are known at compile time, eg { foo: string, bar: boolean, wibble: Foo }.

Fields of Object

keys: HashMap<String, ApiBodyInfo>

The property name and type of each entry in the object.

OneOf

The type is one of several variants, eg string | number | Foo.

Fields of OneOf

values: Vec<ApiBodyInfo>

Each of the possible types that this can be.

StringLiteral

The type is a string literal with a specific value, eg "stringvalue".

Fields of StringLiteral

literal: String

The exact string literal that we expect.

Optional

The type is optional, and need not be provided. It corresponds to either { key?: Foo } in objects, or Foo | undefined in other contexts.

Fields of Optional

value: Box<ApiBodyInfo>

The type that is optional.

Trait Implementations

impl Clone for ApiBodyType[src]

impl Debug for ApiBodyType[src]

impl Eq for ApiBodyType[src]

impl PartialEq<ApiBodyType> for ApiBodyType[src]

impl Serialize for ApiBodyType[src]

impl StructuralEq for ApiBodyType[src]

impl StructuralPartialEq for ApiBodyType[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.