12个稳定版本 (4个主要版本)
5.0.5+20240605 | 2024年6月27日 |
---|---|
5.0.4+20240228 | 2024年3月5日 |
5.0.3+20221220 | 2023年8月23日 |
5.0.2+20221220 | 2023年3月16日 |
1.0.14+20200612 | 2020年7月10日 |
#2274 in Web编程
2.5MB
26K SLoC
该 google-healthcare1
库允许访问Google Cloud Healthcare服务的所有功能。
本文档是从Cloud Healthcare crate版本5.0.5+20240605生成的,其中20240605是mako代码生成器v5.0.5构建的healthcare:v1模式的精确版本。
有关Cloud Healthcare v1 API的其他所有信息,请参阅官方文档网站。
功能
从中心 枢纽 轻松处理以下 资源...
- 项目
- locations datasets consent stores attribute definitions create, locations datasets consent stores attribute definitions delete, locations datasets consent stores attribute definitions get, locations datasets consent stores attribute definitions list, locations datasets consent stores attribute definitions patch, locations datasets consent stores check data access, locations datasets consent stores consent artifacts create, locations datasets consent stores consent artifacts delete, locations datasets consent stores consent artifacts get, locations datasets consent stores consent artifacts list, locations datasets consent stores consents activate, locations datasets consent stores consents create, locations datasets consent stores consents delete, locations datasets consent stores consents delete revision, locations datasets consent stores consents get, locations datasets consent stores consents list, locations datasets consent stores consents list revisions, locations datasets consent stores consents patch, locations datasets consent stores consents reject, locations datasets consent stores consents revoke, locations datasets consent stores create, locations datasets consent stores delete, locations datasets consent stores evaluate user consents, locations datasets consent stores get, locations datasets consent stores get iam policy, locations datasets consent stores list, locations datasets consent stores patch, locations datasets consent stores query accessible data, locations datasets consent stores set iam policy, locations datasets consent stores test iam permissions, locations datasets consent stores user data mappings archive, locations datasets consent stores user data mappings create, locations datasets consent stores user data mappings delete, locations datasets consent stores user data mappings get, locations datasets consent stores user data mappings list, locations datasets consent stores user data mappings patch, locations datasets create, locations datasets data mapper workspaces get iam policy, locations datasets data mapper workspaces set iam policy, locations datasets data mapper workspaces test iam permissions, locations datasets deidentify, locations datasets delete, locations datasets dicom stores create, locations datasets dicom stores deidentify, locations datasets dicom stores delete, locations datasets dicom stores dicom web studies get study metrics, locations datasets dicom stores dicom web studies series get series metrics, locations datasets dicom stores export, locations datasets dicom stores get, locations datasets dicom stores get dicom store metrics, locations datasets dicom stores get iam policy, locations datasets dicom stores import, locations datasets dicom stores list, locations datasets dicom stores patch, locations datasets dicom stores search for instances, locations datasets dicom stores search for series, locations datasets dicom stores search for studies, locations datasets dicom stores set iam policy, locations datasets dicom stores store instances, locations datasets dicom stores studies delete, locations datasets dicom stores studies retrieve metadata, locations datasets dicom stores studies retrieve study, locations datasets dicom stores studies search for instances, locations datasets dicom stores studies search for series, locations datasets dicom stores studies series delete, locations datasets dicom stores studies series instances delete, locations datasets dicom stores studies series instances frames retrieve frames, locations datasets dicom stores studies series instances frames retrieve rendered, locations datasets dicom stores studies series instances retrieve instance, locations datasets dicom stores studies series instances retrieve metadata, locations datasets dicom stores studies series instances retrieve rendered, locations datasets dicom stores studies series retrieve metadata, locations datasets dicom stores studies series retrieve series, locations datasets dicom stores studies series search for instances, locations datasets dicom stores studies store instances, locations datasets dicom stores test iam permissions, locations datasets fhir stores create, locations datasets fhir stores deidentify, locations datasets fhir stores delete, locations datasets fhir stores export, locations datasets fhir stores fhir patient-everything, locations datasets fhir stores fhir resource-purge, locations datasets fhir stores fhir resource-validate, locations datasets fhir stores fhir capabilities, locations datasets fhir stores fhir conditional delete, locations datasets fhir stores fhir conditional patch, locations datasets fhir stores fhir conditional update, locations datasets fhir stores fhir create, locations datasets fhir stores fhir delete, locations datasets fhir stores fhir execute bundle, locations datasets fhir stores fhir history, locations datasets fhir stores fhir patch, locations datasets fhir stores fhir read, locations datasets fhir stores fhir search, locations datasets fhir stores fhir search-type, locations datasets fhir stores fhir update, locations datasets fhir stores fhir vread, locations datasets fhir stores get, locations datasets fhir stores get fhir store metrics, locations datasets fhir stores get iam policy, locations datasets fhir stores import, locations datasets fhir stores list, locations datasets fhir stores patch, locations datasets fhir stores rollback, locations datasets fhir stores set iam policy, locations datasets fhir stores test iam permissions, locations datasets get, locations datasets get iam policy, locations datasets hl7 v2 stores create, locations datasets hl7 v2 stores delete, locations datasets hl7 v2 stores export, locations datasets hl7 v2 stores get, locations datasets hl7 v2 stores get hl7v2 store metrics, locations datasets hl7 v2 stores get iam policy, locations datasets hl7 v2 stores import, locations datasets hl7 v2 stores list, locations datasets hl7 v2 stores messages create, locations datasets hl7 v2 stores messages delete, locations datasets hl7 v2 stores messages get, locations datasets hl7 v2 stores messages ingest, locations datasets hl7 v2 stores messages list, locations datasets hl7 v2 stores messages patch, locations datasets hl7 v2 stores patch, locations datasets hl7 v2 stores set iam policy, locations datasets hl7 v2 stores test iam permissions, locations datasets list, locations datasets operations cancel, locations datasets operations get, locations datasets operations list, locations datasets patch, locations datasets set iam policy, locations datasets test iam permissions, locations get, locations list and locations services nlp analyze entities
本库的结构
API结构如下
所有 结构 都带有适用的特性,以便进一步分类并简化浏览。
一般来说,您可以像这样调用 活动
let r = hub.resource().activity(...).doit().await
或具体...
let r = hub.projects().locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_frames(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_rendered(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_instance(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_metadata(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_rendered(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_studies_series_retrieve_metadata(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_studies_series_retrieve_series(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_studies_series_search_for_instances(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_studies_retrieve_metadata(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_studies_retrieve_study(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_studies_search_for_instances(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_studies_search_for_series(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_studies_store_instances(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_search_for_instances(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_search_for_series(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_search_for_studies(...).doit().await
let r = hub.projects().locations_datasets_dicom_stores_store_instances(...).doit().await
let r = hub.projects().locations_datasets_fhir_stores_fhir__patient_everything(...).doit().await
let r = hub.projects().locations_datasets_fhir_stores_fhir__resource_validate(...).doit().await
let r = hub.projects().locations_datasets_fhir_stores_fhir_capabilities(...).doit().await
let r = hub.projects().locations_datasets_fhir_stores_fhir_conditional_patch(...).doit().await
let r = hub.projects().locations_datasets_fhir_stores_fhir_conditional_update(...).doit().await
let r = hub.projects().locations_datasets_fhir_stores_fhir_create(...).doit().await
let r = hub.projects().locations_datasets_fhir_stores_fhir_delete(...).doit().await
let r = hub.projects().locations_datasets_fhir_stores_fhir_execute_bundle(...).doit().await
let r = hub.projects().locations_datasets_fhir_stores_fhir_history(...).doit().await
let r = hub.projects().locations_datasets_fhir_stores_fhir_patch(...).doit().await
let r = hub.projects().locations_datasets_fhir_stores_fhir_read(...).doit().await
let r = hub.projects().locations_datasets_fhir_stores_fhir_search(...).doit().await
let r = hub.projects().locations_datasets_fhir_stores_fhir_search_type(...).doit().await
let r = hub.projects().locations_datasets_fhir_stores_fhir_update(...).doit().await
let r = hub.projects().locations_datasets_fhir_stores_fhir_vread(...).doit().await
resource()
和 activity(...)
调用创建 构建器。第二个处理 Activities
,支持各种配置即将进行的操作的方法(此处未显示)。它被设计成必须立即指定所有必需的参数(即 (...)
),而所有可选的参数可以按照所需的任何方式构建。 doit()
方法执行与服务器实际通信并返回相应的结果。
使用方法
设置您的项目
要使用这个库,您需要将以下几行代码添加到您的 Cargo.toml
文件中
[dependencies]
google-healthcare1 = "*"
serde = "^1.0"
serde_json = "^1.0"
一个完整的示例
extern crate hyper;
extern crate hyper_rustls;
extern crate google_healthcare1 as healthcare1;
use healthcare1::{Result, Error};
use std::default::Default;
use healthcare1::{CloudHealthcare, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
// what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = CloudHealthcare::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().https_or_http().enable_http1().build()), auth);
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.projects().locations_datasets_fhir_stores_fhir__patient_everything("name")
.start("magna")
.end("no")
._type("ipsum")
._since("voluptua.")
._page_token("At")
._count(-8)
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
错误处理
系统产生的所有错误都作为 Result 枚举返回,这些枚举作为 doit() 方法的返回值,或者作为可能的中途结果传递给 Hub Delegate 或 Authenticator Delegate。
当代理处理错误或中间值时,它们可能会有机会指示系统重试。这使得系统对各种错误具有潜在的鲁棒性。
上传和下载
如果某个方法支持下载,您应该读取响应体以获取媒体,响应体是 Result 的一部分。如果这样的方法也支持 Response Result,则默认返回该结果。您可以将它视为实际媒体的元数据。要触发媒体下载,您必须通过以下调用设置构建器:.param("alt", "media")
。
支持上传的方法可以使用多达 2 种不同的协议进行上传:简单 和 可重试。每种协议的独特性通过定制的 doit(...)
方法表示,这些方法分别命名为 upload(...)
和 upload_resumable(...)
。
定制和回调
您可以通过在最终调用 doit() 之前向 Method Builder 提供一个 delegate 来改变 doit() 方法被调用的方式。相应的方会调用提供进度信息,以及确定系统在失败时是否应该重试。
delegate trait 默认实现,允许您以最小的努力对其进行定制。
服务器请求中的可选部分
该库提供的所有结构都是通过 json 编码和解码的,以便 encodable 和 decodable。可选用于表示部分请求或响应是有效的。大多数可选都是 Parts,这些部分可以通过名称识别,将被发送到服务器以指示请求中设置的部件或响应中期望的部件。
构建器参数
通过使用 method builders,您可以通过重复调用其方法来准备一个操作调用。这些方法始终接受单个参数,以下语句是正确的。
- PODs 通过复制传递
- 字符串作为
&str
传递 - request values 被移动
参数将始终被复制或克隆到构建器中,以确保它们与其原始生命周期独立。
Cargo 功能
utoipa
- 添加对 utoipa 的支持,并在所有类型上派生utoipa::ToSchema
。您必须在#[openapi(schemas(...))]
中导入和注册所需的类型,否则生成的openapi
规范将是无效的。
许可证
healthcare1 库是由 Sebastian Thiel 生成的,并置于 MIT 许可证之下。您可以在存储库的 许可证文件 中阅读全文。
依赖关系
~12–23MB
~347K SLoC