diff options
Diffstat (limited to 'fatcat-openapi/examples')
-rw-r--r-- | fatcat-openapi/examples/ca.pem | 17 | ||||
-rw-r--r-- | fatcat-openapi/examples/client/main.rs | 1148 | ||||
-rw-r--r-- | fatcat-openapi/examples/server-chain.pem | 66 | ||||
-rw-r--r-- | fatcat-openapi/examples/server-key.pem | 28 | ||||
-rw-r--r-- | fatcat-openapi/examples/server/main.rs | 26 | ||||
-rw-r--r-- | fatcat-openapi/examples/server/server.rs | 1687 |
6 files changed, 2972 insertions, 0 deletions
diff --git a/fatcat-openapi/examples/ca.pem b/fatcat-openapi/examples/ca.pem new file mode 100644 index 0000000..d2317fb --- /dev/null +++ b/fatcat-openapi/examples/ca.pem @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICtjCCAZ4CCQDpKecRERZ0xDANBgkqhkiG9w0BAQsFADAdMQswCQYDVQQGEwJV +UzEOMAwGA1UEAxMFTXkgQ0EwHhcNMTcwNTIzMTYwMDIzWhcNMTcwNjIyMTYwMDIz +WjAdMQswCQYDVQQGEwJVUzEOMAwGA1UEAxMFTXkgQ0EwggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQCt66py3x7sCSASRF2D05L5wkNDxAUjQKYx23W8Gbwv +GMGykk89BIdU5LX1JB1cKiUOkoIxfwAYuWc2V/wzTvVV7+11besnk3uX1c9KiqUF +LIX7kn/z5hzS4aelhKvH+MJlSZCSlp1ytpZbwo5GB5Pi2SGH56jDBiBoDRNBVdWL +z4wH7TdrQjqWwNxIZumD5OGMtcfJyuX08iPiEOaslOeoMqzObhvjc9aUgjVjhqyA +FkJGTXsi0oaD7oml+NE+mTNfEeZvEJQpLSjBY0OvQHzuHkyGBShBnfu/9x7/NRwd +WaqsLiF7/re9KDGYdJwP7Cu6uxYfKAyWarp6h2mG/GIdAgMBAAEwDQYJKoZIhvcN +AQELBQADggEBAGIl/VVIafeq/AJOQ9r7TzzB2ABJYr7NZa6bTu5O1jSp1Fonac15 +SZ8gvRxODgH22ZYSqghPG4xzq4J3hkytlQqm57ZEt2I2M3OqIp17Ndcc1xDYzpLl +tA0FrVn6crQTM8vQkTDtGesaCWX+7Fir5dK7HnYWzfpSmsOpST07PfbNisEXKOxG +Dj4lBL1OnhTjsJeymVS1pFvkKkrcEJO+IxFiHL3CDsWjcXB0Z+E1zBtPoYyYsNsO +rBrjUxcZewF4xqWZhpW90Mt61fY2nRgU0uUwHcvDQUqvmzKcsqYa4mPKzfBI5mxo +01Ta96cDD6pS5Y1hOflZ0g84f2g/7xBLLDA= +-----END CERTIFICATE----- diff --git a/fatcat-openapi/examples/client/main.rs b/fatcat-openapi/examples/client/main.rs new file mode 100644 index 0000000..14a1bdf --- /dev/null +++ b/fatcat-openapi/examples/client/main.rs @@ -0,0 +1,1148 @@ +#![allow(missing_docs, unused_variables, trivial_casts)] + +use clap::{App, Arg}; +#[allow(unused_imports)] +use fatcat_openapi::{ + models, AcceptEditgroupResponse, Api, ApiNoContext, AuthCheckResponse, AuthOidcResponse, + Client, ContextWrapperExt, CreateAuthTokenResponse, CreateContainerAutoBatchResponse, + CreateContainerResponse, CreateCreatorAutoBatchResponse, CreateCreatorResponse, + CreateEditgroupAnnotationResponse, CreateEditgroupResponse, CreateFileAutoBatchResponse, + CreateFileResponse, CreateFilesetAutoBatchResponse, CreateFilesetResponse, + CreateReleaseAutoBatchResponse, CreateReleaseResponse, CreateWebcaptureAutoBatchResponse, + CreateWebcaptureResponse, CreateWorkAutoBatchResponse, CreateWorkResponse, + DeleteContainerEditResponse, DeleteContainerResponse, DeleteCreatorEditResponse, + DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, DeleteFilesetEditResponse, + DeleteFilesetResponse, DeleteReleaseEditResponse, DeleteReleaseResponse, + DeleteWebcaptureEditResponse, DeleteWebcaptureResponse, DeleteWorkEditResponse, + DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerEditResponse, + GetContainerHistoryResponse, GetContainerRedirectsResponse, GetContainerResponse, + GetContainerRevisionResponse, GetCreatorEditResponse, GetCreatorHistoryResponse, + GetCreatorRedirectsResponse, GetCreatorReleasesResponse, GetCreatorResponse, + GetCreatorRevisionResponse, GetEditgroupAnnotationsResponse, GetEditgroupResponse, + GetEditgroupsReviewableResponse, GetEditorAnnotationsResponse, GetEditorEditgroupsResponse, + GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, 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, +}; +#[allow(unused_imports)] +use futures::{future, stream, Stream}; + +#[allow(unused_imports)] +use log::info; + +// swagger::Has may be unused if there are no examples +#[allow(unused_imports)] +use swagger::{AuthData, ContextBuilder, EmptyContext, Has, Push, XSpanIdString}; + +type ClientContext = swagger::make_context_ty!( + ContextBuilder, + EmptyContext, + Option<AuthData>, + XSpanIdString +); + +// rt may be unused if there are no examples +#[allow(unused_mut)] +fn main() { + env_logger::init(); + + let matches = App::new("client") + .arg( + Arg::with_name("operation") + .help("Sets the operation to run") + .possible_values(&[ + "AcceptEditgroup", + "AuthCheck", + "CreateAuthToken", + "DeleteContainer", + "DeleteContainerEdit", + "DeleteCreator", + "DeleteCreatorEdit", + "DeleteFile", + "DeleteFileEdit", + "DeleteFileset", + "DeleteFilesetEdit", + "DeleteRelease", + "DeleteReleaseEdit", + "DeleteWebcapture", + "DeleteWebcaptureEdit", + "DeleteWork", + "DeleteWorkEdit", + "GetChangelog", + "GetChangelogEntry", + "GetContainer", + "GetContainerEdit", + "GetContainerHistory", + "GetContainerRedirects", + "GetContainerRevision", + "GetCreator", + "GetCreatorEdit", + "GetCreatorHistory", + "GetCreatorRedirects", + "GetCreatorReleases", + "GetCreatorRevision", + "GetEditgroup", + "GetEditgroupAnnotations", + "GetEditgroupsReviewable", + "GetEditor", + "GetEditorAnnotations", + "GetEditorEditgroups", + "GetFile", + "GetFileEdit", + "GetFileHistory", + "GetFileRedirects", + "GetFileRevision", + "GetFileset", + "GetFilesetEdit", + "GetFilesetHistory", + "GetFilesetRedirects", + "GetFilesetRevision", + "GetRelease", + "GetReleaseEdit", + "GetReleaseFiles", + "GetReleaseFilesets", + "GetReleaseHistory", + "GetReleaseRedirects", + "GetReleaseRevision", + "GetReleaseWebcaptures", + "GetWebcapture", + "GetWebcaptureEdit", + "GetWebcaptureHistory", + "GetWebcaptureRedirects", + "GetWebcaptureRevision", + "GetWork", + "GetWorkEdit", + "GetWorkHistory", + "GetWorkRedirects", + "GetWorkReleases", + "GetWorkRevision", + "LookupContainer", + "LookupCreator", + "LookupFile", + "LookupRelease", + ]) + .required(true) + .index(1), + ) + .arg( + Arg::with_name("https") + .long("https") + .help("Whether to use HTTPS or not"), + ) + .arg( + Arg::with_name("host") + .long("host") + .takes_value(true) + .default_value("api.fatcat.wiki") + .help("Hostname to contact"), + ) + .arg( + Arg::with_name("port") + .long("port") + .takes_value(true) + .default_value("8080") + .help("Port to contact"), + ) + .get_matches(); + + let is_https = matches.is_present("https"); + let base_url = format!( + "{}://{}:{}", + if is_https { "https" } else { "http" }, + matches.value_of("host").unwrap(), + matches.value_of("port").unwrap() + ); + + let context: ClientContext = swagger::make_context!( + ContextBuilder, + EmptyContext, + None as Option<AuthData>, + XSpanIdString::default() + ); + + let mut client: Box<dyn ApiNoContext<ClientContext>> = if matches.is_present("https") { + // Using Simple HTTPS + let client = + Box::new(Client::try_new_https(&base_url).expect("Failed to create HTTPS client")); + Box::new(client.with_context(context)) + } else { + // Using HTTP + let client = + Box::new(Client::try_new_http(&base_url).expect("Failed to create HTTP client")); + Box::new(client.with_context(context)) + }; + + let mut rt = tokio::runtime::Runtime::new().unwrap(); + + match matches.value_of("operation") { + Some("AcceptEditgroup") => { + let result = rt.block_on(client.accept_editgroup("editgroup_id_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("AuthCheck") => { + let result = rt.block_on(client.auth_check(Some("role_example".to_string()))); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + /* Disabled because there's no example. + Some("AuthOidc") => { + let result = rt.block_on(client.auth_oidc( + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + Some("CreateAuthToken") => { + let result = + rt.block_on(client.create_auth_token("editor_id_example".to_string(), Some(56))); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + /* Disabled because there's no example. + Some("CreateContainer") => { + let result = rt.block_on(client.create_container( + "editgroup_id_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("CreateContainerAutoBatch") => { + let result = rt.block_on(client.create_container_auto_batch( + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("CreateCreator") => { + let result = rt.block_on(client.create_creator( + "editgroup_id_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("CreateCreatorAutoBatch") => { + let result = rt.block_on(client.create_creator_auto_batch( + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("CreateEditgroup") => { + let result = rt.block_on(client.create_editgroup( + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("CreateEditgroupAnnotation") => { + let result = rt.block_on(client.create_editgroup_annotation( + "editgroup_id_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("CreateFile") => { + let result = rt.block_on(client.create_file( + "editgroup_id_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("CreateFileAutoBatch") => { + let result = rt.block_on(client.create_file_auto_batch( + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("CreateFileset") => { + let result = rt.block_on(client.create_fileset( + "editgroup_id_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("CreateFilesetAutoBatch") => { + let result = rt.block_on(client.create_fileset_auto_batch( + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("CreateRelease") => { + let result = rt.block_on(client.create_release( + "editgroup_id_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("CreateReleaseAutoBatch") => { + let result = rt.block_on(client.create_release_auto_batch( + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("CreateWebcapture") => { + let result = rt.block_on(client.create_webcapture( + "editgroup_id_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("CreateWebcaptureAutoBatch") => { + let result = rt.block_on(client.create_webcapture_auto_batch( + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("CreateWork") => { + let result = rt.block_on(client.create_work( + "editgroup_id_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("CreateWorkAutoBatch") => { + let result = rt.block_on(client.create_work_auto_batch( + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + Some("DeleteContainer") => { + let result = rt.block_on(client.delete_container( + "editgroup_id_example".to_string(), + "ident_example".to_string(), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("DeleteContainerEdit") => { + let result = rt.block_on(client.delete_container_edit( + "editgroup_id_example".to_string(), + "edit_id_example".to_string(), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("DeleteCreator") => { + let result = rt.block_on(client.delete_creator( + "editgroup_id_example".to_string(), + "ident_example".to_string(), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("DeleteCreatorEdit") => { + let result = rt.block_on(client.delete_creator_edit( + "editgroup_id_example".to_string(), + "edit_id_example".to_string(), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("DeleteFile") => { + let result = rt.block_on(client.delete_file( + "editgroup_id_example".to_string(), + "ident_example".to_string(), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("DeleteFileEdit") => { + let result = rt.block_on(client.delete_file_edit( + "editgroup_id_example".to_string(), + "edit_id_example".to_string(), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("DeleteFileset") => { + let result = rt.block_on(client.delete_fileset( + "editgroup_id_example".to_string(), + "ident_example".to_string(), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("DeleteFilesetEdit") => { + let result = rt.block_on(client.delete_fileset_edit( + "editgroup_id_example".to_string(), + "edit_id_example".to_string(), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("DeleteRelease") => { + let result = rt.block_on(client.delete_release( + "editgroup_id_example".to_string(), + "ident_example".to_string(), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("DeleteReleaseEdit") => { + let result = rt.block_on(client.delete_release_edit( + "editgroup_id_example".to_string(), + "edit_id_example".to_string(), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("DeleteWebcapture") => { + let result = rt.block_on(client.delete_webcapture( + "editgroup_id_example".to_string(), + "ident_example".to_string(), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("DeleteWebcaptureEdit") => { + let result = rt.block_on(client.delete_webcapture_edit( + "editgroup_id_example".to_string(), + "edit_id_example".to_string(), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("DeleteWork") => { + let result = rt.block_on(client.delete_work( + "editgroup_id_example".to_string(), + "ident_example".to_string(), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("DeleteWorkEdit") => { + let result = rt.block_on(client.delete_work_edit( + "editgroup_id_example".to_string(), + "edit_id_example".to_string(), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetChangelog") => { + let result = rt.block_on(client.get_changelog(Some(789))); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetChangelogEntry") => { + let result = rt.block_on(client.get_changelog_entry(789)); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetContainer") => { + let result = rt.block_on(client.get_container( + "ident_example".to_string(), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetContainerEdit") => { + let result = rt.block_on(client.get_container_edit("edit_id_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetContainerHistory") => { + let result = + rt.block_on(client.get_container_history("ident_example".to_string(), Some(789))); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetContainerRedirects") => { + let result = rt.block_on(client.get_container_redirects("ident_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetContainerRevision") => { + let result = rt.block_on(client.get_container_revision( + "rev_id_example".to_string(), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetCreator") => { + let result = rt.block_on(client.get_creator( + "ident_example".to_string(), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetCreatorEdit") => { + let result = rt.block_on(client.get_creator_edit("edit_id_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetCreatorHistory") => { + let result = + rt.block_on(client.get_creator_history("ident_example".to_string(), Some(789))); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetCreatorRedirects") => { + let result = rt.block_on(client.get_creator_redirects("ident_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetCreatorReleases") => { + let result = rt.block_on(client.get_creator_releases( + "ident_example".to_string(), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetCreatorRevision") => { + let result = rt.block_on(client.get_creator_revision( + "rev_id_example".to_string(), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetEditgroup") => { + let result = rt.block_on(client.get_editgroup("editgroup_id_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetEditgroupAnnotations") => { + let result = rt.block_on(client.get_editgroup_annotations( + "editgroup_id_example".to_string(), + Some("expand_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetEditgroupsReviewable") => { + let result = rt.block_on(client.get_editgroups_reviewable( + Some("expand_example".to_string()), + Some(789), + None, + None, + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetEditor") => { + let result = rt.block_on(client.get_editor("editor_id_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetEditorAnnotations") => { + let result = rt.block_on(client.get_editor_annotations( + "editor_id_example".to_string(), + Some(789), + None, + None, + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetEditorEditgroups") => { + let result = rt.block_on(client.get_editor_editgroups( + "editor_id_example".to_string(), + Some(789), + None, + None, + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetFile") => { + let result = rt.block_on(client.get_file( + "ident_example".to_string(), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetFileEdit") => { + let result = rt.block_on(client.get_file_edit("edit_id_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetFileHistory") => { + let result = + rt.block_on(client.get_file_history("ident_example".to_string(), Some(789))); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetFileRedirects") => { + let result = rt.block_on(client.get_file_redirects("ident_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetFileRevision") => { + let result = rt.block_on(client.get_file_revision( + "rev_id_example".to_string(), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetFileset") => { + let result = rt.block_on(client.get_fileset( + "ident_example".to_string(), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetFilesetEdit") => { + let result = rt.block_on(client.get_fileset_edit("edit_id_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetFilesetHistory") => { + let result = + rt.block_on(client.get_fileset_history("ident_example".to_string(), Some(789))); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetFilesetRedirects") => { + let result = rt.block_on(client.get_fileset_redirects("ident_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetFilesetRevision") => { + let result = rt.block_on(client.get_fileset_revision( + "rev_id_example".to_string(), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetRelease") => { + let result = rt.block_on(client.get_release( + "ident_example".to_string(), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetReleaseEdit") => { + let result = rt.block_on(client.get_release_edit("edit_id_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetReleaseFiles") => { + let result = rt.block_on(client.get_release_files( + "ident_example".to_string(), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetReleaseFilesets") => { + let result = rt.block_on(client.get_release_filesets( + "ident_example".to_string(), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetReleaseHistory") => { + let result = + rt.block_on(client.get_release_history("ident_example".to_string(), Some(789))); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetReleaseRedirects") => { + let result = rt.block_on(client.get_release_redirects("ident_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetReleaseRevision") => { + let result = rt.block_on(client.get_release_revision( + "rev_id_example".to_string(), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetReleaseWebcaptures") => { + let result = rt.block_on(client.get_release_webcaptures( + "ident_example".to_string(), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetWebcapture") => { + let result = rt.block_on(client.get_webcapture( + "ident_example".to_string(), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetWebcaptureEdit") => { + let result = rt.block_on(client.get_webcapture_edit("edit_id_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetWebcaptureHistory") => { + let result = + rt.block_on(client.get_webcapture_history("ident_example".to_string(), Some(789))); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetWebcaptureRedirects") => { + let result = rt.block_on(client.get_webcapture_redirects("ident_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetWebcaptureRevision") => { + let result = rt.block_on(client.get_webcapture_revision( + "rev_id_example".to_string(), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetWork") => { + let result = rt.block_on(client.get_work( + "ident_example".to_string(), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetWorkEdit") => { + let result = rt.block_on(client.get_work_edit("edit_id_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetWorkHistory") => { + let result = + rt.block_on(client.get_work_history("ident_example".to_string(), Some(789))); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetWorkRedirects") => { + let result = rt.block_on(client.get_work_redirects("ident_example".to_string())); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetWorkReleases") => { + let result = rt.block_on(client.get_work_releases( + "ident_example".to_string(), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("GetWorkRevision") => { + let result = rt.block_on(client.get_work_revision( + "rev_id_example".to_string(), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("LookupContainer") => { + let result = rt.block_on(client.lookup_container( + Some("issnl_example".to_string()), + Some("wikidata_qid_example".to_string()), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("LookupCreator") => { + let result = rt.block_on(client.lookup_creator( + Some("orcid_example".to_string()), + Some("wikidata_qid_example".to_string()), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("LookupFile") => { + let result = rt.block_on(client.lookup_file( + Some("md5_example".to_string()), + Some("sha1_example".to_string()), + Some("sha256_example".to_string()), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + Some("LookupRelease") => { + let result = rt.block_on(client.lookup_release( + Some("doi_example".to_string()), + Some("wikidata_qid_example".to_string()), + Some("isbn13_example".to_string()), + Some("pmid_example".to_string()), + Some("pmcid_example".to_string()), + Some("core_example".to_string()), + Some("arxiv_example".to_string()), + Some("jstor_example".to_string()), + Some("ark_example".to_string()), + Some("mag_example".to_string()), + Some("doaj_example".to_string()), + Some("dblp_example".to_string()), + Some("oai_example".to_string()), + Some("expand_example".to_string()), + Some("hide_example".to_string()), + )); + info!( + "{:?} (X-Span-ID: {:?})", + result, + (client.context() as &dyn Has<XSpanIdString>).get().clone() + ); + } + /* Disabled because there's no example. + Some("UpdateContainer") => { + let result = rt.block_on(client.update_container( + "editgroup_id_example".to_string(), + "ident_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("UpdateCreator") => { + let result = rt.block_on(client.update_creator( + "editgroup_id_example".to_string(), + "ident_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("UpdateEditgroup") => { + let result = rt.block_on(client.update_editgroup( + "editgroup_id_example".to_string(), + ???, + Some(true) + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("UpdateEditor") => { + let result = rt.block_on(client.update_editor( + "editor_id_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("UpdateFile") => { + let result = rt.block_on(client.update_file( + "editgroup_id_example".to_string(), + "ident_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("UpdateFileset") => { + let result = rt.block_on(client.update_fileset( + "editgroup_id_example".to_string(), + "ident_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("UpdateRelease") => { + let result = rt.block_on(client.update_release( + "editgroup_id_example".to_string(), + "ident_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("UpdateWebcapture") => { + let result = rt.block_on(client.update_webcapture( + "editgroup_id_example".to_string(), + "ident_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + /* Disabled because there's no example. + Some("UpdateWork") => { + let result = rt.block_on(client.update_work( + "editgroup_id_example".to_string(), + "ident_example".to_string(), + ??? + )); + info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone()); + }, + */ + _ => { + panic!("Invalid operation provided") + } + } +} diff --git a/fatcat-openapi/examples/server-chain.pem b/fatcat-openapi/examples/server-chain.pem new file mode 100644 index 0000000..47d7e20 --- /dev/null +++ b/fatcat-openapi/examples/server-chain.pem @@ -0,0 +1,66 @@ +Certificate: + Data: + Version: 1 (0x0) + Serial Number: 4096 (0x1000) + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=US, CN=My CA + Validity + Not Before: May 23 16:00:23 2017 GMT + Not After : Apr 29 16:00:23 2117 GMT + Subject: CN=localhost, C=US + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:c9:d4:43:60:50:fc:d6:0f:38:4d:5d:5e:aa:7c: + c0:5e:a9:ec:d9:93:78:d3:93:72:28:41:f5:08:a5: + ea:ac:67:07:d7:1f:f7:7d:74:69:7e:46:89:20:4b: + 7a:2d:9b:02:08:e7:6f:0f:1d:0c:0f:c7:60:69:19: + 4b:df:7e:ca:75:94:0b:49:71:e3:6d:f2:e8:79:fd: + ed:0a:94:67:55:f3:ca:6b:61:ba:58:b7:2e:dd:7b: + ca:b9:02:9f:24:36:ac:26:8f:04:8f:81:c8:35:10: + f4:aa:33:b2:24:16:f8:f7:1e:ea:f7:16:fe:fa:34: + c3:dd:bb:2c:ba:7a:df:4d:e2:da:1e:e5:d2:28:44: + 6e:c8:96:e0:fd:09:0c:14:0c:31:dc:e0:ca:c1:a7: + 9b:bf:16:8c:f7:36:3f:1b:2e:dd:90:eb:45:78:51: + bf:59:22:1e:c6:8c:0a:69:88:e5:03:5e:73:b7:fc: + 93:7f:1b:46:1b:97:68:c5:c0:8b:35:1f:bb:1e:67: + 7f:55:b7:3b:55:3f:ea:f2:ca:db:cc:52:cd:16:89: + db:15:47:bd:f2:cd:6c:7a:d7:b4:1a:ac:c8:15:6c: + 6a:fb:77:c4:e9:f2:30:e0:14:24:66:65:6f:2a:e5: + 2d:cc:f6:81:ae:57:c8:d1:9b:38:90:dc:60:93:02: + 5e:cb + Exponent: 65537 (0x10001) + Signature Algorithm: sha256WithRSAEncryption + 1c:7c:39:e8:3d:49:b2:09:1e:68:5a:2f:74:18:f4:63:b5:8c: + f6:e6:a1:e3:4d:95:90:99:ef:32:5c:34:40:e8:55:13:0e:e0: + 1c:be:cd:ab:3f:64:38:99:5e:2b:c1:81:53:a0:18:a8:f6:ee: + 6a:33:73:6c:9a:73:9d:86:08:5d:c7:11:38:46:4c:cd:a0:47: + 37:8f:fe:a6:50:a9:02:21:99:42:86:5e:47:fe:65:56:60:1d: + 16:53:86:bd:e4:63:c5:69:cf:fa:30:51:ab:a1:c3:50:53:cc: + 66:1c:4c:ff:3f:2a:39:4d:a2:8f:9d:d1:a7:8b:22:e4:78:69: + 24:06:83:4d:cc:0a:c0:87:69:9b:bc:80:a9:d2:b7:a5:23:84: + 7e:a2:32:26:7c:78:0e:bd:db:cd:3b:69:18:33:b8:44:ef:96: + b4:99:86:ee:06:bd:51:1c:c7:a1:a4:0c:c4:4c:51:a0:df:ac: + 14:07:88:8e:d7:39:45:fe:52:e0:a3:4c:db:5d:7a:ab:4d:e4: + ca:06:e8:bd:74:6f:46:e7:93:4a:4f:1b:67:e7:a5:9f:ef:9c: + 02:49:d1:f2:d5:e9:53:ee:09:21:ac:08:c8:15:f7:af:35:b9: + 4f:11:0f:43:ae:46:8e:fd:5b:8d:a3:4e:a7:2c:b7:25:ed:e4: + e5:94:1d:e3 +-----BEGIN CERTIFICATE----- +MIICtTCCAZ0CAhAAMA0GCSqGSIb3DQEBCwUAMB0xCzAJBgNVBAYTAlVTMQ4wDAYD +VQQDEwVNeSBDQTAgFw0xNzA1MjMxNjAwMjNaGA8yMTE3MDQyOTE2MDAyM1owITES +MBAGA1UEAxMJbG9jYWxob3N0MQswCQYDVQQGEwJVUzCCASIwDQYJKoZIhvcNAQEB +BQADggEPADCCAQoCggEBAMnUQ2BQ/NYPOE1dXqp8wF6p7NmTeNOTcihB9Qil6qxn +B9cf9310aX5GiSBLei2bAgjnbw8dDA/HYGkZS99+ynWUC0lx423y6Hn97QqUZ1Xz +ymthuli3Lt17yrkCnyQ2rCaPBI+ByDUQ9KozsiQW+Pce6vcW/vo0w927LLp6303i +2h7l0ihEbsiW4P0JDBQMMdzgysGnm78WjPc2Pxsu3ZDrRXhRv1kiHsaMCmmI5QNe +c7f8k38bRhuXaMXAizUfux5nf1W3O1U/6vLK28xSzRaJ2xVHvfLNbHrXtBqsyBVs +avt3xOnyMOAUJGZlbyrlLcz2ga5XyNGbOJDcYJMCXssCAwEAATANBgkqhkiG9w0B +AQsFAAOCAQEAHHw56D1JsgkeaFovdBj0Y7WM9uah402VkJnvMlw0QOhVEw7gHL7N +qz9kOJleK8GBU6AYqPbuajNzbJpznYYIXccROEZMzaBHN4/+plCpAiGZQoZeR/5l +VmAdFlOGveRjxWnP+jBRq6HDUFPMZhxM/z8qOU2ij53Rp4si5HhpJAaDTcwKwIdp +m7yAqdK3pSOEfqIyJnx4Dr3bzTtpGDO4RO+WtJmG7ga9URzHoaQMxExRoN+sFAeI +jtc5Rf5S4KNM2116q03kygbovXRvRueTSk8bZ+eln++cAknR8tXpU+4JIawIyBX3 +rzW5TxEPQ65Gjv1bjaNOpyy3Je3k5ZQd4w== +-----END CERTIFICATE----- diff --git a/fatcat-openapi/examples/server-key.pem b/fatcat-openapi/examples/server-key.pem new file mode 100644 index 0000000..29c0068 --- /dev/null +++ b/fatcat-openapi/examples/server-key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDJ1ENgUPzWDzhN +XV6qfMBeqezZk3jTk3IoQfUIpeqsZwfXH/d9dGl+RokgS3otmwII528PHQwPx2Bp +GUvffsp1lAtJceNt8uh5/e0KlGdV88prYbpYty7de8q5Ap8kNqwmjwSPgcg1EPSq +M7IkFvj3Hur3Fv76NMPduyy6et9N4toe5dIoRG7IluD9CQwUDDHc4MrBp5u/Foz3 +Nj8bLt2Q60V4Ub9ZIh7GjAppiOUDXnO3/JN/G0Ybl2jFwIs1H7seZ39VtztVP+ry +ytvMUs0WidsVR73yzWx617QarMgVbGr7d8Tp8jDgFCRmZW8q5S3M9oGuV8jRmziQ +3GCTAl7LAgMBAAECggEBAKEd1q9j14KWYc64s6KLthGbutyxsinMMbxbct11fdIk +6YhdF3fJ35ETg9IJDr6rWEN9ZRX+jStncNpVfFEs6ThVd3Eo/nI+EEGaaIkikR93 +X2a7fEPn7/yVHu70XdBN6L1bPDvHUeiy4W2hmRrgT90OjGm1rNRWHOm7yugOwIZu +HclzbR9Ca7EInFnotUiDQm9sw9VKHbJHqWx6OORdZrxR2ytYs0Qkq0XpGMvti2HW +7WAmKTg5QM8myXW7+/4iqb/u68wVBR2BBalShKmIf7lim9O3W2a1RjDdsvm/wNe9 +I+D+Iq825vpqkKXcrxYlpVg7hYiaQaW/MNsEb7lQRjECgYEA/RJYby0POW+/k0Jn +jO8UmJVEMiuGa8WIUu/JJWMOmzRCukjSRNQOkt7niQrZPJYE8W6clM6RJTolWf9L +IL6mIb+mRaoudUk8SHGDq7ho1iMg9GK8lhYxvKh1Q6uv8EyVSkgLknAEY0NANKC1 +zNdU5Dhven9aRX2gq9vP4XwMz2MCgYEAzCogQ7IFk+gkp3k491dOZnrGRoRCfuzo +4CJtyKFgOSd7BjmpcKkj0IPfVBjw6GjMIxfQRMTQmxAjjWevH45vG8l0Iiwz/gSp +81b5nsDEX5uv2Olcmcz5zxRFy36jOZ9ihMWinxcIlT2oDbyCdbruDKZq9ieJ9S8g +4qGx0OkwE3kCgYEA7CmAiU89U9YqqttfEq/RQoqY91CSwmO10d+ej9seuEtOsdRf +FIfnibulycdr7hP5TOxyBpO1802NqayJiWcgVYIpQf2MGTtcnCYCP+95NcvWZvj1 +EAJqK6nwtFO1fcOZ1ZXh5qfOEGujsPkAbsXLnKXlsiTCMvMHSxl3pu5Cbg0CgYBf +JjbZNctRrjv+7Qj2hPLd4dQsIxGWc7ToWENP4J2mpVa5hQAJqFovoHXhjKohtk2F +AWEn243Y5oGbMjo0e74edhmwn2cvuF64MM2vBem/ISCn98IXT6cQskMA3qkVfsl8 +VVs/x41ReGWs2TD3y0GMFbb9t1mdMfSiincDhNnKCQKBgGfeT4jKyYeCoCw4OLI1 +G75Gd0METt/IkppwODPpNwj3Rp9I5jctWZFA/3wCX/zk0HgBeou5AFNS4nQZ/X/L +L9axbSdR7UJTGkT1r4gu3rLkPV4Tk+8XM03/JT2cofMlzQBuhvl1Pn4SgKowz7hl +lS76ECw4Av3T0S34VW9Z5oye +-----END PRIVATE KEY----- diff --git a/fatcat-openapi/examples/server/main.rs b/fatcat-openapi/examples/server/main.rs new file mode 100644 index 0000000..5488dc6 --- /dev/null +++ b/fatcat-openapi/examples/server/main.rs @@ -0,0 +1,26 @@ +//! Main binary entry point for fatcat_openapi implementation. + +#![allow(missing_docs)] + +use clap::{App, Arg}; + +mod server; + +/// Create custom server, wire it to the autogenerated router, +/// and pass it to the web server. +#[tokio::main] +async fn main() { + env_logger::init(); + + let matches = App::new("server") + .arg( + Arg::with_name("https") + .long("https") + .help("Whether to use HTTPS or not"), + ) + .get_matches(); + + let addr = "127.0.0.1:8080"; + + server::create(addr, matches.is_present("https")).await; +} diff --git a/fatcat-openapi/examples/server/server.rs b/fatcat-openapi/examples/server/server.rs new file mode 100644 index 0000000..981487e --- /dev/null +++ b/fatcat-openapi/examples/server/server.rs @@ -0,0 +1,1687 @@ +//! Main library entry point for fatcat_openapi implementation. + +#![allow(unused_imports)] + +use async_trait::async_trait; +use futures::{future, Stream, StreamExt, TryFutureExt, TryStreamExt}; +use hyper::server::conn::Http; +use hyper::service::Service; +use log::info; +#[cfg(not(any(target_os = "macos", target_os = "windows", target_os = "ios")))] +use openssl::ssl::SslAcceptorBuilder; +use std::future::Future; +use std::marker::PhantomData; +use std::net::SocketAddr; +use std::sync::{Arc, Mutex}; +use std::task::{Context, Poll}; +use swagger::auth::MakeAllowAllAuthenticator; +use swagger::EmptyContext; +use swagger::{Has, XSpanIdString}; +use tokio::net::TcpListener; + +#[cfg(not(any(target_os = "macos", target_os = "windows", target_os = "ios")))] +use openssl::ssl::{SslAcceptor, SslFiletype, SslMethod}; + +use fatcat_openapi::models; + +/// Builds an SSL implementation for Simple HTTPS from some hard-coded file names +pub async fn create(addr: &str, https: bool) { + let addr = addr.parse().expect("Failed to parse bind address"); + + let server = Server::new(); + + let service = MakeService::new(server); + + let service = MakeAllowAllAuthenticator::new(service, "cosmo"); + + let mut service = + fatcat_openapi::server::context::MakeAddContext::<_, EmptyContext>::new(service); + + if https { + #[cfg(any(target_os = "macos", target_os = "windows", target_os = "ios"))] + { + unimplemented!("SSL is not implemented for the examples on MacOS, Windows or iOS"); + } + + #[cfg(not(any(target_os = "macos", target_os = "windows", target_os = "ios")))] + { + let mut ssl = SslAcceptor::mozilla_intermediate_v5(SslMethod::tls()) + .expect("Failed to create SSL Acceptor"); + + // Server authentication + ssl.set_private_key_file("examples/server-key.pem", SslFiletype::PEM) + .expect("Failed to set private key"); + ssl.set_certificate_chain_file("examples/server-chain.pem") + .expect("Failed to set cerificate chain"); + ssl.check_private_key() + .expect("Failed to check private key"); + + let tls_acceptor = Arc::new(ssl.build()); + let mut tcp_listener = TcpListener::bind(&addr).await.unwrap(); + let mut incoming = tcp_listener.incoming(); + + while let (Some(tcp), rest) = incoming.into_future().await { + if let Ok(tcp) = tcp { + let addr = tcp.peer_addr().expect("Unable to get remote address"); + let service = service.call(addr); + let tls_acceptor = Arc::clone(&tls_acceptor); + + tokio::spawn(async move { + let tls = tokio_openssl::accept(&*tls_acceptor, tcp) + .await + .map_err(|_| ())?; + + let service = service.await.map_err(|_| ())?; + + Http::new() + .serve_connection(tls, service) + .await + .map_err(|_| ()) + }); + } + + incoming = rest; + } + } + } else { + // Using HTTP + hyper::server::Server::bind(&addr) + .serve(service) + .await + .unwrap() + } +} + +#[derive(Copy, Clone)] +pub struct Server<C> { + marker: PhantomData<C>, +} + +impl<C> Server<C> { + pub fn new() -> Self { + Server { + marker: PhantomData, + } + } +} + +use fatcat_openapi::server::MakeService; +use fatcat_openapi::{ + AcceptEditgroupResponse, Api, AuthCheckResponse, AuthOidcResponse, CreateAuthTokenResponse, + CreateContainerAutoBatchResponse, CreateContainerResponse, CreateCreatorAutoBatchResponse, + CreateCreatorResponse, CreateEditgroupAnnotationResponse, CreateEditgroupResponse, + CreateFileAutoBatchResponse, CreateFileResponse, CreateFilesetAutoBatchResponse, + CreateFilesetResponse, CreateReleaseAutoBatchResponse, CreateReleaseResponse, + CreateWebcaptureAutoBatchResponse, CreateWebcaptureResponse, CreateWorkAutoBatchResponse, + CreateWorkResponse, DeleteContainerEditResponse, DeleteContainerResponse, + DeleteCreatorEditResponse, DeleteCreatorResponse, DeleteFileEditResponse, DeleteFileResponse, + DeleteFilesetEditResponse, DeleteFilesetResponse, DeleteReleaseEditResponse, + DeleteReleaseResponse, DeleteWebcaptureEditResponse, DeleteWebcaptureResponse, + DeleteWorkEditResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, + GetContainerEditResponse, GetContainerHistoryResponse, GetContainerRedirectsResponse, + GetContainerResponse, GetContainerRevisionResponse, GetCreatorEditResponse, + GetCreatorHistoryResponse, GetCreatorRedirectsResponse, GetCreatorReleasesResponse, + GetCreatorResponse, GetCreatorRevisionResponse, GetEditgroupAnnotationsResponse, + GetEditgroupResponse, GetEditgroupsReviewableResponse, GetEditorAnnotationsResponse, + GetEditorEditgroupsResponse, GetEditorResponse, GetFileEditResponse, GetFileHistoryResponse, + 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, +}; +use std::error::Error; +use swagger::ApiError; + +#[async_trait] +impl<C> Api<C> for Server<C> +where + C: Has<XSpanIdString> + Send + Sync, +{ + async fn accept_editgroup( + &self, + editgroup_id: String, + context: &C, + ) -> Result<AcceptEditgroupResponse, ApiError> { + let context = context.clone(); + info!( + "accept_editgroup(\"{}\") - X-Span-ID: {:?}", + editgroup_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn auth_check( + &self, + role: Option<String>, + context: &C, + ) -> Result<AuthCheckResponse, ApiError> { + let context = context.clone(); + info!( + "auth_check({:?}) - X-Span-ID: {:?}", + role, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn auth_oidc( + &self, + auth_oidc: models::AuthOidc, + context: &C, + ) -> Result<AuthOidcResponse, ApiError> { + let context = context.clone(); + info!( + "auth_oidc({:?}) - X-Span-ID: {:?}", + auth_oidc, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_auth_token( + &self, + editor_id: String, + duration_seconds: Option<i32>, + context: &C, + ) -> Result<CreateAuthTokenResponse, ApiError> { + let context = context.clone(); + info!( + "create_auth_token(\"{}\", {:?}) - X-Span-ID: {:?}", + editor_id, + duration_seconds, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_container( + &self, + editgroup_id: String, + container_entity: models::ContainerEntity, + context: &C, + ) -> Result<CreateContainerResponse, ApiError> { + let context = context.clone(); + info!( + "create_container(\"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + container_entity, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_container_auto_batch( + &self, + container_auto_batch: models::ContainerAutoBatch, + context: &C, + ) -> Result<CreateContainerAutoBatchResponse, ApiError> { + let context = context.clone(); + info!( + "create_container_auto_batch({:?}) - X-Span-ID: {:?}", + container_auto_batch, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_creator( + &self, + editgroup_id: String, + creator_entity: models::CreatorEntity, + context: &C, + ) -> Result<CreateCreatorResponse, ApiError> { + let context = context.clone(); + info!( + "create_creator(\"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + creator_entity, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_creator_auto_batch( + &self, + creator_auto_batch: models::CreatorAutoBatch, + context: &C, + ) -> Result<CreateCreatorAutoBatchResponse, ApiError> { + let context = context.clone(); + info!( + "create_creator_auto_batch({:?}) - X-Span-ID: {:?}", + creator_auto_batch, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_editgroup( + &self, + editgroup: models::Editgroup, + context: &C, + ) -> Result<CreateEditgroupResponse, ApiError> { + let context = context.clone(); + info!( + "create_editgroup({:?}) - X-Span-ID: {:?}", + editgroup, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_editgroup_annotation( + &self, + editgroup_id: String, + editgroup_annotation: models::EditgroupAnnotation, + context: &C, + ) -> Result<CreateEditgroupAnnotationResponse, ApiError> { + let context = context.clone(); + info!( + "create_editgroup_annotation(\"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + editgroup_annotation, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_file( + &self, + editgroup_id: String, + file_entity: models::FileEntity, + context: &C, + ) -> Result<CreateFileResponse, ApiError> { + let context = context.clone(); + info!( + "create_file(\"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + file_entity, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_file_auto_batch( + &self, + file_auto_batch: models::FileAutoBatch, + context: &C, + ) -> Result<CreateFileAutoBatchResponse, ApiError> { + let context = context.clone(); + info!( + "create_file_auto_batch({:?}) - X-Span-ID: {:?}", + file_auto_batch, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_fileset( + &self, + editgroup_id: String, + fileset_entity: models::FilesetEntity, + context: &C, + ) -> Result<CreateFilesetResponse, ApiError> { + let context = context.clone(); + info!( + "create_fileset(\"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + fileset_entity, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_fileset_auto_batch( + &self, + fileset_auto_batch: models::FilesetAutoBatch, + context: &C, + ) -> Result<CreateFilesetAutoBatchResponse, ApiError> { + let context = context.clone(); + info!( + "create_fileset_auto_batch({:?}) - X-Span-ID: {:?}", + fileset_auto_batch, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_release( + &self, + editgroup_id: String, + release_entity: models::ReleaseEntity, + context: &C, + ) -> Result<CreateReleaseResponse, ApiError> { + let context = context.clone(); + info!( + "create_release(\"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + release_entity, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_release_auto_batch( + &self, + release_auto_batch: models::ReleaseAutoBatch, + context: &C, + ) -> Result<CreateReleaseAutoBatchResponse, ApiError> { + let context = context.clone(); + info!( + "create_release_auto_batch({:?}) - X-Span-ID: {:?}", + release_auto_batch, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_webcapture( + &self, + editgroup_id: String, + webcapture_entity: models::WebcaptureEntity, + context: &C, + ) -> Result<CreateWebcaptureResponse, ApiError> { + let context = context.clone(); + info!( + "create_webcapture(\"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + webcapture_entity, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_webcapture_auto_batch( + &self, + webcapture_auto_batch: models::WebcaptureAutoBatch, + context: &C, + ) -> Result<CreateWebcaptureAutoBatchResponse, ApiError> { + let context = context.clone(); + info!( + "create_webcapture_auto_batch({:?}) - X-Span-ID: {:?}", + webcapture_auto_batch, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_work( + &self, + editgroup_id: String, + work_entity: models::WorkEntity, + context: &C, + ) -> Result<CreateWorkResponse, ApiError> { + let context = context.clone(); + info!( + "create_work(\"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + work_entity, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn create_work_auto_batch( + &self, + work_auto_batch: models::WorkAutoBatch, + context: &C, + ) -> Result<CreateWorkAutoBatchResponse, ApiError> { + let context = context.clone(); + info!( + "create_work_auto_batch({:?}) - X-Span-ID: {:?}", + work_auto_batch, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn delete_container( + &self, + editgroup_id: String, + ident: String, + context: &C, + ) -> Result<DeleteContainerResponse, ApiError> { + let context = context.clone(); + info!( + "delete_container(\"{}\", \"{}\") - X-Span-ID: {:?}", + editgroup_id, + ident, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn delete_container_edit( + &self, + editgroup_id: String, + edit_id: String, + context: &C, + ) -> Result<DeleteContainerEditResponse, ApiError> { + let context = context.clone(); + info!( + "delete_container_edit(\"{}\", \"{}\") - X-Span-ID: {:?}", + editgroup_id, + edit_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn delete_creator( + &self, + editgroup_id: String, + ident: String, + context: &C, + ) -> Result<DeleteCreatorResponse, ApiError> { + let context = context.clone(); + info!( + "delete_creator(\"{}\", \"{}\") - X-Span-ID: {:?}", + editgroup_id, + ident, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn delete_creator_edit( + &self, + editgroup_id: String, + edit_id: String, + context: &C, + ) -> Result<DeleteCreatorEditResponse, ApiError> { + let context = context.clone(); + info!( + "delete_creator_edit(\"{}\", \"{}\") - X-Span-ID: {:?}", + editgroup_id, + edit_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn delete_file( + &self, + editgroup_id: String, + ident: String, + context: &C, + ) -> Result<DeleteFileResponse, ApiError> { + let context = context.clone(); + info!( + "delete_file(\"{}\", \"{}\") - X-Span-ID: {:?}", + editgroup_id, + ident, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn delete_file_edit( + &self, + editgroup_id: String, + edit_id: String, + context: &C, + ) -> Result<DeleteFileEditResponse, ApiError> { + let context = context.clone(); + info!( + "delete_file_edit(\"{}\", \"{}\") - X-Span-ID: {:?}", + editgroup_id, + edit_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn delete_fileset( + &self, + editgroup_id: String, + ident: String, + context: &C, + ) -> Result<DeleteFilesetResponse, ApiError> { + let context = context.clone(); + info!( + "delete_fileset(\"{}\", \"{}\") - X-Span-ID: {:?}", + editgroup_id, + ident, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn delete_fileset_edit( + &self, + editgroup_id: String, + edit_id: String, + context: &C, + ) -> Result<DeleteFilesetEditResponse, ApiError> { + let context = context.clone(); + info!( + "delete_fileset_edit(\"{}\", \"{}\") - X-Span-ID: {:?}", + editgroup_id, + edit_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn delete_release( + &self, + editgroup_id: String, + ident: String, + context: &C, + ) -> Result<DeleteReleaseResponse, ApiError> { + let context = context.clone(); + info!( + "delete_release(\"{}\", \"{}\") - X-Span-ID: {:?}", + editgroup_id, + ident, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn delete_release_edit( + &self, + editgroup_id: String, + edit_id: String, + context: &C, + ) -> Result<DeleteReleaseEditResponse, ApiError> { + let context = context.clone(); + info!( + "delete_release_edit(\"{}\", \"{}\") - X-Span-ID: {:?}", + editgroup_id, + edit_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn delete_webcapture( + &self, + editgroup_id: String, + ident: String, + context: &C, + ) -> Result<DeleteWebcaptureResponse, ApiError> { + let context = context.clone(); + info!( + "delete_webcapture(\"{}\", \"{}\") - X-Span-ID: {:?}", + editgroup_id, + ident, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn delete_webcapture_edit( + &self, + editgroup_id: String, + edit_id: String, + context: &C, + ) -> Result<DeleteWebcaptureEditResponse, ApiError> { + let context = context.clone(); + info!( + "delete_webcapture_edit(\"{}\", \"{}\") - X-Span-ID: {:?}", + editgroup_id, + edit_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn delete_work( + &self, + editgroup_id: String, + ident: String, + context: &C, + ) -> Result<DeleteWorkResponse, ApiError> { + let context = context.clone(); + info!( + "delete_work(\"{}\", \"{}\") - X-Span-ID: {:?}", + editgroup_id, + ident, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn delete_work_edit( + &self, + editgroup_id: String, + edit_id: String, + context: &C, + ) -> Result<DeleteWorkEditResponse, ApiError> { + let context = context.clone(); + info!( + "delete_work_edit(\"{}\", \"{}\") - X-Span-ID: {:?}", + editgroup_id, + edit_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_changelog( + &self, + limit: Option<i64>, + context: &C, + ) -> Result<GetChangelogResponse, ApiError> { + let context = context.clone(); + info!( + "get_changelog({:?}) - X-Span-ID: {:?}", + limit, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_changelog_entry( + &self, + index: i64, + context: &C, + ) -> Result<GetChangelogEntryResponse, ApiError> { + let context = context.clone(); + info!( + "get_changelog_entry({}) - X-Span-ID: {:?}", + index, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_container( + &self, + ident: String, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<GetContainerResponse, ApiError> { + let context = context.clone(); + info!( + "get_container(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + ident, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_container_edit( + &self, + edit_id: String, + context: &C, + ) -> Result<GetContainerEditResponse, ApiError> { + let context = context.clone(); + info!( + "get_container_edit(\"{}\") - X-Span-ID: {:?}", + edit_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_container_history( + &self, + ident: String, + limit: Option<i64>, + context: &C, + ) -> Result<GetContainerHistoryResponse, ApiError> { + let context = context.clone(); + info!( + "get_container_history(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + limit, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_container_redirects( + &self, + ident: String, + context: &C, + ) -> Result<GetContainerRedirectsResponse, ApiError> { + let context = context.clone(); + info!( + "get_container_redirects(\"{}\") - X-Span-ID: {:?}", + ident, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_container_revision( + &self, + rev_id: String, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<GetContainerRevisionResponse, ApiError> { + let context = context.clone(); + info!( + "get_container_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + rev_id, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_creator( + &self, + ident: String, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<GetCreatorResponse, ApiError> { + let context = context.clone(); + info!( + "get_creator(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + ident, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_creator_edit( + &self, + edit_id: String, + context: &C, + ) -> Result<GetCreatorEditResponse, ApiError> { + let context = context.clone(); + info!( + "get_creator_edit(\"{}\") - X-Span-ID: {:?}", + edit_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_creator_history( + &self, + ident: String, + limit: Option<i64>, + context: &C, + ) -> Result<GetCreatorHistoryResponse, ApiError> { + let context = context.clone(); + info!( + "get_creator_history(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + limit, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_creator_redirects( + &self, + ident: String, + context: &C, + ) -> Result<GetCreatorRedirectsResponse, ApiError> { + let context = context.clone(); + info!( + "get_creator_redirects(\"{}\") - X-Span-ID: {:?}", + ident, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_creator_releases( + &self, + ident: String, + hide: Option<String>, + context: &C, + ) -> Result<GetCreatorReleasesResponse, ApiError> { + let context = context.clone(); + info!( + "get_creator_releases(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_creator_revision( + &self, + rev_id: String, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<GetCreatorRevisionResponse, ApiError> { + let context = context.clone(); + info!( + "get_creator_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + rev_id, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_editgroup( + &self, + editgroup_id: String, + context: &C, + ) -> Result<GetEditgroupResponse, ApiError> { + let context = context.clone(); + info!( + "get_editgroup(\"{}\") - X-Span-ID: {:?}", + editgroup_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_editgroup_annotations( + &self, + editgroup_id: String, + expand: Option<String>, + context: &C, + ) -> Result<GetEditgroupAnnotationsResponse, ApiError> { + let context = context.clone(); + info!( + "get_editgroup_annotations(\"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + expand, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_editgroups_reviewable( + &self, + expand: Option<String>, + limit: Option<i64>, + before: Option<chrono::DateTime<chrono::Utc>>, + since: Option<chrono::DateTime<chrono::Utc>>, + context: &C, + ) -> Result<GetEditgroupsReviewableResponse, ApiError> { + let context = context.clone(); + info!( + "get_editgroups_reviewable({:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", + expand, + limit, + before, + since, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_editor( + &self, + editor_id: String, + context: &C, + ) -> Result<GetEditorResponse, ApiError> { + let context = context.clone(); + info!( + "get_editor(\"{}\") - X-Span-ID: {:?}", + editor_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_editor_annotations( + &self, + editor_id: String, + limit: Option<i64>, + before: Option<chrono::DateTime<chrono::Utc>>, + since: Option<chrono::DateTime<chrono::Utc>>, + context: &C, + ) -> Result<GetEditorAnnotationsResponse, ApiError> { + let context = context.clone(); + info!( + "get_editor_annotations(\"{}\", {:?}, {:?}, {:?}) - X-Span-ID: {:?}", + editor_id, + limit, + before, + since, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_editor_editgroups( + &self, + editor_id: String, + limit: Option<i64>, + before: Option<chrono::DateTime<chrono::Utc>>, + since: Option<chrono::DateTime<chrono::Utc>>, + context: &C, + ) -> Result<GetEditorEditgroupsResponse, ApiError> { + let context = context.clone(); + info!( + "get_editor_editgroups(\"{}\", {:?}, {:?}, {:?}) - X-Span-ID: {:?}", + editor_id, + limit, + before, + since, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_file( + &self, + ident: String, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<GetFileResponse, ApiError> { + let context = context.clone(); + info!( + "get_file(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + ident, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_file_edit( + &self, + edit_id: String, + context: &C, + ) -> Result<GetFileEditResponse, ApiError> { + let context = context.clone(); + info!( + "get_file_edit(\"{}\") - X-Span-ID: {:?}", + edit_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_file_history( + &self, + ident: String, + limit: Option<i64>, + context: &C, + ) -> Result<GetFileHistoryResponse, ApiError> { + let context = context.clone(); + info!( + "get_file_history(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + limit, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_file_redirects( + &self, + ident: String, + context: &C, + ) -> Result<GetFileRedirectsResponse, ApiError> { + let context = context.clone(); + info!( + "get_file_redirects(\"{}\") - X-Span-ID: {:?}", + ident, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_file_revision( + &self, + rev_id: String, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<GetFileRevisionResponse, ApiError> { + let context = context.clone(); + info!( + "get_file_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + rev_id, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_fileset( + &self, + ident: String, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<GetFilesetResponse, ApiError> { + let context = context.clone(); + info!( + "get_fileset(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + ident, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_fileset_edit( + &self, + edit_id: String, + context: &C, + ) -> Result<GetFilesetEditResponse, ApiError> { + let context = context.clone(); + info!( + "get_fileset_edit(\"{}\") - X-Span-ID: {:?}", + edit_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_fileset_history( + &self, + ident: String, + limit: Option<i64>, + context: &C, + ) -> Result<GetFilesetHistoryResponse, ApiError> { + let context = context.clone(); + info!( + "get_fileset_history(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + limit, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_fileset_redirects( + &self, + ident: String, + context: &C, + ) -> Result<GetFilesetRedirectsResponse, ApiError> { + let context = context.clone(); + info!( + "get_fileset_redirects(\"{}\") - X-Span-ID: {:?}", + ident, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_fileset_revision( + &self, + rev_id: String, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<GetFilesetRevisionResponse, ApiError> { + let context = context.clone(); + info!( + "get_fileset_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + rev_id, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_release( + &self, + ident: String, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<GetReleaseResponse, ApiError> { + let context = context.clone(); + info!( + "get_release(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + ident, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_release_edit( + &self, + edit_id: String, + context: &C, + ) -> Result<GetReleaseEditResponse, ApiError> { + let context = context.clone(); + info!( + "get_release_edit(\"{}\") - X-Span-ID: {:?}", + edit_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_release_files( + &self, + ident: String, + hide: Option<String>, + context: &C, + ) -> Result<GetReleaseFilesResponse, ApiError> { + let context = context.clone(); + info!( + "get_release_files(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_release_filesets( + &self, + ident: String, + hide: Option<String>, + context: &C, + ) -> Result<GetReleaseFilesetsResponse, ApiError> { + let context = context.clone(); + info!( + "get_release_filesets(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_release_history( + &self, + ident: String, + limit: Option<i64>, + context: &C, + ) -> Result<GetReleaseHistoryResponse, ApiError> { + let context = context.clone(); + info!( + "get_release_history(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + limit, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_release_redirects( + &self, + ident: String, + context: &C, + ) -> Result<GetReleaseRedirectsResponse, ApiError> { + let context = context.clone(); + info!( + "get_release_redirects(\"{}\") - X-Span-ID: {:?}", + ident, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_release_revision( + &self, + rev_id: String, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<GetReleaseRevisionResponse, ApiError> { + let context = context.clone(); + info!( + "get_release_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + rev_id, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_release_webcaptures( + &self, + ident: String, + hide: Option<String>, + context: &C, + ) -> Result<GetReleaseWebcapturesResponse, ApiError> { + let context = context.clone(); + info!( + "get_release_webcaptures(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_webcapture( + &self, + ident: String, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<GetWebcaptureResponse, ApiError> { + let context = context.clone(); + info!( + "get_webcapture(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + ident, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_webcapture_edit( + &self, + edit_id: String, + context: &C, + ) -> Result<GetWebcaptureEditResponse, ApiError> { + let context = context.clone(); + info!( + "get_webcapture_edit(\"{}\") - X-Span-ID: {:?}", + edit_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_webcapture_history( + &self, + ident: String, + limit: Option<i64>, + context: &C, + ) -> Result<GetWebcaptureHistoryResponse, ApiError> { + let context = context.clone(); + info!( + "get_webcapture_history(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + limit, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_webcapture_redirects( + &self, + ident: String, + context: &C, + ) -> Result<GetWebcaptureRedirectsResponse, ApiError> { + let context = context.clone(); + info!( + "get_webcapture_redirects(\"{}\") - X-Span-ID: {:?}", + ident, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_webcapture_revision( + &self, + rev_id: String, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<GetWebcaptureRevisionResponse, ApiError> { + let context = context.clone(); + info!( + "get_webcapture_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + rev_id, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_work( + &self, + ident: String, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<GetWorkResponse, ApiError> { + let context = context.clone(); + info!( + "get_work(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + ident, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_work_edit( + &self, + edit_id: String, + context: &C, + ) -> Result<GetWorkEditResponse, ApiError> { + let context = context.clone(); + info!( + "get_work_edit(\"{}\") - X-Span-ID: {:?}", + edit_id, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_work_history( + &self, + ident: String, + limit: Option<i64>, + context: &C, + ) -> Result<GetWorkHistoryResponse, ApiError> { + let context = context.clone(); + info!( + "get_work_history(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + limit, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_work_redirects( + &self, + ident: String, + context: &C, + ) -> Result<GetWorkRedirectsResponse, ApiError> { + let context = context.clone(); + info!( + "get_work_redirects(\"{}\") - X-Span-ID: {:?}", + ident, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_work_releases( + &self, + ident: String, + hide: Option<String>, + context: &C, + ) -> Result<GetWorkReleasesResponse, ApiError> { + let context = context.clone(); + info!( + "get_work_releases(\"{}\", {:?}) - X-Span-ID: {:?}", + ident, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn get_work_revision( + &self, + rev_id: String, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<GetWorkRevisionResponse, ApiError> { + let context = context.clone(); + info!( + "get_work_revision(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + rev_id, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn lookup_container( + &self, + issnl: Option<String>, + wikidata_qid: Option<String>, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<LookupContainerResponse, ApiError> { + let context = context.clone(); + info!( + "lookup_container({:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", + issnl, + wikidata_qid, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn lookup_creator( + &self, + orcid: Option<String>, + wikidata_qid: Option<String>, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<LookupCreatorResponse, ApiError> { + let context = context.clone(); + info!( + "lookup_creator({:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", + orcid, + wikidata_qid, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn lookup_file( + &self, + md5: Option<String>, + sha1: Option<String>, + sha256: Option<String>, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<LookupFileResponse, ApiError> { + let context = context.clone(); + info!( + "lookup_file({:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", + md5, + sha1, + sha256, + expand, + hide, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn lookup_release( + &self, + doi: Option<String>, + wikidata_qid: Option<String>, + isbn13: Option<String>, + pmid: Option<String>, + pmcid: Option<String>, + core: Option<String>, + arxiv: Option<String>, + jstor: Option<String>, + ark: Option<String>, + mag: Option<String>, + doaj: Option<String>, + dblp: Option<String>, + oai: Option<String>, + expand: Option<String>, + hide: Option<String>, + context: &C, + ) -> Result<LookupReleaseResponse, ApiError> { + let context = context.clone(); + info!("lookup_release({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", doi, wikidata_qid, isbn13, pmid, pmcid, core, arxiv, jstor, ark, mag, doaj, dblp, oai, expand, hide, context.get().0.clone()); + Err("Generic failuare".into()) + } + + async fn update_container( + &self, + editgroup_id: String, + ident: String, + container_entity: models::ContainerEntity, + context: &C, + ) -> Result<UpdateContainerResponse, ApiError> { + let context = context.clone(); + info!( + "update_container(\"{}\", \"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + ident, + container_entity, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn update_creator( + &self, + editgroup_id: String, + ident: String, + creator_entity: models::CreatorEntity, + context: &C, + ) -> Result<UpdateCreatorResponse, ApiError> { + let context = context.clone(); + info!( + "update_creator(\"{}\", \"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + ident, + creator_entity, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn update_editgroup( + &self, + editgroup_id: String, + editgroup: models::Editgroup, + submit: Option<bool>, + context: &C, + ) -> Result<UpdateEditgroupResponse, ApiError> { + let context = context.clone(); + info!( + "update_editgroup(\"{}\", {:?}, {:?}) - X-Span-ID: {:?}", + editgroup_id, + editgroup, + submit, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn update_editor( + &self, + editor_id: String, + editor: models::Editor, + context: &C, + ) -> Result<UpdateEditorResponse, ApiError> { + let context = context.clone(); + info!( + "update_editor(\"{}\", {:?}) - X-Span-ID: {:?}", + editor_id, + editor, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn update_file( + &self, + editgroup_id: String, + ident: String, + file_entity: models::FileEntity, + context: &C, + ) -> Result<UpdateFileResponse, ApiError> { + let context = context.clone(); + info!( + "update_file(\"{}\", \"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + ident, + file_entity, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn update_fileset( + &self, + editgroup_id: String, + ident: String, + fileset_entity: models::FilesetEntity, + context: &C, + ) -> Result<UpdateFilesetResponse, ApiError> { + let context = context.clone(); + info!( + "update_fileset(\"{}\", \"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + ident, + fileset_entity, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn update_release( + &self, + editgroup_id: String, + ident: String, + release_entity: models::ReleaseEntity, + context: &C, + ) -> Result<UpdateReleaseResponse, ApiError> { + let context = context.clone(); + info!( + "update_release(\"{}\", \"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + ident, + release_entity, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn update_webcapture( + &self, + editgroup_id: String, + ident: String, + webcapture_entity: models::WebcaptureEntity, + context: &C, + ) -> Result<UpdateWebcaptureResponse, ApiError> { + let context = context.clone(); + info!( + "update_webcapture(\"{}\", \"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + ident, + webcapture_entity, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } + + async fn update_work( + &self, + editgroup_id: String, + ident: String, + work_entity: models::WorkEntity, + context: &C, + ) -> Result<UpdateWorkResponse, ApiError> { + let context = context.clone(); + info!( + "update_work(\"{}\", \"{}\", {:?}) - X-Span-ID: {:?}", + editgroup_id, + ident, + work_entity, + context.get().0.clone() + ); + Err("Generic failuare".into()) + } +} |