Closed lippirk closed 4 years ago
Actually I don't think there is a better way, unfortunately. And I really thought about it :D!
A major issue seems to be that every field is an option. The next version of these APIs supports specifying custom structures, leaving you with control over the types of fields. Thus you could have a structure without options that can be initialized like this:
let s = MySpreadsheet::default();
s.sheets.push(Sheet {
data: vec![GridData {
row_data: vec![RowData {
values: vec![CellData {
user_entered_value: ExtendedValue {
number_value: Some(8.0),
..ExtendedValue::default()
},
..CellData::default()
}],
..RowData::default()
}],
..GridData::default()
}],
..Sheet::default()
}]
})
It's not much better, so there is probably no other way but to live with it and hide it behind constructor-like functions for common cases.
I am using this library to make requests to the google sheets api, although not using
yup-oauth2
. I'm testing it out and it works, but I was wondering if there's an easier way to build requests if I don't want to use theHub
. At the moment I have:Is there an easier way to construct the
Spreadsheet
without all those nested updates?