diff options
Diffstat (limited to 'rust/fatcat-api/examples')
-rw-r--r-- | rust/fatcat-api/examples/client.rs | 55 | ||||
-rw-r--r-- | rust/fatcat-api/examples/server_lib/server.rs | 10 |
2 files changed, 30 insertions, 35 deletions
diff --git a/rust/fatcat-api/examples/client.rs b/rust/fatcat-api/examples/client.rs index 8c1ec930..3302c0cd 100644 --- a/rust/fatcat-api/examples/client.rs +++ b/rust/fatcat-api/examples/client.rs @@ -25,10 +25,8 @@ fn main() { .possible_values(&[ "ContainerIdGet", "ContainerLookupGet", - "ContainerPost", "CreatorIdGet", "CreatorLookupGet", - "CreatorPost", "EditgroupIdAcceptPost", "EditgroupIdGet", "EditgroupPost", @@ -36,12 +34,9 @@ fn main() { "EditorUsernameGet", "FileIdGet", "FileLookupGet", - "FilePost", "ReleaseIdGet", "ReleaseLookupGet", - "ReleasePost", "WorkIdGet", - "WorkPost", ]) .required(true) .index(1), @@ -80,11 +75,11 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("ContainerPost") => { - let result = client.container_post(None).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - + // Disabled because there's no example. + // Some("ContainerPost") => { + // let result = client.container_post(???).wait(); + // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); + // }, Some("CreatorIdGet") => { let result = client.creator_id_get("id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); @@ -95,11 +90,11 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("CreatorPost") => { - let result = client.creator_post(None).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - + // Disabled because there's no example. + // Some("CreatorPost") => { + // let result = client.creator_post(???).wait(); + // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); + // }, Some("EditgroupIdAcceptPost") => { let result = client.editgroup_id_accept_post(56).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); @@ -135,11 +130,11 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("FilePost") => { - let result = client.file_post(None).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - + // Disabled because there's no example. + // Some("FilePost") => { + // let result = client.file_post(???).wait(); + // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); + // }, Some("ReleaseIdGet") => { let result = client.release_id_get("id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); @@ -150,21 +145,21 @@ fn main() { println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("ReleasePost") => { - let result = client.release_post(None).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - + // Disabled because there's no example. + // Some("ReleasePost") => { + // let result = client.release_post(???).wait(); + // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); + // }, Some("WorkIdGet") => { let result = client.work_id_get("id_example".to_string()).wait(); println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); } - Some("WorkPost") => { - let result = client.work_post(None).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - + // Disabled because there's no example. + // Some("WorkPost") => { + // let result = client.work_post(???).wait(); + // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); + // }, _ => panic!("Invalid operation provided"), } } diff --git a/rust/fatcat-api/examples/server_lib/server.rs b/rust/fatcat-api/examples/server_lib/server.rs index fc0e5174..42b6384f 100644 --- a/rust/fatcat-api/examples/server_lib/server.rs +++ b/rust/fatcat-api/examples/server_lib/server.rs @@ -30,7 +30,7 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn container_post(&self, body: Option<models::ContainerEntity>, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> { + fn container_post(&self, body: models::ContainerEntity, context: &Context) -> Box<Future<Item = ContainerPostResponse, Error = ApiError> + Send> { let context = context.clone(); println!("container_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) @@ -48,7 +48,7 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn creator_post(&self, body: Option<models::CreatorEntity>, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> { + fn creator_post(&self, body: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreatorPostResponse, Error = ApiError> + Send> { let context = context.clone(); println!("creator_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) @@ -100,7 +100,7 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn file_post(&self, body: Option<models::FileEntity>, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> { + fn file_post(&self, body: models::FileEntity, context: &Context) -> Box<Future<Item = FilePostResponse, Error = ApiError> + Send> { let context = context.clone(); println!("file_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) @@ -118,7 +118,7 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn release_post(&self, body: Option<models::ReleaseEntity>, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> { + fn release_post(&self, body: models::ReleaseEntity, context: &Context) -> Box<Future<Item = ReleasePostResponse, Error = ApiError> + Send> { let context = context.clone(); println!("release_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) @@ -130,7 +130,7 @@ impl Api for Server { Box::new(futures::failed("Generic failure".into())) } - fn work_post(&self, body: Option<models::WorkEntity>, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> { + fn work_post(&self, body: models::WorkEntity, context: &Context) -> Box<Future<Item = WorkPostResponse, Error = ApiError> + Send> { let context = context.clone(); println!("work_post({:?}) - X-Span-ID: {:?}", body, context.x_span_id.unwrap_or(String::from("<none>")).clone()); Box::new(futures::failed("Generic failure".into())) |