style: use 2-space indentation across entire codebase

Add rustfmt.toml with tab_spaces = 2 and reformat all source files,
tests, and README code examples to use 2-space indentation.
This commit is contained in:
Stevan Freeborn
2026-03-25 14:11:08 -05:00
parent 9201556646
commit 905f7f945a
27 changed files with 1250 additions and 1231 deletions
+1
View File
@@ -0,0 +1 @@
tab_spaces = 2
+6 -3
View File
@@ -13,20 +13,23 @@ impl OnspringClient {
query.push(("PageSize", p.page_size.to_string()));
}
let query_refs: Vec<(&str, String)> = query.iter().map(|(k, v)| (*k, v.clone())).collect();
self.request(Method::GET, "/Apps", &query_refs, Option::<&()>::None)
self
.request(Method::GET, "/Apps", &query_refs, Option::<&()>::None)
.await
}
/// Gets an app by its identifier.
pub async fn get_app(&self, app_id: i32) -> Result<App> {
let path = format!("/Apps/id/{}", app_id);
self.request(Method::GET, &path, &[], Option::<&()>::None)
self
.request(Method::GET, &path, &[], Option::<&()>::None)
.await
}
/// Gets up to 100 apps by their identifiers.
pub async fn batch_get_apps(&self, ids: &[i32]) -> Result<CollectionResponse<App>> {
self.request(Method::POST, "/Apps/batch-get", &[], Some(&ids))
self
.request(Method::POST, "/Apps/batch-get", &[], Some(&ids))
.await
}
}
+6 -3
View File
@@ -8,13 +8,15 @@ impl OnspringClient {
/// Gets a field by its identifier.
pub async fn get_field(&self, field_id: i32) -> Result<Field> {
let path = format!("/Fields/id/{}", field_id);
self.request(Method::GET, &path, &[], Option::<&()>::None)
self
.request(Method::GET, &path, &[], Option::<&()>::None)
.await
}
/// Gets up to 100 fields by their identifiers.
pub async fn batch_get_fields(&self, ids: &[i32]) -> Result<CollectionResponse<Field>> {
self.request(Method::POST, "/Fields/batch-get", &[], Some(&ids))
self
.request(Method::POST, "/Fields/batch-get", &[], Some(&ids))
.await
}
@@ -31,7 +33,8 @@ impl OnspringClient {
query.push(("PageSize", p.page_size.to_string()));
}
let query_refs: Vec<(&str, String)> = query.iter().map(|(k, v)| (*k, v.clone())).collect();
self.request(Method::GET, &path, &query_refs, Option::<&()>::None)
self
.request(Method::GET, &path, &query_refs, Option::<&()>::None)
.await
}
}
+4 -2
View File
@@ -16,7 +16,8 @@ impl OnspringClient {
"/Files/recordId/{}/fieldId/{}/fileId/{}",
record_id, field_id, file_id
);
self.request(Method::GET, &path, &[], Option::<&()>::None)
self
.request(Method::GET, &path, &[], Option::<&()>::None)
.await
}
@@ -82,7 +83,8 @@ impl OnspringClient {
"/Files/recordId/{}/fieldId/{}/fileId/{}",
record_id, field_id, file_id
);
self.request_no_content(Method::DELETE, &path, &[], Option::<&()>::None)
self
.request_no_content(Method::DELETE, &path, &[], Option::<&()>::None)
.await
}
}
+2 -1
View File
@@ -19,7 +19,8 @@ impl OnspringClient {
/// Deletes a list item from the specified list.
pub async fn delete_list_item(&self, list_id: i32, item_id: Uuid) -> Result<()> {
let path = format!("/Lists/id/{}/itemId/{}", list_id, item_id);
self.request_no_content(Method::DELETE, &path, &[], Option::<&()>::None)
self
.request_no_content(Method::DELETE, &path, &[], Option::<&()>::None)
.await
}
}
+2 -1
View File
@@ -6,7 +6,8 @@ use crate::error::Result;
impl OnspringClient {
/// Checks if the Onspring API is reachable.
pub async fn ping(&self) -> Result<()> {
self.request_no_content(Method::GET, "/Ping", &[], Option::<&()>::None)
self
.request_no_content(Method::GET, "/Ping", &[], Option::<&()>::None)
.await
}
}
+16 -10
View File
@@ -3,9 +3,8 @@ use reqwest::Method;
use crate::client::OnspringClient;
use crate::error::Result;
use crate::models::{
BatchDeleteRecordsRequest, BatchGetRecordsRequest, CollectionResponse, DataFormat,
PagedResponse, PagingRequest, QueryRecordsRequest, Record, SaveRecordRequest,
SaveRecordResponse,
BatchDeleteRecordsRequest, BatchGetRecordsRequest, CollectionResponse, DataFormat, PagedResponse,
PagingRequest, QueryRecordsRequest, Record, SaveRecordRequest, SaveRecordResponse,
};
impl OnspringClient {
@@ -35,7 +34,8 @@ impl OnspringClient {
query.push(("dataFormat", format!("{:?}", fmt)));
}
let query_refs: Vec<(&str, String)> = query.iter().map(|(k, v)| (*k, v.clone())).collect();
self.request(Method::GET, &path, &query_refs, Option::<&()>::None)
self
.request(Method::GET, &path, &query_refs, Option::<&()>::None)
.await
}
@@ -61,20 +61,23 @@ impl OnspringClient {
query.push(("dataFormat", format!("{:?}", fmt)));
}
let query_refs: Vec<(&str, String)> = query.iter().map(|(k, v)| (*k, v.clone())).collect();
self.request(Method::GET, &path, &query_refs, Option::<&()>::None)
self
.request(Method::GET, &path, &query_refs, Option::<&()>::None)
.await
}
/// Creates or updates a record.
pub async fn save_record(&self, request: SaveRecordRequest) -> Result<SaveRecordResponse> {
self.request(Method::PUT, "/Records", &[], Some(&request))
self
.request(Method::PUT, "/Records", &[], Some(&request))
.await
}
/// Deletes a record by its identifier.
pub async fn delete_record(&self, app_id: i32, record_id: i32) -> Result<()> {
let path = format!("/Records/appId/{}/recordId/{}", app_id, record_id);
self.request_no_content(Method::DELETE, &path, &[], Option::<&()>::None)
self
.request_no_content(Method::DELETE, &path, &[], Option::<&()>::None)
.await
}
@@ -83,7 +86,8 @@ impl OnspringClient {
&self,
request: BatchGetRecordsRequest,
) -> Result<CollectionResponse<Record>> {
self.request(Method::POST, "/Records/batch-get", &[], Some(&request))
self
.request(Method::POST, "/Records/batch-get", &[], Some(&request))
.await
}
@@ -99,13 +103,15 @@ impl OnspringClient {
query.push(("PageSize", p.page_size.to_string()));
}
let query_refs: Vec<(&str, String)> = query.iter().map(|(k, v)| (*k, v.clone())).collect();
self.request(Method::POST, "/Records/Query", &query_refs, Some(&request))
self
.request(Method::POST, "/Records/Query", &query_refs, Some(&request))
.await
}
/// Deletes a batch of records.
pub async fn batch_delete_records(&self, request: BatchDeleteRecordsRequest) -> Result<()> {
self.request_no_content(Method::POST, "/Records/batch-delete", &[], Some(&request))
self
.request_no_content(Method::POST, "/Records/batch-delete", &[], Some(&request))
.await
}
}
+4 -2
View File
@@ -23,7 +23,8 @@ impl OnspringClient {
query.push(("dataType", format!("{:?}", dt)));
}
let query_refs: Vec<(&str, String)> = query.iter().map(|(k, v)| (*k, v.clone())).collect();
self.request(Method::GET, &path, &query_refs, Option::<&()>::None)
self
.request(Method::GET, &path, &query_refs, Option::<&()>::None)
.await
}
@@ -40,7 +41,8 @@ impl OnspringClient {
query.push(("PageSize", p.page_size.to_string()));
}
let query_refs: Vec<(&str, String)> = query.iter().map(|(k, v)| (*k, v.clone())).collect();
self.request(Method::GET, &path, &query_refs, Option::<&()>::None)
self
.request(Method::GET, &path, &query_refs, Option::<&()>::None)
.await
}
}