[−][src]Struct vkapi::vk::VK
VK structure, used for call api method, use longpoll api and etc
Methods
impl<'a> VK<'a>
[src]
pub fn new(api_version: &'a str, language: &'a str) -> Self
[src]
pub fn set_access_token(&mut self, token: String)
[src]
Set access token
pub fn get_access_token(&self) -> &String
[src]
Get a reference to token
pub async fn start_longpoll<'_>(
&'_ self,
group_id: u32,
wait: u16,
callback: Box<dyn Fn(&JsonValue)>
)
[src]
&'_ self,
group_id: u32,
wait: u16,
callback: Box<dyn Fn(&JsonValue)>
)
This methond starts to longpolling, It's sad, but as for now there're ways to stop it (but I'm gonna make it)
Arguments:
group_id
- your group IDwait
- Maximal time to waiting, max value is 90callback
- closure which have 1 argument: event
pub async fn upload<'_>(
&'_ self,
file: File,
params: Params
) -> Result<JsonValue, String>
[src]
&'_ self,
file: File,
params: Params
) -> Result<JsonValue, String>
Use if you want to upload any file
Arguments:
file
- is File struct
Return:
this method returns JsonValue like this:
[{"id":457239436,"album_id":-64,"owner_id":-142102660,"user_id":100,"sizes":[{"type":"s","url":"https://sun9-64.userapi.com/c857724/v857724964/1cd30a/OkprPbgIA4M.jpg","width":75,"height":42},{"type":"m","url":"https://sun9-11.userapi.com/c857724/v857724964/1cd30b/zf7PALt9LiQ.jpg","width":130,"height":73},{"type":"x","url":"https://sun9-42.userapi.com/c857724/v857724964/1cd30c/QkU_GWrWrtg.jpg",":"o","url":"https://sun9-55.userapi.com/c857724/v857724964/1cd30f/VuJoCsfzNhQ.jpg","width":130,"height":87},{"type":"p","url":"https://sun9-7.userapi.com/c857724/v857724964/1cd310/03M7NFSwldw.jpg","width":200,"height":133},{"type":"q","url":"https://sun9-27.userapi.com/c857724/v857724964/1cd311/E-l93bSWpSk.jpg","width":320,"height":213},{"type":"r","url":"https://sun9-61.userapi.com/c857724/v857724964/1cd312/0aqWUY6M9jE.jpg","width":510,"height":340}],"text":"","date":1587293486,"access_key":"cb0b2221048b3d8021"}]
More details about return here
pub async fn request<'_, '_, '_>(
&'_ self,
method: &'_ str,
params: &'_ mut Params
) -> Result<JsonValue, String>
[src]
&'_ self,
method: &'_ str,
params: &'_ mut Params
) -> Result<JsonValue, String>
Used for request API
Arguments:
method
- all methods are listed hereparams
- params to call API. useParams::new()
and thenparams.add()
pub async fn request_public<'_, '_, '_, '_, '_>(
method: &'_ str,
params: &'_ mut Params,
access_token: &'_ Option<String>,
api_version: &'_ str,
language: &'_ str
) -> Result<JsonValue, String>
[src]
method: &'_ str,
params: &'_ mut Params,
access_token: &'_ Option<String>,
api_version: &'_ str,
language: &'_ str
) -> Result<JsonValue, String>
** I'm not recommend use it **
You can use request
but without constructing VK instance
pub async fn direct_auth<'_, '_, '_>(
&'_ mut self,
login: &'_ str,
password: &'_ str
) -> Result<(), JsonValue>
[src]
&'_ mut self,
login: &'_ str,
password: &'_ str
) -> Result<(), JsonValue>
Used for direct auth
login
- email or phone numberpassword
- Hm..what it's supposed to be
Auto Trait Implementations
impl<'a> RefUnwindSafe for VK<'a>
impl<'a> Send for VK<'a>
impl<'a> Sync for VK<'a>
impl<'a> Unpin for VK<'a>
impl<'a> UnwindSafe for VK<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,