use openlark_core::{
SDKResult,
api::{ApiRequest, ApiResponseTrait, ResponseFormat},
config::Config,
http::Transport,
req_option::RequestOption,
};
use super::super::models::*;
use crate::common::api_endpoints::SheetsApiV3;
impl ApiResponseTrait for GetSheetResponse {
fn data_format() -> ResponseFormat {
ResponseFormat::Data
}
}
pub async fn get_sheet(
config: &Config,
spreadsheet_token: &str,
sheet_id: &str,
) -> SDKResult<GetSheetResponse> {
get_sheet_with_options(
config,
spreadsheet_token,
sheet_id,
RequestOption::default(),
)
.await
}
pub async fn get_sheet_with_options(
config: &Config,
spreadsheet_token: &str,
sheet_id: &str,
option: RequestOption,
) -> SDKResult<GetSheetResponse> {
let api_endpoint = SheetsApiV3::GetSheet(spreadsheet_token.to_string(), sheet_id.to_string());
let api_request: ApiRequest<GetSheetResponse> = api_endpoint.to_request();
Transport::request_typed(api_request, config, Some(option), "获取工作表信息").await
}