feat: implement lists commands
This commit is contained in:
1 parent
213ed0b834
commit
c83708a727
5 files changed
+574
-8
No files matched your search
+14
-2
@@ -3,8 +3,8 @@ use std::io::Write;
|
||||
use chrono::{DateTime, Utc};
|
||||
use onspring::{
|
||||
App, CollectionResponse, CreatedWithIdResponse, Field, FileInfo, FormulaOutputType,
|
||||
ListFieldValue, Multiplicity, PagedResponse, Record, RecordFieldValue, SaveRecordResponse,
|
||||
ValueType,
|
||||
ListFieldValue, Multiplicity, PagedResponse, Record, RecordFieldValue, SaveListItemResponse,
|
||||
SaveRecordResponse, ValueType,
|
||||
};
|
||||
use serde::Serialize;
|
||||
use uuid::Uuid;
|
||||
@@ -251,6 +251,18 @@ impl From<CreatedWithIdResponse> for CreatedWithIdResponseOutput {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SaveListItemResponseOutput {
|
||||
pub id: Uuid,
|
||||
}
|
||||
|
||||
impl From<SaveListItemResponse> for SaveListItemResponseOutput {
|
||||
fn from(value: SaveListItemResponse) -> Self {
|
||||
Self { id: value.id }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render_json<T: Serialize>(value: &T, pretty: bool) -> CliResult<String> {
|
||||
if pretty {
|
||||
serde_json::to_string_pretty(value).map_err(|_| CliError::runtime("Failed to serialize output"))
|
||||
|
||||
Reference in new issue
Block a user