aboutsummaryrefslogtreecommitdiffstats
path: root/rust/fatcat-openapi/examples
diff options
context:
space:
mode:
Diffstat (limited to 'rust/fatcat-openapi/examples')
-rw-r--r--rust/fatcat-openapi/examples/client.rs20
-rw-r--r--rust/fatcat-openapi/examples/server_lib/server.rs24
2 files changed, 35 insertions, 9 deletions
diff --git a/rust/fatcat-openapi/examples/client.rs b/rust/fatcat-openapi/examples/client.rs
index eaaf26a6..b919d174 100644
--- a/rust/fatcat-openapi/examples/client.rs
+++ b/rust/fatcat-openapi/examples/client.rs
@@ -23,9 +23,9 @@ use fatcat_openapi::{
GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse,
GetReleaseEditResponse, GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse,
GetReleaseWebcapturesResponse, GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse,
- GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse,
- LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateEditgroupResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse,
- UpdateWebcaptureResponse, UpdateWorkResponse,
+ GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupEditorResponse,
+ LookupFileResponse, LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateEditgroupResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse,
+ UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse,
};
#[allow(unused_imports)]
use futures::{future, stream, Future, Stream};
@@ -64,6 +64,7 @@ fn main() {
"GetEditor",
"GetEditorAnnotations",
"GetEditorEditgroups",
+ "LookupEditor",
"DeleteFile",
"DeleteFileEdit",
"GetFile",
@@ -212,6 +213,9 @@ fn main() {
let result = client
.lookup_container(
Some("issnl_example".to_string()),
+ Some("issne_example".to_string()),
+ Some("issnp_example".to_string()),
+ Some("issn_example".to_string()),
Some("wikidata_qid_example".to_string()),
Some("expand_example".to_string()),
Some("hide_example".to_string()),
@@ -349,6 +353,11 @@ fn main() {
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
}
+ Some("LookupEditor") => {
+ let result = client.lookup_editor(Some("username_example".to_string())).wait();
+ println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
+ }
+
// Disabled because there's no example.
// Some("UpdateEditor") => {
// let result = client.update_editor("editor_id_example".to_string(), ???).wait();
@@ -561,6 +570,7 @@ fn main() {
Some("doaj_example".to_string()),
Some("dblp_example".to_string()),
Some("oai_example".to_string()),
+ Some("hdl_example".to_string()),
Some("expand_example".to_string()),
Some("hide_example".to_string()),
)
@@ -690,6 +700,8 @@ fn main() {
// let result = client.update_work("editgroup_id_example".to_string(), "ident_example".to_string(), ???).wait();
// println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
// },
- _ => panic!("Invalid operation provided"),
+ _ => {
+ panic!("Invalid operation provided")
+ }
}
}
diff --git a/rust/fatcat-openapi/examples/server_lib/server.rs b/rust/fatcat-openapi/examples/server_lib/server.rs
index 56b82cc5..2aa38fd8 100644
--- a/rust/fatcat-openapi/examples/server_lib/server.rs
+++ b/rust/fatcat-openapi/examples/server_lib/server.rs
@@ -22,9 +22,9 @@ use fatcat_openapi::{
GetFileRedirectsResponse, GetFileResponse, GetFileRevisionResponse, GetFilesetEditResponse, GetFilesetHistoryResponse, GetFilesetRedirectsResponse, GetFilesetResponse, GetFilesetRevisionResponse,
GetReleaseEditResponse, GetReleaseFilesResponse, GetReleaseFilesetsResponse, GetReleaseHistoryResponse, GetReleaseRedirectsResponse, GetReleaseResponse, GetReleaseRevisionResponse,
GetReleaseWebcapturesResponse, GetWebcaptureEditResponse, GetWebcaptureHistoryResponse, GetWebcaptureRedirectsResponse, GetWebcaptureResponse, GetWebcaptureRevisionResponse, GetWorkEditResponse,
- GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupFileResponse,
- LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateEditgroupResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse, UpdateReleaseResponse,
- UpdateWebcaptureResponse, UpdateWorkResponse,
+ GetWorkHistoryResponse, GetWorkRedirectsResponse, GetWorkReleasesResponse, GetWorkResponse, GetWorkRevisionResponse, LookupContainerResponse, LookupCreatorResponse, LookupEditorResponse,
+ LookupFileResponse, LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateEditgroupResponse, UpdateEditorResponse, UpdateFileResponse, UpdateFilesetResponse,
+ UpdateReleaseResponse, UpdateWebcaptureResponse, UpdateWorkResponse,
};
#[derive(Copy, Clone)]
@@ -159,6 +159,9 @@ impl Api for Server {
fn lookup_container(
&self,
issnl: Option<String>,
+ issne: Option<String>,
+ issnp: Option<String>,
+ issn: Option<String>,
wikidata_qid: Option<String>,
expand: Option<String>,
hide: Option<String>,
@@ -166,8 +169,11 @@ impl Api for Server {
) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "lookup_container({:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ "lookup_container({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
issnl,
+ issne,
+ issnp,
+ issn,
wikidata_qid,
expand,
hide,
@@ -444,6 +450,12 @@ impl Api for Server {
Box::new(futures::failed("Generic failure".into()))
}
+ fn lookup_editor(&self, username: Option<String>, context: &Context) -> Box<Future<Item = LookupEditorResponse, Error = ApiError> + Send> {
+ let context = context.clone();
+ println!("lookup_editor({:?}) - X-Span-ID: {:?}", username, context.x_span_id.unwrap_or(String::from("<none>")).clone());
+ Box::new(futures::failed("Generic failure".into()))
+ }
+
fn update_editor(&self, editor_id: String, editor: models::Editor, context: &Context) -> Box<Future<Item = UpdateEditorResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
@@ -819,13 +831,14 @@ impl Api for Server {
doaj: Option<String>,
dblp: Option<String>,
oai: Option<String>,
+ hdl: Option<String>,
expand: Option<String>,
hide: Option<String>,
context: &Context,
) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> {
let context = context.clone();
println!(
- "lookup_release({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
+ "lookup_release({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}",
doi,
wikidata_qid,
isbn13,
@@ -839,6 +852,7 @@ impl Api for Server {
doaj,
dblp,
oai,
+ hdl,
expand,
hide,
context.x_span_id.unwrap_or(String::from("<none>")).clone()