spacex_sdk
Example
run as cargo run --example simple
auto generate:
```rust
use jwfetch::{FetchError, Method};
use log::info;
use serde::{Deserialize, Serialize};
use spacexsdk::{getautoopenapi, GetAccessTokenOptions, GetOpenAPIOptions};
[derive(Deserialize, Debug, Serialize, Clone)]
pub struct UserInfo {
username: String,
email: String,
}
pub async fn getuserinfo() -> Result {
let params = GetAccessTokenOptions {
clientid: "xx".tostring(),
clientsecret: "xx".tostring(),
scope: "wecom".tostring(),
useragent: "xxx".tostring(),
authapi: "https://open.xx.com/sso/v2".tostring(),
};
let openid = "xx".tostring();
let url = format!("account/getuserinfobyopenid?openid={}", openid);
let openparams = GetOpenAPIOptions {
clientid: params.clientid.clone(),
useragent: params.useragent.clone(),
url,
method: Method::GET,
authorizationtype: "Basic".tostring(),
body: None,
authapi: params.authapi.clone(),
timeout: None,
};
getautoopenapi::(params, openparams).await
}
[tokio::main]
async fn main() {
match getuserinfo().await {
Ok(user) => {
info!("userinfo: {:?}", user);
}
Err(e) => {
println!("error: {}", e);
}
}
}
```