diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-09-11 13:59:32 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-09-11 13:59:32 -0700 |
commit | cd8e09fcb6ee0a1b23c0bd57d0f097f99fd6d828 (patch) | |
tree | fbd5c91c576a2fce2c44cfe36e5754b69aedc046 /rust/fatcat-api/examples | |
parent | 0dc872921023030f6ffd320eb038e5379b47fa53 (diff) | |
download | fatcat-cd8e09fcb6ee0a1b23c0bd57d0f097f99fd6d828.tar.gz fatcat-cd8e09fcb6ee0a1b23c0bd57d0f097f99fd6d828.zip |
refactor fatcat-api => fatcat-api-spec
Diffstat (limited to 'rust/fatcat-api/examples')
-rw-r--r-- | rust/fatcat-api/examples/ca.pem | 17 | ||||
-rw-r--r-- | rust/fatcat-api/examples/client.rs | 325 | ||||
-rw-r--r-- | rust/fatcat-api/examples/server-chain.pem | 66 | ||||
-rw-r--r-- | rust/fatcat-api/examples/server-key.pem | 28 | ||||
-rw-r--r-- | rust/fatcat-api/examples/server.rs | 64 | ||||
-rw-r--r-- | rust/fatcat-api/examples/server_lib/mod.rs | 14 | ||||
-rw-r--r-- | rust/fatcat-api/examples/server_lib/server.rs | 420 |
7 files changed, 0 insertions, 934 deletions
diff --git a/rust/fatcat-api/examples/ca.pem b/rust/fatcat-api/examples/ca.pem deleted file mode 100644 index d2317fb5..00000000 --- a/rust/fatcat-api/examples/ca.pem +++ /dev/null @@ -1,17 +0,0 @@ ------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/rust/fatcat-api/examples/client.rs b/rust/fatcat-api/examples/client.rs deleted file mode 100644 index cc94af11..00000000 --- a/rust/fatcat-api/examples/client.rs +++ /dev/null @@ -1,325 +0,0 @@ -#![allow(missing_docs, unused_variables, trivial_casts)] - -extern crate clap; -extern crate fatcat; -#[allow(unused_extern_crates)] -extern crate futures; -#[allow(unused_extern_crates)] -extern crate swagger; -#[allow(unused_extern_crates)] -extern crate uuid; - -use clap::{App, Arg}; -#[allow(unused_imports)] -use fatcat::{ - AcceptEditgroupResponse, ApiError, ApiNoContext, ContextWrapperExt, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, - CreateEditgroupResponse, CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerResponse, - DeleteCreatorResponse, DeleteFileResponse, DeleteReleaseResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerHistoryResponse, GetContainerResponse, - GetCreatorHistoryResponse, GetCreatorReleasesResponse, GetCreatorResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileHistoryResponse, GetFileResponse, - GetReleaseFilesResponse, GetReleaseHistoryResponse, GetReleaseResponse, GetStatsResponse, GetWorkHistoryResponse, GetWorkReleasesResponse, GetWorkResponse, LookupContainerResponse, - LookupCreatorResponse, LookupFileResponse, LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse, -}; -#[allow(unused_imports)] -use futures::{future, stream, Future, Stream}; - -fn main() { - let matches = App::new("client") - .arg( - Arg::with_name("operation") - .help("Sets the operation to run") - .possible_values(&[ - "AcceptEditgroup", - "CreateContainerBatch", - "CreateCreatorBatch", - "CreateFileBatch", - "CreateReleaseBatch", - "CreateWorkBatch", - "DeleteContainer", - "DeleteCreator", - "DeleteFile", - "DeleteRelease", - "DeleteWork", - "GetChangelog", - "GetChangelogEntry", - "GetContainer", - "GetContainerHistory", - "GetCreator", - "GetCreatorHistory", - "GetCreatorReleases", - "GetEditgroup", - "GetEditor", - "GetEditorChangelog", - "GetFile", - "GetFileHistory", - "GetRelease", - "GetReleaseFiles", - "GetReleaseHistory", - "GetStats", - "GetWork", - "GetWorkHistory", - "GetWorkReleases", - "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("localhost").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 client = if is_https { - // Using Simple HTTPS - fatcat::Client::try_new_https(&base_url, "examples/ca.pem").expect("Failed to create HTTPS client") - } else { - // Using HTTP - fatcat::Client::try_new_http(&base_url).expect("Failed to create HTTP client") - }; - - // Using a non-default `Context` is not required; this is just an example! - let client = client.with_context(fatcat::Context::new_with_span_id(self::uuid::Uuid::new_v4().to_string())); - - match matches.value_of("operation") { - Some("AcceptEditgroup") => { - let result = client.accept_editgroup("id_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("CreateContainer") => { - // let result = client.create_container(???).wait(); - // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - // }, - Some("CreateContainerBatch") => { - let result = client.create_container_batch(&Vec::new(), Some(true), Some("editgroup_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("CreateCreator") => { - // let result = client.create_creator(???).wait(); - // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - // }, - Some("CreateCreatorBatch") => { - let result = client.create_creator_batch(&Vec::new(), Some(true), Some("editgroup_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("CreateEditgroup") => { - // let result = client.create_editgroup(???).wait(); - // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - // }, - - // Disabled because there's no example. - // Some("CreateFile") => { - // let result = client.create_file(???).wait(); - // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - // }, - Some("CreateFileBatch") => { - let result = client.create_file_batch(&Vec::new(), Some(true), Some("editgroup_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("CreateRelease") => { - // let result = client.create_release(???).wait(); - // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - // }, - Some("CreateReleaseBatch") => { - let result = client.create_release_batch(&Vec::new(), Some(true), Some("editgroup_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("CreateWork") => { - // let result = client.create_work(???).wait(); - // println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - // }, - Some("CreateWorkBatch") => { - let result = client.create_work_batch(&Vec::new(), Some(true), Some("editgroup_example".to_string())).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("DeleteContainer") => { - let result = client.delete_container("id_example".to_string(), Some("editgroup_example".to_string())).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("DeleteCreator") => { - let result = client.delete_creator("id_example".to_string(), Some("editgroup_example".to_string())).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("DeleteFile") => { - let result = client.delete_file("id_example".to_string(), Some("editgroup_example".to_string())).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("DeleteRelease") => { - let result = client.delete_release("id_example".to_string(), Some("editgroup_example".to_string())).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("DeleteWork") => { - let result = client.delete_work("id_example".to_string(), Some("editgroup_example".to_string())).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetChangelog") => { - let result = client.get_changelog(Some(789)).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetChangelogEntry") => { - let result = client.get_changelog_entry(789).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetContainer") => { - let result = client.get_container("id_example".to_string(), Some("expand_example".to_string())).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetContainerHistory") => { - let result = client.get_container_history("id_example".to_string(), Some(789)).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetCreator") => { - let result = client.get_creator("id_example".to_string(), Some("expand_example".to_string())).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetCreatorHistory") => { - let result = client.get_creator_history("id_example".to_string(), Some(789)).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetCreatorReleases") => { - let result = client.get_creator_releases("id_example".to_string()).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetEditgroup") => { - let result = client.get_editgroup("id_example".to_string()).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetEditor") => { - let result = client.get_editor("id_example".to_string()).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetEditorChangelog") => { - let result = client.get_editor_changelog("id_example".to_string()).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetFile") => { - let result = client.get_file("id_example".to_string(), Some("expand_example".to_string())).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetFileHistory") => { - let result = client.get_file_history("id_example".to_string(), Some(789)).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetRelease") => { - let result = client.get_release("id_example".to_string(), Some("expand_example".to_string())).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetReleaseFiles") => { - let result = client.get_release_files("id_example".to_string()).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetReleaseHistory") => { - let result = client.get_release_history("id_example".to_string(), Some(789)).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetStats") => { - let result = client.get_stats(Some("more_example".to_string())).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetWork") => { - let result = client.get_work("id_example".to_string(), Some("expand_example".to_string())).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetWorkHistory") => { - let result = client.get_work_history("id_example".to_string(), Some(789)).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("GetWorkReleases") => { - let result = client.get_work_releases("id_example".to_string()).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("LookupContainer") => { - let result = client.lookup_container("issnl_example".to_string()).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("LookupCreator") => { - let result = client.lookup_creator("orcid_example".to_string()).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("LookupFile") => { - let result = client.lookup_file("sha1_example".to_string()).wait(); - println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>"))); - } - - Some("LookupRelease") => { - let result = client.lookup_release("doi_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("UpdateContainer") => { - // let result = client.update_container("id_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("UpdateCreator") => { - // let result = client.update_creator("id_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("UpdateFile") => { - // let result = client.update_file("id_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("UpdateRelease") => { - // let result = client.update_release("id_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("UpdateWork") => { - // let result = client.update_work("id_example".to_string(), ???).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-chain.pem b/rust/fatcat-api/examples/server-chain.pem deleted file mode 100644 index 47d7e201..00000000 --- a/rust/fatcat-api/examples/server-chain.pem +++ /dev/null @@ -1,66 +0,0 @@ -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/rust/fatcat-api/examples/server-key.pem b/rust/fatcat-api/examples/server-key.pem deleted file mode 100644 index 29c00682..00000000 --- a/rust/fatcat-api/examples/server-key.pem +++ /dev/null @@ -1,28 +0,0 @@ ------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/rust/fatcat-api/examples/server.rs b/rust/fatcat-api/examples/server.rs deleted file mode 100644 index 8d2e9b64..00000000 --- a/rust/fatcat-api/examples/server.rs +++ /dev/null @@ -1,64 +0,0 @@ -//! Main binary entry point for fatcat implementation. - -#![allow(missing_docs)] - -// Imports required by this file. -// extern crate <name of this crate>; -extern crate clap; -extern crate fatcat; -extern crate hyper_openssl; -extern crate iron; -extern crate swagger; - -// Imports required by server library. -// extern crate fatcat; -// extern crate swagger; -extern crate chrono; -extern crate futures; -#[macro_use] -extern crate error_chain; - -use clap::{App, Arg}; -use hyper_openssl::openssl::error::ErrorStack; -use hyper_openssl::openssl::ssl::{SslAcceptorBuilder, SslMethod}; -use hyper_openssl::openssl::x509::X509_FILETYPE_PEM; -use hyper_openssl::OpensslServer; -use iron::{Chain, Iron}; -use swagger::auth::AllowAllMiddleware; - -mod server_lib; - -/// Builds an SSL implementation for Simple HTTPS from some hard-coded file names -fn ssl() -> Result<OpensslServer, ErrorStack> { - let mut ssl = SslAcceptorBuilder::mozilla_intermediate_raw(SslMethod::tls())?; - - // Server authentication - ssl.set_private_key_file("examples/server-key.pem", X509_FILETYPE_PEM)?; - ssl.set_certificate_chain_file("examples/server-chain.pem")?; - ssl.check_private_key()?; - - Ok(OpensslServer::from(ssl.build())) -} - -/// Create custom server, wire it to the autogenerated router, -/// and pass it to the web server. -fn main() { - let matches = App::new("server").arg(Arg::with_name("https").long("https").help("Whether to use HTTPS or not")).get_matches(); - - let server = server_lib::server().unwrap(); - let router = fatcat::router(server); - - let mut chain = Chain::new(router); - chain.link_before(fatcat::server::ExtractAuthData); - // add authentication middlewares into the chain here - // for the purpose of this example, pretend we have authenticated a user - chain.link_before(AllowAllMiddleware::new("cosmo")); - - if matches.is_present("https") { - // Using Simple HTTPS - Iron::new(chain).https("localhost:8080", ssl().expect("Failed to load SSL keys")).expect("Failed to start HTTPS server"); - } else { - // Using HTTP - Iron::new(chain).http("localhost:8080").expect("Failed to start HTTP server"); - } -} diff --git a/rust/fatcat-api/examples/server_lib/mod.rs b/rust/fatcat-api/examples/server_lib/mod.rs deleted file mode 100644 index 5291637e..00000000 --- a/rust/fatcat-api/examples/server_lib/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -//! Main library entry point for fatcat implementation. - -mod server; - -mod errors { - error_chain!{} -} - -pub use self::errors::*; - -/// Instantiate a new server. -pub fn server() -> Result<server::Server> { - Ok(server::Server {}) -} diff --git a/rust/fatcat-api/examples/server_lib/server.rs b/rust/fatcat-api/examples/server_lib/server.rs deleted file mode 100644 index ab08f594..00000000 --- a/rust/fatcat-api/examples/server_lib/server.rs +++ /dev/null @@ -1,420 +0,0 @@ -//! Server implementation of fatcat. - -#![allow(unused_imports)] - -use chrono; -use futures::{self, Future}; - -use std::collections::HashMap; - -use swagger; - -use fatcat::models; -use fatcat::{ - AcceptEditgroupResponse, Api, ApiError, Context, CreateContainerBatchResponse, CreateContainerResponse, CreateCreatorBatchResponse, CreateCreatorResponse, CreateEditgroupResponse, - CreateFileBatchResponse, CreateFileResponse, CreateReleaseBatchResponse, CreateReleaseResponse, CreateWorkBatchResponse, CreateWorkResponse, DeleteContainerResponse, DeleteCreatorResponse, - DeleteFileResponse, DeleteReleaseResponse, DeleteWorkResponse, GetChangelogEntryResponse, GetChangelogResponse, GetContainerHistoryResponse, GetContainerResponse, GetCreatorHistoryResponse, - GetCreatorReleasesResponse, GetCreatorResponse, GetEditgroupResponse, GetEditorChangelogResponse, GetEditorResponse, GetFileHistoryResponse, GetFileResponse, GetReleaseFilesResponse, - GetReleaseHistoryResponse, GetReleaseResponse, GetStatsResponse, GetWorkHistoryResponse, GetWorkReleasesResponse, GetWorkResponse, LookupContainerResponse, LookupCreatorResponse, - LookupFileResponse, LookupReleaseResponse, UpdateContainerResponse, UpdateCreatorResponse, UpdateFileResponse, UpdateReleaseResponse, UpdateWorkResponse, -}; - -#[derive(Copy, Clone)] -pub struct Server; - -impl Api for Server { - fn accept_editgroup(&self, id: String, context: &Context) -> Box<Future<Item = AcceptEditgroupResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("accept_editgroup(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_container(&self, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = CreateContainerResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("create_container({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_container_batch( - &self, - entity_list: &Vec<models::ContainerEntity>, - autoaccept: Option<bool>, - editgroup: Option<String>, - context: &Context, - ) -> Box<Future<Item = CreateContainerBatchResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "create_container_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", - entity_list, - autoaccept, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_creator(&self, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = CreateCreatorResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("create_creator({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_creator_batch( - &self, - entity_list: &Vec<models::CreatorEntity>, - autoaccept: Option<bool>, - editgroup: Option<String>, - context: &Context, - ) -> Box<Future<Item = CreateCreatorBatchResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "create_creator_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", - entity_list, - autoaccept, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_editgroup(&self, entity: models::Editgroup, context: &Context) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("create_editgroup({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_file(&self, entity: models::FileEntity, context: &Context) -> Box<Future<Item = CreateFileResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("create_file({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_file_batch( - &self, - entity_list: &Vec<models::FileEntity>, - autoaccept: Option<bool>, - editgroup: Option<String>, - context: &Context, - ) -> Box<Future<Item = CreateFileBatchResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "create_file_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", - entity_list, - autoaccept, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_release(&self, entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = CreateReleaseResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("create_release({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_release_batch( - &self, - entity_list: &Vec<models::ReleaseEntity>, - autoaccept: Option<bool>, - editgroup: Option<String>, - context: &Context, - ) -> Box<Future<Item = CreateReleaseBatchResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "create_release_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", - entity_list, - autoaccept, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_work(&self, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = CreateWorkResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("create_work({:?}) - X-Span-ID: {:?}", entity, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn create_work_batch( - &self, - entity_list: &Vec<models::WorkEntity>, - autoaccept: Option<bool>, - editgroup: Option<String>, - context: &Context, - ) -> Box<Future<Item = CreateWorkBatchResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "create_work_batch({:?}, {:?}, {:?}) - X-Span-ID: {:?}", - entity_list, - autoaccept, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn delete_container(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteContainerResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "delete_container(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn delete_creator(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteCreatorResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "delete_creator(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn delete_file(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteFileResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "delete_file(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn delete_release(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteReleaseResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "delete_release(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn delete_work(&self, id: String, editgroup: Option<String>, context: &Context) -> Box<Future<Item = DeleteWorkResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "delete_work(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - editgroup, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_changelog(&self, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetChangelogResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("get_changelog({:?}) - X-Span-ID: {:?}", limit, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_changelog_entry(&self, id: i64, context: &Context) -> Box<Future<Item = GetChangelogEntryResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("get_changelog_entry({}) - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_container(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetContainerResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("get_container(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_container_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetContainerHistoryResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "get_container_history(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - limit, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_creator(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetCreatorResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("get_creator(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_creator_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetCreatorHistoryResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "get_creator_history(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - limit, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_creator_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetCreatorReleasesResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("get_creator_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_editgroup(&self, id: String, context: &Context) -> Box<Future<Item = GetEditgroupResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("get_editgroup(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_editor(&self, id: String, context: &Context) -> Box<Future<Item = GetEditorResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("get_editor(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_editor_changelog(&self, id: String, context: &Context) -> Box<Future<Item = GetEditorChangelogResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("get_editor_changelog(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_file(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetFileResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("get_file(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_file_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetFileHistoryResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "get_file_history(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - limit, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_release(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetReleaseResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("get_release(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_release_files(&self, id: String, context: &Context) -> Box<Future<Item = GetReleaseFilesResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("get_release_files(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_release_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetReleaseHistoryResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "get_release_history(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - limit, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_stats(&self, more: Option<String>, context: &Context) -> Box<Future<Item = GetStatsResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("get_stats({:?}) - X-Span-ID: {:?}", more, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_work(&self, id: String, expand: Option<String>, context: &Context) -> Box<Future<Item = GetWorkResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("get_work(\"{}\", {:?}) - X-Span-ID: {:?}", id, expand, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_work_history(&self, id: String, limit: Option<i64>, context: &Context) -> Box<Future<Item = GetWorkHistoryResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "get_work_history(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - limit, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn get_work_releases(&self, id: String, context: &Context) -> Box<Future<Item = GetWorkReleasesResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("get_work_releases(\"{}\") - X-Span-ID: {:?}", id, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn lookup_container(&self, issnl: String, context: &Context) -> Box<Future<Item = LookupContainerResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("lookup_container(\"{}\") - X-Span-ID: {:?}", issnl, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn lookup_creator(&self, orcid: String, context: &Context) -> Box<Future<Item = LookupCreatorResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("lookup_creator(\"{}\") - X-Span-ID: {:?}", orcid, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn lookup_file(&self, sha1: String, context: &Context) -> Box<Future<Item = LookupFileResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("lookup_file(\"{}\") - X-Span-ID: {:?}", sha1, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn lookup_release(&self, doi: String, context: &Context) -> Box<Future<Item = LookupReleaseResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("lookup_release(\"{}\") - X-Span-ID: {:?}", doi, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn update_container(&self, id: String, entity: models::ContainerEntity, context: &Context) -> Box<Future<Item = UpdateContainerResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "update_container(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - entity, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn update_creator(&self, id: String, entity: models::CreatorEntity, context: &Context) -> Box<Future<Item = UpdateCreatorResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "update_creator(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - entity, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn update_file(&self, id: String, entity: models::FileEntity, context: &Context) -> Box<Future<Item = UpdateFileResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("update_file(\"{}\", {:?}) - X-Span-ID: {:?}", id, entity, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } - - fn update_release(&self, id: String, entity: models::ReleaseEntity, context: &Context) -> Box<Future<Item = UpdateReleaseResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!( - "update_release(\"{}\", {:?}) - X-Span-ID: {:?}", - id, - entity, - context.x_span_id.unwrap_or(String::from("<none>")).clone() - ); - Box::new(futures::failed("Generic failure".into())) - } - - fn update_work(&self, id: String, entity: models::WorkEntity, context: &Context) -> Box<Future<Item = UpdateWorkResponse, Error = ApiError> + Send> { - let context = context.clone(); - println!("update_work(\"{}\", {:?}) - X-Span-ID: {:?}", id, entity, context.x_span_id.unwrap_or(String::from("<none>")).clone()); - Box::new(futures::failed("Generic failure".into())) - } -} |