Enum seamless::api::ApiBodyType
source · pub enum ApiBodyType {
Show 14 variants
String,
Number,
Boolean,
Null,
Any,
Unknown,
Binary,
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>,
},
}
Expand description
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, and we want to
indicate that any type can be provided. In many cases ApiBodyType::Unknown
may be preferred.
Unknown
Corresponds to the TypeScript type unknown
.
This is used when the shape cannot be statically determined, and we want to
indicate that we’re not sure what the type is, unlike ApiBodyType::Any
which hints that any type can be provided.
Binary
Indicate that we expect binary data to be provided. This may correspond to
Blob
in a UI.
ArrayOf
Fields
value: Box<ApiBodyInfo>
The type of all of the values in the array.
An array of values of one type, where each value has the type value
, eg
string[]
or number[]
.
TupleOf
Fields
values: Vec<ApiBodyInfo>
A list of each of the types in this fixed length array.
A fixed length array of values that can be of mixed types, eg
[string, number, Foo]
.
ObjectOf
Fields
value: Box<ApiBodyInfo>
The type of all of the values in the object/map.
An object where the keys are strings and the values are all of the same type, eg
{ [key: string]: Foo }
.
Object
Fields
keys: HashMap<String, ApiBodyInfo>
The property name and type of each entry in the object.
An object whose keys and value types are known at compile time, eg
{ foo: string, bar: boolean, wibble: Foo }
.
OneOf
Fields
values: Vec<ApiBodyInfo>
Each of the possible types that this can be.
The type is one of several variants, eg
string | number | Foo
.
StringLiteral
The type is a string literal with a specific value, eg
"stringvalue"
.
Optional
Fields
value: Box<ApiBodyInfo>
The type that is optional.
The type is optional, and need not be provided. It corresponds to either
{ key?: Foo }
in objects, or Foo | undefined
in other contexts.
Trait Implementations§
source§impl Clone for ApiBodyType
impl Clone for ApiBodyType
source§fn clone(&self) -> ApiBodyType
fn clone(&self) -> ApiBodyType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ApiBodyType
impl Debug for ApiBodyType
source§impl PartialEq<ApiBodyType> for ApiBodyType
impl PartialEq<ApiBodyType> for ApiBodyType
source§fn eq(&self, other: &ApiBodyType) -> bool
fn eq(&self, other: &ApiBodyType) -> bool
self
and other
values to be equal, and is used
by ==
.