Struct divoom::DivoomServiceClient
source · [−]pub struct DivoomServiceClient { /* private fields */ }
Expand description
Divoom backend service client
This is the client that talks to Divoom online service for fetching information like device info in the same LAN etc.
It is very simple to start using it, simply creates the client without argument, and then start calling the APIs:
use divoom::*;
let divoom = DivoomServiceClient::new();
// let devices = divoom.get_same_lan_devices().await?;
// devices.iter().for_each(|x| println!("{:?}", x));
Implementations
sourceimpl DivoomServiceClient
impl DivoomServiceClient
sourcepub fn new() -> DivoomServiceClient
pub fn new() -> DivoomServiceClient
Create new DivoomServiceClient
sourcepub fn with_options(timeout: Option<Duration>) -> DivoomServiceClient
pub fn with_options(timeout: Option<Duration>) -> DivoomServiceClient
Create new DivoomServiceClient with options
sourcepub fn with_server_url_base(
server_url_base: String,
timeout: Option<Duration>
) -> DivoomServiceClient
pub fn with_server_url_base(
server_url_base: String,
timeout: Option<Duration>
) -> DivoomServiceClient
Create new DivoomServiceClient with specific server URL
sourcepub fn server_url_base(&self) -> &str
pub fn server_url_base(&self) -> &str
Get the server url we send request to
sourcepub async fn get_same_lan_devices(
&self
) -> DivoomAPIResult<Vec<DivoomDeviceInfo>>
pub async fn get_same_lan_devices(
&self
) -> DivoomAPIResult<Vec<DivoomDeviceInfo>>
Find device
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=336
Sample response:
{
"ReturnCode": 0,
"ReturnMessage": "",
"DeviceList": [
{
"DeviceName": "Pixoo64",
"DeviceId": 300000020,
"DevicePrivateIP": "10.0.0.100"
},
...
]
}
sourcepub async fn get_clock_type(&self) -> DivoomAPIResult<Vec<String>>
pub async fn get_clock_type(&self) -> DivoomAPIResult<Vec<String>>
Get channel type
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=189
Sample response:
{
"ReturnCode": 0,
"ReturnMessage": "",
"DialTypeList": [
"Social",
"normal",
"financial",
"Game",
"HOLIDAYS",
"TOOLS",
"DESIGN-64"
]
}
sourcepub async fn get_clock_list(
&self,
dial_type: String,
page_index: i32
) -> DivoomAPIResult<DivoomClockInfoPage>
pub async fn get_clock_list(
&self,
dial_type: String,
page_index: i32
) -> DivoomAPIResult<DivoomClockInfoPage>
Get clock list
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=190
Sample request:
{
"DialType":"Social",
"Page":1
}
Sample response:
{
"ReturnCode": 0,
"ReturnMessage": "",
"TotalNum": 100,
"DialList": [
{
"ClockId": 10,
"Name": "Classic Digital Clock"
},
...
]
}
sourcepub async fn get_font_list(&self) -> DivoomAPIResult<Vec<DivoomFontInfo>>
pub async fn get_font_list(&self) -> DivoomAPIResult<Vec<DivoomFontInfo>>
Get time channel font list.
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=233
Sample response:
{
"ReturnCode": 0,
"ReturnMessage": "",
"FontList": [
{
"id": 2,
"name": "8*8 English letters, Arabic figures,punctuation",
"width": "8",
"high": "8",
"charset": "",
"type": 0
},
...
]
}
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for DivoomServiceClient
impl Send for DivoomServiceClient
impl Sync for DivoomServiceClient
impl Unpin for DivoomServiceClient
impl !UnwindSafe for DivoomServiceClient
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>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
sourcefn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian()
.
sourcefn read_from_big_endian(read: &mut R) -> Result<Self, Error>
fn read_from_big_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian()
.
sourcefn read_from_native_endian(read: &mut R) -> Result<Self, Error>
fn read_from_native_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian()
.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
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