summaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api/examples
diff options
context:
space:
mode:
Diffstat (limited to 'rust/fatcat-api/examples')
-rw-r--r--rust/fatcat-api/examples/client.rs10
-rw-r--r--rust/fatcat-api/examples/server_lib/server.rs46
2 files changed, 41 insertions, 15 deletions
diff --git a/rust/fatcat-api/examples/client.rs b/rust/fatcat-api/examples/client.rs
index f98518cc..06519232 100644
--- a/rust/fatcat-api/examples/client.rs
+++ b/rust/fatcat-api/examples/client.rs
@@ -95,7 +95,7 @@ fn main() {
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
Some("CreateContainerBatch") => {
- let result = client.create_container_batch(&Vec::new()).wait();
+ let result = client.create_container_batch(&Vec::new(), Some(true)).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
@@ -105,7 +105,7 @@ fn main() {
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
Some("CreateCreatorBatch") => {
- let result = client.create_creator_batch(&Vec::new()).wait();
+ let result = client.create_creator_batch(&Vec::new(), Some(true)).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
@@ -121,7 +121,7 @@ fn main() {
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
Some("CreateFileBatch") => {
- let result = client.create_file_batch(&Vec::new()).wait();
+ let result = client.create_file_batch(&Vec::new(), Some(true)).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
@@ -131,7 +131,7 @@ fn main() {
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
Some("CreateReleaseBatch") => {
- let result = client.create_release_batch(&Vec::new()).wait();
+ let result = client.create_release_batch(&Vec::new(), Some(true)).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
@@ -141,7 +141,7 @@ fn main() {
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
Some("CreateWorkBatch") => {
- let result = client.create_work_batch(&Vec::new()).wait();
+ let result = client.create_work_batch(&Vec::new(), Some(true)).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
diff --git a/rust/fatcat-api/examples/server_lib/server.rs b/rust/fatcat-api/examples/server_lib/server.rs
index 572025f0..32c7e97f 100644
--- a/rust/fatcat-api/examples/server_lib/server.rs
+++ b/rust/fatcat-api/examples/server_lib/server.rs
@@ -34,11 +34,17 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn create_container_batch(&self, entity_list: &Vec<models::ContainerEntity>, context: &Context) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send> {
+ fn create_container_batch(
+ &self,
+ entity_list: &Vec<models::ContainerEntity>,
+ autoaccept: Option<bool>,
+ context: &Context,
+ ) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "create_container_batch({:?}) - X-Span-ID: {:?}",
+ "create_container_batch({:?}, {:?}) - X-Span-ID: {:?}",
entity_list,
+ autoaccept,
context.x_span_id.unwrap_or(String::from("<none>")).clone()
);
Box::new(futures::failed("Generic failure".into()))
@@ -50,9 +56,14 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn create_creator_batch(&self, entity_list: &Vec<models::CreatorEntity>, context: &Context) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> {
+ fn create_creator_batch(&self, entity_list: &Vec<models::CreatorEntity>, autoaccept: Option<bool>, context: &Context) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("create_creator_batch({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "create_creator_batch({:?}, {:?}) - X-Span-ID: {:?}",
+ entity_list,
+ autoaccept,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
@@ -68,9 +79,14 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>, context: &Context) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
+ fn create_file_batch(&self, entity_list: &Vec<models::FileEntity>, autoaccept: Option<bool>, context: &Context) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("create_file_batch({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "create_file_batch({:?}, {:?}) - X-Span-ID: {:?}",
+ entity_list,
+ autoaccept,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
@@ -80,9 +96,14 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn create_release_batch(&self, entity_list: &Vec<models::ReleaseEntity>, context: &Context) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> {
+ fn create_release_batch(&self, entity_list: &Vec<models::ReleaseEntity>, autoaccept: Option<bool>, context: &Context) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("create_release_batch({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "create_release_batch({:?}, {:?}) - X-Span-ID: {:?}",
+ entity_list,
+ autoaccept,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}
@@ -92,9 +113,14 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
- fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>, context: &Context) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
+ fn create_work_batch(&self, entity_list: &Vec<models::WorkEntity>, autoaccept: Option<bool>, context: &Context) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> {
let context = context.clone();
- println!("create_work_batch({:?}) - X-Span-ID: {:?}", entity_list, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ println!(
+ "create_work_batch({:?}, {:?}) - X-Span-ID: {:?}",
+ entity_list,
+ autoaccept,
+ context.x_span_id.unwrap_or(String::from("<none>")).clone()
+ );
Box::new(futures::failed("Generic failure".into()))
}