pub type Range = String;
pub type SpreadsheetToken = String;
pub type SheetId = String;
use openlark_core::config::Config;
pub mod models;
pub mod spreadsheet;
pub use spreadsheet::{
CreateFilterConditionRequest, CreateFilterConditionResponse, CreateFilterRequest,
CreateFilterResponse, CreateFilterViewRequest, CreateFilterViewResponse,
CreateFloatImageRequest, CreateFloatImageResponse, CreateSpreadsheetParams,
CreateSpreadsheetResponse, CreatedSpreadsheet, DeleteFilterConditionResponse,
DeleteFilterResponse, DeleteFilterViewResponse, DeleteFloatImageResponse, DimensionSource,
FindCondition, FindParams, FindReplaceParams, FindReplaceResponse, FindResponse, FindResult,
GetFilterConditionResponse, GetFilterResponse, GetFilterViewResponse, GetFloatImageResponse,
GetSheetResponse, GetSpreadsheetResponse, GridProperties, MergeRange, MoveDimensionParams,
MoveDimensionResponse, QueryFilterConditionsResponse, QueryFilterViewsResponse,
QueryFloatImagesResponse, QuerySheetResponse, Sheet, SpreadsheetInfo,
UpdateFilterConditionRequest, UpdateFilterConditionResponse, UpdateFilterRequest,
UpdateFilterResponse, UpdateFilterViewRequest, UpdateFilterViewResponse,
UpdateFloatImageRequest, UpdateFloatImageResponse, UpdateSpreadsheetParams,
UpdateSpreadsheetResponse,
};
pub use models::{
CellPosition, CellReference, FilterCondition, FilterInfo, FilterViewCondition, FilterViewId,
FilterViewInfo, FloatImageId, FloatImageInfo, FloatImageToken, Locale, PagedResponse,
ReplaceCellsRequest, ReplaceResult, SheetInfo, SheetProperty, SheetsResponse, TimeZone,
};
#[derive(Clone, Debug)]
pub struct SheetsService {
config: Config,
}
impl SheetsService {
pub fn new(config: Config) -> Self {
Self { config }
}
pub fn config(&self) -> &Config {
&self.config
}
}
impl Default for SheetsService {
fn default() -> Self {
Self::new(Config::default())
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_sheets_service_creation() {
let config = Config::default();
let service = SheetsService::new(config);
assert!(!service.config.base_url().is_empty());
}
#[test]
fn test_type_aliases() {
let range: Range = "A1:B10".to_string();
let token: SpreadsheetToken = "sheet_token_123".to_string();
let sheet_id: SheetId = "sheet_id_456".to_string();
assert_eq!(range, "A1:B10");
assert_eq!(token, "sheet_token_123");
assert_eq!(sheet_id, "sheet_id_456");
}
#[test]
fn test_sheets_service_default() {
let service = SheetsService::default();
assert!(!service.config.base_url().is_empty());
}
}