Expand description
A single catalyst server.
Fields
base_url: String
owner: String
id: String
Implementations
sourceimpl Server
impl Server
sourcepub fn new<T>(base_url: T) -> Server where
T: AsRef<str>,
pub fn new<T>(base_url: T) -> Server where
T: AsRef<str>,
Constructs a new Server
using a custom base_url
.
Example
let server = catalyst::Server::new("https://my-awesome-server.org");
assert_eq!(server.base_url, "https://my-awesome-server.org")
sourcepub fn development() -> Server
pub fn development() -> Server
Constructs a new Server
using a development base_url
(https://server.decentraland.zone
).
Example
let server = catalyst::Server::development();
assert_eq!(server.base_url, "https://peer.decentraland.zone")
sourcepub fn staging() -> Server
pub fn staging() -> Server
Constructs a new Server
using a staging base_url
(https://peer-testing.decentraland.org
).
Example
let server = catalyst::Server::staging();
assert_eq!(server.base_url,"https://peer-testing.decentraland.org")
sourcepub fn production() -> Server
pub fn production() -> Server
Constructs a new Server
using a production root base_url
(https://peer.decentraland.org
).
Example
let server = catalyst::Server::production();
assert_eq!(server.base_url, "https://peer.decentraland.org")
sourcepub async fn get<U, R>(&self, path: U) -> Result<R> where
U: AsRef<str> + Display,
R: for<'a> Deserialize<'a>,
pub async fn get<U, R>(&self, path: U) -> Result<R> where
U: AsRef<str> + Display,
R: for<'a> Deserialize<'a>,
Executes a GET
request to path
.
The response is parsed as JSON and deserialized in the result.
If you need to deal with the result by hand, use get_raw
.
sourcepub async fn raw_get<U>(&self, path: U) -> Result<Response> where
U: AsRef<str> + Display,
pub async fn raw_get<U>(&self, path: U) -> Result<Response> where
U: AsRef<str> + Display,
Executes a GET
request to path
.
The response is returned as is using reqwest::Response
.
For automatic deserialization of JSON response see get
.
sourcepub async fn post<U, B, R>(&self, path: U, body: &B) -> Result<R> where
U: AsRef<str> + Display,
B: for<'a> Serialize,
R: for<'a> Deserialize<'a>,
pub async fn post<U, B, R>(&self, path: U, body: &B) -> Result<R> where
U: AsRef<str> + Display,
B: for<'a> Serialize,
R: for<'a> Deserialize<'a>,
Executes a POST
request to path
with body body
.
The response is parsed as JSON and deserialized in the result.
If you need to deal with the result by hand, use get_raw
.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Server
impl<'de> Deserialize<'de> for Server
sourcefn 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 !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more