use super::CatalogEndpoint;
use openlark_core::api::{ApiRequest, HttpMethod};
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(test, derive(strum_macros::EnumIter))]
pub enum CcmSheetApiOld {
OperateSheets(String), UpdateSheetProperties(String), DimensionRange(String), InsertDimensionRange(String), DimensionRangeUpdate(String), DimensionRangeDelete(String), MergeCells(String), UnmergeCells(String), Style(String), StylesBatchUpdate(String), ValuesPrepend(String), ValuesAppend(String), ValuesImage(String), ValuesRange(String, String), ValuesBatchGet(String), Values(String), ValuesBatchUpdate(String), ProtectedDimension(String), ProtectedRangeBatchUpdate(String), ProtectedRangeBatchGet(String), ProtectedRangeBatchDel(String), Metainfo(String), Properties(String), Import,
ImportResult,
ConditionFormats(String), ConditionFormatsBatchCreate(String), ConditionFormatsBatchDelete(String), ConditionFormatsBatchUpdate(String), DataValidation(String), DataValidationCreate(String), DataValidationUpdate(String, String), DataValidationDelete(String), ReadSingleRange(String, String), ReadMultipleRanges(String), WriteSingleRange(String), BatchWriteRanges(String), AppendValues(String), InsertValues(String), GetSpreadsheet(String), CreateSpreadsheet,
UpdateSpreadsheet(String), AddSheet(String), GetSheet(String, String), UpdateSheet(String), DeleteSheet(String), CreateFilter(String), GetFilter(String), UpdateFilter(String), DeleteFilter(String), CreateFilterView(String, String), UpdateFilterView(String, String, String), QueryFilterViews(String, String), GetFilterView(String, String, String), DeleteFilterView(String, String, String), CreateFilterCondition(String, String, String), UpdateFilterCondition(String, String, String, String), QueryFilterConditions(String, String, String), GetFilterCondition(String, String, String, String), DeleteFilterCondition(String, String, String, String), CreateFloatImage(String, String), UpdateFloatImage(String, String, String), GetFloatImage(String, String, String), QueryFloatImages(String, String), DeleteFloatImage(String, String, String), DeleteRange(String), InsertDimension(String), MoveDimension(String), ReplaceRange(String), FindReplace(String), }
impl CcmSheetApiOld {
pub fn to_url(&self) -> String {
match self {
CcmSheetApiOld::OperateSheets(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/sheets_batch_update")
}
CcmSheetApiOld::UpdateSheetProperties(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/sheets_batch_update")
}
CcmSheetApiOld::Style(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/style")
}
CcmSheetApiOld::StylesBatchUpdate(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/styles_batch_update")
}
CcmSheetApiOld::ValuesPrepend(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/values_prepend")
}
CcmSheetApiOld::ValuesAppend(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/values_append")
}
CcmSheetApiOld::ValuesImage(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/values_image")
}
CcmSheetApiOld::ValuesRange(spreadsheet_token, range) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/values/{range}")
}
CcmSheetApiOld::ValuesBatchGet(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/values_batch_get")
}
CcmSheetApiOld::Values(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/values")
}
CcmSheetApiOld::ValuesBatchUpdate(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/values_batch_update")
}
CcmSheetApiOld::DimensionRange(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/dimension_range")
}
CcmSheetApiOld::InsertDimensionRange(spreadsheet_token) => {
format!(
"/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/insert_dimension_range"
)
}
CcmSheetApiOld::DimensionRangeUpdate(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/dimension_range")
}
CcmSheetApiOld::DimensionRangeDelete(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/dimension_range")
}
CcmSheetApiOld::MergeCells(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/merge_cells")
}
CcmSheetApiOld::UnmergeCells(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/unmerge_cells")
}
CcmSheetApiOld::ProtectedDimension(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/protected_dimension")
}
CcmSheetApiOld::ProtectedRangeBatchUpdate(spreadsheet_token) => {
format!(
"/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/protected_range_batch_update"
)
}
CcmSheetApiOld::ProtectedRangeBatchGet(spreadsheet_token) => {
format!(
"/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/protected_range_batch_get"
)
}
CcmSheetApiOld::ProtectedRangeBatchDel(spreadsheet_token) => {
format!(
"/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/protected_range_batch_del"
)
}
CcmSheetApiOld::Metainfo(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/metainfo")
}
CcmSheetApiOld::Properties(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/properties")
}
CcmSheetApiOld::Import => "/open-apis/sheets/v2/import".to_string(),
CcmSheetApiOld::ImportResult => "/open-apis/sheets/v2/import/result".to_string(),
CcmSheetApiOld::ConditionFormats(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/condition_formats")
}
CcmSheetApiOld::ConditionFormatsBatchCreate(spreadsheet_token) => {
format!(
"/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/condition_formats/batch_create"
)
}
CcmSheetApiOld::ConditionFormatsBatchDelete(spreadsheet_token) => {
format!(
"/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/condition_formats/batch_delete"
)
}
CcmSheetApiOld::ConditionFormatsBatchUpdate(spreadsheet_token) => {
format!(
"/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/condition_formats/batch_update"
)
}
CcmSheetApiOld::DataValidation(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/dataValidation")
}
CcmSheetApiOld::DataValidationCreate(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/dataValidation")
}
CcmSheetApiOld::DataValidationUpdate(spreadsheet_token, sheet_id) => {
format!(
"/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/dataValidation/{sheet_id}"
)
}
CcmSheetApiOld::DataValidationDelete(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/dataValidation")
}
CcmSheetApiOld::ReadSingleRange(spreadsheet_token, range) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/values/{range}")
}
CcmSheetApiOld::ReadMultipleRanges(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/values_batch_get")
}
CcmSheetApiOld::WriteSingleRange(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/values")
}
CcmSheetApiOld::BatchWriteRanges(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/values_batch_update")
}
CcmSheetApiOld::AppendValues(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/values_append")
}
CcmSheetApiOld::InsertValues(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/values_prepend")
}
CcmSheetApiOld::GetSpreadsheet(spreadsheet_token) => {
format!("/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}")
}
CcmSheetApiOld::CreateSpreadsheet => "/open-apis/sheets/v3/spreadsheets".to_string(),
CcmSheetApiOld::UpdateSpreadsheet(spreadsheet_token) => {
format!("/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}")
}
CcmSheetApiOld::AddSheet(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/sheets_batch_update")
}
CcmSheetApiOld::GetSheet(spreadsheet_token, sheet_id) => {
format!("/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}")
}
CcmSheetApiOld::UpdateSheet(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/sheets_batch_update")
}
CcmSheetApiOld::DeleteSheet(spreadsheet_token) => {
format!("/open-apis/sheets/v2/spreadsheets/{spreadsheet_token}/sheets_batch_update")
}
CcmSheetApiOld::CreateFilter(spreadsheet_token) => {
format!("/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/filterViews")
}
CcmSheetApiOld::GetFilter(spreadsheet_token) => {
format!("/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/filterViews/query")
}
CcmSheetApiOld::UpdateFilter(spreadsheet_token) => {
format!("/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/filterViews")
}
CcmSheetApiOld::DeleteFilter(spreadsheet_token) => {
format!("/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/filterViews")
}
CcmSheetApiOld::CreateFilterView(spreadsheet_token, sheet_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views"
)
}
CcmSheetApiOld::UpdateFilterView(spreadsheet_token, sheet_id, filter_view_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views/{filter_view_id}"
)
}
CcmSheetApiOld::QueryFilterViews(spreadsheet_token, sheet_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views/query"
)
}
CcmSheetApiOld::GetFilterView(spreadsheet_token, sheet_id, filter_view_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views/{filter_view_id}"
)
}
CcmSheetApiOld::DeleteFilterView(spreadsheet_token, sheet_id, filter_view_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views/{filter_view_id}"
)
}
CcmSheetApiOld::CreateFilterCondition(spreadsheet_token, sheet_id, filter_view_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views/{filter_view_id}/conditions"
)
}
CcmSheetApiOld::UpdateFilterCondition(
spreadsheet_token,
sheet_id,
filter_view_id,
condition_id,
) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views/{filter_view_id}/conditions/{condition_id}"
)
}
CcmSheetApiOld::QueryFilterConditions(spreadsheet_token, sheet_id, filter_view_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views/{filter_view_id}/conditions/query"
)
}
CcmSheetApiOld::GetFilterCondition(
spreadsheet_token,
sheet_id,
filter_view_id,
condition_id,
) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views/{filter_view_id}/conditions/{condition_id}"
)
}
CcmSheetApiOld::DeleteFilterCondition(
spreadsheet_token,
sheet_id,
filter_view_id,
condition_id,
) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views/{filter_view_id}/conditions/{condition_id}"
)
}
CcmSheetApiOld::CreateFloatImage(spreadsheet_token, sheet_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/float_images"
)
}
CcmSheetApiOld::UpdateFloatImage(spreadsheet_token, sheet_id, float_image_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/float_images/{float_image_id}"
)
}
CcmSheetApiOld::GetFloatImage(spreadsheet_token, sheet_id, float_image_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/float_images/{float_image_id}"
)
}
CcmSheetApiOld::QueryFloatImages(spreadsheet_token, sheet_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/float_images/query"
)
}
CcmSheetApiOld::DeleteFloatImage(spreadsheet_token, sheet_id, float_image_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/float_images/{float_image_id}"
)
}
CcmSheetApiOld::DeleteRange(spreadsheet_token) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/dimensionRange/delete"
)
}
CcmSheetApiOld::InsertDimension(spreadsheet_token) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/dimensionRange/insert"
)
}
CcmSheetApiOld::MoveDimension(spreadsheet_token) => {
format!("/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/dimensionRange/move")
}
CcmSheetApiOld::ReplaceRange(spreadsheet_token) => {
format!("/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/values/batchReplace")
}
CcmSheetApiOld::FindReplace(spreadsheet_token) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/values/batchFindReplace"
)
}
}
}
pub fn to_request<R>(&self) -> ApiRequest<R> {
<Self as CatalogEndpoint>::to_request(self)
}
}
impl CatalogEndpoint for CcmSheetApiOld {
fn to_url(&self) -> String {
CcmSheetApiOld::to_url(self)
}
fn method(&self) -> HttpMethod {
match self {
Self::ValuesRange(_, _)
| Self::ValuesBatchGet(_)
| Self::ProtectedRangeBatchGet(_)
| Self::Metainfo(_)
| Self::ImportResult
| Self::ConditionFormats(_)
| Self::DataValidation(_)
| Self::ReadSingleRange(_, _)
| Self::ReadMultipleRanges(_)
| Self::GetSpreadsheet(_)
| Self::GetSheet(_, _)
| Self::QueryFilterViews(_, _)
| Self::GetFilterView(_, _, _)
| Self::QueryFilterConditions(_, _, _)
| Self::GetFilterCondition(_, _, _, _)
| Self::QueryFloatImages(_, _) => HttpMethod::Get,
Self::Values(_)
| Self::WriteSingleRange(_)
| Self::DataValidationUpdate(_, _)
| Self::DimensionRangeUpdate(_)
| Self::Properties(_) => HttpMethod::Put,
Self::UpdateSpreadsheet(_) | Self::UpdateFilterView(_, _, _) => HttpMethod::Patch,
Self::DimensionRangeDelete(_)
| Self::DataValidationDelete(_)
| Self::DeleteFilterView(_, _, _)
| Self::DeleteFilterCondition(_, _, _, _) => HttpMethod::Delete,
Self::OperateSheets(_)
| Self::UpdateSheetProperties(_)
| Self::DimensionRange(_)
| Self::InsertDimensionRange(_)
| Self::MergeCells(_)
| Self::UnmergeCells(_)
| Self::Style(_)
| Self::StylesBatchUpdate(_)
| Self::ValuesPrepend(_)
| Self::ValuesAppend(_)
| Self::ValuesImage(_)
| Self::ValuesBatchUpdate(_)
| Self::ProtectedDimension(_)
| Self::ProtectedRangeBatchUpdate(_)
| Self::ProtectedRangeBatchDel(_)
| Self::Import
| Self::ConditionFormatsBatchCreate(_)
| Self::ConditionFormatsBatchDelete(_)
| Self::ConditionFormatsBatchUpdate(_)
| Self::DataValidationCreate(_)
| Self::BatchWriteRanges(_)
| Self::AppendValues(_)
| Self::InsertValues(_)
| Self::CreateSpreadsheet
| Self::AddSheet(_)
| Self::UpdateSheet(_)
| Self::DeleteSheet(_)
| Self::CreateFilter(_)
| Self::GetFilter(_)
| Self::UpdateFilter(_)
| Self::DeleteFilter(_)
| Self::CreateFilterView(_, _)
| Self::CreateFilterCondition(_, _, _)
| Self::UpdateFilterCondition(_, _, _, _)
| Self::CreateFloatImage(_, _)
| Self::UpdateFloatImage(_, _, _)
| Self::GetFloatImage(_, _, _)
| Self::DeleteFloatImage(_, _, _)
| Self::DeleteRange(_)
| Self::InsertDimension(_)
| Self::MoveDimension(_)
| Self::ReplaceRange(_)
| Self::FindReplace(_) => HttpMethod::Post,
}
}
}
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(test, derive(strum_macros::EnumIter))]
pub enum SheetsApiV3 {
CreateSpreadsheet,
GetSpreadsheet(String), PatchSpreadsheet(String),
QuerySheets(String), GetSheet(String, String), MoveDimension(String, String), FindCells(String, String), ReplaceCells(String, String),
CreateFilter(String, String), UpdateFilter(String, String), GetFilter(String, String), DeleteFilter(String, String),
CreateFilterView(String, String), QueryFilterViews(String, String), GetFilterView(String, String, String), PatchFilterView(String, String, String), DeleteFilterView(String, String, String),
CreateFilterCondition(String, String, String), QueryFilterConditions(String, String, String), GetFilterCondition(String, String, String, String), UpdateFilterCondition(String, String, String, String), DeleteFilterCondition(String, String, String, String),
CreateFloatImage(String, String), QueryFloatImages(String, String), GetFloatImage(String, String, String), PatchFloatImage(String, String, String), DeleteFloatImage(String, String, String), }
impl SheetsApiV3 {
pub fn to_url(&self) -> String {
match self {
SheetsApiV3::CreateSpreadsheet => "/open-apis/sheets/v3/spreadsheets".to_string(),
SheetsApiV3::GetSpreadsheet(spreadsheet_token) => {
format!("/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}")
}
SheetsApiV3::PatchSpreadsheet(spreadsheet_token) => {
format!("/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}")
}
SheetsApiV3::QuerySheets(spreadsheet_token) => {
format!("/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/query")
}
SheetsApiV3::GetSheet(spreadsheet_token, sheet_id) => {
format!("/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}")
}
SheetsApiV3::MoveDimension(spreadsheet_token, sheet_id) => format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/move_dimension"
),
SheetsApiV3::FindCells(spreadsheet_token, sheet_id) => format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/find"
),
SheetsApiV3::ReplaceCells(spreadsheet_token, sheet_id) => format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/replace"
),
SheetsApiV3::CreateFilter(spreadsheet_token, sheet_id)
| SheetsApiV3::UpdateFilter(spreadsheet_token, sheet_id)
| SheetsApiV3::GetFilter(spreadsheet_token, sheet_id)
| SheetsApiV3::DeleteFilter(spreadsheet_token, sheet_id) => format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter"
),
SheetsApiV3::CreateFilterView(spreadsheet_token, sheet_id) => format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views"
),
SheetsApiV3::QueryFilterViews(spreadsheet_token, sheet_id) => format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views/query"
),
SheetsApiV3::GetFilterView(spreadsheet_token, sheet_id, filter_view_id)
| SheetsApiV3::PatchFilterView(spreadsheet_token, sheet_id, filter_view_id)
| SheetsApiV3::DeleteFilterView(spreadsheet_token, sheet_id, filter_view_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views/{filter_view_id}"
)
}
SheetsApiV3::CreateFilterCondition(spreadsheet_token, sheet_id, filter_view_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views/{filter_view_id}/conditions"
)
}
SheetsApiV3::QueryFilterConditions(spreadsheet_token, sheet_id, filter_view_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views/{filter_view_id}/conditions/query"
)
}
SheetsApiV3::GetFilterCondition(
spreadsheet_token,
sheet_id,
filter_view_id,
condition_id,
)
| SheetsApiV3::UpdateFilterCondition(
spreadsheet_token,
sheet_id,
filter_view_id,
condition_id,
)
| SheetsApiV3::DeleteFilterCondition(
spreadsheet_token,
sheet_id,
filter_view_id,
condition_id,
) => format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/filter_views/{filter_view_id}/conditions/{condition_id}"
),
SheetsApiV3::CreateFloatImage(spreadsheet_token, sheet_id) => format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/float_images"
),
SheetsApiV3::QueryFloatImages(spreadsheet_token, sheet_id) => format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/float_images/query"
),
SheetsApiV3::GetFloatImage(spreadsheet_token, sheet_id, float_image_id)
| SheetsApiV3::PatchFloatImage(spreadsheet_token, sheet_id, float_image_id)
| SheetsApiV3::DeleteFloatImage(spreadsheet_token, sheet_id, float_image_id) => {
format!(
"/open-apis/sheets/v3/spreadsheets/{spreadsheet_token}/sheets/{sheet_id}/float_images/{float_image_id}"
)
}
}
}
pub fn to_request<R>(&self) -> ApiRequest<R> {
<Self as CatalogEndpoint>::to_request(self)
}
}
impl CatalogEndpoint for SheetsApiV3 {
fn to_url(&self) -> String {
SheetsApiV3::to_url(self)
}
fn method(&self) -> HttpMethod {
match self {
Self::GetSpreadsheet(_)
| Self::QuerySheets(_)
| Self::GetSheet(_, _)
| Self::GetFilter(_, _)
| Self::QueryFilterViews(_, _)
| Self::GetFilterView(_, _, _)
| Self::QueryFilterConditions(_, _, _)
| Self::GetFilterCondition(_, _, _, _)
| Self::QueryFloatImages(_, _)
| Self::GetFloatImage(_, _, _) => HttpMethod::Get,
Self::CreateSpreadsheet
| Self::CreateFilter(_, _)
| Self::CreateFilterView(_, _)
| Self::CreateFilterCondition(_, _, _)
| Self::CreateFloatImage(_, _) => HttpMethod::Post,
Self::MoveDimension(_, _) | Self::FindCells(_, _) | Self::ReplaceCells(_, _) => {
HttpMethod::Post
}
Self::PatchSpreadsheet(_)
| Self::PatchFilterView(_, _, _)
| Self::PatchFloatImage(_, _, _) => HttpMethod::Patch,
Self::UpdateFilter(_, _) | Self::UpdateFilterCondition(_, _, _, _) => HttpMethod::Put,
Self::DeleteFilter(_, _)
| Self::DeleteFilterView(_, _, _)
| Self::DeleteFilterCondition(_, _, _, _)
| Self::DeleteFloatImage(_, _, _) => HttpMethod::Delete,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::common::api_endpoints::test_support::catalog_semantics_snapshot;
#[test]
fn sheets_catalog_semantics_snapshots() {
insta::assert_snapshot!(
"ccm_sheet_old_catalog_semantics",
catalog_semantics_snapshot::<CcmSheetApiOld>()
);
insta::assert_snapshot!(
"sheets_v3_catalog_semantics",
catalog_semantics_snapshot::<SheetsApiV3>()
);
}
}