pub struct EndpointSchema {
pub name: String,
pub code: u32,
pub parameters: Vec<Field>,
pub returns: Vec<Field>,
pub stream_response: Option<Type>,
pub description: String,
pub json_schema: Value,
pub roles: Vec<String>,
}Expand description
EndpointSchema is a struct that represents a single endpoint in the API.
Fields§
§name: StringThe name of the endpoint (e.g. UserListSymbols)
code: u32The method code of the endpoint (e.g. 10020)
parameters: Vec<Field>A list of parameters that the endpoint accepts (e.g. “symbol” of type String)
returns: Vec<Field>A list of fields that the endpoint returns
stream_response: Option<Type>The type of the stream response (if any)
description: StringA description of the endpoint added by with_description method
json_schema: ValueThe JSON schema of the endpoint (Default::default())
roles: Vec<String>Implementations§
Source§impl EndpointSchema
impl EndpointSchema
Sourcepub fn new(
name: impl Into<String>,
code: u32,
parameters: Vec<Field>,
returns: Vec<Field>,
) -> Self
pub fn new( name: impl Into<String>, code: u32, parameters: Vec<Field>, returns: Vec<Field>, ) -> Self
Creates a new EndpointSchema with the given name, method code, parameters and returns.
Sourcepub fn with_stream_response_type(self, stream_response: Type) -> Self
pub fn with_stream_response_type(self, stream_response: Type) -> Self
Adds a stream response type field to the endpoint.
Sourcepub fn with_description(self, desc: impl Into<String>) -> Self
pub fn with_description(self, desc: impl Into<String>) -> Self
Adds a description field to the endpoint.
Sourcepub fn with_roles(self, roles: Vec<String>) -> Self
pub fn with_roles(self, roles: Vec<String>) -> Self
Adds allowed roles to the endpoint.
Trait Implementations§
Source§impl Clone for EndpointSchema
impl Clone for EndpointSchema
Source§fn clone(&self) -> EndpointSchema
fn clone(&self) -> EndpointSchema
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EndpointSchema
impl Debug for EndpointSchema
Source§impl Default for EndpointSchema
impl Default for EndpointSchema
Source§fn default() -> EndpointSchema
fn default() -> EndpointSchema
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for EndpointSchema
impl<'de> Deserialize<'de> for EndpointSchema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for EndpointSchema
impl RefUnwindSafe for EndpointSchema
impl Send for EndpointSchema
impl Sync for EndpointSchema
impl Unpin for EndpointSchema
impl UnsafeUnpin for EndpointSchema
impl UnwindSafe for EndpointSchema
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more