use openlark_core::{
SDKResult, api::ApiRequest, config::Config, http::Transport, req_option::RequestOption,
};
use std::{collections::HashMap, sync::Arc};
#[derive(Debug, Clone)]
pub struct ListSparkAppsRequest {
config: Arc<Config>,
query: HashMap<String, String>,
}
impl ListSparkAppsRequest {
pub fn new(config: Arc<Config>) -> Self {
Self {
config,
query: HashMap::new(),
}
}
pub fn query_param(mut self, key: impl Into<String>, value: impl Into<String>) -> Self {
self.query.insert(key.into(), value.into());
self
}
pub async fn execute(self) -> SDKResult<serde_json::Value> {
self.execute_with_options(RequestOption::default()).await
}
pub async fn execute_with_options(self, option: RequestOption) -> SDKResult<serde_json::Value> {
let mut req = ApiRequest::<serde_json::Value>::get("/open-apis/spark/v1/apps");
for (key, value) in self.query {
req = req.query(key, value);
}
Transport::request_typed(req, &self.config, Some(option), "批量获取妙搭应用").await
}
}