3 releases (breaking)
0.3.0 | Nov 20, 2023 |
---|---|
0.2.0 | Jun 29, 2023 |
0.1.0 | Jun 7, 2023 |
#63 in #api-request
165KB
4K
SLoC
Implemented Openapi version
2023-07-13
Document
Changelog
License
Copyright 2023 - Golden_Water
SPDX-License-Identifier: MIT
lib.rs
:
Initializing bot instance
you can simply initialize a Bot instance by calling the new method
use mys_villa::bot::bot_event_handler::BotEventHandler;
use mys_villa::bot::bot_info::BotAuthInfo;
use mys_villa::bot::bot_permission::BotPermission;
use mys_villa::bot::Bot;
// the default implementation of request executor
use mys_villa::request::request_executor::request_executor_impl::RequestExecutorImpl;
#
#
#
#
let bot = Bot::new(
BotAuthInfo::from_env()?,
BotPermission::all(),
RequestExecutorImpl::new()?,
State,
EventHandler,
);
Make a api request
for example if we want to get the villa info of villa by id 123456789
use mys_villa::api_type::villa::villa_info::VillaInfo;
#
// first create a instance of target villa,
// store it in variable for future reuse
let villa = bot.villa(12345789);
// then we can call the get_info method on the instance
let villa_info: VillaInfo = villa.get_info().await?;
println!("{}",villa_info.name); // name of this villa
Other
for more information, you can view the related module/struct documentation and examples
Dependencies
~5–21MB
~257K SLoC