google_healthcare1/api.rs
1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16 /// Read, write and manage healthcare data
17 CloudHealthcare,
18
19 /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
20 CloudPlatform,
21}
22
23impl AsRef<str> for Scope {
24 fn as_ref(&self) -> &str {
25 match *self {
26 Scope::CloudHealthcare => "https://www.googleapis.com/auth/cloud-healthcare",
27 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
28 }
29 }
30}
31
32#[allow(clippy::derivable_impls)]
33impl Default for Scope {
34 fn default() -> Scope {
35 Scope::CloudPlatform
36 }
37}
38
39// ########
40// HUB ###
41// ######
42
43/// Central instance to access all CloudHealthcare related resource activities
44///
45/// # Examples
46///
47/// Instantiate a new hub
48///
49/// ```test_harness,no_run
50/// extern crate hyper;
51/// extern crate hyper_rustls;
52/// extern crate google_healthcare1 as healthcare1;
53/// use healthcare1::{Result, Error};
54/// # async fn dox() {
55/// use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
56///
57/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
58/// // `client_secret`, among other things.
59/// let secret: yup_oauth2::ApplicationSecret = Default::default();
60/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
61/// // unless you replace `None` with the desired Flow.
62/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
63/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
64/// // retrieve them from storage.
65/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
66/// secret,
67/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
68/// ).build().await.unwrap();
69///
70/// let client = hyper_util::client::legacy::Client::builder(
71/// hyper_util::rt::TokioExecutor::new()
72/// )
73/// .build(
74/// hyper_rustls::HttpsConnectorBuilder::new()
75/// .with_native_roots()
76/// .unwrap()
77/// .https_or_http()
78/// .enable_http1()
79/// .build()
80/// );
81/// let mut hub = CloudHealthcare::new(client, auth);
82/// // You can configure optional parameters by calling the respective setters at will, and
83/// // execute the final call using `doit()`.
84/// // Values shown here are possibly random and not representative !
85/// let result = hub.projects().locations_datasets_fhir_stores_fhir__patient_everything("name")
86/// .start("gubergren")
87/// .end("eos")
88/// ._type("dolor")
89/// ._since("ea")
90/// ._page_token("ipsum")
91/// ._count(-88)
92/// .doit().await;
93///
94/// match result {
95/// Err(e) => match e {
96/// // The Error enum provides details about what exactly happened.
97/// // You can also just use its `Debug`, `Display` or `Error` traits
98/// Error::HttpError(_)
99/// |Error::Io(_)
100/// |Error::MissingAPIKey
101/// |Error::MissingToken(_)
102/// |Error::Cancelled
103/// |Error::UploadSizeLimitExceeded(_, _)
104/// |Error::Failure(_)
105/// |Error::BadRequest(_)
106/// |Error::FieldClash(_)
107/// |Error::JsonDecodeError(_, _) => println!("{}", e),
108/// },
109/// Ok(res) => println!("Success: {:?}", res),
110/// }
111/// # }
112/// ```
113#[derive(Clone)]
114pub struct CloudHealthcare<C> {
115 pub client: common::Client<C>,
116 pub auth: Box<dyn common::GetToken>,
117 _user_agent: String,
118 _base_url: String,
119 _root_url: String,
120}
121
122impl<C> common::Hub for CloudHealthcare<C> {}
123
124impl<'a, C> CloudHealthcare<C> {
125 pub fn new<A: 'static + common::GetToken>(
126 client: common::Client<C>,
127 auth: A,
128 ) -> CloudHealthcare<C> {
129 CloudHealthcare {
130 client,
131 auth: Box::new(auth),
132 _user_agent: "google-api-rust-client/6.0.0".to_string(),
133 _base_url: "https://healthcare.googleapis.com/".to_string(),
134 _root_url: "https://healthcare.googleapis.com/".to_string(),
135 }
136 }
137
138 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
139 ProjectMethods { hub: self }
140 }
141
142 /// Set the user-agent header field to use in all requests to the server.
143 /// It defaults to `google-api-rust-client/6.0.0`.
144 ///
145 /// Returns the previously set user-agent.
146 pub fn user_agent(&mut self, agent_name: String) -> String {
147 std::mem::replace(&mut self._user_agent, agent_name)
148 }
149
150 /// Set the base url to use in all requests to the server.
151 /// It defaults to `https://healthcare.googleapis.com/`.
152 ///
153 /// Returns the previously set base url.
154 pub fn base_url(&mut self, new_base_url: String) -> String {
155 std::mem::replace(&mut self._base_url, new_base_url)
156 }
157
158 /// Set the root url to use in all requests to the server.
159 /// It defaults to `https://healthcare.googleapis.com/`.
160 ///
161 /// Returns the previously set root url.
162 pub fn root_url(&mut self, new_root_url: String) -> String {
163 std::mem::replace(&mut self._root_url, new_root_url)
164 }
165}
166
167// ############
168// SCHEMAS ###
169// ##########
170/// Activates the latest revision of the specified Consent by committing a new revision with `state` updated to `ACTIVE`. If the latest revision of the given Consent is in the `ACTIVE` state, no new revision is committed. A FAILED_PRECONDITION error occurs if the latest revision of the given consent is in the `REJECTED` or `REVOKED` state.
171///
172/// # Activities
173///
174/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
175/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
176///
177/// * [locations datasets consent stores consents activate projects](ProjectLocationDatasetConsentStoreConsentActivateCall) (request)
178#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
179#[serde_with::serde_as]
180#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
181pub struct ActivateConsentRequest {
182 /// Required. The resource name of the Consent artifact that contains documentation of the user's consent, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consentArtifacts/{consent_artifact_id}`. If the draft Consent had a Consent artifact, this Consent artifact overwrites it.
183 #[serde(rename = "consentArtifact")]
184 pub consent_artifact: Option<String>,
185 /// Timestamp in UTC of when this Consent is considered expired.
186 #[serde(rename = "expireTime")]
187 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
188 /// The time to live for this Consent from when it is marked as active.
189 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
190 pub ttl: Option<chrono::Duration>,
191}
192
193impl common::RequestValue for ActivateConsentRequest {}
194
195/// The request to analyze healthcare entities in a document.
196///
197/// # Activities
198///
199/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
200/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
201///
202/// * [locations services nlp analyze entities projects](ProjectLocationServiceNlpAnalyzeEntityCall) (request)
203#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
204#[serde_with::serde_as]
205#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
206pub struct AnalyzeEntitiesRequest {
207 /// Optional. Alternative output format to be generated based on the results of analysis.
208 #[serde(rename = "alternativeOutputFormat")]
209 pub alternative_output_format: Option<String>,
210 /// document_content is a document to be annotated.
211 #[serde(rename = "documentContent")]
212 pub document_content: Option<String>,
213 /// A list of licensed vocabularies to use in the request, in addition to the default unlicensed vocabularies.
214 #[serde(rename = "licensedVocabularies")]
215 pub licensed_vocabularies: Option<Vec<String>>,
216}
217
218impl common::RequestValue for AnalyzeEntitiesRequest {}
219
220/// Includes recognized entity mentions and relationships between them.
221///
222/// # Activities
223///
224/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
225/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
226///
227/// * [locations services nlp analyze entities projects](ProjectLocationServiceNlpAnalyzeEntityCall) (response)
228#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
229#[serde_with::serde_as]
230#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
231pub struct AnalyzeEntitiesResponse {
232 /// The union of all the candidate entities that the entity_mentions in this response could link to. These are UMLS concepts or normalized mention content.
233 pub entities: Option<Vec<Entity>>,
234 /// The `entity_mentions` field contains all the annotated medical entities that were mentioned in the provided document.
235 #[serde(rename = "entityMentions")]
236 pub entity_mentions: Option<Vec<EntityMention>>,
237 /// The FHIR bundle ([`R4`](http://hl7.org/fhir/R4/bundle.html)) that includes all the entities, the entity mentions, and the relationships in JSON format.
238 #[serde(rename = "fhirBundle")]
239 pub fhir_bundle: Option<String>,
240 /// relationships contains all the binary relationships that were identified between entity mentions within the provided document.
241 pub relationships: Option<Vec<EntityMentionRelationship>>,
242}
243
244impl common::ResponseResult for AnalyzeEntitiesResponse {}
245
246/// Archives the specified User data mapping.
247///
248/// # Activities
249///
250/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
251/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
252///
253/// * [locations datasets consent stores user data mappings archive projects](ProjectLocationDatasetConsentStoreUserDataMappingArchiveCall) (request)
254#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
255#[serde_with::serde_as]
256#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
257pub struct ArchiveUserDataMappingRequest {
258 _never_set: Option<bool>,
259}
260
261impl common::RequestValue for ArchiveUserDataMappingRequest {}
262
263/// Archives the specified User data mapping.
264///
265/// # Activities
266///
267/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
268/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
269///
270/// * [locations datasets consent stores user data mappings archive projects](ProjectLocationDatasetConsentStoreUserDataMappingArchiveCall) (response)
271#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
272#[serde_with::serde_as]
273#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
274pub struct ArchiveUserDataMappingResponse {
275 _never_set: Option<bool>,
276}
277
278impl common::ResponseResult for ArchiveUserDataMappingResponse {}
279
280/// An attribute value for a Consent or User data mapping. Each Attribute must have a corresponding AttributeDefinition in the consent store that defines the default and allowed values.
281///
282/// This type is not used in any activity, and only used as *part* of another schema.
283///
284#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
285#[serde_with::serde_as]
286#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
287pub struct Attribute {
288 /// Indicates the name of an attribute defined in the consent store.
289 #[serde(rename = "attributeDefinitionId")]
290 pub attribute_definition_id: Option<String>,
291 /// Required. The value of the attribute. Must be an acceptable value as defined in the consent store. For example, if the consent store defines "data type" with acceptable values "questionnaire" and "step-count", when the attribute name is data type, this field must contain one of those values.
292 pub values: Option<Vec<String>>,
293}
294
295impl common::Part for Attribute {}
296
297/// A client-defined consent attribute.
298///
299/// # Activities
300///
301/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
302/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
303///
304/// * [locations datasets consent stores attribute definitions create projects](ProjectLocationDatasetConsentStoreAttributeDefinitionCreateCall) (request|response)
305/// * [locations datasets consent stores attribute definitions get projects](ProjectLocationDatasetConsentStoreAttributeDefinitionGetCall) (response)
306/// * [locations datasets consent stores attribute definitions patch projects](ProjectLocationDatasetConsentStoreAttributeDefinitionPatchCall) (request|response)
307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
308#[serde_with::serde_as]
309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
310pub struct AttributeDefinition {
311 /// Required. Possible values for the attribute. The number of allowed values must not exceed 500. An empty list is invalid. The list can only be expanded after creation.
312 #[serde(rename = "allowedValues")]
313 pub allowed_values: Option<Vec<String>>,
314 /// Required. The category of the attribute. The value of this field cannot be changed after creation.
315 pub category: Option<String>,
316 /// Optional. Default values of the attribute in Consents. If no default values are specified, it defaults to an empty value.
317 #[serde(rename = "consentDefaultValues")]
318 pub consent_default_values: Option<Vec<String>>,
319 /// Optional. Default value of the attribute in User data mappings. If no default value is specified, it defaults to an empty value. This field is only applicable to attributes of the category `RESOURCE`.
320 #[serde(rename = "dataMappingDefaultValue")]
321 pub data_mapping_default_value: Option<String>,
322 /// Optional. A description of the attribute.
323 pub description: Option<String>,
324 /// Identifier. Resource name of the Attribute definition, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/attributeDefinitions/{attribute_definition_id}`. Cannot be changed after creation.
325 pub name: Option<String>,
326}
327
328impl common::RequestValue for AttributeDefinition {}
329impl common::ResponseResult for AttributeDefinition {}
330
331/// Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs. If there are AuditConfigs for both `allServices` and a specific service, the union of the two AuditConfigs is used for that service: the log_types specified in each AuditConfig are enabled, and the exempted_members in each AuditLogConfig are exempted. Example Policy with multiple AuditConfigs: { "audit_configs": [ { "service": "allServices", "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" }, { "log_type": "ADMIN_READ" } ] }, { "service": "sampleservice.googleapis.com", "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type": "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ logging. It also exempts `jose@example.com` from DATA_READ logging, and `aliya@example.com` from DATA_WRITE logging.
332///
333/// This type is not used in any activity, and only used as *part* of another schema.
334///
335#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
336#[serde_with::serde_as]
337#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
338pub struct AuditConfig {
339 /// The configuration for logging of each type of permission.
340 #[serde(rename = "auditLogConfigs")]
341 pub audit_log_configs: Option<Vec<AuditLogConfig>>,
342 /// Specifies a service that will be enabled for audit logging. For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices` is a special value that covers all services.
343 pub service: Option<String>,
344}
345
346impl common::Part for AuditConfig {}
347
348/// Provides the configuration for logging a type of permissions. Example: { "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" } ] } This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting jose@example.com from DATA_READ logging.
349///
350/// This type is not used in any activity, and only used as *part* of another schema.
351///
352#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
353#[serde_with::serde_as]
354#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
355pub struct AuditLogConfig {
356 /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
357 #[serde(rename = "exemptedMembers")]
358 pub exempted_members: Option<Vec<String>>,
359 /// The log type that this config enables.
360 #[serde(rename = "logType")]
361 pub log_type: Option<String>,
362}
363
364impl common::Part for AuditLogConfig {}
365
366/// Associates `members`, or principals, with a `role`.
367///
368/// This type is not used in any activity, and only used as *part* of another schema.
369///
370#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
371#[serde_with::serde_as]
372#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
373pub struct Binding {
374 /// The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
375 pub condition: Option<Expr>,
376 /// Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workforce identity pool. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/group/{group_id}`: All workforce identities in a group. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All workforce identities with a specific attribute value. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/*`: All identities in a workforce identity pool. * `principal://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workload identity pool. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool group. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All identities in a workload identity pool with a certain attribute. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/*`: All identities in a workload identity pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: Deleted single identity in a workforce identity pool. For example, `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-pool-id/subject/my-subject-attribute-value`.
377 pub members: Option<Vec<String>>,
378 /// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. For an overview of the IAM roles and permissions, see the [IAM documentation](https://cloud.google.com/iam/docs/roles-overview). For a list of the available pre-defined roles, see [here](https://cloud.google.com/iam/docs/understanding-roles).
379 pub role: Option<String>,
380}
381
382impl common::Part for Binding {}
383
384/// The request message for Operations.CancelOperation.
385///
386/// # Activities
387///
388/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
389/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
390///
391/// * [locations datasets operations cancel projects](ProjectLocationDatasetOperationCancelCall) (request)
392#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
393#[serde_with::serde_as]
394#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
395pub struct CancelOperationRequest {
396 _never_set: Option<bool>,
397}
398
399impl common::RequestValue for CancelOperationRequest {}
400
401/// Mask a string by replacing its characters with a fixed character.
402///
403/// This type is not used in any activity, and only used as *part* of another schema.
404///
405#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
406#[serde_with::serde_as]
407#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
408pub struct CharacterMaskConfig {
409 /// Character to mask the sensitive values. If not supplied, defaults to "*".
410 #[serde(rename = "maskingCharacter")]
411 pub masking_character: Option<String>,
412}
413
414impl common::Part for CharacterMaskConfig {}
415
416/// Checks if a particular data_id of a User data mapping in the given consent store is consented for a given use.
417///
418/// # Activities
419///
420/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
421/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
422///
423/// * [locations datasets consent stores check data access projects](ProjectLocationDatasetConsentStoreCheckDataAccesCall) (request)
424#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
425#[serde_with::serde_as]
426#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
427pub struct CheckDataAccessRequest {
428 /// Optional. Specific Consents to evaluate the access request against. These Consents must have the same `user_id` as the evaluated User data mapping, must exist in the current `consent_store`, and have a `state` of either `ACTIVE` or `DRAFT`. A maximum of 100 Consents can be provided here. If no selection is specified, the access request is evaluated against all `ACTIVE` unexpired Consents with the same `user_id` as the evaluated User data mapping.
429 #[serde(rename = "consentList")]
430 pub consent_list: Option<ConsentList>,
431 /// Required. The unique identifier of the resource to check access for. This identifier must correspond to a User data mapping in the given consent store.
432 #[serde(rename = "dataId")]
433 pub data_id: Option<String>,
434 /// The values of request attributes associated with this access request.
435 #[serde(rename = "requestAttributes")]
436 pub request_attributes: Option<HashMap<String, String>>,
437 /// Optional. The view for CheckDataAccessResponse. If unspecified, defaults to `BASIC` and returns `consented` as `TRUE` or `FALSE`.
438 #[serde(rename = "responseView")]
439 pub response_view: Option<String>,
440}
441
442impl common::RequestValue for CheckDataAccessRequest {}
443
444/// Checks if a particular data_id of a User data mapping in the given consent store is consented for a given use.
445///
446/// # Activities
447///
448/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
449/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
450///
451/// * [locations datasets consent stores check data access projects](ProjectLocationDatasetConsentStoreCheckDataAccesCall) (response)
452#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
453#[serde_with::serde_as]
454#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
455pub struct CheckDataAccessResponse {
456 /// The resource names of all evaluated Consents mapped to their evaluation.
457 #[serde(rename = "consentDetails")]
458 pub consent_details: Option<HashMap<String, ConsentEvaluation>>,
459 /// Whether the requested resource is consented for the given use.
460 pub consented: Option<bool>,
461}
462
463impl common::ResponseResult for CheckDataAccessResponse {}
464
465/// Represents a user’s consent.
466///
467/// # Activities
468///
469/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
470/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
471///
472/// * [locations datasets consent stores consents activate projects](ProjectLocationDatasetConsentStoreConsentActivateCall) (response)
473/// * [locations datasets consent stores consents create projects](ProjectLocationDatasetConsentStoreConsentCreateCall) (request|response)
474/// * [locations datasets consent stores consents get projects](ProjectLocationDatasetConsentStoreConsentGetCall) (response)
475/// * [locations datasets consent stores consents patch projects](ProjectLocationDatasetConsentStoreConsentPatchCall) (request|response)
476/// * [locations datasets consent stores consents reject projects](ProjectLocationDatasetConsentStoreConsentRejectCall) (response)
477/// * [locations datasets consent stores consents revoke projects](ProjectLocationDatasetConsentStoreConsentRevokeCall) (response)
478#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
479#[serde_with::serde_as]
480#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
481pub struct Consent {
482 /// Required. The resource name of the Consent artifact that contains proof of the end user's consent, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consentArtifacts/{consent_artifact_id}`.
483 #[serde(rename = "consentArtifact")]
484 pub consent_artifact: Option<String>,
485 /// Timestamp in UTC of when this Consent is considered expired.
486 #[serde(rename = "expireTime")]
487 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
488 /// Optional. User-supplied key-value pairs used to organize Consent resources. Metadata keys must: - be between 1 and 63 characters long - have a UTF-8 encoding of maximum 128 bytes - begin with a letter - consist of up to 63 characters including lowercase letters, numeric characters, underscores, and dashes Metadata values must be: - be between 1 and 63 characters long - have a UTF-8 encoding of maximum 128 bytes - consist of up to 63 characters including lowercase letters, numeric characters, underscores, and dashes No more than 64 metadata entries can be associated with a given consent.
489 pub metadata: Option<HashMap<String, String>>,
490 /// Identifier. Resource name of the Consent, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. Cannot be changed after creation.
491 pub name: Option<String>,
492 /// Optional. Represents a user's consent in terms of the resources that can be accessed and under what conditions.
493 pub policies: Option<Vec<GoogleCloudHealthcareV1ConsentPolicy>>,
494 /// Output only. The timestamp that the revision was created.
495 #[serde(rename = "revisionCreateTime")]
496 pub revision_create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
497 /// Output only. The revision ID of the Consent. The format is an 8-character hexadecimal string. Refer to a specific revision of a Consent by appending `@{revision_id}` to the Consent's resource name.
498 #[serde(rename = "revisionId")]
499 pub revision_id: Option<String>,
500 /// Required. Indicates the current state of this Consent.
501 pub state: Option<String>,
502 /// Input only. The time to live for this Consent from when it is created.
503 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
504 pub ttl: Option<chrono::Duration>,
505 /// Required. User's UUID provided by the client.
506 #[serde(rename = "userId")]
507 pub user_id: Option<String>,
508}
509
510impl common::RequestValue for Consent {}
511impl common::ResponseResult for Consent {}
512
513/// Documentation of a user’s consent.
514///
515/// # Activities
516///
517/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
518/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
519///
520/// * [locations datasets consent stores consent artifacts create projects](ProjectLocationDatasetConsentStoreConsentArtifactCreateCall) (request|response)
521/// * [locations datasets consent stores consent artifacts get projects](ProjectLocationDatasetConsentStoreConsentArtifactGetCall) (response)
522#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
523#[serde_with::serde_as]
524#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
525pub struct ConsentArtifact {
526 /// Optional. Screenshots, PDFs, or other binary information documenting the user's consent.
527 #[serde(rename = "consentContentScreenshots")]
528 pub consent_content_screenshots: Option<Vec<Image>>,
529 /// Optional. An string indicating the version of the consent information shown to the user.
530 #[serde(rename = "consentContentVersion")]
531 pub consent_content_version: Option<String>,
532 /// Optional. A signature from a guardian.
533 #[serde(rename = "guardianSignature")]
534 pub guardian_signature: Option<Signature>,
535 /// Optional. Metadata associated with the Consent artifact. For example, the consent locale or user agent version.
536 pub metadata: Option<HashMap<String, String>>,
537 /// Identifier. Resource name of the Consent artifact, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consentArtifacts/{consent_artifact_id}`. Cannot be changed after creation.
538 pub name: Option<String>,
539 /// Required. User's UUID provided by the client.
540 #[serde(rename = "userId")]
541 pub user_id: Option<String>,
542 /// Optional. User's signature.
543 #[serde(rename = "userSignature")]
544 pub user_signature: Option<Signature>,
545 /// Optional. A signature from a witness.
546 #[serde(rename = "witnessSignature")]
547 pub witness_signature: Option<Signature>,
548}
549
550impl common::RequestValue for ConsentArtifact {}
551impl common::ResponseResult for ConsentArtifact {}
552
553/// The detailed evaluation of a particular Consent.
554///
555/// This type is not used in any activity, and only used as *part* of another schema.
556///
557#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
558#[serde_with::serde_as]
559#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
560pub struct ConsentEvaluation {
561 /// The evaluation result.
562 #[serde(rename = "evaluationResult")]
563 pub evaluation_result: Option<String>,
564}
565
566impl common::Part for ConsentEvaluation {}
567
568/// List of resource names of Consent resources.
569///
570/// This type is not used in any activity, and only used as *part* of another schema.
571///
572#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
573#[serde_with::serde_as]
574#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
575pub struct ConsentList {
576 /// The resource names of the Consents to evaluate against, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`.
577 pub consents: Option<Vec<String>>,
578}
579
580impl common::Part for ConsentList {}
581
582/// Represents a consent store.
583///
584/// # Activities
585///
586/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
587/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
588///
589/// * [locations datasets consent stores create projects](ProjectLocationDatasetConsentStoreCreateCall) (request|response)
590/// * [locations datasets consent stores get projects](ProjectLocationDatasetConsentStoreGetCall) (response)
591/// * [locations datasets consent stores patch projects](ProjectLocationDatasetConsentStorePatchCall) (request|response)
592#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
593#[serde_with::serde_as]
594#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
595pub struct ConsentStore {
596 /// Optional. Default time to live for Consents created in this store. Must be at least 24 hours. Updating this field will not affect the expiration time of existing consents.
597 #[serde(rename = "defaultConsentTtl")]
598 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
599 pub default_consent_ttl: Option<chrono::Duration>,
600 /// Optional. If `true`, UpdateConsent creates the Consent if it does not already exist. If unspecified, defaults to `false`.
601 #[serde(rename = "enableConsentCreateOnUpdate")]
602 pub enable_consent_create_on_update: Option<bool>,
603 /// Optional. User-supplied key-value pairs used to organize consent stores. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: \p{Ll}\p{Lo}{0,62}. Label values must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63}. No more than 64 labels can be associated with a given store. For more information: https://cloud.google.com/healthcare/docs/how-tos/labeling-resources
604 pub labels: Option<HashMap<String, String>>,
605 /// Identifier. Resource name of the consent store, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}`. Cannot be changed after creation.
606 pub name: Option<String>,
607}
608
609impl common::RequestValue for ConsentStore {}
610impl common::ResponseResult for ConsentStore {}
611
612/// Creates a new message.
613///
614/// # Activities
615///
616/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
617/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
618///
619/// * [locations datasets hl7 v2 stores messages create projects](ProjectLocationDatasetHl7V2StoreMessageCreateCall) (request)
620#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
621#[serde_with::serde_as]
622#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
623pub struct CreateMessageRequest {
624 /// Required. HL7v2 message.
625 pub message: Option<Message>,
626}
627
628impl common::RequestValue for CreateMessageRequest {}
629
630/// Pseudonymization method that generates surrogates via cryptographic hashing. Uses SHA-256. Outputs a base64-encoded representation of the hashed output (for example, `L7k0BHmF1ha5U3NfGykjro4xWi1MPVQPjhMAZbSV9mM=`).
631///
632/// This type is not used in any activity, and only used as *part* of another schema.
633///
634#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
635#[serde_with::serde_as]
636#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
637pub struct CryptoHashConfig {
638 /// An AES 128/192/256 bit key. Causes the hash to be computed based on this key. A default key is generated for each Deidentify operation and is used when neither `crypto_key` nor `kms_wrapped` is specified. Must not be set if `kms_wrapped` is set.
639 #[serde(rename = "cryptoKey")]
640 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
641 pub crypto_key: Option<Vec<u8>>,
642 /// KMS wrapped key. Must not be set if `crypto_key` is set.
643 #[serde(rename = "kmsWrapped")]
644 pub kms_wrapped: Option<KmsWrappedCryptoKey>,
645}
646
647impl common::Part for CryptoHashConfig {}
648
649/// A message representing a health dataset. A health dataset represents a collection of healthcare data pertaining to one or more patients. This may include multiple modalities of healthcare data, such as electronic medical records or medical imaging data.
650///
651/// # Activities
652///
653/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
654/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
655///
656/// * [locations datasets create projects](ProjectLocationDatasetCreateCall) (request)
657/// * [locations datasets get projects](ProjectLocationDatasetGetCall) (response)
658/// * [locations datasets patch projects](ProjectLocationDatasetPatchCall) (request|response)
659#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
660#[serde_with::serde_as]
661#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
662pub struct Dataset {
663 /// Optional. Customer-managed encryption key spec for a Dataset. If set, this Dataset and all of its sub-resources will be secured by this key. If empty, the Dataset is secured by the default Google encryption key.
664 #[serde(rename = "encryptionSpec")]
665 pub encryption_spec: Option<EncryptionSpec>,
666 /// Identifier. Resource name of the dataset, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
667 pub name: Option<String>,
668 /// Optional. The default timezone used by this dataset. Must be a either a valid IANA time zone name such as "America/New_York" or empty, which defaults to UTC. This is used for parsing times in resources, such as HL7 messages, where no explicit timezone is specified.
669 #[serde(rename = "timeZone")]
670 pub time_zone: Option<String>,
671}
672
673impl common::RequestValue for Dataset {}
674impl common::ResponseResult for Dataset {}
675
676/// Shift a date forward or backward in time by a random amount which is consistent for a given patient and crypto key combination.
677///
678/// This type is not used in any activity, and only used as *part* of another schema.
679///
680#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
681#[serde_with::serde_as]
682#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
683pub struct DateShiftConfig {
684 /// An AES 128/192/256 bit key. The date shift is computed based on this key and the patient ID. If the patient ID is empty for a DICOM resource, the date shift is computed based on this key and the study instance UID. If `crypto_key` is not set, then `kms_wrapped` is used to calculate the date shift. If neither is set, a default key is generated for each de-identify operation. Must not be set if `kms_wrapped` is set.
685 #[serde(rename = "cryptoKey")]
686 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
687 pub crypto_key: Option<Vec<u8>>,
688 /// KMS wrapped key. If `kms_wrapped` is not set, then `crypto_key` is used to calculate the date shift. If neither is set, a default key is generated for each de-identify operation. Must not be set if `crypto_key` is set.
689 #[serde(rename = "kmsWrapped")]
690 pub kms_wrapped: Option<KmsWrappedCryptoKey>,
691}
692
693impl common::Part for DateShiftConfig {}
694
695/// Contains configuration for streaming de-identified FHIR export.
696///
697/// This type is not used in any activity, and only used as *part* of another schema.
698///
699#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
700#[serde_with::serde_as]
701#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
702pub struct DeidentifiedStoreDestination {
703 /// The configuration to use when de-identifying resources that are added to this store.
704 pub config: Option<DeidentifyConfig>,
705 /// The full resource name of a Cloud Healthcare FHIR store, for example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
706 pub store: Option<String>,
707}
708
709impl common::Part for DeidentifiedStoreDestination {}
710
711/// Configures de-id options specific to different types of content. Each submessage customizes the handling of an https://tools.ietf.org/html/rfc6838 media type or subtype. Configs are applied in a nested manner at runtime.
712///
713/// This type is not used in any activity, and only used as *part* of another schema.
714///
715#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
716#[serde_with::serde_as]
717#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
718pub struct DeidentifyConfig {
719 /// Configures de-id of application/DICOM content.
720 pub dicom: Option<DicomConfig>,
721 /// Configures de-id of application/FHIR content.
722 pub fhir: Option<FhirConfig>,
723 /// Configures de-identification of image pixels wherever they are found in the source_dataset.
724 pub image: Option<ImageConfig>,
725 /// Configures de-identification of text wherever it is found in the source_dataset.
726 pub text: Option<TextConfig>,
727 /// Ensures in-flight data remains in the region of origin during de-identification. Using this option results in a significant reduction of throughput, and is not compatible with `LOCATION` or `ORGANIZATION_NAME` infoTypes. `LOCATION` must be excluded within TextConfig, and must also be excluded within ImageConfig if image redaction is required.
728 #[serde(rename = "useRegionalDataProcessing")]
729 pub use_regional_data_processing: Option<bool>,
730}
731
732impl common::Part for DeidentifyConfig {}
733
734/// Redacts identifying information from the specified dataset.
735///
736/// # Activities
737///
738/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
739/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
740///
741/// * [locations datasets deidentify projects](ProjectLocationDatasetDeidentifyCall) (request)
742#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
743#[serde_with::serde_as]
744#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
745pub struct DeidentifyDatasetRequest {
746 /// Deidentify configuration. Only one of `config` and `gcs_config_uri` can be specified.
747 pub config: Option<DeidentifyConfig>,
748 /// Required. The name of the dataset resource to create and write the redacted data to. * The destination dataset must not exist. * The destination dataset must be in the same location as the source dataset. De-identifying data across multiple locations is not supported.
749 #[serde(rename = "destinationDataset")]
750 pub destination_dataset: Option<String>,
751 /// Cloud Storage location to read the JSON cloud.healthcare.deidentify.DeidentifyConfig from, overriding the default config. Must be of the form `gs://{bucket_id}/path/to/object`. The Cloud Storage location must grant the Cloud IAM role `roles/storage.objectViewer` to the project's Cloud Healthcare Service Agent service account. Only one of `config` and `gcs_config_uri` can be specified.
752 #[serde(rename = "gcsConfigUri")]
753 pub gcs_config_uri: Option<String>,
754}
755
756impl common::RequestValue for DeidentifyDatasetRequest {}
757
758/// Creates a new DICOM store with sensitive information de-identified.
759///
760/// # Activities
761///
762/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
763/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
764///
765/// * [locations datasets dicom stores deidentify projects](ProjectLocationDatasetDicomStoreDeidentifyCall) (request)
766#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
767#[serde_with::serde_as]
768#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
769pub struct DeidentifyDicomStoreRequest {
770 /// Deidentify configuration. Only one of `config` and `gcs_config_uri` can be specified.
771 pub config: Option<DeidentifyConfig>,
772 /// Required. The name of the DICOM store to create and write the redacted data to. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`. * The destination dataset must exist. * The source dataset and destination dataset must both reside in the same location. De-identifying data across multiple locations is not supported. * The destination DICOM store must not exist. * The caller must have the necessary permissions to create the destination DICOM store.
773 #[serde(rename = "destinationStore")]
774 pub destination_store: Option<String>,
775 /// Filter configuration.
776 #[serde(rename = "filterConfig")]
777 pub filter_config: Option<DicomFilterConfig>,
778 /// Cloud Storage location to read the JSON cloud.healthcare.deidentify.DeidentifyConfig from, overriding the default config. Must be of the form `gs://{bucket_id}/path/to/object`. The Cloud Storage location must grant the Cloud IAM role `roles/storage.objectViewer` to the project's Cloud Healthcare Service Agent service account. Only one of `config` and `gcs_config_uri` can be specified.
779 #[serde(rename = "gcsConfigUri")]
780 pub gcs_config_uri: Option<String>,
781}
782
783impl common::RequestValue for DeidentifyDicomStoreRequest {}
784
785/// Creates a new FHIR store with sensitive information de-identified.
786///
787/// # Activities
788///
789/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
790/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
791///
792/// * [locations datasets fhir stores deidentify projects](ProjectLocationDatasetFhirStoreDeidentifyCall) (request)
793#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
794#[serde_with::serde_as]
795#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
796pub struct DeidentifyFhirStoreRequest {
797 /// Deidentify configuration. Only one of `config` and `gcs_config_uri` can be specified.
798 pub config: Option<DeidentifyConfig>,
799 /// Required. The name of the FHIR store to create and write the redacted data to. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`. * The destination dataset must exist. * The source dataset and destination dataset must both reside in the same location. De-identifying data across multiple locations is not supported. * The destination FHIR store must exist. * The caller must have the healthcare.fhirResources.update permission to write to the destination FHIR store.
800 #[serde(rename = "destinationStore")]
801 pub destination_store: Option<String>,
802 /// Cloud Storage location to read the JSON cloud.healthcare.deidentify.DeidentifyConfig from, overriding the default config. Must be of the form `gs://{bucket_id}/path/to/object`. The Cloud Storage location must grant the Cloud IAM role `roles/storage.objectViewer` to the project's Cloud Healthcare Service Agent service account. Only one of `config` and `gcs_config_uri` can be specified.
803 #[serde(rename = "gcsConfigUri")]
804 pub gcs_config_uri: Option<String>,
805 /// A filter specifying the resources to include in the output. If not specified, all resources are included in the output.
806 #[serde(rename = "resourceFilter")]
807 pub resource_filter: Option<FhirFilter>,
808 /// If true, skips resources that are created or modified after the de-identify operation is created.
809 #[serde(rename = "skipModifiedResources")]
810 pub skip_modified_resources: Option<bool>,
811}
812
813impl common::RequestValue for DeidentifyFhirStoreRequest {}
814
815/// Specifies the parameters needed for de-identification of DICOM stores.
816///
817/// This type is not used in any activity, and only used as *part* of another schema.
818///
819#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
820#[serde_with::serde_as]
821#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
822pub struct DicomConfig {
823 /// Tag filtering profile that determines which tags to keep/remove.
824 #[serde(rename = "filterProfile")]
825 pub filter_profile: Option<String>,
826 /// List of tags to keep. Remove all other tags.
827 #[serde(rename = "keepList")]
828 pub keep_list: Option<TagFilterList>,
829 /// List of tags to remove. Keep all other tags.
830 #[serde(rename = "removeList")]
831 pub remove_list: Option<TagFilterList>,
832 /// If true, skip replacing StudyInstanceUID, SeriesInstanceUID, SOPInstanceUID, and MediaStorageSOPInstanceUID and leave them untouched. The Cloud Healthcare API regenerates these UIDs by default based on the DICOM Standard's reasoning: "Whilst these UIDs cannot be mapped directly to an individual out of context, given access to the original images, or to a database of the original images containing the UIDs, it would be possible to recover the individual's identity." http://dicom.nema.org/medical/dicom/current/output/chtml/part15/sect_E.3.9.html
833 #[serde(rename = "skipIdRedaction")]
834 pub skip_id_redaction: Option<bool>,
835}
836
837impl common::Part for DicomConfig {}
838
839/// Specifies the filter configuration for DICOM resources.
840///
841/// This type is not used in any activity, and only used as *part* of another schema.
842///
843#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
844#[serde_with::serde_as]
845#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
846pub struct DicomFilterConfig {
847 /// The Cloud Storage location of the filter configuration file. The `gcs_uri` must be in the format `gs://bucket/path/to/object`. The filter configuration file must contain a list of resource paths separated by newline characters (\n or \r\n). Each resource path must be in the format "/studies/{studyUID}[/series/{seriesUID}[/instances/{instanceUID}]]" The Cloud Healthcare API service account must have the `roles/storage.objectViewer` Cloud IAM role for this Cloud Storage location.
848 #[serde(rename = "resourcePathsGcsUri")]
849 pub resource_paths_gcs_uri: Option<String>,
850}
851
852impl common::Part for DicomFilterConfig {}
853
854/// Represents a DICOM store.
855///
856/// # Activities
857///
858/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
859/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
860///
861/// * [locations datasets dicom stores create projects](ProjectLocationDatasetDicomStoreCreateCall) (request|response)
862/// * [locations datasets dicom stores get projects](ProjectLocationDatasetDicomStoreGetCall) (response)
863/// * [locations datasets dicom stores patch projects](ProjectLocationDatasetDicomStorePatchCall) (request|response)
864#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
865#[serde_with::serde_as]
866#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
867pub struct DicomStore {
868 /// User-supplied key-value pairs used to organize DICOM stores. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: \p{Ll}\p{Lo}{0,62} Label values are optional, must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} No more than 64 labels can be associated with a given store.
869 pub labels: Option<HashMap<String, String>>,
870 /// Identifier. Resource name of the DICOM store, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
871 pub name: Option<String>,
872 /// Notification destination for new DICOM instances. Supplied by the client.
873 #[serde(rename = "notificationConfig")]
874 pub notification_config: Option<NotificationConfig>,
875 /// Optional. A list of streaming configs used to configure the destination of streaming exports for every DICOM instance insertion in this DICOM store. After a new config is added to `stream_configs`, DICOM instance insertions are streamed to the new destination. When a config is removed from `stream_configs`, the server stops streaming to that destination. Each config must contain a unique destination.
876 #[serde(rename = "streamConfigs")]
877 pub stream_configs: Option<Vec<GoogleCloudHealthcareV1DicomStreamConfig>>,
878}
879
880impl common::RequestValue for DicomStore {}
881impl common::ResponseResult for DicomStore {}
882
883/// DicomStoreMetrics contains metrics describing a DICOM store.
884///
885/// # Activities
886///
887/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
888/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
889///
890/// * [locations datasets dicom stores get dicom store metrics projects](ProjectLocationDatasetDicomStoreGetDICOMStoreMetricCall) (response)
891#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
892#[serde_with::serde_as]
893#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
894pub struct DicomStoreMetrics {
895 /// Total blob storage bytes for all instances in the store.
896 #[serde(rename = "blobStorageSizeBytes")]
897 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
898 pub blob_storage_size_bytes: Option<i64>,
899 /// Number of instances in the store.
900 #[serde(rename = "instanceCount")]
901 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
902 pub instance_count: Option<i64>,
903 /// Resource name of the DICOM store, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
904 pub name: Option<String>,
905 /// Number of series in the store.
906 #[serde(rename = "seriesCount")]
907 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
908 pub series_count: Option<i64>,
909 /// Total structured storage bytes for all instances in the store.
910 #[serde(rename = "structuredStorageSizeBytes")]
911 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
912 pub structured_storage_size_bytes: Option<i64>,
913 /// Number of studies in the store.
914 #[serde(rename = "studyCount")]
915 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
916 pub study_count: Option<i64>,
917}
918
919impl common::ResponseResult for DicomStoreMetrics {}
920
921/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
922///
923/// # Activities
924///
925/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
926/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
927///
928/// * [locations datasets consent stores attribute definitions delete projects](ProjectLocationDatasetConsentStoreAttributeDefinitionDeleteCall) (response)
929/// * [locations datasets consent stores consent artifacts delete projects](ProjectLocationDatasetConsentStoreConsentArtifactDeleteCall) (response)
930/// * [locations datasets consent stores consents delete projects](ProjectLocationDatasetConsentStoreConsentDeleteCall) (response)
931/// * [locations datasets consent stores consents delete revision projects](ProjectLocationDatasetConsentStoreConsentDeleteRevisionCall) (response)
932/// * [locations datasets consent stores user data mappings delete projects](ProjectLocationDatasetConsentStoreUserDataMappingDeleteCall) (response)
933/// * [locations datasets consent stores delete projects](ProjectLocationDatasetConsentStoreDeleteCall) (response)
934/// * [locations datasets dicom stores studies series instances delete projects](ProjectLocationDatasetDicomStoreStudySeriesInstanceDeleteCall) (response)
935/// * [locations datasets dicom stores delete projects](ProjectLocationDatasetDicomStoreDeleteCall) (response)
936/// * [locations datasets fhir stores fhir resource-purge projects](ProjectLocationDatasetFhirStoreFhirResourcePurgeCall) (response)
937/// * [locations datasets fhir stores fhir conditional delete projects](ProjectLocationDatasetFhirStoreFhirConditionalDeleteCall) (response)
938/// * [locations datasets fhir stores delete projects](ProjectLocationDatasetFhirStoreDeleteCall) (response)
939/// * [locations datasets hl7 v2 stores messages delete projects](ProjectLocationDatasetHl7V2StoreMessageDeleteCall) (response)
940/// * [locations datasets hl7 v2 stores delete projects](ProjectLocationDatasetHl7V2StoreDeleteCall) (response)
941/// * [locations datasets operations cancel projects](ProjectLocationDatasetOperationCancelCall) (response)
942/// * [locations datasets delete projects](ProjectLocationDatasetDeleteCall) (response)
943#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
944#[serde_with::serde_as]
945#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
946pub struct Empty {
947 _never_set: Option<bool>,
948}
949
950impl common::ResponseResult for Empty {}
951
952/// Represents a customer-managed encryption key spec that can be applied to a resource.
953///
954/// This type is not used in any activity, and only used as *part* of another schema.
955///
956#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
957#[serde_with::serde_as]
958#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
959pub struct EncryptionSpec {
960 /// Required. The resource name of customer-managed encryption key that is used to secure a resource and its sub-resources. Only the key in the same location as this Dataset is allowed to be used for encryption. Format is: `projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{key}`
961 #[serde(rename = "kmsKeyName")]
962 pub kms_key_name: Option<String>,
963}
964
965impl common::Part for EncryptionSpec {}
966
967/// The candidate entities that an entity mention could link to.
968///
969/// This type is not used in any activity, and only used as *part* of another schema.
970///
971#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
972#[serde_with::serde_as]
973#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
974pub struct Entity {
975 /// entity_id is a first class field entity_id uniquely identifies this concept and its meta-vocabulary. For example, "UMLS/C0000970".
976 #[serde(rename = "entityId")]
977 pub entity_id: Option<String>,
978 /// preferred_term is the preferred term for this concept. For example, "Acetaminophen". For ad hoc entities formed by normalization, this is the most popular unnormalized string.
979 #[serde(rename = "preferredTerm")]
980 pub preferred_term: Option<String>,
981 /// Vocabulary codes are first-class fields and differentiated from the concept unique identifier (entity_id). vocabulary_codes contains the representation of this concept in particular vocabularies, such as ICD-10, SNOMED-CT and RxNORM. These are prefixed by the name of the vocabulary, followed by the unique code within that vocabulary. For example, "RXNORM/A10334543".
982 #[serde(rename = "vocabularyCodes")]
983 pub vocabulary_codes: Option<Vec<String>>,
984}
985
986impl common::Part for Entity {}
987
988/// An entity mention in the document.
989///
990/// This type is not used in any activity, and only used as *part* of another schema.
991///
992#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
993#[serde_with::serde_as]
994#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
995pub struct EntityMention {
996 /// The certainty assessment of the entity mention. Its value is one of: LIKELY, SOMEWHAT_LIKELY, UNCERTAIN, SOMEWHAT_UNLIKELY, UNLIKELY, CONDITIONAL
997 #[serde(rename = "certaintyAssessment")]
998 pub certainty_assessment: Option<Feature>,
999 /// The model's confidence in this entity mention annotation. A number between 0 and 1.
1000 pub confidence: Option<f64>,
1001 /// linked_entities are candidate ontological concepts that this entity mention may refer to. They are sorted by decreasing confidence.
1002 #[serde(rename = "linkedEntities")]
1003 pub linked_entities: Option<Vec<LinkedEntity>>,
1004 /// mention_id uniquely identifies each entity mention in a single response.
1005 #[serde(rename = "mentionId")]
1006 pub mention_id: Option<String>,
1007 /// The subject this entity mention relates to. Its value is one of: PATIENT, FAMILY_MEMBER, OTHER
1008 pub subject: Option<Feature>,
1009 /// How this entity mention relates to the subject temporally. Its value is one of: CURRENT, CLINICAL_HISTORY, FAMILY_HISTORY, UPCOMING, ALLERGY
1010 #[serde(rename = "temporalAssessment")]
1011 pub temporal_assessment: Option<Feature>,
1012 /// text is the location of the entity mention in the document.
1013 pub text: Option<TextSpan>,
1014 /// The semantic type of the entity: UNKNOWN_ENTITY_TYPE, ALONE, ANATOMICAL_STRUCTURE, ASSISTED_LIVING, BF_RESULT, BM_RESULT, BM_UNIT, BM_VALUE, BODY_FUNCTION, BODY_MEASUREMENT, COMPLIANT, DOESNOT_FOLLOWUP, FAMILY, FOLLOWSUP, LABORATORY_DATA, LAB_RESULT, LAB_UNIT, LAB_VALUE, MEDICAL_DEVICE, MEDICINE, MED_DOSE, MED_DURATION, MED_FORM, MED_FREQUENCY, MED_ROUTE, MED_STATUS, MED_STRENGTH, MED_TOTALDOSE, MED_UNIT, NON_COMPLIANT, OTHER_LIVINGSTATUS, PROBLEM, PROCEDURE, PROCEDURE_RESULT, PROC_METHOD, REASON_FOR_NONCOMPLIANCE, SEVERITY, SUBSTANCE_ABUSE, UNCLEAR_FOLLOWUP.
1015 #[serde(rename = "type")]
1016 pub type_: Option<String>,
1017}
1018
1019impl common::Part for EntityMention {}
1020
1021/// Defines directed relationship from one entity mention to another.
1022///
1023/// This type is not used in any activity, and only used as *part* of another schema.
1024///
1025#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1026#[serde_with::serde_as]
1027#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1028pub struct EntityMentionRelationship {
1029 /// The model's confidence in this annotation. A number between 0 and 1.
1030 pub confidence: Option<f64>,
1031 /// object_id is the id of the object entity mention.
1032 #[serde(rename = "objectId")]
1033 pub object_id: Option<String>,
1034 /// subject_id is the id of the subject entity mention.
1035 #[serde(rename = "subjectId")]
1036 pub subject_id: Option<String>,
1037}
1038
1039impl common::Part for EntityMentionRelationship {}
1040
1041/// Evaluate a user’s Consents for all matching User data mappings. Note: User data mappings are indexed asynchronously, causing slight delays between the time mappings are created or updated and when they are included in EvaluateUserConsents results.
1042///
1043/// # Activities
1044///
1045/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1046/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1047///
1048/// * [locations datasets consent stores evaluate user consents projects](ProjectLocationDatasetConsentStoreEvaluateUserConsentCall) (request)
1049#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1050#[serde_with::serde_as]
1051#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1052pub struct EvaluateUserConsentsRequest {
1053 /// Optional. Specific Consents to evaluate the access request against. These Consents must have the same `user_id` as the User data mappings being evalauted, must exist in the current `consent_store`, and must have a `state` of either `ACTIVE` or `DRAFT`. A maximum of 100 Consents can be provided here. If unspecified, all `ACTIVE` unexpired Consents in the current `consent_store` will be evaluated.
1054 #[serde(rename = "consentList")]
1055 pub consent_list: Option<ConsentList>,
1056 /// Optional. Limit on the number of User data mappings to return in a single response. If not specified, 100 is used. May not be larger than 1000.
1057 #[serde(rename = "pageSize")]
1058 pub page_size: Option<i32>,
1059 /// Optional. Token to retrieve the next page of results, or empty to get the first page.
1060 #[serde(rename = "pageToken")]
1061 pub page_token: Option<String>,
1062 /// Required. The values of request attributes associated with this access request.
1063 #[serde(rename = "requestAttributes")]
1064 pub request_attributes: Option<HashMap<String, String>>,
1065 /// Optional. The values of resource attributes associated with the resources being requested. If no values are specified, then all resources are queried.
1066 #[serde(rename = "resourceAttributes")]
1067 pub resource_attributes: Option<HashMap<String, String>>,
1068 /// Optional. The view for EvaluateUserConsentsResponse. If unspecified, defaults to `BASIC` and returns `consented` as `TRUE` or `FALSE`.
1069 #[serde(rename = "responseView")]
1070 pub response_view: Option<String>,
1071 /// Required. User ID to evaluate consents for.
1072 #[serde(rename = "userId")]
1073 pub user_id: Option<String>,
1074}
1075
1076impl common::RequestValue for EvaluateUserConsentsRequest {}
1077
1078/// There is no detailed description.
1079///
1080/// # Activities
1081///
1082/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1083/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1084///
1085/// * [locations datasets consent stores evaluate user consents projects](ProjectLocationDatasetConsentStoreEvaluateUserConsentCall) (response)
1086#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1087#[serde_with::serde_as]
1088#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1089pub struct EvaluateUserConsentsResponse {
1090 /// Token to retrieve the next page of results, or empty if there are no more results in the list. This token is valid for 72 hours after it is created.
1091 #[serde(rename = "nextPageToken")]
1092 pub next_page_token: Option<String>,
1093 /// The consent evaluation result for each `data_id`.
1094 pub results: Option<Vec<Result>>,
1095}
1096
1097impl common::ResponseResult for EvaluateUserConsentsResponse {}
1098
1099/// Exports data from the specified DICOM store. If a given resource, such as a DICOM object with the same SOPInstance UID, already exists in the output, it is overwritten with the version in the source dataset. Exported DICOM data persists when the DICOM store from which it was exported is deleted.
1100///
1101/// # Activities
1102///
1103/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1104/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1105///
1106/// * [locations datasets dicom stores export projects](ProjectLocationDatasetDicomStoreExportCall) (request)
1107#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1108#[serde_with::serde_as]
1109#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1110pub struct ExportDicomDataRequest {
1111 /// The BigQuery output destination. You can only export to a BigQuery dataset that's in the same project as the DICOM store you're exporting from. The Cloud Healthcare Service Agent requires two IAM roles on the BigQuery location: `roles/bigquery.dataEditor` and `roles/bigquery.jobUser`.
1112 #[serde(rename = "bigqueryDestination")]
1113 pub bigquery_destination: Option<GoogleCloudHealthcareV1DicomBigQueryDestination>,
1114 /// The Cloud Storage output destination. The Cloud Healthcare Service Agent requires the `roles/storage.objectAdmin` Cloud IAM roles on the Cloud Storage location.
1115 #[serde(rename = "gcsDestination")]
1116 pub gcs_destination: Option<GoogleCloudHealthcareV1DicomGcsDestination>,
1117}
1118
1119impl common::RequestValue for ExportDicomDataRequest {}
1120
1121/// Request to schedule an export.
1122///
1123/// # Activities
1124///
1125/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1126/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1127///
1128/// * [locations datasets hl7 v2 stores export projects](ProjectLocationDatasetHl7V2StoreExportCall) (request)
1129#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1130#[serde_with::serde_as]
1131#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1132pub struct ExportMessagesRequest {
1133 /// The end of the range in `send_time` (MSH.7, https://www.hl7.org/documentcenter/public_temp_2E58C1F9-1C23-BA17-0C6126475344DA9D/wg/conf/HL7MSH.htm) to process. If not specified, the time when the export is scheduled is used. This value has to come after the `start_time` defined below. Only messages whose `send_time` lies in the range `start_time` (inclusive) to `end_time` (exclusive) are exported.
1134 #[serde(rename = "endTime")]
1135 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1136 /// Restricts messages exported to those matching a filter, only applicable to PubsubDestination and GcsDestination. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in the `yyyy-mm-dd` format. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, and is just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. The following fields and functions are available for filtering: * `message_type`, from the MSH-9.1 field. For example, `NOT message_type = "ADT"`. * `send_date` or `sendDate`, the `yyyy-mm-dd` date the message was sent in the dataset's time_zone, from the MSH-7 segment. For example, `send_date < "2017-01-02"`. * `send_time`, the timestamp when the message was sent, using the RFC3339 time format for comparisons, from the MSH-7 segment. For example, `send_time < "2017-01-02T00:00:00-05:00"`. * `create_time`, the timestamp when the message was created in the HL7v2 store. Use the RFC3339 time format for comparisons. For example, `create_time < "2017-01-02T00:00:00-05:00"`. * `send_facility`, the care center that the message came from, from the MSH-4 segment. For example, `send_facility = "ABC"`. Note: The filter will be applied to every message in the HL7v2 store whose `send_time` lies in the range defined by the `start_time` and the `end_time`. Even if the filter only matches a small set of messages, the export operation can still take a long time to finish when a lot of messages are between the specified `start_time` and `end_time` range.
1137 pub filter: Option<String>,
1138 /// Export to a Cloud Storage destination.
1139 #[serde(rename = "gcsDestination")]
1140 pub gcs_destination: Option<GcsDestination>,
1141 /// Export messages to a Pub/Sub topic.
1142 #[serde(rename = "pubsubDestination")]
1143 pub pubsub_destination: Option<PubsubDestination>,
1144 /// The start of the range in `send_time` (MSH.7, https://www.hl7.org/documentcenter/public_temp_2E58C1F9-1C23-BA17-0C6126475344DA9D/wg/conf/HL7MSH.htm) to process. If not specified, the UNIX epoch (1970-01-01T00:00:00Z) is used. This value has to come before the `end_time` defined below. Only messages whose `send_time` lies in the range `start_time` (inclusive) to `end_time` (exclusive) are exported.
1145 #[serde(rename = "startTime")]
1146 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1147}
1148
1149impl common::RequestValue for ExportMessagesRequest {}
1150
1151/// Request to export resources.
1152///
1153/// # Activities
1154///
1155/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1156/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1157///
1158/// * [locations datasets fhir stores export projects](ProjectLocationDatasetFhirStoreExportCall) (request)
1159#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1160#[serde_with::serde_as]
1161#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1162pub struct ExportResourcesRequest {
1163 /// If provided, only resources updated after this time are exported. The time uses the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. For example, `2015-02-07T13:28:17.239+02:00` or `2017-01-01T00:00:00Z`. The time must be specified to the second and include a time zone.
1164 pub _since: Option<String>,
1165 /// String of comma-delimited FHIR resource types. If provided, only resources of the specified resource type(s) are exported.
1166 pub _type: Option<String>,
1167 /// The BigQuery output destination. The Cloud Healthcare Service Agent requires two IAM roles on the BigQuery location: `roles/bigquery.dataEditor` and `roles/bigquery.jobUser`. The output is one BigQuery table per resource type. Unlike when setting `BigQueryDestination` for `StreamConfig`, `ExportResources` does not create BigQuery views.
1168 #[serde(rename = "bigqueryDestination")]
1169 pub bigquery_destination: Option<GoogleCloudHealthcareV1FhirBigQueryDestination>,
1170 /// The Cloud Storage output destination. The Healthcare Service Agent account requires the `roles/storage.objectAdmin` role on the Cloud Storage location. The exported outputs are organized by FHIR resource types. The server creates one object per resource type. Each object contains newline delimited JSON, and each line is a FHIR resource.
1171 #[serde(rename = "gcsDestination")]
1172 pub gcs_destination: Option<GoogleCloudHealthcareV1FhirGcsDestination>,
1173}
1174
1175impl common::RequestValue for ExportResourcesRequest {}
1176
1177/// Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.
1178///
1179/// This type is not used in any activity, and only used as *part* of another schema.
1180///
1181#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1182#[serde_with::serde_as]
1183#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1184pub struct Expr {
1185 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
1186 pub description: Option<String>,
1187 /// Textual representation of an expression in Common Expression Language syntax.
1188 pub expression: Option<String>,
1189 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
1190 pub location: Option<String>,
1191 /// Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
1192 pub title: Option<String>,
1193}
1194
1195impl common::Part for Expr {}
1196
1197/// A feature of an entity mention.
1198///
1199/// This type is not used in any activity, and only used as *part* of another schema.
1200///
1201#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1202#[serde_with::serde_as]
1203#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1204pub struct Feature {
1205 /// The model's confidence in this feature annotation. A number between 0 and 1.
1206 pub confidence: Option<f64>,
1207 /// The value of this feature annotation. Its range depends on the type of the feature.
1208 pub value: Option<String>,
1209}
1210
1211impl common::Part for Feature {}
1212
1213/// Specifies how to handle de-identification of a FHIR store.
1214///
1215/// This type is not used in any activity, and only used as *part* of another schema.
1216///
1217#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1218#[serde_with::serde_as]
1219#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1220pub struct FhirConfig {
1221 /// The behaviour for handling FHIR extensions that aren't otherwise specified for de-identification. If true, all extensions are preserved during de-identification by default. If false or unspecified, all extensions are removed during de-identification by default.
1222 #[serde(rename = "defaultKeepExtensions")]
1223 pub default_keep_extensions: Option<bool>,
1224 /// Specifies FHIR paths to match and how to transform them. Any field that is not matched by a FieldMetadata is passed through to the output dataset unmodified. All extensions will be processed according to `default_keep_extensions`.
1225 #[serde(rename = "fieldMetadataList")]
1226 pub field_metadata_list: Option<Vec<FieldMetadata>>,
1227}
1228
1229impl common::Part for FhirConfig {}
1230
1231/// Filter configuration.
1232///
1233/// This type is not used in any activity, and only used as *part* of another schema.
1234///
1235#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1236#[serde_with::serde_as]
1237#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1238pub struct FhirFilter {
1239 /// List of resources to include in the output. If this list is empty or not specified, all resources are included in the output.
1240 pub resources: Option<Resources>,
1241}
1242
1243impl common::Part for FhirFilter {}
1244
1245/// Contains the configuration for FHIR notifications.
1246///
1247/// This type is not used in any activity, and only used as *part* of another schema.
1248///
1249#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1250#[serde_with::serde_as]
1251#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1252pub struct FhirNotificationConfig {
1253 /// The [Pub/Sub](https://cloud.google.com/pubsub/docs/) topic that notifications of changes are published on. Supplied by the client. The notification is a `PubsubMessage` with the following fields: * `PubsubMessage.Data` contains the resource name. * `PubsubMessage.MessageId` is the ID of this notification. It is guaranteed to be unique within the topic. * `PubsubMessage.PublishTime` is the time when the message was published. Note that notifications are only sent if the topic is non-empty. [Topic names](https://cloud.google.com/pubsub/docs/overview#names) must be scoped to a project. The Cloud Healthcare API service account, service-@gcp-sa-healthcare.iam.gserviceaccount.com, must have publisher permissions on the given Pub/Sub topic. Not having adequate permissions causes the calls that send notifications to fail (https://cloud.google.com/healthcare-api/docs/permissions-healthcare-api-gcp-products#dicom_fhir_and_hl7v2_store_cloud_pubsub_permissions). If a notification can't be published to Pub/Sub, errors are logged to Cloud Logging. For more information, see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare-api/docs/how-tos/logging).
1254 #[serde(rename = "pubsubTopic")]
1255 pub pubsub_topic: Option<String>,
1256 /// Whether to send full FHIR resource to this Pub/Sub topic.
1257 #[serde(rename = "sendFullResource")]
1258 pub send_full_resource: Option<bool>,
1259 /// Whether to send full FHIR resource to this Pub/Sub topic for deleting FHIR resource. Note that setting this to true does not guarantee that all previous resources will be sent in the format of full FHIR resource. When a resource change is too large or during heavy traffic, only the resource name will be sent. Clients should always check the "payloadType" label from a Pub/Sub message to determine whether it needs to fetch the full previous resource as a separate operation.
1260 #[serde(rename = "sendPreviousResourceOnDelete")]
1261 pub send_previous_resource_on_delete: Option<bool>,
1262}
1263
1264impl common::Part for FhirNotificationConfig {}
1265
1266/// Represents a FHIR store.
1267///
1268/// # Activities
1269///
1270/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1271/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1272///
1273/// * [locations datasets fhir stores create projects](ProjectLocationDatasetFhirStoreCreateCall) (request|response)
1274/// * [locations datasets fhir stores get projects](ProjectLocationDatasetFhirStoreGetCall) (response)
1275/// * [locations datasets fhir stores patch projects](ProjectLocationDatasetFhirStorePatchCall) (request|response)
1276#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1277#[serde_with::serde_as]
1278#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1279pub struct FhirStore {
1280 /// Enable parsing of references within complex FHIR data types such as Extensions. If this value is set to ENABLED, then features like referential integrity and Bundle reference rewriting apply to all references. If this flag has not been specified the behavior of the FHIR store will not change, references in complex data types will not be parsed. New stores will have this value set to ENABLED after a notification period. Warning: turning on this flag causes processing existing resources to fail if they contain references to non-existent resources.
1281 #[serde(rename = "complexDataTypeReferenceParsing")]
1282 pub complex_data_type_reference_parsing: Option<String>,
1283 /// If true, overrides the default search behavior for this FHIR store to `handling=strict` which returns an error for unrecognized search parameters. If false, uses the FHIR specification default `handling=lenient` which ignores unrecognized search parameters. The handling can always be changed from the default on an individual API call by setting the HTTP header `Prefer: handling=strict` or `Prefer: handling=lenient`.
1284 #[serde(rename = "defaultSearchHandlingStrict")]
1285 pub default_search_handling_strict: Option<bool>,
1286 /// Immutable. Whether to disable referential integrity in this FHIR store. This field is immutable after FHIR store creation. The default value is false, meaning that the API enforces referential integrity and fails the requests that result in inconsistent state in the FHIR store. When this field is set to true, the API skips referential integrity checks. Consequently, operations that rely on references, such as GetPatientEverything, do not return all the results if broken references exist.
1287 #[serde(rename = "disableReferentialIntegrity")]
1288 pub disable_referential_integrity: Option<bool>,
1289 /// Immutable. Whether to disable resource versioning for this FHIR store. This field can not be changed after the creation of FHIR store. If set to false, which is the default behavior, all write operations cause historical versions to be recorded automatically. The historical versions can be fetched through the history APIs, but cannot be updated. If set to true, no historical versions are kept. The server sends errors for attempts to read the historical versions.
1290 #[serde(rename = "disableResourceVersioning")]
1291 pub disable_resource_versioning: Option<bool>,
1292 /// Whether this FHIR store has the [updateCreate capability](https://www.hl7.org/fhir/capabilitystatement-definitions.html#CapabilityStatement.rest.resource.updateCreate). This determines if the client can use an Update operation to create a new resource with a client-specified ID. If false, all IDs are server-assigned through the Create operation and attempts to update a non-existent resource return errors. It is strongly advised not to include or encode any sensitive data such as patient identifiers in client-specified resource IDs. Those IDs are part of the FHIR resource path recorded in Cloud audit logs and Pub/Sub notifications. Those IDs can also be contained in reference fields within other resources.
1293 #[serde(rename = "enableUpdateCreate")]
1294 pub enable_update_create: Option<bool>,
1295 /// User-supplied key-value pairs used to organize FHIR stores. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: \p{Ll}\p{Lo}{0,62} Label values are optional, must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} No more than 64 labels can be associated with a given store.
1296 pub labels: Option<HashMap<String, String>>,
1297 /// Output only. Identifier. Resource name of the FHIR store, of the form `projects/{project_id}/locations/{location}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
1298 pub name: Option<String>,
1299 /// Deprecated. Use `notification_configs` instead. If non-empty, publish all resource modifications of this FHIR store to this destination. The Pub/Sub message attributes contain a map with a string describing the action that has triggered the notification. For example, "action":"CreateResource".
1300 #[serde(rename = "notificationConfig")]
1301 pub notification_config: Option<NotificationConfig>,
1302 /// Specifies where and whether to send notifications upon changes to a FHIR store.
1303 #[serde(rename = "notificationConfigs")]
1304 pub notification_configs: Option<Vec<FhirNotificationConfig>>,
1305 /// A list of streaming configs that configure the destinations of streaming export for every resource mutation in this FHIR store. Each store is allowed to have up to 10 streaming configs. After a new config is added, the next resource mutation is streamed to the new location in addition to the existing ones. When a location is removed from the list, the server stops streaming to that location. Before adding a new config, you must add the required [`bigquery.dataEditor`](https://cloud.google.com/bigquery/docs/access-control#bigquery.dataEditor) role to your project's **Cloud Healthcare Service Agent** [service account](https://cloud.google.com/iam/docs/service-accounts). Some lag (typically on the order of dozens of seconds) is expected before the results show up in the streaming destination.
1306 #[serde(rename = "streamConfigs")]
1307 pub stream_configs: Option<Vec<StreamConfig>>,
1308 /// Configuration for how to validate incoming FHIR resources against configured profiles.
1309 #[serde(rename = "validationConfig")]
1310 pub validation_config: Option<ValidationConfig>,
1311 /// Required. Immutable. The FHIR specification version that this FHIR store supports natively. This field is immutable after store creation. Requests are rejected if they contain FHIR resources of a different version. Version is required for every FHIR store.
1312 pub version: Option<String>,
1313}
1314
1315impl common::RequestValue for FhirStore {}
1316impl common::ResponseResult for FhirStore {}
1317
1318/// Count of resources and total storage size by type for a given FHIR store.
1319///
1320/// This type is not used in any activity, and only used as *part* of another schema.
1321///
1322#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1323#[serde_with::serde_as]
1324#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1325pub struct FhirStoreMetric {
1326 /// The total count of FHIR resources in the store of this resource type.
1327 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1328 pub count: Option<i64>,
1329 /// The FHIR resource type this metric applies to.
1330 #[serde(rename = "resourceType")]
1331 pub resource_type: Option<String>,
1332 /// The total amount of structured storage used by FHIR resources of this resource type in the store.
1333 #[serde(rename = "structuredStorageSizeBytes")]
1334 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1335 pub structured_storage_size_bytes: Option<i64>,
1336}
1337
1338impl common::Part for FhirStoreMetric {}
1339
1340/// List of metrics for a given FHIR store.
1341///
1342/// # Activities
1343///
1344/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1345/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1346///
1347/// * [locations datasets fhir stores get fhir store metrics projects](ProjectLocationDatasetFhirStoreGetFHIRStoreMetricCall) (response)
1348#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1349#[serde_with::serde_as]
1350#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1351pub struct FhirStoreMetrics {
1352 /// List of FhirStoreMetric by resource type.
1353 pub metrics: Option<Vec<FhirStoreMetric>>,
1354 /// The resource name of the FHIR store to get metrics for, in the format `projects/{project_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
1355 pub name: Option<String>,
1356}
1357
1358impl common::ResponseResult for FhirStoreMetrics {}
1359
1360/// A (sub) field of a type.
1361///
1362/// This type is not used in any activity, and only used as *part* of another schema.
1363///
1364#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1365#[serde_with::serde_as]
1366#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1367pub struct Field {
1368 /// The maximum number of times this field can be repeated. 0 or -1 means unbounded.
1369 #[serde(rename = "maxOccurs")]
1370 pub max_occurs: Option<i32>,
1371 /// The minimum number of times this field must be present/repeated.
1372 #[serde(rename = "minOccurs")]
1373 pub min_occurs: Option<i32>,
1374 /// The name of the field. For example, "PID-1" or just "1".
1375 pub name: Option<String>,
1376 /// The HL7v2 table this field refers to. For example, PID-15 (Patient's Primary Language) usually refers to table "0296".
1377 pub table: Option<String>,
1378 /// The type of this field. A Type with this name must be defined in an Hl7TypesConfig.
1379 #[serde(rename = "type")]
1380 pub type_: Option<String>,
1381}
1382
1383impl common::Part for Field {}
1384
1385/// Specifies FHIR paths to match, and how to handle de-identification of matching fields.
1386///
1387/// This type is not used in any activity, and only used as *part* of another schema.
1388///
1389#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1390#[serde_with::serde_as]
1391#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1392pub struct FieldMetadata {
1393 /// Deidentify action for one field.
1394 pub action: Option<String>,
1395 /// List of paths to FHIR fields to be redacted. Each path is a period-separated list where each component is either a field name or FHIR type name, for example: Patient, HumanName. For "choice" types (those defined in the FHIR spec with the form: field[x]) we use two separate components. For example, "deceasedAge.unit" is matched by "Deceased.Age.unit". Supported types are: AdministrativeGenderCode, Base64Binary, Boolean, Code, Date, DateTime, Decimal, HumanName, Id, Instant, Integer, LanguageCode, Markdown, Oid, PositiveInt, String, UnsignedInt, Uri, Uuid, Xhtml.
1396 pub paths: Option<Vec<String>>,
1397}
1398
1399impl common::Part for FieldMetadata {}
1400
1401/// The Cloud Storage output destination. The Cloud Healthcare Service Agent requires the `roles/storage.objectAdmin` Cloud IAM roles on the Cloud Storage location.
1402///
1403/// This type is not used in any activity, and only used as *part* of another schema.
1404///
1405#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1406#[serde_with::serde_as]
1407#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1408pub struct GcsDestination {
1409 /// The format of the exported HL7v2 message files.
1410 #[serde(rename = "contentStructure")]
1411 pub content_structure: Option<String>,
1412 /// Specifies the parts of the Message resource to include in the export. If not specified, FULL is used.
1413 #[serde(rename = "messageView")]
1414 pub message_view: Option<String>,
1415 /// URI of an existing Cloud Storage directory where the server writes result files, in the format `gs://{bucket-id}/{path/to/destination/dir}`. If there is no trailing slash, the service appends one when composing the object path.
1416 #[serde(rename = "uriPrefix")]
1417 pub uri_prefix: Option<String>,
1418}
1419
1420impl common::Part for GcsDestination {}
1421
1422/// Specifies the configuration for importing data from Cloud Storage.
1423///
1424/// This type is not used in any activity, and only used as *part* of another schema.
1425///
1426#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1427#[serde_with::serde_as]
1428#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1429pub struct GcsSource {
1430 /// Points to a Cloud Storage URI containing file(s) to import. The URI must be in the following format: `gs://{bucket_id}/{object_id}`. The URI can include wildcards in `object_id` and thus identify multiple files. Supported wildcards: * `*` to match 0 or more non-separator characters * `**` to match 0 or more characters (including separators). Must be used at the end of a path and with no other wildcards in the path. Can also be used with a file extension (such as .ndjson), which imports all files with the extension in the specified directory and its sub-directories. For example, `gs://my-bucket/my-directory/**.ndjson` imports all files with `.ndjson` extensions in `my-directory/` and its sub-directories. * `?` to match 1 character Files matching the wildcard are expected to contain content only, no metadata.
1431 pub uri: Option<String>,
1432}
1433
1434impl common::Part for GcsSource {}
1435
1436/// The Cloud Storage location for export.
1437///
1438/// This type is not used in any activity, and only used as *part* of another schema.
1439///
1440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1441#[serde_with::serde_as]
1442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1443pub struct GoogleCloudHealthcareV1ConsentGcsDestination {
1444 /// URI for a Cloud Storage directory where the server writes result files, in the format `gs://{bucket-id}/{path/to/destination/dir}`. If there is no trailing slash, the service appends one when composing the object path. The user is responsible for creating the Cloud Storage bucket and directory referenced in `uri_prefix`.
1445 #[serde(rename = "uriPrefix")]
1446 pub uri_prefix: Option<String>,
1447}
1448
1449impl common::Part for GoogleCloudHealthcareV1ConsentGcsDestination {}
1450
1451/// Represents a user's consent in terms of the resources that can be accessed and under what conditions.
1452///
1453/// This type is not used in any activity, and only used as *part* of another schema.
1454///
1455#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1456#[serde_with::serde_as]
1457#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1458pub struct GoogleCloudHealthcareV1ConsentPolicy {
1459 /// Required. The request conditions to meet to grant access. In addition to any supported comparison operators, authorization rules may have `IN` operator as well as at most 10 logical operators that are limited to `AND` (`&&`), `OR` (`||`).
1460 #[serde(rename = "authorizationRule")]
1461 pub authorization_rule: Option<Expr>,
1462 /// The resources that this policy applies to. A resource is a match if it matches all the attributes listed here. If empty, this policy applies to all User data mappings for the given user.
1463 #[serde(rename = "resourceAttributes")]
1464 pub resource_attributes: Option<Vec<Attribute>>,
1465}
1466
1467impl common::Part for GoogleCloudHealthcareV1ConsentPolicy {}
1468
1469/// The BigQuery table where the server writes the output.
1470///
1471/// This type is not used in any activity, and only used as *part* of another schema.
1472///
1473#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1474#[serde_with::serde_as]
1475#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1476pub struct GoogleCloudHealthcareV1DicomBigQueryDestination {
1477 /// Use `write_disposition` instead. If `write_disposition` is specified, this parameter is ignored. force=false is equivalent to write_disposition=WRITE_EMPTY and force=true is equivalent to write_disposition=WRITE_TRUNCATE.
1478 pub force: Option<bool>,
1479 /// BigQuery URI to a table, up to 2000 characters long, in the format `bq://projectId.bqDatasetId.tableId`
1480 #[serde(rename = "tableUri")]
1481 pub table_uri: Option<String>,
1482 /// Determines whether the existing table in the destination is to be overwritten or appended to. If a write_disposition is specified, the `force` parameter is ignored.
1483 #[serde(rename = "writeDisposition")]
1484 pub write_disposition: Option<String>,
1485}
1486
1487impl common::Part for GoogleCloudHealthcareV1DicomBigQueryDestination {}
1488
1489/// The Cloud Storage location where the server writes the output and the export configuration.
1490///
1491/// This type is not used in any activity, and only used as *part* of another schema.
1492///
1493#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1494#[serde_with::serde_as]
1495#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1496pub struct GoogleCloudHealthcareV1DicomGcsDestination {
1497 /// MIME types supported by DICOM spec. Each file is written in the following format: `.../{study_id}/{series_id}/{instance_id}[/{frame_number}].{extension}` The frame_number component exists only for multi-frame instances. Supported MIME types are consistent with supported formats in DICOMweb: https://cloud.google.com/healthcare/docs/dicom#retrieve_transaction. Specifically, the following are supported: - application/dicom; transfer-syntax=1.2.840.10008.1.2.1 (uncompressed DICOM) - application/dicom; transfer-syntax=1.2.840.10008.1.2.4.50 (DICOM with embedded JPEG Baseline) - application/dicom; transfer-syntax=1.2.840.10008.1.2.4.90 (DICOM with embedded JPEG 2000 Lossless Only) - application/dicom; transfer-syntax=1.2.840.10008.1.2.4.91 (DICOM with embedded JPEG 2000) - application/dicom; transfer-syntax=* (DICOM with no transcoding) - application/octet-stream; transfer-syntax=1.2.840.10008.1.2.1 (raw uncompressed PixelData) - application/octet-stream; transfer-syntax=* (raw PixelData in whatever format it was uploaded in) - image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.50 (Consumer JPEG) - image/png The following extensions are used for output files: - application/dicom -> .dcm - image/jpeg -> .jpg - image/png -> .png - application/octet-stream -> no extension If unspecified, the instances are exported in the original DICOM format they were uploaded in.
1498 #[serde(rename = "mimeType")]
1499 pub mime_type: Option<String>,
1500 /// The Cloud Storage destination to export to. URI for a Cloud Storage directory where the server writes the result files, in the format `gs://{bucket-id}/{path/to/destination/dir}`). If there is no trailing slash, the service appends one when composing the object path. The user is responsible for creating the Cloud Storage bucket referenced in `uri_prefix`.
1501 #[serde(rename = "uriPrefix")]
1502 pub uri_prefix: Option<String>,
1503}
1504
1505impl common::Part for GoogleCloudHealthcareV1DicomGcsDestination {}
1506
1507/// Specifies the configuration for importing data from Cloud Storage.
1508///
1509/// This type is not used in any activity, and only used as *part* of another schema.
1510///
1511#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1512#[serde_with::serde_as]
1513#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1514pub struct GoogleCloudHealthcareV1DicomGcsSource {
1515 /// Points to a Cloud Storage URI containing file(s) with content only. The URI must be in the following format: `gs://{bucket_id}/{object_id}`. The URI can include wildcards in `object_id` and thus identify multiple files. Supported wildcards: * '*' to match 0 or more non-separator characters * '**' to match 0 or more characters (including separators). Must be used at the end of a path and with no other wildcards in the path. Can also be used with a file extension (such as .dcm), which imports all files with the extension in the specified directory and its sub-directories. For example, `gs://my-bucket/my-directory/**.dcm` imports all files with .dcm extensions in `my-directory/` and its sub-directories. * '?' to match 1 character. All other URI formats are invalid. Files matching the wildcard are expected to contain content only, no metadata.
1516 pub uri: Option<String>,
1517}
1518
1519impl common::Part for GoogleCloudHealthcareV1DicomGcsSource {}
1520
1521/// StreamConfig specifies configuration for a streaming DICOM export.
1522///
1523/// This type is not used in any activity, and only used as *part* of another schema.
1524///
1525#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1526#[serde_with::serde_as]
1527#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1528pub struct GoogleCloudHealthcareV1DicomStreamConfig {
1529 /// Results are appended to this table. The server creates a new table in the given BigQuery dataset if the specified table does not exist. To enable the Cloud Healthcare API to write to your BigQuery table, you must give the Cloud Healthcare API service account the bigquery.dataEditor role. The service account is: `service-{PROJECT_NUMBER}@gcp-sa-healthcare.iam.gserviceaccount.com`. The PROJECT_NUMBER identifies the project that the DICOM store resides in. To get the project number, go to the Cloud Console Dashboard. It is recommended to not have a custom schema in the destination table which could conflict with the schema created by the Cloud Healthcare API. Instance deletions are not applied to the destination table. The destination's table schema will be automatically updated in case a new instance's data is incompatible with the current schema. The schema should not be updated manually as this can cause incompatibilies that cannot be resolved automatically. One resolution in this case is to delete the incompatible table and let the server recreate one, though the newly created table only contains data after the table recreation. BigQuery imposes a 1 MB limit on streaming insert row size, therefore any instance that generates more than 1 MB of BigQuery data will not be streamed. If an instance cannot be streamed to BigQuery, errors will be logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).
1530 #[serde(rename = "bigqueryDestination")]
1531 pub bigquery_destination: Option<GoogleCloudHealthcareV1DicomBigQueryDestination>,
1532}
1533
1534impl common::Part for GoogleCloudHealthcareV1DicomStreamConfig {}
1535
1536/// The configuration for exporting to BigQuery.
1537///
1538/// This type is not used in any activity, and only used as *part* of another schema.
1539///
1540#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1541#[serde_with::serde_as]
1542#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1543pub struct GoogleCloudHealthcareV1FhirBigQueryDestination {
1544 /// BigQuery URI to an existing dataset, up to 2000 characters long, in the format `bq://projectId.bqDatasetId`.
1545 #[serde(rename = "datasetUri")]
1546 pub dataset_uri: Option<String>,
1547 /// If this flag is `TRUE`, all tables are deleted from the dataset before the new exported tables are written. If the flag is not set and the destination dataset contains tables, the export call returns an error. If `write_disposition` is specified, this parameter is ignored. force=false is equivalent to write_disposition=WRITE_EMPTY and force=true is equivalent to write_disposition=WRITE_TRUNCATE.
1548 pub force: Option<bool>,
1549 /// The configuration for the exported BigQuery schema.
1550 #[serde(rename = "schemaConfig")]
1551 pub schema_config: Option<SchemaConfig>,
1552 /// Determines if existing data in the destination dataset is overwritten, appended to, or not written if the tables contain data. If a write_disposition is specified, the `force` parameter is ignored.
1553 #[serde(rename = "writeDisposition")]
1554 pub write_disposition: Option<String>,
1555}
1556
1557impl common::Part for GoogleCloudHealthcareV1FhirBigQueryDestination {}
1558
1559/// The configuration for exporting to Cloud Storage.
1560///
1561/// This type is not used in any activity, and only used as *part* of another schema.
1562///
1563#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1564#[serde_with::serde_as]
1565#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1566pub struct GoogleCloudHealthcareV1FhirGcsDestination {
1567 /// URI for a Cloud Storage directory where result files should be written, in the format of `gs://{bucket-id}/{path/to/destination/dir}`. If there is no trailing slash, the service appends one when composing the object path. The user is responsible for creating the Cloud Storage bucket referenced in `uri_prefix`.
1568 #[serde(rename = "uriPrefix")]
1569 pub uri_prefix: Option<String>,
1570}
1571
1572impl common::Part for GoogleCloudHealthcareV1FhirGcsDestination {}
1573
1574/// Specifies the configuration for importing data from Cloud Storage.
1575///
1576/// This type is not used in any activity, and only used as *part* of another schema.
1577///
1578#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1579#[serde_with::serde_as]
1580#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1581pub struct GoogleCloudHealthcareV1FhirGcsSource {
1582 /// Points to a Cloud Storage URI containing file(s) to import. The URI must be in the following format: `gs://{bucket_id}/{object_id}`. The URI can include wildcards in `object_id` and thus identify multiple files. Supported wildcards: * `*` to match 0 or more non-separator characters * `**` to match 0 or more characters (including separators). Must be used at the end of a path and with no other wildcards in the path. Can also be used with a file extension (such as .ndjson), which imports all files with the extension in the specified directory and its sub-directories. For example, `gs://my-bucket/my-directory/**.ndjson` imports all files with `.ndjson` extensions in `my-directory/` and its sub-directories. * `?` to match 1 character Files matching the wildcard are expected to contain content only, no metadata.
1583 pub uri: Option<String>,
1584}
1585
1586impl common::Part for GoogleCloudHealthcareV1FhirGcsSource {}
1587
1588/// Construct representing a logical group or a segment.
1589///
1590/// This type is not used in any activity, and only used as *part* of another schema.
1591///
1592#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1593#[serde_with::serde_as]
1594#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1595pub struct GroupOrSegment {
1596 /// no description provided
1597 pub group: Option<SchemaGroup>,
1598 /// no description provided
1599 pub segment: Option<SchemaSegment>,
1600}
1601
1602impl common::Part for GroupOrSegment {}
1603
1604/// Root config message for HL7v2 schema. This contains a schema structure of groups and segments, and filters that determine which messages to apply the schema structure to.
1605///
1606/// This type is not used in any activity, and only used as *part* of another schema.
1607///
1608#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1609#[serde_with::serde_as]
1610#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1611pub struct Hl7SchemaConfig {
1612 /// Map from each HL7v2 message type and trigger event pair, such as ADT_A04, to its schema configuration root group.
1613 #[serde(rename = "messageSchemaConfigs")]
1614 pub message_schema_configs: Option<HashMap<String, SchemaGroup>>,
1615 /// Each VersionSource is tested and only if they all match is the schema used for the message.
1616 pub version: Option<Vec<VersionSource>>,
1617}
1618
1619impl common::Part for Hl7SchemaConfig {}
1620
1621/// Root config for HL7v2 datatype definitions for a specific HL7v2 version.
1622///
1623/// This type is not used in any activity, and only used as *part* of another schema.
1624///
1625#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1626#[serde_with::serde_as]
1627#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1628pub struct Hl7TypesConfig {
1629 /// The HL7v2 type definitions.
1630 #[serde(rename = "type")]
1631 pub type_: Option<Vec<Type>>,
1632 /// The version selectors that this config applies to. A message must match ALL version sources to apply.
1633 pub version: Option<Vec<VersionSource>>,
1634}
1635
1636impl common::Part for Hl7TypesConfig {}
1637
1638/// Specifies where and whether to send notifications upon changes to a data store.
1639///
1640/// This type is not used in any activity, and only used as *part* of another schema.
1641///
1642#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1643#[serde_with::serde_as]
1644#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1645pub struct Hl7V2NotificationConfig {
1646 /// Restricts notifications sent for messages matching a filter. If this is empty, all messages are matched. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. The following fields and functions are available for filtering: * `message_type`, from the MSH-9.1 field. For example, `NOT message_type = "ADT"`. * `send_date` or `sendDate`, the YYYY-MM-DD date the message was sent in the dataset's time_zone, from the MSH-7 segment. For example, `send_date < "2017-01-02"`. * `send_time`, the timestamp when the message was sent, using the RFC3339 time format for comparisons, from the MSH-7 segment. For example, `send_time < "2017-01-02T00:00:00-05:00"`. * `create_time`, the timestamp when the message was created in the HL7v2 store. Use the RFC3339 time format for comparisons. For example, `create_time < "2017-01-02T00:00:00-05:00"`. * `send_facility`, the care center that the message came from, from the MSH-4 segment. For example, `send_facility = "ABC"`. * `PatientId(value, type)`, which matches if the message lists a patient having an ID of the given value and type in the PID-2, PID-3, or PID-4 segments. For example, `PatientId("123456", "MRN")`. * `labels.x`, a string value of the label with key `x` as set using the Message.labels map. For example, `labels."priority"="high"`. The operator `:*` can be used to assert the existence of a label. For example, `labels."priority":*`.
1647 pub filter: Option<String>,
1648 /// The [Pub/Sub](https://cloud.google.com/pubsub/docs/) topic that notifications of changes are published on. Supplied by the client. The notification is a `PubsubMessage` with the following fields: * `PubsubMessage.Data` contains the resource name. * `PubsubMessage.MessageId` is the ID of this notification. It's guaranteed to be unique within the topic. * `PubsubMessage.PublishTime` is the time when the message was published. Note that notifications are only sent if the topic is non-empty. [Topic names](https://cloud.google.com/pubsub/docs/overview#names) must be scoped to a project. The Cloud Healthcare API service account, service-PROJECT_NUMBER@gcp-sa-healthcare.iam.gserviceaccount.com, must have publisher permissions on the given Pub/Sub topic. Not having adequate permissions causes the calls that send notifications to fail. If a notification cannot be published to Pub/Sub, errors are logged to Cloud Logging. For more information, see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).
1649 #[serde(rename = "pubsubTopic")]
1650 pub pubsub_topic: Option<String>,
1651}
1652
1653impl common::Part for Hl7V2NotificationConfig {}
1654
1655/// Represents an HL7v2 store.
1656///
1657/// # Activities
1658///
1659/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1660/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1661///
1662/// * [locations datasets hl7 v2 stores create projects](ProjectLocationDatasetHl7V2StoreCreateCall) (request|response)
1663/// * [locations datasets hl7 v2 stores get projects](ProjectLocationDatasetHl7V2StoreGetCall) (response)
1664/// * [locations datasets hl7 v2 stores patch projects](ProjectLocationDatasetHl7V2StorePatchCall) (request|response)
1665#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1666#[serde_with::serde_as]
1667#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1668pub struct Hl7V2Store {
1669 /// User-supplied key-value pairs used to organize HL7v2 stores. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: \p{Ll}\p{Lo}{0,62} Label values are optional, must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} No more than 64 labels can be associated with a given store.
1670 pub labels: Option<HashMap<String, String>>,
1671 /// Identifier. Resource name of the HL7v2 store, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7V2Stores/{hl7v2_store_id}`.
1672 pub name: Option<String>,
1673 /// A list of notification configs. Each configuration uses a filter to determine whether to publish a message (both Ingest & Create) on the corresponding notification destination. Only the message name is sent as part of the notification. Supplied by the client.
1674 #[serde(rename = "notificationConfigs")]
1675 pub notification_configs: Option<Vec<Hl7V2NotificationConfig>>,
1676 /// The configuration for the parser. It determines how the server parses the messages.
1677 #[serde(rename = "parserConfig")]
1678 pub parser_config: Option<ParserConfig>,
1679 /// Determines whether to reject duplicate messages. A duplicate message is a message with the same raw bytes as a message that has already been ingested/created in this HL7v2 store. The default value is false, meaning that the store accepts the duplicate messages and it also returns the same ACK message in the IngestMessageResponse as has been returned previously. Note that only one resource is created in the store. When this field is set to true, CreateMessage/IngestMessage requests with a duplicate message will be rejected by the store, and IngestMessageErrorDetail returns a NACK message upon rejection.
1680 #[serde(rename = "rejectDuplicateMessage")]
1681 pub reject_duplicate_message: Option<bool>,
1682}
1683
1684impl common::RequestValue for Hl7V2Store {}
1685impl common::ResponseResult for Hl7V2Store {}
1686
1687/// Count of messages and total storage size by type for a given HL7 store.
1688///
1689/// This type is not used in any activity, and only used as *part* of another schema.
1690///
1691#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1692#[serde_with::serde_as]
1693#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1694pub struct Hl7V2StoreMetric {
1695 /// The total count of HL7v2 messages in the store for the given message type.
1696 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1697 pub count: Option<i64>,
1698 /// The Hl7v2 message type this metric applies to, such as `ADT` or `ORU`.
1699 #[serde(rename = "messageType")]
1700 pub message_type: Option<String>,
1701 /// The total amount of structured storage used by HL7v2 messages of this message type in the store.
1702 #[serde(rename = "structuredStorageSizeBytes")]
1703 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1704 pub structured_storage_size_bytes: Option<i64>,
1705}
1706
1707impl common::Part for Hl7V2StoreMetric {}
1708
1709/// List of metrics for a given HL7v2 store.
1710///
1711/// # Activities
1712///
1713/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1714/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1715///
1716/// * [locations datasets hl7 v2 stores get hl7v2 store metrics projects](ProjectLocationDatasetHl7V2StoreGetHL7v2StoreMetricCall) (response)
1717#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1718#[serde_with::serde_as]
1719#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1720pub struct Hl7V2StoreMetrics {
1721 /// List of HL7v2 store metrics by message type.
1722 pub metrics: Option<Vec<Hl7V2StoreMetric>>,
1723 /// The resource name of the HL7v2 store to get metrics for, in the format `projects/{project_id}/datasets/{dataset_id}/hl7V2Stores/{hl7v2_store_id}`.
1724 pub name: Option<String>,
1725}
1726
1727impl common::ResponseResult for Hl7V2StoreMetrics {}
1728
1729/// Message that represents an arbitrary HTTP body. It should only be used for payload formats that can’t be represented as JSON, such as raw binary or an HTML page. This message can be used both in streaming and non-streaming API methods in the request as well as the response. It can be used as a top-level request field, which is convenient if one wants to extract parameters from either the URL or HTTP template into the request fields and also want access to the raw HTTP body. Example: message GetResourceRequest { // A unique request id. string request_id = 1; // The raw HTTP body is bound to this field. google.api.HttpBody http_body = 2; } service ResourceService { rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); rpc UpdateResource(google.api.HttpBody) returns (google.protobuf.Empty); } Example with streaming methods: service CaldavService { rpc GetCalendar(stream google.api.HttpBody) returns (stream google.api.HttpBody); rpc UpdateCalendar(stream google.api.HttpBody) returns (stream google.api.HttpBody); } Use of this type only changes how the request and response bodies are handled, all other features will continue to work unchanged.
1730///
1731/// # Activities
1732///
1733/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1734/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1735///
1736/// * [locations datasets dicom stores studies series instances frames retrieve frames projects](ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveFrameCall) (response)
1737/// * [locations datasets dicom stores studies series instances frames retrieve rendered projects](ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveRenderedCall) (response)
1738/// * [locations datasets dicom stores studies series instances retrieve instance projects](ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveInstanceCall) (response)
1739/// * [locations datasets dicom stores studies series instances retrieve metadata projects](ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveMetadataCall) (response)
1740/// * [locations datasets dicom stores studies series instances retrieve rendered projects](ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveRenderedCall) (response)
1741/// * [locations datasets dicom stores studies series retrieve metadata projects](ProjectLocationDatasetDicomStoreStudySeriesRetrieveMetadataCall) (response)
1742/// * [locations datasets dicom stores studies series retrieve series projects](ProjectLocationDatasetDicomStoreStudySeriesRetrieveSeryCall) (response)
1743/// * [locations datasets dicom stores studies series search for instances projects](ProjectLocationDatasetDicomStoreStudySeriesSearchForInstanceCall) (response)
1744/// * [locations datasets dicom stores studies retrieve metadata projects](ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall) (response)
1745/// * [locations datasets dicom stores studies retrieve study projects](ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall) (response)
1746/// * [locations datasets dicom stores studies search for instances projects](ProjectLocationDatasetDicomStoreStudySearchForInstanceCall) (response)
1747/// * [locations datasets dicom stores studies search for series projects](ProjectLocationDatasetDicomStoreStudySearchForSeryCall) (response)
1748/// * [locations datasets dicom stores studies store instances projects](ProjectLocationDatasetDicomStoreStudyStoreInstanceCall) (request|response)
1749/// * [locations datasets dicom stores search for instances projects](ProjectLocationDatasetDicomStoreSearchForInstanceCall) (response)
1750/// * [locations datasets dicom stores search for series projects](ProjectLocationDatasetDicomStoreSearchForSeryCall) (response)
1751/// * [locations datasets dicom stores search for studies projects](ProjectLocationDatasetDicomStoreSearchForStudyCall) (response)
1752/// * [locations datasets dicom stores store instances projects](ProjectLocationDatasetDicomStoreStoreInstanceCall) (request|response)
1753/// * [locations datasets fhir stores fhir patient-everything projects](ProjectLocationDatasetFhirStoreFhirPatientEverythingCall) (response)
1754/// * [locations datasets fhir stores fhir resource-validate projects](ProjectLocationDatasetFhirStoreFhirResourceValidateCall) (request|response)
1755/// * [locations datasets fhir stores fhir capabilities projects](ProjectLocationDatasetFhirStoreFhirCapabilityCall) (response)
1756/// * [locations datasets fhir stores fhir conditional patch projects](ProjectLocationDatasetFhirStoreFhirConditionalPatchCall) (request|response)
1757/// * [locations datasets fhir stores fhir conditional update projects](ProjectLocationDatasetFhirStoreFhirConditionalUpdateCall) (request|response)
1758/// * [locations datasets fhir stores fhir create projects](ProjectLocationDatasetFhirStoreFhirCreateCall) (request|response)
1759/// * [locations datasets fhir stores fhir delete projects](ProjectLocationDatasetFhirStoreFhirDeleteCall) (response)
1760/// * [locations datasets fhir stores fhir execute bundle projects](ProjectLocationDatasetFhirStoreFhirExecuteBundleCall) (request|response)
1761/// * [locations datasets fhir stores fhir history projects](ProjectLocationDatasetFhirStoreFhirHistoryCall) (response)
1762/// * [locations datasets fhir stores fhir patch projects](ProjectLocationDatasetFhirStoreFhirPatchCall) (request|response)
1763/// * [locations datasets fhir stores fhir read projects](ProjectLocationDatasetFhirStoreFhirReadCall) (response)
1764/// * [locations datasets fhir stores fhir search projects](ProjectLocationDatasetFhirStoreFhirSearchCall) (response)
1765/// * [locations datasets fhir stores fhir search-type projects](ProjectLocationDatasetFhirStoreFhirSearchTypeCall) (response)
1766/// * [locations datasets fhir stores fhir update projects](ProjectLocationDatasetFhirStoreFhirUpdateCall) (request|response)
1767/// * [locations datasets fhir stores fhir vread projects](ProjectLocationDatasetFhirStoreFhirVreadCall) (response)
1768#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1769#[serde_with::serde_as]
1770#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1771pub struct HttpBody {
1772 /// The HTTP Content-Type header value specifying the content type of the body.
1773 #[serde(rename = "contentType")]
1774 pub content_type: Option<String>,
1775 /// The HTTP request/response body as raw binary.
1776 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1777 pub data: Option<Vec<u8>>,
1778 /// Application specific response metadata. Must be set in the first response for streaming APIs.
1779 pub extensions: Option<Vec<HashMap<String, serde_json::Value>>>,
1780}
1781
1782impl common::RequestValue for HttpBody {}
1783impl common::ResponseResult for HttpBody {}
1784
1785/// Raw bytes representing consent artifact content.
1786///
1787/// This type is not used in any activity, and only used as *part* of another schema.
1788///
1789#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1790#[serde_with::serde_as]
1791#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1792pub struct Image {
1793 /// Input only. Points to a Cloud Storage URI containing the consent artifact content. The URI must be in the following format: `gs://{bucket_id}/{object_id}`. The Cloud Healthcare API service account must have the `roles/storage.objectViewer` Cloud IAM role for this Cloud Storage location. The consent artifact content at this URI is copied to a Cloud Storage location managed by the Cloud Healthcare API. Responses to fetching requests return the consent artifact content in raw_bytes.
1794 #[serde(rename = "gcsUri")]
1795 pub gcs_uri: Option<String>,
1796 /// Consent artifact content represented as a stream of bytes. This field is populated when returned in GetConsentArtifact response, but not included in CreateConsentArtifact and ListConsentArtifact response.
1797 #[serde(rename = "rawBytes")]
1798 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1799 pub raw_bytes: Option<Vec<u8>>,
1800}
1801
1802impl common::Part for Image {}
1803
1804/// Specifies how to handle de-identification of image pixels.
1805///
1806/// This type is not used in any activity, and only used as *part* of another schema.
1807///
1808#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1809#[serde_with::serde_as]
1810#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1811pub struct ImageConfig {
1812 /// Determines how to redact text from image.
1813 #[serde(rename = "textRedactionMode")]
1814 pub text_redaction_mode: Option<String>,
1815}
1816
1817impl common::Part for ImageConfig {}
1818
1819/// Imports data into the specified DICOM store. Returns an error if any of the files to import are not DICOM files. This API accepts duplicate DICOM instances by ignoring the newly-pushed instance. It does not overwrite.
1820///
1821/// # Activities
1822///
1823/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1824/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1825///
1826/// * [locations datasets dicom stores import projects](ProjectLocationDatasetDicomStoreImportCall) (request)
1827#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1828#[serde_with::serde_as]
1829#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1830pub struct ImportDicomDataRequest {
1831 /// Cloud Storage source data location and import configuration. The Cloud Healthcare Service Agent requires the `roles/storage.objectViewer` Cloud IAM roles on the Cloud Storage location.
1832 #[serde(rename = "gcsSource")]
1833 pub gcs_source: Option<GoogleCloudHealthcareV1DicomGcsSource>,
1834}
1835
1836impl common::RequestValue for ImportDicomDataRequest {}
1837
1838/// Request to import messages.
1839///
1840/// # Activities
1841///
1842/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1843/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1844///
1845/// * [locations datasets hl7 v2 stores import projects](ProjectLocationDatasetHl7V2StoreImportCall) (request)
1846#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1847#[serde_with::serde_as]
1848#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1849pub struct ImportMessagesRequest {
1850 /// Cloud Storage source data location and import configuration. The Cloud Healthcare Service Agent requires the `roles/storage.objectViewer` Cloud IAM roles on the Cloud Storage location.
1851 #[serde(rename = "gcsSource")]
1852 pub gcs_source: Option<GcsSource>,
1853}
1854
1855impl common::RequestValue for ImportMessagesRequest {}
1856
1857/// Request to import resources.
1858///
1859/// # Activities
1860///
1861/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1862/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1863///
1864/// * [locations datasets fhir stores import projects](ProjectLocationDatasetFhirStoreImportCall) (request)
1865#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1866#[serde_with::serde_as]
1867#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1868pub struct ImportResourcesRequest {
1869 /// The content structure in the source location. If not specified, the server treats the input source files as BUNDLE.
1870 #[serde(rename = "contentStructure")]
1871 pub content_structure: Option<String>,
1872 /// Cloud Storage source data location and import configuration. The Healthcare Service Agent account requires the `roles/storage.objectAdmin` role on the Cloud Storage location. Each Cloud Storage object should be a text file that contains the format specified in ContentStructure.
1873 #[serde(rename = "gcsSource")]
1874 pub gcs_source: Option<GoogleCloudHealthcareV1FhirGcsSource>,
1875}
1876
1877impl common::RequestValue for ImportResourcesRequest {}
1878
1879/// A transformation to apply to text that is identified as a specific info_type.
1880///
1881/// This type is not used in any activity, and only used as *part* of another schema.
1882///
1883#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1884#[serde_with::serde_as]
1885#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1886pub struct InfoTypeTransformation {
1887 /// Config for character mask.
1888 #[serde(rename = "characterMaskConfig")]
1889 pub character_mask_config: Option<CharacterMaskConfig>,
1890 /// Config for crypto hash.
1891 #[serde(rename = "cryptoHashConfig")]
1892 pub crypto_hash_config: Option<CryptoHashConfig>,
1893 /// Config for date shift.
1894 #[serde(rename = "dateShiftConfig")]
1895 pub date_shift_config: Option<DateShiftConfig>,
1896 /// InfoTypes to apply this transformation to. If this is not specified, the transformation applies to any info_type.
1897 #[serde(rename = "infoTypes")]
1898 pub info_types: Option<Vec<String>>,
1899 /// Config for text redaction.
1900 #[serde(rename = "redactConfig")]
1901 pub redact_config: Option<RedactConfig>,
1902 /// Config for replace with InfoType.
1903 #[serde(rename = "replaceWithInfoTypeConfig")]
1904 pub replace_with_info_type_config: Option<ReplaceWithInfoTypeConfig>,
1905}
1906
1907impl common::Part for InfoTypeTransformation {}
1908
1909/// Ingests a message into the specified HL7v2 store.
1910///
1911/// # Activities
1912///
1913/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1914/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1915///
1916/// * [locations datasets hl7 v2 stores messages ingest projects](ProjectLocationDatasetHl7V2StoreMessageIngestCall) (request)
1917#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1918#[serde_with::serde_as]
1919#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1920pub struct IngestMessageRequest {
1921 /// Required. HL7v2 message to ingest.
1922 pub message: Option<Message>,
1923}
1924
1925impl common::RequestValue for IngestMessageRequest {}
1926
1927/// Acknowledges that a message has been ingested into the specified HL7v2 store.
1928///
1929/// # Activities
1930///
1931/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1932/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1933///
1934/// * [locations datasets hl7 v2 stores messages ingest projects](ProjectLocationDatasetHl7V2StoreMessageIngestCall) (response)
1935#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1936#[serde_with::serde_as]
1937#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1938pub struct IngestMessageResponse {
1939 /// HL7v2 ACK message.
1940 #[serde(rename = "hl7Ack")]
1941 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1942 pub hl7_ack: Option<Vec<u8>>,
1943 /// Created message resource.
1944 pub message: Option<Message>,
1945}
1946
1947impl common::ResponseResult for IngestMessageResponse {}
1948
1949/// Include to use an existing data crypto key wrapped by KMS. The wrapped key must be a 128-, 192-, or 256-bit key. The key must grant the Cloud IAM permission `cloudkms.cryptoKeyVersions.useToDecrypt` to the project's Cloud Healthcare Service Agent service account. For more information, see [Creating a wrapped key] (https://cloud.google.com/dlp/docs/create-wrapped-key).
1950///
1951/// This type is not used in any activity, and only used as *part* of another schema.
1952///
1953#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1954#[serde_with::serde_as]
1955#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1956pub struct KmsWrappedCryptoKey {
1957 /// Required. The resource name of the KMS CryptoKey to use for unwrapping. For example, `projects/{project_id}/locations/{location_id}/keyRings/{keyring}/cryptoKeys/{key}`.
1958 #[serde(rename = "cryptoKey")]
1959 pub crypto_key: Option<String>,
1960 /// Required. The wrapped data crypto key.
1961 #[serde(rename = "wrappedKey")]
1962 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1963 pub wrapped_key: Option<Vec<u8>>,
1964}
1965
1966impl common::Part for KmsWrappedCryptoKey {}
1967
1968/// EntityMentions can be linked to multiple entities using a LinkedEntity message lets us add other fields, e.g. confidence.
1969///
1970/// This type is not used in any activity, and only used as *part* of another schema.
1971///
1972#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1973#[serde_with::serde_as]
1974#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1975pub struct LinkedEntity {
1976 /// entity_id is a concept unique identifier. These are prefixed by a string that identifies the entity coding system, followed by the unique identifier within that system. For example, "UMLS/C0000970". This also supports ad hoc entities, which are formed by normalizing entity mention content.
1977 #[serde(rename = "entityId")]
1978 pub entity_id: Option<String>,
1979}
1980
1981impl common::Part for LinkedEntity {}
1982
1983/// There is no detailed description.
1984///
1985/// # Activities
1986///
1987/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1988/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1989///
1990/// * [locations datasets consent stores attribute definitions list projects](ProjectLocationDatasetConsentStoreAttributeDefinitionListCall) (response)
1991#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1992#[serde_with::serde_as]
1993#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1994pub struct ListAttributeDefinitionsResponse {
1995 /// The returned Attribute definitions. The maximum number of attributes returned is determined by the value of page_size in the ListAttributeDefinitionsRequest.
1996 #[serde(rename = "attributeDefinitions")]
1997 pub attribute_definitions: Option<Vec<AttributeDefinition>>,
1998 /// Token to retrieve the next page of results, or empty if there are no more results in the list.
1999 #[serde(rename = "nextPageToken")]
2000 pub next_page_token: Option<String>,
2001}
2002
2003impl common::ResponseResult for ListAttributeDefinitionsResponse {}
2004
2005/// There is no detailed description.
2006///
2007/// # Activities
2008///
2009/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2010/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2011///
2012/// * [locations datasets consent stores consent artifacts list projects](ProjectLocationDatasetConsentStoreConsentArtifactListCall) (response)
2013#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2014#[serde_with::serde_as]
2015#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2016pub struct ListConsentArtifactsResponse {
2017 /// The returned Consent artifacts. The maximum number of artifacts returned is determined by the value of page_size in the ListConsentArtifactsRequest.
2018 #[serde(rename = "consentArtifacts")]
2019 pub consent_artifacts: Option<Vec<ConsentArtifact>>,
2020 /// Token to retrieve the next page of results, or empty if there are no more results in the list.
2021 #[serde(rename = "nextPageToken")]
2022 pub next_page_token: Option<String>,
2023}
2024
2025impl common::ResponseResult for ListConsentArtifactsResponse {}
2026
2027/// There is no detailed description.
2028///
2029/// # Activities
2030///
2031/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2032/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2033///
2034/// * [locations datasets consent stores consents list revisions projects](ProjectLocationDatasetConsentStoreConsentListRevisionCall) (response)
2035#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2036#[serde_with::serde_as]
2037#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2038pub struct ListConsentRevisionsResponse {
2039 /// The returned Consent revisions. The maximum number of revisions returned is determined by the value of `page_size` in the ListConsentRevisionsRequest.
2040 pub consents: Option<Vec<Consent>>,
2041 /// Token to retrieve the next page of results, or empty if there are no more results in the list.
2042 #[serde(rename = "nextPageToken")]
2043 pub next_page_token: Option<String>,
2044}
2045
2046impl common::ResponseResult for ListConsentRevisionsResponse {}
2047
2048/// There is no detailed description.
2049///
2050/// # Activities
2051///
2052/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2053/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2054///
2055/// * [locations datasets consent stores list projects](ProjectLocationDatasetConsentStoreListCall) (response)
2056#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2057#[serde_with::serde_as]
2058#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2059pub struct ListConsentStoresResponse {
2060 /// The returned consent stores. The maximum number of stores returned is determined by the value of page_size in the ListConsentStoresRequest.
2061 #[serde(rename = "consentStores")]
2062 pub consent_stores: Option<Vec<ConsentStore>>,
2063 /// Token to retrieve the next page of results, or empty if there are no more results in the list.
2064 #[serde(rename = "nextPageToken")]
2065 pub next_page_token: Option<String>,
2066}
2067
2068impl common::ResponseResult for ListConsentStoresResponse {}
2069
2070/// There is no detailed description.
2071///
2072/// # Activities
2073///
2074/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2075/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2076///
2077/// * [locations datasets consent stores consents list projects](ProjectLocationDatasetConsentStoreConsentListCall) (response)
2078#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2079#[serde_with::serde_as]
2080#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2081pub struct ListConsentsResponse {
2082 /// The returned Consents. The maximum number of Consents returned is determined by the value of page_size in the ListConsentsRequest.
2083 pub consents: Option<Vec<Consent>>,
2084 /// Token to retrieve the next page of results, or empty if there are no more results in the list.
2085 #[serde(rename = "nextPageToken")]
2086 pub next_page_token: Option<String>,
2087}
2088
2089impl common::ResponseResult for ListConsentsResponse {}
2090
2091/// Lists the available datasets.
2092///
2093/// # Activities
2094///
2095/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2096/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2097///
2098/// * [locations datasets list projects](ProjectLocationDatasetListCall) (response)
2099#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2100#[serde_with::serde_as]
2101#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2102pub struct ListDatasetsResponse {
2103 /// The first page of datasets.
2104 pub datasets: Option<Vec<Dataset>>,
2105 /// Token to retrieve the next page of results, or empty if there are no more results in the list.
2106 #[serde(rename = "nextPageToken")]
2107 pub next_page_token: Option<String>,
2108}
2109
2110impl common::ResponseResult for ListDatasetsResponse {}
2111
2112/// Lists the DICOM stores in the given dataset.
2113///
2114/// # Activities
2115///
2116/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2117/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2118///
2119/// * [locations datasets dicom stores list projects](ProjectLocationDatasetDicomStoreListCall) (response)
2120#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2121#[serde_with::serde_as]
2122#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2123pub struct ListDicomStoresResponse {
2124 /// The returned DICOM stores. Won't be more DICOM stores than the value of page_size in the request.
2125 #[serde(rename = "dicomStores")]
2126 pub dicom_stores: Option<Vec<DicomStore>>,
2127 /// Token to retrieve the next page of results or empty if there are no more results in the list.
2128 #[serde(rename = "nextPageToken")]
2129 pub next_page_token: Option<String>,
2130}
2131
2132impl common::ResponseResult for ListDicomStoresResponse {}
2133
2134/// Lists the FHIR stores in the given dataset.
2135///
2136/// # Activities
2137///
2138/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2139/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2140///
2141/// * [locations datasets fhir stores list projects](ProjectLocationDatasetFhirStoreListCall) (response)
2142#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2143#[serde_with::serde_as]
2144#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2145pub struct ListFhirStoresResponse {
2146 /// The returned FHIR stores. Won't be more FHIR stores than the value of page_size in the request.
2147 #[serde(rename = "fhirStores")]
2148 pub fhir_stores: Option<Vec<FhirStore>>,
2149 /// Token to retrieve the next page of results or empty if there are no more results in the list.
2150 #[serde(rename = "nextPageToken")]
2151 pub next_page_token: Option<String>,
2152}
2153
2154impl common::ResponseResult for ListFhirStoresResponse {}
2155
2156/// Lists the HL7v2 stores in the given dataset.
2157///
2158/// # Activities
2159///
2160/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2161/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2162///
2163/// * [locations datasets hl7 v2 stores list projects](ProjectLocationDatasetHl7V2StoreListCall) (response)
2164#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2165#[serde_with::serde_as]
2166#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2167pub struct ListHl7V2StoresResponse {
2168 /// The returned HL7v2 stores. Won't be more HL7v2 stores than the value of page_size in the request.
2169 #[serde(rename = "hl7V2Stores")]
2170 pub hl7_v2_stores: Option<Vec<Hl7V2Store>>,
2171 /// Token to retrieve the next page of results or empty if there are no more results in the list.
2172 #[serde(rename = "nextPageToken")]
2173 pub next_page_token: Option<String>,
2174}
2175
2176impl common::ResponseResult for ListHl7V2StoresResponse {}
2177
2178/// The response message for Locations.ListLocations.
2179///
2180/// # Activities
2181///
2182/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2183/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2184///
2185/// * [locations list projects](ProjectLocationListCall) (response)
2186#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2187#[serde_with::serde_as]
2188#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2189pub struct ListLocationsResponse {
2190 /// A list of locations that matches the specified filter in the request.
2191 pub locations: Option<Vec<Location>>,
2192 /// The standard List next-page token.
2193 #[serde(rename = "nextPageToken")]
2194 pub next_page_token: Option<String>,
2195}
2196
2197impl common::ResponseResult for ListLocationsResponse {}
2198
2199/// Lists the messages in the specified HL7v2 store.
2200///
2201/// # Activities
2202///
2203/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2204/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2205///
2206/// * [locations datasets hl7 v2 stores messages list projects](ProjectLocationDatasetHl7V2StoreMessageListCall) (response)
2207#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2208#[serde_with::serde_as]
2209#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2210pub struct ListMessagesResponse {
2211 /// The returned Messages. Won't be more Messages than the value of page_size in the request. See view for populated fields.
2212 #[serde(rename = "hl7V2Messages")]
2213 pub hl7_v2_messages: Option<Vec<Message>>,
2214 /// Token to retrieve the next page of results or empty if there are no more results in the list.
2215 #[serde(rename = "nextPageToken")]
2216 pub next_page_token: Option<String>,
2217}
2218
2219impl common::ResponseResult for ListMessagesResponse {}
2220
2221/// The response message for Operations.ListOperations.
2222///
2223/// # Activities
2224///
2225/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2226/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2227///
2228/// * [locations datasets operations list projects](ProjectLocationDatasetOperationListCall) (response)
2229#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2230#[serde_with::serde_as]
2231#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2232pub struct ListOperationsResponse {
2233 /// The standard List next-page token.
2234 #[serde(rename = "nextPageToken")]
2235 pub next_page_token: Option<String>,
2236 /// A list of operations that matches the specified filter in the request.
2237 pub operations: Option<Vec<Operation>>,
2238}
2239
2240impl common::ResponseResult for ListOperationsResponse {}
2241
2242/// There is no detailed description.
2243///
2244/// # Activities
2245///
2246/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2247/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2248///
2249/// * [locations datasets consent stores user data mappings list projects](ProjectLocationDatasetConsentStoreUserDataMappingListCall) (response)
2250#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2251#[serde_with::serde_as]
2252#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2253pub struct ListUserDataMappingsResponse {
2254 /// Token to retrieve the next page of results, or empty if there are no more results in the list.
2255 #[serde(rename = "nextPageToken")]
2256 pub next_page_token: Option<String>,
2257 /// The returned User data mappings. The maximum number of User data mappings returned is determined by the value of page_size in the ListUserDataMappingsRequest.
2258 #[serde(rename = "userDataMappings")]
2259 pub user_data_mappings: Option<Vec<UserDataMapping>>,
2260}
2261
2262impl common::ResponseResult for ListUserDataMappingsResponse {}
2263
2264/// A resource that represents a Google Cloud location.
2265///
2266/// # Activities
2267///
2268/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2269/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2270///
2271/// * [locations get projects](ProjectLocationGetCall) (response)
2272#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2273#[serde_with::serde_as]
2274#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2275pub struct Location {
2276 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
2277 #[serde(rename = "displayName")]
2278 pub display_name: Option<String>,
2279 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
2280 pub labels: Option<HashMap<String, String>>,
2281 /// The canonical id for this location. For example: `"us-east1"`.
2282 #[serde(rename = "locationId")]
2283 pub location_id: Option<String>,
2284 /// Service-specific metadata. For example the available capacity at the given location.
2285 pub metadata: Option<HashMap<String, serde_json::Value>>,
2286 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
2287 pub name: Option<String>,
2288}
2289
2290impl common::ResponseResult for Location {}
2291
2292/// A complete HL7v2 message. See \[Introduction to HL7 Standards\] (https://www.hl7.org/implement/standards/index.cfm?ref=common) for details on the standard.
2293///
2294/// # Activities
2295///
2296/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2297/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2298///
2299/// * [locations datasets hl7 v2 stores messages create projects](ProjectLocationDatasetHl7V2StoreMessageCreateCall) (response)
2300/// * [locations datasets hl7 v2 stores messages get projects](ProjectLocationDatasetHl7V2StoreMessageGetCall) (response)
2301/// * [locations datasets hl7 v2 stores messages patch projects](ProjectLocationDatasetHl7V2StoreMessagePatchCall) (request|response)
2302#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2303#[serde_with::serde_as]
2304#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2305pub struct Message {
2306 /// Output only. The datetime when the message was created. Set by the server.
2307 #[serde(rename = "createTime")]
2308 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2309 /// Required. Raw message bytes.
2310 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2311 pub data: Option<Vec<u8>>,
2312 /// User-supplied key-value pairs used to organize HL7v2 stores. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: \p{Ll}\p{Lo}{0,62} Label values are optional, must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} No more than 64 labels can be associated with a given store.
2313 pub labels: Option<HashMap<String, String>>,
2314 /// The message type for this message. MSH-9.1.
2315 #[serde(rename = "messageType")]
2316 pub message_type: Option<String>,
2317 /// Output only. Resource name of the Message, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7V2Stores/{hl7_v2_store_id}/messages/{message_id}`. Assigned by the server.
2318 pub name: Option<String>,
2319 /// Output only. The parsed version of the raw message data.
2320 #[serde(rename = "parsedData")]
2321 pub parsed_data: Option<ParsedData>,
2322 /// All patient IDs listed in the PID-2, PID-3, and PID-4 segments of this message.
2323 #[serde(rename = "patientIds")]
2324 pub patient_ids: Option<Vec<PatientId>>,
2325 /// The parsed version of the raw message data schematized according to this store's schemas and type definitions.
2326 #[serde(rename = "schematizedData")]
2327 pub schematized_data: Option<SchematizedData>,
2328 /// The hospital that this message came from. MSH-4.
2329 #[serde(rename = "sendFacility")]
2330 pub send_facility: Option<String>,
2331 /// The datetime the sending application sent this message. MSH-7.
2332 #[serde(rename = "sendTime")]
2333 pub send_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2334}
2335
2336impl common::RequestValue for Message {}
2337impl common::ResponseResult for Message {}
2338
2339/// Specifies where to send notifications upon changes to a data store.
2340///
2341/// This type is not used in any activity, and only used as *part* of another schema.
2342///
2343#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2344#[serde_with::serde_as]
2345#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2346pub struct NotificationConfig {
2347 /// The [Pub/Sub](https://cloud.google.com/pubsub/docs/) topic that notifications of changes are published on. Supplied by the client. PubsubMessage.Data contains the resource name. PubsubMessage.MessageId is the ID of this message. It is guaranteed to be unique within the topic. PubsubMessage.PublishTime is the time at which the message was published. Notifications are only sent if the topic is non-empty. [Topic names](https://cloud.google.com/pubsub/docs/overview#names) must be scoped to a project. Cloud Healthcare API service account must have publisher permissions on the given Pub/Sub topic. Not having adequate permissions causes the calls that send notifications to fail. If a notification can't be published to Pub/Sub, errors are logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). If the number of errors exceeds a certain rate, some aren't submitted. Note that not all operations trigger notifications, see [Configuring Pub/Sub notifications](https://cloud.google.com/healthcare/docs/how-tos/pubsub) for specific details.
2348 #[serde(rename = "pubsubTopic")]
2349 pub pubsub_topic: Option<String>,
2350 /// Indicates whether or not to send Pub/Sub notifications on bulk import. Only supported for DICOM imports.
2351 #[serde(rename = "sendForBulkImport")]
2352 pub send_for_bulk_import: Option<bool>,
2353}
2354
2355impl common::Part for NotificationConfig {}
2356
2357/// This resource represents a long-running operation that is the result of a network API call.
2358///
2359/// # Activities
2360///
2361/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2362/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2363///
2364/// * [locations datasets consent stores query accessible data projects](ProjectLocationDatasetConsentStoreQueryAccessibleDataCall) (response)
2365/// * [locations datasets dicom stores studies series delete projects](ProjectLocationDatasetDicomStoreStudySeriesDeleteCall) (response)
2366/// * [locations datasets dicom stores studies delete projects](ProjectLocationDatasetDicomStoreStudyDeleteCall) (response)
2367/// * [locations datasets dicom stores deidentify projects](ProjectLocationDatasetDicomStoreDeidentifyCall) (response)
2368/// * [locations datasets dicom stores export projects](ProjectLocationDatasetDicomStoreExportCall) (response)
2369/// * [locations datasets dicom stores import projects](ProjectLocationDatasetDicomStoreImportCall) (response)
2370/// * [locations datasets fhir stores deidentify projects](ProjectLocationDatasetFhirStoreDeidentifyCall) (response)
2371/// * [locations datasets fhir stores export projects](ProjectLocationDatasetFhirStoreExportCall) (response)
2372/// * [locations datasets fhir stores import projects](ProjectLocationDatasetFhirStoreImportCall) (response)
2373/// * [locations datasets fhir stores rollback projects](ProjectLocationDatasetFhirStoreRollbackCall) (response)
2374/// * [locations datasets hl7 v2 stores export projects](ProjectLocationDatasetHl7V2StoreExportCall) (response)
2375/// * [locations datasets hl7 v2 stores import projects](ProjectLocationDatasetHl7V2StoreImportCall) (response)
2376/// * [locations datasets operations get projects](ProjectLocationDatasetOperationGetCall) (response)
2377/// * [locations datasets create projects](ProjectLocationDatasetCreateCall) (response)
2378/// * [locations datasets deidentify projects](ProjectLocationDatasetDeidentifyCall) (response)
2379#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2380#[serde_with::serde_as]
2381#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2382pub struct Operation {
2383 /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
2384 pub done: Option<bool>,
2385 /// The error result of the operation in case of failure or cancellation.
2386 pub error: Option<Status>,
2387 /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
2388 pub metadata: Option<HashMap<String, serde_json::Value>>,
2389 /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
2390 pub name: Option<String>,
2391 /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
2392 pub response: Option<HashMap<String, serde_json::Value>>,
2393}
2394
2395impl common::ResponseResult for Operation {}
2396
2397/// The content of a HL7v2 message in a structured format.
2398///
2399/// This type is not used in any activity, and only used as *part* of another schema.
2400///
2401#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2402#[serde_with::serde_as]
2403#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2404pub struct ParsedData {
2405 /// no description provided
2406 pub segments: Option<Vec<Segment>>,
2407}
2408
2409impl common::Part for ParsedData {}
2410
2411/// The configuration for the parser. It determines how the server parses the messages.
2412///
2413/// This type is not used in any activity, and only used as *part* of another schema.
2414///
2415#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2416#[serde_with::serde_as]
2417#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2418pub struct ParserConfig {
2419 /// Determines whether messages with no header are allowed.
2420 #[serde(rename = "allowNullHeader")]
2421 pub allow_null_header: Option<bool>,
2422 /// Schemas used to parse messages in this store, if schematized parsing is desired.
2423 pub schema: Option<SchemaPackage>,
2424 /// Byte(s) to use as the segment terminator. If this is unset, '\r' is used as segment terminator, matching the HL7 version 2 specification.
2425 #[serde(rename = "segmentTerminator")]
2426 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2427 pub segment_terminator: Option<Vec<u8>>,
2428 /// Immutable. Determines the version of both the default parser to be used when `schema` is not given, as well as the schematized parser used when `schema` is specified. This field is immutable after HL7v2 store creation.
2429 pub version: Option<String>,
2430}
2431
2432impl common::Part for ParserConfig {}
2433
2434/// A patient identifier and associated type.
2435///
2436/// This type is not used in any activity, and only used as *part* of another schema.
2437///
2438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2439#[serde_with::serde_as]
2440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2441pub struct PatientId {
2442 /// ID type. For example, MRN or NHS.
2443 #[serde(rename = "type")]
2444 pub type_: Option<String>,
2445 /// The patient's unique identifier.
2446 pub value: Option<String>,
2447}
2448
2449impl common::Part for PatientId {}
2450
2451/// An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members`, or principals, to a single `role`. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). **JSON example:** `{ "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }` **YAML example:** `bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3` For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).
2452///
2453/// # Activities
2454///
2455/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2456/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2457///
2458/// * [locations datasets consent stores get iam policy projects](ProjectLocationDatasetConsentStoreGetIamPolicyCall) (response)
2459/// * [locations datasets consent stores set iam policy projects](ProjectLocationDatasetConsentStoreSetIamPolicyCall) (response)
2460/// * [locations datasets data mapper workspaces get iam policy projects](ProjectLocationDatasetDataMapperWorkspaceGetIamPolicyCall) (response)
2461/// * [locations datasets data mapper workspaces set iam policy projects](ProjectLocationDatasetDataMapperWorkspaceSetIamPolicyCall) (response)
2462/// * [locations datasets dicom stores get iam policy projects](ProjectLocationDatasetDicomStoreGetIamPolicyCall) (response)
2463/// * [locations datasets dicom stores set iam policy projects](ProjectLocationDatasetDicomStoreSetIamPolicyCall) (response)
2464/// * [locations datasets fhir stores get iam policy projects](ProjectLocationDatasetFhirStoreGetIamPolicyCall) (response)
2465/// * [locations datasets fhir stores set iam policy projects](ProjectLocationDatasetFhirStoreSetIamPolicyCall) (response)
2466/// * [locations datasets hl7 v2 stores get iam policy projects](ProjectLocationDatasetHl7V2StoreGetIamPolicyCall) (response)
2467/// * [locations datasets hl7 v2 stores set iam policy projects](ProjectLocationDatasetHl7V2StoreSetIamPolicyCall) (response)
2468/// * [locations datasets get iam policy projects](ProjectLocationDatasetGetIamPolicyCall) (response)
2469/// * [locations datasets set iam policy projects](ProjectLocationDatasetSetIamPolicyCall) (response)
2470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2471#[serde_with::serde_as]
2472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2473pub struct Policy {
2474 /// Specifies cloud audit logging configuration for this policy.
2475 #[serde(rename = "auditConfigs")]
2476 pub audit_configs: Option<Vec<AuditConfig>>,
2477 /// Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another 1,450 principals to the `bindings` in the `Policy`.
2478 pub bindings: Option<Vec<Binding>>,
2479 /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost.
2480 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2481 pub etag: Option<Vec<u8>>,
2482 /// Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
2483 pub version: Option<i32>,
2484}
2485
2486impl common::ResponseResult for Policy {}
2487
2488/// The Pub/Sub output destination. The Cloud Healthcare Service Agent requires the `roles/pubsub.publisher` Cloud IAM role on the Pub/Sub topic.
2489///
2490/// This type is not used in any activity, and only used as *part* of another schema.
2491///
2492#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2493#[serde_with::serde_as]
2494#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2495pub struct PubsubDestination {
2496 /// The [Pub/Sub](https://cloud.google.com/pubsub/docs/) topic that Pub/Sub messages are published on. Supplied by the client. The `PubsubMessage` contains the following fields: * `PubsubMessage.Data` contains the resource name. * `PubsubMessage.MessageId` is the ID of this notification. It is guaranteed to be unique within the topic. * `PubsubMessage.PublishTime` is the time when the message was published. [Topic names](https://cloud.google.com/pubsub/docs/overview#names) must be scoped to a project. The Cloud Healthcare API service account, service-PROJECT_NUMBER@gcp-sa-healthcare.iam.gserviceaccount.com, must have publisher permissions on the given Pub/Sub topic. Not having adequate permissions causes the calls that send notifications to fail.
2497 #[serde(rename = "pubsubTopic")]
2498 pub pubsub_topic: Option<String>,
2499}
2500
2501impl common::Part for PubsubDestination {}
2502
2503/// Queries all data_ids that are consented for a given use in the given consent store and writes them to a specified destination. The returned Operation includes a progress counter for the number of User data mappings processed. Errors are logged to Cloud Logging (see \[Viewing error logs in Cloud Logging\] (https://cloud.google.com/healthcare/docs/how-tos/logging) and \[QueryAccessibleData\] for a sample log entry).
2504///
2505/// # Activities
2506///
2507/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2508/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2509///
2510/// * [locations datasets consent stores query accessible data projects](ProjectLocationDatasetConsentStoreQueryAccessibleDataCall) (request)
2511#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2512#[serde_with::serde_as]
2513#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2514pub struct QueryAccessibleDataRequest {
2515 /// The Cloud Storage destination. The Cloud Healthcare API service account must have the `roles/storage.objectAdmin` Cloud IAM role for this Cloud Storage location.
2516 #[serde(rename = "gcsDestination")]
2517 pub gcs_destination: Option<GoogleCloudHealthcareV1ConsentGcsDestination>,
2518 /// The values of request attributes associated with this access request.
2519 #[serde(rename = "requestAttributes")]
2520 pub request_attributes: Option<HashMap<String, String>>,
2521 /// Optional. The values of resource attributes associated with the type of resources being requested. If no values are specified, then all resource types are included in the output.
2522 #[serde(rename = "resourceAttributes")]
2523 pub resource_attributes: Option<HashMap<String, String>>,
2524}
2525
2526impl common::RequestValue for QueryAccessibleDataRequest {}
2527
2528/// Define how to redact sensitive values. Default behaviour is erase. For example, "My name is Jane." becomes "My name is ."
2529///
2530/// This type is not used in any activity, and only used as *part* of another schema.
2531///
2532#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2533#[serde_with::serde_as]
2534#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2535pub struct RedactConfig {
2536 _never_set: Option<bool>,
2537}
2538
2539impl common::Part for RedactConfig {}
2540
2541/// Rejects the latest revision of the specified Consent by committing a new revision with `state` updated to `REJECTED`. If the latest revision of the given Consent is in the `REJECTED` state, no new revision is committed.
2542///
2543/// # Activities
2544///
2545/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2546/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2547///
2548/// * [locations datasets consent stores consents reject projects](ProjectLocationDatasetConsentStoreConsentRejectCall) (request)
2549#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2550#[serde_with::serde_as]
2551#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2552pub struct RejectConsentRequest {
2553 /// Optional. The resource name of the Consent artifact that contains documentation of the user's rejection of the draft Consent, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consentArtifacts/{consent_artifact_id}`. If the draft Consent had a Consent artifact, this Consent artifact overwrites it.
2554 #[serde(rename = "consentArtifact")]
2555 pub consent_artifact: Option<String>,
2556}
2557
2558impl common::RequestValue for RejectConsentRequest {}
2559
2560/// When using the INSPECT_AND_TRANSFORM action, each match is replaced with the name of the info_type. For example, "My name is Jane" becomes "My name is [PERSON_NAME]." The TRANSFORM action is equivalent to redacting.
2561///
2562/// This type is not used in any activity, and only used as *part* of another schema.
2563///
2564#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2565#[serde_with::serde_as]
2566#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2567pub struct ReplaceWithInfoTypeConfig {
2568 _never_set: Option<bool>,
2569}
2570
2571impl common::Part for ReplaceWithInfoTypeConfig {}
2572
2573/// A list of FHIR resources.
2574///
2575/// This type is not used in any activity, and only used as *part* of another schema.
2576///
2577#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2578#[serde_with::serde_as]
2579#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2580pub struct Resources {
2581 /// List of resources IDs. For example, "Patient/1234".
2582 pub resources: Option<Vec<String>>,
2583}
2584
2585impl common::Part for Resources {}
2586
2587/// The consent evaluation result for a single `data_id`.
2588///
2589/// This type is not used in any activity, and only used as *part* of another schema.
2590///
2591#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2592#[serde_with::serde_as]
2593#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2594pub struct Result {
2595 /// The resource names of all evaluated Consents mapped to their evaluation.
2596 #[serde(rename = "consentDetails")]
2597 pub consent_details: Option<HashMap<String, ConsentEvaluation>>,
2598 /// Whether the resource is consented for the given use.
2599 pub consented: Option<bool>,
2600 /// The unique identifier of the evaluated resource.
2601 #[serde(rename = "dataId")]
2602 pub data_id: Option<String>,
2603}
2604
2605impl common::Part for Result {}
2606
2607/// Revokes the latest revision of the specified Consent by committing a new revision with `state` updated to `REVOKED`. If the latest revision of the given Consent is in the `REVOKED` state, no new revision is committed.
2608///
2609/// # Activities
2610///
2611/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2612/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2613///
2614/// * [locations datasets consent stores consents revoke projects](ProjectLocationDatasetConsentStoreConsentRevokeCall) (request)
2615#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2616#[serde_with::serde_as]
2617#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2618pub struct RevokeConsentRequest {
2619 /// Optional. The resource name of the Consent artifact that contains proof of the user's revocation of the Consent, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consentArtifacts/{consent_artifact_id}`.
2620 #[serde(rename = "consentArtifact")]
2621 pub consent_artifact: Option<String>,
2622}
2623
2624impl common::RequestValue for RevokeConsentRequest {}
2625
2626/// There is no detailed description.
2627///
2628/// This type is not used in any activity, and only used as *part* of another schema.
2629///
2630#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2631#[serde_with::serde_as]
2632#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2633pub struct RollbackFhirResourceFilteringFields {
2634 /// Optional. A filter expression that matches data in the `Resource.meta` element. Supports all filters in [AIP-160](https://google.aip.dev/160) except the "has" (`:`) operator. Supports the following custom functions: * `tag("") = ""` for tag filtering. * `extension_value_ts("") = ` for filtering extensions with a timestamp, where `` is a Unix timestamp. Supports the `>`, `<`, `<=`, `>=`, and `!=` comparison operators.
2635 #[serde(rename = "metadataFilter")]
2636 pub metadata_filter: Option<String>,
2637 /// Optional. A list of operation IDs to roll back.
2638 #[serde(rename = "operationIds")]
2639 #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
2640 pub operation_ids: Option<Vec<u64>>,
2641}
2642
2643impl common::Part for RollbackFhirResourceFilteringFields {}
2644
2645/// There is no detailed description.
2646///
2647/// # Activities
2648///
2649/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2650/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2651///
2652/// * [locations datasets fhir stores rollback projects](ProjectLocationDatasetFhirStoreRollbackCall) (request)
2653#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2654#[serde_with::serde_as]
2655#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2656pub struct RollbackFhirResourcesRequest {
2657 /// Optional. CREATE/UPDATE/DELETE/ALL for reverting all txns of a certain type.
2658 #[serde(rename = "changeType")]
2659 pub change_type: Option<String>,
2660 /// Optional. Specifies whether to exclude earlier rollbacks.
2661 #[serde(rename = "excludeRollbacks")]
2662 pub exclude_rollbacks: Option<bool>,
2663 /// Optional. Parameters for filtering resources
2664 #[serde(rename = "filteringFields")]
2665 pub filtering_fields: Option<RollbackFhirResourceFilteringFields>,
2666 /// Optional. When enabled, changes will be reverted without explicit confirmation
2667 pub force: Option<bool>,
2668 /// Optional. Cloud Storage object containing list of {resourceType}/{resourceId} lines, identifying resources to be reverted
2669 #[serde(rename = "inputGcsObject")]
2670 pub input_gcs_object: Option<String>,
2671 /// Required. Bucket to deposit result
2672 #[serde(rename = "resultGcsBucket")]
2673 pub result_gcs_bucket: Option<String>,
2674 /// Required. Time point to rollback to.
2675 #[serde(rename = "rollbackTime")]
2676 pub rollback_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2677 /// Optional. If specified, revert only resources of these types
2678 #[serde(rename = "type")]
2679 pub type_: Option<Vec<String>>,
2680}
2681
2682impl common::RequestValue for RollbackFhirResourcesRequest {}
2683
2684/// Configuration for the FHIR BigQuery schema. Determines how the server generates the schema.
2685///
2686/// This type is not used in any activity, and only used as *part* of another schema.
2687///
2688#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2689#[serde_with::serde_as]
2690#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2691pub struct SchemaConfig {
2692 /// The configuration for exported BigQuery tables to be partitioned by FHIR resource's last updated time column.
2693 #[serde(rename = "lastUpdatedPartitionConfig")]
2694 pub last_updated_partition_config: Option<TimePartitioning>,
2695 /// The depth for all recursive structures in the output analytics schema. For example, `concept` in the CodeSystem resource is a recursive structure; when the depth is 2, the CodeSystem table will have a column called `concept.concept` but not `concept.concept.concept`. If not specified or set to 0, the server will use the default value 2. The maximum depth allowed is 5.
2696 #[serde(rename = "recursiveStructureDepth")]
2697 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2698 pub recursive_structure_depth: Option<i64>,
2699 /// Specifies the output schema type. Schema type is required.
2700 #[serde(rename = "schemaType")]
2701 pub schema_type: Option<String>,
2702}
2703
2704impl common::Part for SchemaConfig {}
2705
2706/// An HL7v2 logical group construct.
2707///
2708/// This type is not used in any activity, and only used as *part* of another schema.
2709///
2710#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2711#[serde_with::serde_as]
2712#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2713pub struct SchemaGroup {
2714 /// True indicates that this is a choice group, meaning that only one of its segments can exist in a given message.
2715 pub choice: Option<bool>,
2716 /// The maximum number of times this group can be repeated. 0 or -1 means unbounded.
2717 #[serde(rename = "maxOccurs")]
2718 pub max_occurs: Option<i32>,
2719 /// Nested groups and/or segments.
2720 pub members: Option<Vec<GroupOrSegment>>,
2721 /// The minimum number of times this group must be present/repeated.
2722 #[serde(rename = "minOccurs")]
2723 pub min_occurs: Option<i32>,
2724 /// The name of this group. For example, "ORDER_DETAIL".
2725 pub name: Option<String>,
2726}
2727
2728impl common::Part for SchemaGroup {}
2729
2730/// A schema package contains a set of schemas and type definitions.
2731///
2732/// This type is not used in any activity, and only used as *part* of another schema.
2733///
2734#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2735#[serde_with::serde_as]
2736#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2737pub struct SchemaPackage {
2738 /// Flag to ignore all min_occurs restrictions in the schema. This means that incoming messages can omit any group, segment, field, component, or subcomponent.
2739 #[serde(rename = "ignoreMinOccurs")]
2740 pub ignore_min_occurs: Option<bool>,
2741 /// Schema configs that are layered based on their VersionSources that match the incoming message. Schema configs present in higher indices override those in lower indices with the same message type and trigger event if their VersionSources all match an incoming message.
2742 pub schemas: Option<Vec<Hl7SchemaConfig>>,
2743 /// Determines how messages that fail to parse are handled.
2744 #[serde(rename = "schematizedParsingType")]
2745 pub schematized_parsing_type: Option<String>,
2746 /// Schema type definitions that are layered based on their VersionSources that match the incoming message. Type definitions present in higher indices override those in lower indices with the same type name if their VersionSources all match an incoming message.
2747 pub types: Option<Vec<Hl7TypesConfig>>,
2748 /// Determines how unexpected segments (segments not matched to the schema) are handled.
2749 #[serde(rename = "unexpectedSegmentHandling")]
2750 pub unexpected_segment_handling: Option<String>,
2751}
2752
2753impl common::Part for SchemaPackage {}
2754
2755/// An HL7v2 Segment.
2756///
2757/// This type is not used in any activity, and only used as *part* of another schema.
2758///
2759#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2760#[serde_with::serde_as]
2761#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2762pub struct SchemaSegment {
2763 /// The maximum number of times this segment can be present in this group. 0 or -1 means unbounded.
2764 #[serde(rename = "maxOccurs")]
2765 pub max_occurs: Option<i32>,
2766 /// The minimum number of times this segment can be present in this group.
2767 #[serde(rename = "minOccurs")]
2768 pub min_occurs: Option<i32>,
2769 /// The Segment type. For example, "PID".
2770 #[serde(rename = "type")]
2771 pub type_: Option<String>,
2772}
2773
2774impl common::Part for SchemaSegment {}
2775
2776/// The content of an HL7v2 message in a structured format as specified by a schema.
2777///
2778/// This type is not used in any activity, and only used as *part* of another schema.
2779///
2780#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2781#[serde_with::serde_as]
2782#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2783pub struct SchematizedData {
2784 /// JSON output of the parser.
2785 pub data: Option<String>,
2786 /// The error output of the parser.
2787 pub error: Option<String>,
2788}
2789
2790impl common::Part for SchematizedData {}
2791
2792/// Request to search the resources in the specified FHIR store.
2793///
2794/// # Activities
2795///
2796/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2797/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2798///
2799/// * [locations datasets fhir stores fhir search projects](ProjectLocationDatasetFhirStoreFhirSearchCall) (request)
2800/// * [locations datasets fhir stores fhir search-type projects](ProjectLocationDatasetFhirStoreFhirSearchTypeCall) (request)
2801#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2802#[serde_with::serde_as]
2803#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2804pub struct SearchResourcesRequest {
2805 /// Required. The FHIR resource type to search, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](http://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](http://hl7.org/implement/standards/fhir/R4/resourcelist.html)).
2806 #[serde(rename = "resourceType")]
2807 pub resource_type: Option<String>,
2808}
2809
2810impl common::RequestValue for SearchResourcesRequest {}
2811
2812/// A segment in a structured format.
2813///
2814/// This type is not used in any activity, and only used as *part* of another schema.
2815///
2816#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2817#[serde_with::serde_as]
2818#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2819pub struct Segment {
2820 /// A mapping from the positional location to the value. The key string uses zero-based indexes separated by dots to identify Fields, components and sub-components. A bracket notation is also used to identify different instances of a repeated field. Regex for key: (\d+)(\[\d+\])?(.\d+)?(.\d+)? Examples of (key, value) pairs: * (0.1, "hemoglobin") denotes that the first component of Field 0 has the value "hemoglobin". * (1.1.2, "CBC") denotes that the second sub-component of the first component of Field 1 has the value "CBC". * (1[0].1, "HbA1c") denotes that the first component of the first Instance of Field 1, which is repeated, has the value "HbA1c".
2821 pub fields: Option<HashMap<String, String>>,
2822 /// A string that indicates the type of segment. For example, EVN or PID.
2823 #[serde(rename = "segmentId")]
2824 pub segment_id: Option<String>,
2825 /// Set ID for segments that can be in a set. This can be empty if it's missing or isn't applicable.
2826 #[serde(rename = "setId")]
2827 pub set_id: Option<String>,
2828}
2829
2830impl common::Part for Segment {}
2831
2832/// SeriesMetrics contains metrics describing a DICOM series.
2833///
2834/// # Activities
2835///
2836/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2837/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2838///
2839/// * [locations datasets dicom stores dicom web studies series get series metrics projects](ProjectLocationDatasetDicomStoreDicomWebStudySeriesGetSeriesMetricCall) (response)
2840#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2841#[serde_with::serde_as]
2842#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2843pub struct SeriesMetrics {
2844 /// Total blob storage bytes for all instances in the series.
2845 #[serde(rename = "blobStorageSizeBytes")]
2846 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2847 pub blob_storage_size_bytes: Option<i64>,
2848 /// Number of instances in the series.
2849 #[serde(rename = "instanceCount")]
2850 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2851 pub instance_count: Option<i64>,
2852 /// The series resource path. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}/dicomWeb/studies/{study_uid}/series/{series_uid}`.
2853 pub series: Option<String>,
2854 /// Total structured storage bytes for all instances in the series.
2855 #[serde(rename = "structuredStorageSizeBytes")]
2856 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2857 pub structured_storage_size_bytes: Option<i64>,
2858}
2859
2860impl common::ResponseResult for SeriesMetrics {}
2861
2862/// Request message for `SetIamPolicy` method.
2863///
2864/// # Activities
2865///
2866/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2867/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2868///
2869/// * [locations datasets consent stores set iam policy projects](ProjectLocationDatasetConsentStoreSetIamPolicyCall) (request)
2870/// * [locations datasets data mapper workspaces set iam policy projects](ProjectLocationDatasetDataMapperWorkspaceSetIamPolicyCall) (request)
2871/// * [locations datasets dicom stores set iam policy projects](ProjectLocationDatasetDicomStoreSetIamPolicyCall) (request)
2872/// * [locations datasets fhir stores set iam policy projects](ProjectLocationDatasetFhirStoreSetIamPolicyCall) (request)
2873/// * [locations datasets hl7 v2 stores set iam policy projects](ProjectLocationDatasetHl7V2StoreSetIamPolicyCall) (request)
2874/// * [locations datasets set iam policy projects](ProjectLocationDatasetSetIamPolicyCall) (request)
2875#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2876#[serde_with::serde_as]
2877#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2878pub struct SetIamPolicyRequest {
2879 /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.
2880 pub policy: Option<Policy>,
2881 /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used: `paths: "bindings, etag"`
2882 #[serde(rename = "updateMask")]
2883 pub update_mask: Option<common::FieldMask>,
2884}
2885
2886impl common::RequestValue for SetIamPolicyRequest {}
2887
2888/// User signature.
2889///
2890/// This type is not used in any activity, and only used as *part* of another schema.
2891///
2892#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2893#[serde_with::serde_as]
2894#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2895pub struct Signature {
2896 /// Optional. An image of the user's signature.
2897 pub image: Option<Image>,
2898 /// Optional. Metadata associated with the user's signature. For example, the user's name or the user's title.
2899 pub metadata: Option<HashMap<String, String>>,
2900 /// Optional. Timestamp of the signature.
2901 #[serde(rename = "signatureTime")]
2902 pub signature_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2903 /// Required. User's UUID provided by the client.
2904 #[serde(rename = "userId")]
2905 pub user_id: Option<String>,
2906}
2907
2908impl common::Part for Signature {}
2909
2910/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
2911///
2912/// This type is not used in any activity, and only used as *part* of another schema.
2913///
2914#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2915#[serde_with::serde_as]
2916#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2917pub struct Status {
2918 /// The status code, which should be an enum value of google.rpc.Code.
2919 pub code: Option<i32>,
2920 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
2921 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
2922 /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
2923 pub message: Option<String>,
2924}
2925
2926impl common::Part for Status {}
2927
2928/// Contains configuration for streaming FHIR export.
2929///
2930/// This type is not used in any activity, and only used as *part* of another schema.
2931///
2932#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2933#[serde_with::serde_as]
2934#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2935pub struct StreamConfig {
2936 /// The destination BigQuery structure that contains both the dataset location and corresponding schema config. The output is organized in one table per resource type. The server reuses the existing tables (if any) that are named after the resource types. For example, "Patient", "Observation". When there is no existing table for a given resource type, the server attempts to create one. When a table schema doesn't align with the schema config, either because of existing incompatible schema or out of band incompatible modification, the server does not stream in new data. BigQuery imposes a 1 MB limit on streaming insert row size, therefore any resource mutation that generates more than 1 MB of BigQuery data is not streamed. One resolution in this case is to delete the incompatible table and let the server recreate one, though the newly created table only contains data after the table recreation. Results are written to BigQuery tables according to the parameters in BigQueryDestination.WriteDisposition. Different versions of the same resource are distinguishable by the meta.versionId and meta.lastUpdated columns. The operation (CREATE/UPDATE/DELETE) that results in the new version is recorded in the meta.tag. The tables contain all historical resource versions since streaming was enabled. For query convenience, the server also creates one view per table of the same name containing only the current resource version. The streamed data in the BigQuery dataset is not guaranteed to be completely unique. The combination of the id and meta.versionId columns should ideally identify a single unique row. But in rare cases, duplicates may exist. At query time, users may use the SQL select statement to keep only one of the duplicate rows given an id and meta.versionId pair. Alternatively, the server created view mentioned above also filters out duplicates. If a resource mutation cannot be streamed to BigQuery, errors are logged to Cloud Logging. For more information, see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).
2937 #[serde(rename = "bigqueryDestination")]
2938 pub bigquery_destination: Option<GoogleCloudHealthcareV1FhirBigQueryDestination>,
2939 /// The destination FHIR store for de-identified resources. After this field is added, all subsequent creates/updates/patches to the source store will be de-identified using the provided configuration and applied to the destination store. Importing resources to the source store will not trigger the streaming. If the source store already contains resources when this option is enabled, those resources will not be copied to the destination store unless they are subsequently updated. This may result in invalid references in the destination store. Before adding this config, you must grant the healthcare.fhirResources.update permission on the destination store to your project's **Cloud Healthcare Service Agent** [service account](https://cloud.google.com/healthcare/docs/how-tos/permissions-healthcare-api-gcp-products#the_cloud_healthcare_service_agent). The destination store must set enable_update_create to true. The destination store must have disable_referential_integrity set to true. If a resource cannot be de-identified, errors will be logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).
2940 #[serde(rename = "deidentifiedStoreDestination")]
2941 pub deidentified_store_destination: Option<DeidentifiedStoreDestination>,
2942 /// Supply a FHIR resource type (such as "Patient" or "Observation"). See https://www.hl7.org/fhir/valueset-resource-types.html for a list of all FHIR resource types. The server treats an empty list as an intent to stream all the supported resource types in this FHIR store.
2943 #[serde(rename = "resourceTypes")]
2944 pub resource_types: Option<Vec<String>>,
2945}
2946
2947impl common::Part for StreamConfig {}
2948
2949/// StudyMetrics contains metrics describing a DICOM study.
2950///
2951/// # Activities
2952///
2953/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2954/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2955///
2956/// * [locations datasets dicom stores dicom web studies get study metrics projects](ProjectLocationDatasetDicomStoreDicomWebStudyGetStudyMetricCall) (response)
2957#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2958#[serde_with::serde_as]
2959#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2960pub struct StudyMetrics {
2961 /// Total blob storage bytes for all instances in the study.
2962 #[serde(rename = "blobStorageSizeBytes")]
2963 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2964 pub blob_storage_size_bytes: Option<i64>,
2965 /// Number of instances in the study.
2966 #[serde(rename = "instanceCount")]
2967 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2968 pub instance_count: Option<i64>,
2969 /// Number of series in the study.
2970 #[serde(rename = "seriesCount")]
2971 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2972 pub series_count: Option<i64>,
2973 /// Total structured storage bytes for all instances in the study.
2974 #[serde(rename = "structuredStorageSizeBytes")]
2975 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2976 pub structured_storage_size_bytes: Option<i64>,
2977 /// The study resource path. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}/dicomWeb/studies/{study_uid}`.
2978 pub study: Option<String>,
2979}
2980
2981impl common::ResponseResult for StudyMetrics {}
2982
2983/// List of tags to be filtered.
2984///
2985/// This type is not used in any activity, and only used as *part* of another schema.
2986///
2987#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2988#[serde_with::serde_as]
2989#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2990pub struct TagFilterList {
2991 /// Tags to be filtered. Tags must be DICOM Data Elements, File Meta Elements, or Directory Structuring Elements, as defined at: http://dicom.nema.org/medical/dicom/current/output/html/part06.html#table_6-1,. They may be provided by "Keyword" or "Tag". For example "PatientID", "00100010".
2992 pub tags: Option<Vec<String>>,
2993}
2994
2995impl common::Part for TagFilterList {}
2996
2997/// Request message for `TestIamPermissions` method.
2998///
2999/// # Activities
3000///
3001/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3002/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3003///
3004/// * [locations datasets consent stores test iam permissions projects](ProjectLocationDatasetConsentStoreTestIamPermissionCall) (request)
3005/// * [locations datasets data mapper workspaces test iam permissions projects](ProjectLocationDatasetDataMapperWorkspaceTestIamPermissionCall) (request)
3006/// * [locations datasets dicom stores test iam permissions projects](ProjectLocationDatasetDicomStoreTestIamPermissionCall) (request)
3007/// * [locations datasets fhir stores test iam permissions projects](ProjectLocationDatasetFhirStoreTestIamPermissionCall) (request)
3008/// * [locations datasets hl7 v2 stores test iam permissions projects](ProjectLocationDatasetHl7V2StoreTestIamPermissionCall) (request)
3009/// * [locations datasets test iam permissions projects](ProjectLocationDatasetTestIamPermissionCall) (request)
3010#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3011#[serde_with::serde_as]
3012#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3013pub struct TestIamPermissionsRequest {
3014 /// The set of permissions to check for the `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
3015 pub permissions: Option<Vec<String>>,
3016}
3017
3018impl common::RequestValue for TestIamPermissionsRequest {}
3019
3020/// Response message for `TestIamPermissions` method.
3021///
3022/// # Activities
3023///
3024/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3025/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3026///
3027/// * [locations datasets consent stores test iam permissions projects](ProjectLocationDatasetConsentStoreTestIamPermissionCall) (response)
3028/// * [locations datasets data mapper workspaces test iam permissions projects](ProjectLocationDatasetDataMapperWorkspaceTestIamPermissionCall) (response)
3029/// * [locations datasets dicom stores test iam permissions projects](ProjectLocationDatasetDicomStoreTestIamPermissionCall) (response)
3030/// * [locations datasets fhir stores test iam permissions projects](ProjectLocationDatasetFhirStoreTestIamPermissionCall) (response)
3031/// * [locations datasets hl7 v2 stores test iam permissions projects](ProjectLocationDatasetHl7V2StoreTestIamPermissionCall) (response)
3032/// * [locations datasets test iam permissions projects](ProjectLocationDatasetTestIamPermissionCall) (response)
3033#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3034#[serde_with::serde_as]
3035#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3036pub struct TestIamPermissionsResponse {
3037 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
3038 pub permissions: Option<Vec<String>>,
3039}
3040
3041impl common::ResponseResult for TestIamPermissionsResponse {}
3042
3043/// There is no detailed description.
3044///
3045/// This type is not used in any activity, and only used as *part* of another schema.
3046///
3047#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3048#[serde_with::serde_as]
3049#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3050pub struct TextConfig {
3051 /// Transformations to apply to the detected data, overridden by `exclude_info_types`.
3052 #[serde(rename = "additionalTransformations")]
3053 pub additional_transformations: Option<Vec<InfoTypeTransformation>>,
3054 /// InfoTypes to skip transforming, overriding `additional_transformations`.
3055 #[serde(rename = "excludeInfoTypes")]
3056 pub exclude_info_types: Option<Vec<String>>,
3057 /// The transformations to apply to the detected data. Deprecated. Use `additional_transformations` instead.
3058 pub transformations: Option<Vec<InfoTypeTransformation>>,
3059}
3060
3061impl common::Part for TextConfig {}
3062
3063/// A span of text in the provided document.
3064///
3065/// This type is not used in any activity, and only used as *part* of another schema.
3066///
3067#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3068#[serde_with::serde_as]
3069#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3070pub struct TextSpan {
3071 /// The unicode codepoint index of the beginning of this span.
3072 #[serde(rename = "beginOffset")]
3073 pub begin_offset: Option<i32>,
3074 /// The original text contained in this span.
3075 pub content: Option<String>,
3076}
3077
3078impl common::Part for TextSpan {}
3079
3080/// Configuration for FHIR BigQuery time-partitioned tables.
3081///
3082/// This type is not used in any activity, and only used as *part* of another schema.
3083///
3084#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3085#[serde_with::serde_as]
3086#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3087pub struct TimePartitioning {
3088 /// Number of milliseconds for which to keep the storage for a partition.
3089 #[serde(rename = "expirationMs")]
3090 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3091 pub expiration_ms: Option<i64>,
3092 /// Type of partitioning.
3093 #[serde(rename = "type")]
3094 pub type_: Option<String>,
3095}
3096
3097impl common::Part for TimePartitioning {}
3098
3099/// A type definition for some HL7v2 type (incl. Segments and Datatypes).
3100///
3101/// This type is not used in any activity, and only used as *part* of another schema.
3102///
3103#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3104#[serde_with::serde_as]
3105#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3106pub struct Type {
3107 /// The (sub) fields this type has (if not primitive).
3108 pub fields: Option<Vec<Field>>,
3109 /// The name of this type. This would be the segment or datatype name. For example, "PID" or "XPN".
3110 pub name: Option<String>,
3111 /// If this is a primitive type then this field is the type of the primitive For example, STRING. Leave unspecified for composite types.
3112 pub primitive: Option<String>,
3113}
3114
3115impl common::Part for Type {}
3116
3117/// Maps a resource to the associated user and Attributes.
3118///
3119/// # Activities
3120///
3121/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3122/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3123///
3124/// * [locations datasets consent stores user data mappings create projects](ProjectLocationDatasetConsentStoreUserDataMappingCreateCall) (request|response)
3125/// * [locations datasets consent stores user data mappings get projects](ProjectLocationDatasetConsentStoreUserDataMappingGetCall) (response)
3126/// * [locations datasets consent stores user data mappings patch projects](ProjectLocationDatasetConsentStoreUserDataMappingPatchCall) (request|response)
3127#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3128#[serde_with::serde_as]
3129#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3130pub struct UserDataMapping {
3131 /// Output only. Indicates the time when this mapping was archived.
3132 #[serde(rename = "archiveTime")]
3133 pub archive_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3134 /// Output only. Indicates whether this mapping is archived.
3135 pub archived: Option<bool>,
3136 /// Required. A unique identifier for the mapped resource.
3137 #[serde(rename = "dataId")]
3138 pub data_id: Option<String>,
3139 /// Resource name of the User data mapping, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/userDataMappings/{user_data_mapping_id}`.
3140 pub name: Option<String>,
3141 /// Attributes of the resource. Only explicitly set attributes are displayed here. Attribute definitions with defaults set implicitly apply to these User data mappings. Attributes listed here must be single valued, that is, exactly one value is specified for the field "values" in each Attribute.
3142 #[serde(rename = "resourceAttributes")]
3143 pub resource_attributes: Option<Vec<Attribute>>,
3144 /// Required. User's UUID provided by the client.
3145 #[serde(rename = "userId")]
3146 pub user_id: Option<String>,
3147}
3148
3149impl common::RequestValue for UserDataMapping {}
3150impl common::ResponseResult for UserDataMapping {}
3151
3152/// Contains the configuration for FHIR profiles and validation.
3153///
3154/// This type is not used in any activity, and only used as *part* of another schema.
3155///
3156#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3157#[serde_with::serde_as]
3158#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3159pub struct ValidationConfig {
3160 /// Whether to disable FHIRPath validation for incoming resources. Set this to true to disable checking incoming resources for conformance against FHIRPath requirement defined in the FHIR specification. This property only affects resource types that do not have profiles configured for them, any rules in enabled implementation guides will still be enforced.
3161 #[serde(rename = "disableFhirpathValidation")]
3162 pub disable_fhirpath_validation: Option<bool>,
3163 /// Whether to disable profile validation for this FHIR store. Set this to true to disable checking incoming resources for conformance against structure definitions in this FHIR store.
3164 #[serde(rename = "disableProfileValidation")]
3165 pub disable_profile_validation: Option<bool>,
3166 /// Whether to disable reference type validation for incoming resources. Set this to true to disable checking incoming resources for conformance against reference type requirement defined in the FHIR specification. This property only affects resource types that do not have profiles configured for them, any rules in enabled implementation guides will still be enforced.
3167 #[serde(rename = "disableReferenceTypeValidation")]
3168 pub disable_reference_type_validation: Option<bool>,
3169 /// Whether to disable required fields validation for incoming resources. Set this to true to disable checking incoming resources for conformance against required fields requirement defined in the FHIR specification. This property only affects resource types that do not have profiles configured for them, any rules in enabled implementation guides will still be enforced.
3170 #[serde(rename = "disableRequiredFieldValidation")]
3171 pub disable_required_field_validation: Option<bool>,
3172 /// A list of implementation guide URLs in this FHIR store that are used to configure the profiles to use for validation. For example, to use the US Core profiles for validation, set `enabled_implementation_guides` to `["http://hl7.org/fhir/us/core/ImplementationGuide/ig"]`. If `enabled_implementation_guides` is empty or omitted, then incoming resources are only required to conform to the base FHIR profiles. Otherwise, a resource must conform to at least one profile listed in the `global` property of one of the enabled ImplementationGuides. The Cloud Healthcare API does not currently enforce all of the rules in a StructureDefinition. The following rules are supported: - min/max - minValue/maxValue - maxLength - type - fixed[x] - pattern[x] on simple types - slicing, when using "value" as the discriminator type When a URL cannot be resolved (for example, in a type assertion), the server does not return an error.
3173 #[serde(rename = "enabledImplementationGuides")]
3174 pub enabled_implementation_guides: Option<Vec<String>>,
3175}
3176
3177impl common::Part for ValidationConfig {}
3178
3179/// Describes a selector for extracting and matching an MSH field to a value.
3180///
3181/// This type is not used in any activity, and only used as *part* of another schema.
3182///
3183#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3184#[serde_with::serde_as]
3185#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3186pub struct VersionSource {
3187 /// The field to extract from the MSH segment. For example, "3.1" or "18[1].1".
3188 #[serde(rename = "mshField")]
3189 pub msh_field: Option<String>,
3190 /// The value to match with the field. For example, "My Application Name" or "2.3".
3191 pub value: Option<String>,
3192}
3193
3194impl common::Part for VersionSource {}
3195
3196// ###################
3197// MethodBuilders ###
3198// #################
3199
3200/// A builder providing access to all methods supported on *project* resources.
3201/// It is not used directly, but through the [`CloudHealthcare`] hub.
3202///
3203/// # Example
3204///
3205/// Instantiate a resource builder
3206///
3207/// ```test_harness,no_run
3208/// extern crate hyper;
3209/// extern crate hyper_rustls;
3210/// extern crate google_healthcare1 as healthcare1;
3211///
3212/// # async fn dox() {
3213/// use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3214///
3215/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3216/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3217/// secret,
3218/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3219/// ).build().await.unwrap();
3220///
3221/// let client = hyper_util::client::legacy::Client::builder(
3222/// hyper_util::rt::TokioExecutor::new()
3223/// )
3224/// .build(
3225/// hyper_rustls::HttpsConnectorBuilder::new()
3226/// .with_native_roots()
3227/// .unwrap()
3228/// .https_or_http()
3229/// .enable_http1()
3230/// .build()
3231/// );
3232/// let mut hub = CloudHealthcare::new(client, auth);
3233/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3234/// // like `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(...)`
3235/// // to build up your call.
3236/// let rb = hub.projects();
3237/// # }
3238/// ```
3239pub struct ProjectMethods<'a, C>
3240where
3241 C: 'a,
3242{
3243 hub: &'a CloudHealthcare<C>,
3244}
3245
3246impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
3247
3248impl<'a, C> ProjectMethods<'a, C> {
3249 /// Create a builder to help you perform the following task:
3250 ///
3251 /// Creates a new Attribute definition in the parent consent store.
3252 ///
3253 /// # Arguments
3254 ///
3255 /// * `request` - No description provided.
3256 /// * `parent` - Required. The name of the consent store that this Attribute definition belongs to.
3257 pub fn locations_datasets_consent_stores_attribute_definitions_create(
3258 &self,
3259 request: AttributeDefinition,
3260 parent: &str,
3261 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionCreateCall<'a, C> {
3262 ProjectLocationDatasetConsentStoreAttributeDefinitionCreateCall {
3263 hub: self.hub,
3264 _request: request,
3265 _parent: parent.to_string(),
3266 _attribute_definition_id: Default::default(),
3267 _delegate: Default::default(),
3268 _additional_params: Default::default(),
3269 _scopes: Default::default(),
3270 }
3271 }
3272
3273 /// Create a builder to help you perform the following task:
3274 ///
3275 /// Deletes the specified Attribute definition. Fails if the Attribute definition is referenced by any User data mapping, or the latest revision of any Consent.
3276 ///
3277 /// # Arguments
3278 ///
3279 /// * `name` - Required. The resource name of the Attribute definition to delete. To preserve referential integrity, Attribute definitions referenced by a User data mapping or the latest revision of a Consent cannot be deleted.
3280 pub fn locations_datasets_consent_stores_attribute_definitions_delete(
3281 &self,
3282 name: &str,
3283 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionDeleteCall<'a, C> {
3284 ProjectLocationDatasetConsentStoreAttributeDefinitionDeleteCall {
3285 hub: self.hub,
3286 _name: name.to_string(),
3287 _delegate: Default::default(),
3288 _additional_params: Default::default(),
3289 _scopes: Default::default(),
3290 }
3291 }
3292
3293 /// Create a builder to help you perform the following task:
3294 ///
3295 /// Gets the specified Attribute definition.
3296 ///
3297 /// # Arguments
3298 ///
3299 /// * `name` - Required. The resource name of the Attribute definition to get.
3300 pub fn locations_datasets_consent_stores_attribute_definitions_get(
3301 &self,
3302 name: &str,
3303 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionGetCall<'a, C> {
3304 ProjectLocationDatasetConsentStoreAttributeDefinitionGetCall {
3305 hub: self.hub,
3306 _name: name.to_string(),
3307 _delegate: Default::default(),
3308 _additional_params: Default::default(),
3309 _scopes: Default::default(),
3310 }
3311 }
3312
3313 /// Create a builder to help you perform the following task:
3314 ///
3315 /// Lists the Attribute definitions in the specified consent store.
3316 ///
3317 /// # Arguments
3318 ///
3319 /// * `parent` - Required. Name of the consent store to retrieve Attribute definitions from.
3320 pub fn locations_datasets_consent_stores_attribute_definitions_list(
3321 &self,
3322 parent: &str,
3323 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionListCall<'a, C> {
3324 ProjectLocationDatasetConsentStoreAttributeDefinitionListCall {
3325 hub: self.hub,
3326 _parent: parent.to_string(),
3327 _page_token: Default::default(),
3328 _page_size: Default::default(),
3329 _filter: Default::default(),
3330 _delegate: Default::default(),
3331 _additional_params: Default::default(),
3332 _scopes: Default::default(),
3333 }
3334 }
3335
3336 /// Create a builder to help you perform the following task:
3337 ///
3338 /// Updates the specified Attribute definition.
3339 ///
3340 /// # Arguments
3341 ///
3342 /// * `request` - No description provided.
3343 /// * `name` - Identifier. Resource name of the Attribute definition, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/attributeDefinitions/{attribute_definition_id}`. Cannot be changed after creation.
3344 pub fn locations_datasets_consent_stores_attribute_definitions_patch(
3345 &self,
3346 request: AttributeDefinition,
3347 name: &str,
3348 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionPatchCall<'a, C> {
3349 ProjectLocationDatasetConsentStoreAttributeDefinitionPatchCall {
3350 hub: self.hub,
3351 _request: request,
3352 _name: name.to_string(),
3353 _update_mask: Default::default(),
3354 _delegate: Default::default(),
3355 _additional_params: Default::default(),
3356 _scopes: Default::default(),
3357 }
3358 }
3359
3360 /// Create a builder to help you perform the following task:
3361 ///
3362 /// Creates a new Consent artifact in the parent consent store.
3363 ///
3364 /// # Arguments
3365 ///
3366 /// * `request` - No description provided.
3367 /// * `parent` - Required. The name of the consent store this Consent artifact belongs to.
3368 pub fn locations_datasets_consent_stores_consent_artifacts_create(
3369 &self,
3370 request: ConsentArtifact,
3371 parent: &str,
3372 ) -> ProjectLocationDatasetConsentStoreConsentArtifactCreateCall<'a, C> {
3373 ProjectLocationDatasetConsentStoreConsentArtifactCreateCall {
3374 hub: self.hub,
3375 _request: request,
3376 _parent: parent.to_string(),
3377 _delegate: Default::default(),
3378 _additional_params: Default::default(),
3379 _scopes: Default::default(),
3380 }
3381 }
3382
3383 /// Create a builder to help you perform the following task:
3384 ///
3385 /// Deletes the specified Consent artifact. Fails if the artifact is referenced by the latest revision of any Consent.
3386 ///
3387 /// # Arguments
3388 ///
3389 /// * `name` - Required. The resource name of the Consent artifact to delete. To preserve referential integrity, Consent artifacts referenced by the latest revision of a Consent cannot be deleted.
3390 pub fn locations_datasets_consent_stores_consent_artifacts_delete(
3391 &self,
3392 name: &str,
3393 ) -> ProjectLocationDatasetConsentStoreConsentArtifactDeleteCall<'a, C> {
3394 ProjectLocationDatasetConsentStoreConsentArtifactDeleteCall {
3395 hub: self.hub,
3396 _name: name.to_string(),
3397 _delegate: Default::default(),
3398 _additional_params: Default::default(),
3399 _scopes: Default::default(),
3400 }
3401 }
3402
3403 /// Create a builder to help you perform the following task:
3404 ///
3405 /// Gets the specified Consent artifact.
3406 ///
3407 /// # Arguments
3408 ///
3409 /// * `name` - Required. The resource name of the Consent artifact to retrieve.
3410 pub fn locations_datasets_consent_stores_consent_artifacts_get(
3411 &self,
3412 name: &str,
3413 ) -> ProjectLocationDatasetConsentStoreConsentArtifactGetCall<'a, C> {
3414 ProjectLocationDatasetConsentStoreConsentArtifactGetCall {
3415 hub: self.hub,
3416 _name: name.to_string(),
3417 _delegate: Default::default(),
3418 _additional_params: Default::default(),
3419 _scopes: Default::default(),
3420 }
3421 }
3422
3423 /// Create a builder to help you perform the following task:
3424 ///
3425 /// Lists the Consent artifacts in the specified consent store.
3426 ///
3427 /// # Arguments
3428 ///
3429 /// * `parent` - Required. Name of the consent store to retrieve consent artifacts from.
3430 pub fn locations_datasets_consent_stores_consent_artifacts_list(
3431 &self,
3432 parent: &str,
3433 ) -> ProjectLocationDatasetConsentStoreConsentArtifactListCall<'a, C> {
3434 ProjectLocationDatasetConsentStoreConsentArtifactListCall {
3435 hub: self.hub,
3436 _parent: parent.to_string(),
3437 _page_token: Default::default(),
3438 _page_size: Default::default(),
3439 _filter: Default::default(),
3440 _delegate: Default::default(),
3441 _additional_params: Default::default(),
3442 _scopes: Default::default(),
3443 }
3444 }
3445
3446 /// Create a builder to help you perform the following task:
3447 ///
3448 /// Activates the latest revision of the specified Consent by committing a new revision with `state` updated to `ACTIVE`. If the latest revision of the specified Consent is in the `ACTIVE` state, no new revision is committed. A FAILED_PRECONDITION error occurs if the latest revision of the specified Consent is in the `REJECTED` or `REVOKED` state.
3449 ///
3450 /// # Arguments
3451 ///
3452 /// * `request` - No description provided.
3453 /// * `name` - Required. The resource name of the Consent to activate, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. An INVALID_ARGUMENT error occurs if `revision_id` is specified in the name.
3454 pub fn locations_datasets_consent_stores_consents_activate(
3455 &self,
3456 request: ActivateConsentRequest,
3457 name: &str,
3458 ) -> ProjectLocationDatasetConsentStoreConsentActivateCall<'a, C> {
3459 ProjectLocationDatasetConsentStoreConsentActivateCall {
3460 hub: self.hub,
3461 _request: request,
3462 _name: name.to_string(),
3463 _delegate: Default::default(),
3464 _additional_params: Default::default(),
3465 _scopes: Default::default(),
3466 }
3467 }
3468
3469 /// Create a builder to help you perform the following task:
3470 ///
3471 /// Creates a new Consent in the parent consent store.
3472 ///
3473 /// # Arguments
3474 ///
3475 /// * `request` - No description provided.
3476 /// * `parent` - Required. Name of the consent store.
3477 pub fn locations_datasets_consent_stores_consents_create(
3478 &self,
3479 request: Consent,
3480 parent: &str,
3481 ) -> ProjectLocationDatasetConsentStoreConsentCreateCall<'a, C> {
3482 ProjectLocationDatasetConsentStoreConsentCreateCall {
3483 hub: self.hub,
3484 _request: request,
3485 _parent: parent.to_string(),
3486 _delegate: Default::default(),
3487 _additional_params: Default::default(),
3488 _scopes: Default::default(),
3489 }
3490 }
3491
3492 /// Create a builder to help you perform the following task:
3493 ///
3494 /// Deletes the Consent and its revisions. To keep a record of the Consent but mark it inactive, see [RevokeConsent]. To delete a revision of a Consent, see [DeleteConsentRevision]. This operation does not delete the related Consent artifact.
3495 ///
3496 /// # Arguments
3497 ///
3498 /// * `name` - Required. The resource name of the Consent to delete, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. An INVALID_ARGUMENT error occurs if `revision_id` is specified in the name.
3499 pub fn locations_datasets_consent_stores_consents_delete(
3500 &self,
3501 name: &str,
3502 ) -> ProjectLocationDatasetConsentStoreConsentDeleteCall<'a, C> {
3503 ProjectLocationDatasetConsentStoreConsentDeleteCall {
3504 hub: self.hub,
3505 _name: name.to_string(),
3506 _delegate: Default::default(),
3507 _additional_params: Default::default(),
3508 _scopes: Default::default(),
3509 }
3510 }
3511
3512 /// Create a builder to help you perform the following task:
3513 ///
3514 /// Deletes the specified revision of a Consent. An INVALID_ARGUMENT error occurs if the specified revision is the latest revision.
3515 ///
3516 /// # Arguments
3517 ///
3518 /// * `name` - Required. The resource name of the Consent revision to delete, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}@{revision_id}`. An INVALID_ARGUMENT error occurs if `revision_id` is not specified in the name.
3519 pub fn locations_datasets_consent_stores_consents_delete_revision(
3520 &self,
3521 name: &str,
3522 ) -> ProjectLocationDatasetConsentStoreConsentDeleteRevisionCall<'a, C> {
3523 ProjectLocationDatasetConsentStoreConsentDeleteRevisionCall {
3524 hub: self.hub,
3525 _name: name.to_string(),
3526 _delegate: Default::default(),
3527 _additional_params: Default::default(),
3528 _scopes: Default::default(),
3529 }
3530 }
3531
3532 /// Create a builder to help you perform the following task:
3533 ///
3534 /// Gets the specified revision of a Consent, or the latest revision if `revision_id` is not specified in the resource name.
3535 ///
3536 /// # Arguments
3537 ///
3538 /// * `name` - Required. The resource name of the Consent to retrieve, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. In order to retrieve a previous revision of the Consent, also provide the revision ID: `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}@{revision_id}`
3539 pub fn locations_datasets_consent_stores_consents_get(
3540 &self,
3541 name: &str,
3542 ) -> ProjectLocationDatasetConsentStoreConsentGetCall<'a, C> {
3543 ProjectLocationDatasetConsentStoreConsentGetCall {
3544 hub: self.hub,
3545 _name: name.to_string(),
3546 _delegate: Default::default(),
3547 _additional_params: Default::default(),
3548 _scopes: Default::default(),
3549 }
3550 }
3551
3552 /// Create a builder to help you perform the following task:
3553 ///
3554 /// Lists the Consent in the given consent store, returning each Consent's latest revision.
3555 ///
3556 /// # Arguments
3557 ///
3558 /// * `parent` - Required. Name of the consent store to retrieve Consents from.
3559 pub fn locations_datasets_consent_stores_consents_list(
3560 &self,
3561 parent: &str,
3562 ) -> ProjectLocationDatasetConsentStoreConsentListCall<'a, C> {
3563 ProjectLocationDatasetConsentStoreConsentListCall {
3564 hub: self.hub,
3565 _parent: parent.to_string(),
3566 _page_token: Default::default(),
3567 _page_size: Default::default(),
3568 _filter: Default::default(),
3569 _delegate: Default::default(),
3570 _additional_params: Default::default(),
3571 _scopes: Default::default(),
3572 }
3573 }
3574
3575 /// Create a builder to help you perform the following task:
3576 ///
3577 /// Lists the revisions of the specified Consent in reverse chronological order.
3578 ///
3579 /// # Arguments
3580 ///
3581 /// * `name` - Required. The resource name of the Consent to retrieve revisions for.
3582 pub fn locations_datasets_consent_stores_consents_list_revisions(
3583 &self,
3584 name: &str,
3585 ) -> ProjectLocationDatasetConsentStoreConsentListRevisionCall<'a, C> {
3586 ProjectLocationDatasetConsentStoreConsentListRevisionCall {
3587 hub: self.hub,
3588 _name: name.to_string(),
3589 _page_token: Default::default(),
3590 _page_size: Default::default(),
3591 _filter: Default::default(),
3592 _delegate: Default::default(),
3593 _additional_params: Default::default(),
3594 _scopes: Default::default(),
3595 }
3596 }
3597
3598 /// Create a builder to help you perform the following task:
3599 ///
3600 /// Updates the latest revision of the specified Consent by committing a new revision with the changes. A FAILED_PRECONDITION error occurs if the latest revision of the specified Consent is in the `REJECTED` or `REVOKED` state.
3601 ///
3602 /// # Arguments
3603 ///
3604 /// * `request` - No description provided.
3605 /// * `name` - Identifier. Resource name of the Consent, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. Cannot be changed after creation.
3606 pub fn locations_datasets_consent_stores_consents_patch(
3607 &self,
3608 request: Consent,
3609 name: &str,
3610 ) -> ProjectLocationDatasetConsentStoreConsentPatchCall<'a, C> {
3611 ProjectLocationDatasetConsentStoreConsentPatchCall {
3612 hub: self.hub,
3613 _request: request,
3614 _name: name.to_string(),
3615 _update_mask: Default::default(),
3616 _delegate: Default::default(),
3617 _additional_params: Default::default(),
3618 _scopes: Default::default(),
3619 }
3620 }
3621
3622 /// Create a builder to help you perform the following task:
3623 ///
3624 /// Rejects the latest revision of the specified Consent by committing a new revision with `state` updated to `REJECTED`. If the latest revision of the specified Consent is in the `REJECTED` state, no new revision is committed. A FAILED_PRECONDITION error occurs if the latest revision of the specified Consent is in the `ACTIVE` or `REVOKED` state.
3625 ///
3626 /// # Arguments
3627 ///
3628 /// * `request` - No description provided.
3629 /// * `name` - Required. The resource name of the Consent to reject, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. An INVALID_ARGUMENT error occurs if `revision_id` is specified in the name.
3630 pub fn locations_datasets_consent_stores_consents_reject(
3631 &self,
3632 request: RejectConsentRequest,
3633 name: &str,
3634 ) -> ProjectLocationDatasetConsentStoreConsentRejectCall<'a, C> {
3635 ProjectLocationDatasetConsentStoreConsentRejectCall {
3636 hub: self.hub,
3637 _request: request,
3638 _name: name.to_string(),
3639 _delegate: Default::default(),
3640 _additional_params: Default::default(),
3641 _scopes: Default::default(),
3642 }
3643 }
3644
3645 /// Create a builder to help you perform the following task:
3646 ///
3647 /// Revokes the latest revision of the specified Consent by committing a new revision with `state` updated to `REVOKED`. If the latest revision of the specified Consent is in the `REVOKED` state, no new revision is committed. A FAILED_PRECONDITION error occurs if the latest revision of the given consent is in `DRAFT` or `REJECTED` state.
3648 ///
3649 /// # Arguments
3650 ///
3651 /// * `request` - No description provided.
3652 /// * `name` - Required. The resource name of the Consent to revoke, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. An INVALID_ARGUMENT error occurs if `revision_id` is specified in the name.
3653 pub fn locations_datasets_consent_stores_consents_revoke(
3654 &self,
3655 request: RevokeConsentRequest,
3656 name: &str,
3657 ) -> ProjectLocationDatasetConsentStoreConsentRevokeCall<'a, C> {
3658 ProjectLocationDatasetConsentStoreConsentRevokeCall {
3659 hub: self.hub,
3660 _request: request,
3661 _name: name.to_string(),
3662 _delegate: Default::default(),
3663 _additional_params: Default::default(),
3664 _scopes: Default::default(),
3665 }
3666 }
3667
3668 /// Create a builder to help you perform the following task:
3669 ///
3670 /// Archives the specified User data mapping.
3671 ///
3672 /// # Arguments
3673 ///
3674 /// * `request` - No description provided.
3675 /// * `name` - Required. The resource name of the User data mapping to archive.
3676 pub fn locations_datasets_consent_stores_user_data_mappings_archive(
3677 &self,
3678 request: ArchiveUserDataMappingRequest,
3679 name: &str,
3680 ) -> ProjectLocationDatasetConsentStoreUserDataMappingArchiveCall<'a, C> {
3681 ProjectLocationDatasetConsentStoreUserDataMappingArchiveCall {
3682 hub: self.hub,
3683 _request: request,
3684 _name: name.to_string(),
3685 _delegate: Default::default(),
3686 _additional_params: Default::default(),
3687 _scopes: Default::default(),
3688 }
3689 }
3690
3691 /// Create a builder to help you perform the following task:
3692 ///
3693 /// Creates a new User data mapping in the parent consent store.
3694 ///
3695 /// # Arguments
3696 ///
3697 /// * `request` - No description provided.
3698 /// * `parent` - Required. Name of the consent store.
3699 pub fn locations_datasets_consent_stores_user_data_mappings_create(
3700 &self,
3701 request: UserDataMapping,
3702 parent: &str,
3703 ) -> ProjectLocationDatasetConsentStoreUserDataMappingCreateCall<'a, C> {
3704 ProjectLocationDatasetConsentStoreUserDataMappingCreateCall {
3705 hub: self.hub,
3706 _request: request,
3707 _parent: parent.to_string(),
3708 _delegate: Default::default(),
3709 _additional_params: Default::default(),
3710 _scopes: Default::default(),
3711 }
3712 }
3713
3714 /// Create a builder to help you perform the following task:
3715 ///
3716 /// Deletes the specified User data mapping.
3717 ///
3718 /// # Arguments
3719 ///
3720 /// * `name` - Required. The resource name of the User data mapping to delete.
3721 pub fn locations_datasets_consent_stores_user_data_mappings_delete(
3722 &self,
3723 name: &str,
3724 ) -> ProjectLocationDatasetConsentStoreUserDataMappingDeleteCall<'a, C> {
3725 ProjectLocationDatasetConsentStoreUserDataMappingDeleteCall {
3726 hub: self.hub,
3727 _name: name.to_string(),
3728 _delegate: Default::default(),
3729 _additional_params: Default::default(),
3730 _scopes: Default::default(),
3731 }
3732 }
3733
3734 /// Create a builder to help you perform the following task:
3735 ///
3736 /// Gets the specified User data mapping.
3737 ///
3738 /// # Arguments
3739 ///
3740 /// * `name` - Required. The resource name of the User data mapping to retrieve.
3741 pub fn locations_datasets_consent_stores_user_data_mappings_get(
3742 &self,
3743 name: &str,
3744 ) -> ProjectLocationDatasetConsentStoreUserDataMappingGetCall<'a, C> {
3745 ProjectLocationDatasetConsentStoreUserDataMappingGetCall {
3746 hub: self.hub,
3747 _name: name.to_string(),
3748 _delegate: Default::default(),
3749 _additional_params: Default::default(),
3750 _scopes: Default::default(),
3751 }
3752 }
3753
3754 /// Create a builder to help you perform the following task:
3755 ///
3756 /// Lists the User data mappings in the specified consent store.
3757 ///
3758 /// # Arguments
3759 ///
3760 /// * `parent` - Required. Name of the consent store to retrieve User data mappings from.
3761 pub fn locations_datasets_consent_stores_user_data_mappings_list(
3762 &self,
3763 parent: &str,
3764 ) -> ProjectLocationDatasetConsentStoreUserDataMappingListCall<'a, C> {
3765 ProjectLocationDatasetConsentStoreUserDataMappingListCall {
3766 hub: self.hub,
3767 _parent: parent.to_string(),
3768 _page_token: Default::default(),
3769 _page_size: Default::default(),
3770 _filter: Default::default(),
3771 _delegate: Default::default(),
3772 _additional_params: Default::default(),
3773 _scopes: Default::default(),
3774 }
3775 }
3776
3777 /// Create a builder to help you perform the following task:
3778 ///
3779 /// Updates the specified User data mapping.
3780 ///
3781 /// # Arguments
3782 ///
3783 /// * `request` - No description provided.
3784 /// * `name` - Resource name of the User data mapping, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/userDataMappings/{user_data_mapping_id}`.
3785 pub fn locations_datasets_consent_stores_user_data_mappings_patch(
3786 &self,
3787 request: UserDataMapping,
3788 name: &str,
3789 ) -> ProjectLocationDatasetConsentStoreUserDataMappingPatchCall<'a, C> {
3790 ProjectLocationDatasetConsentStoreUserDataMappingPatchCall {
3791 hub: self.hub,
3792 _request: request,
3793 _name: name.to_string(),
3794 _update_mask: Default::default(),
3795 _delegate: Default::default(),
3796 _additional_params: Default::default(),
3797 _scopes: Default::default(),
3798 }
3799 }
3800
3801 /// Create a builder to help you perform the following task:
3802 ///
3803 /// Checks if a particular data_id of a User data mapping in the specified consent store is consented for the specified use.
3804 ///
3805 /// # Arguments
3806 ///
3807 /// * `request` - No description provided.
3808 /// * `consentStore` - Required. Name of the consent store where the requested data_id is stored, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}`.
3809 pub fn locations_datasets_consent_stores_check_data_access(
3810 &self,
3811 request: CheckDataAccessRequest,
3812 consent_store: &str,
3813 ) -> ProjectLocationDatasetConsentStoreCheckDataAccesCall<'a, C> {
3814 ProjectLocationDatasetConsentStoreCheckDataAccesCall {
3815 hub: self.hub,
3816 _request: request,
3817 _consent_store: consent_store.to_string(),
3818 _delegate: Default::default(),
3819 _additional_params: Default::default(),
3820 _scopes: Default::default(),
3821 }
3822 }
3823
3824 /// Create a builder to help you perform the following task:
3825 ///
3826 /// Creates a new consent store in the parent dataset. Attempting to create a consent store with the same ID as an existing store fails with an ALREADY_EXISTS error.
3827 ///
3828 /// # Arguments
3829 ///
3830 /// * `request` - No description provided.
3831 /// * `parent` - Required. The name of the dataset this consent store belongs to.
3832 pub fn locations_datasets_consent_stores_create(
3833 &self,
3834 request: ConsentStore,
3835 parent: &str,
3836 ) -> ProjectLocationDatasetConsentStoreCreateCall<'a, C> {
3837 ProjectLocationDatasetConsentStoreCreateCall {
3838 hub: self.hub,
3839 _request: request,
3840 _parent: parent.to_string(),
3841 _consent_store_id: Default::default(),
3842 _delegate: Default::default(),
3843 _additional_params: Default::default(),
3844 _scopes: Default::default(),
3845 }
3846 }
3847
3848 /// Create a builder to help you perform the following task:
3849 ///
3850 /// Deletes the specified consent store and removes all the consent store's data.
3851 ///
3852 /// # Arguments
3853 ///
3854 /// * `name` - Required. The resource name of the consent store to delete.
3855 pub fn locations_datasets_consent_stores_delete(
3856 &self,
3857 name: &str,
3858 ) -> ProjectLocationDatasetConsentStoreDeleteCall<'a, C> {
3859 ProjectLocationDatasetConsentStoreDeleteCall {
3860 hub: self.hub,
3861 _name: name.to_string(),
3862 _delegate: Default::default(),
3863 _additional_params: Default::default(),
3864 _scopes: Default::default(),
3865 }
3866 }
3867
3868 /// Create a builder to help you perform the following task:
3869 ///
3870 /// Evaluates the user's Consents for all matching User data mappings. Note: User data mappings are indexed asynchronously, which can cause a slight delay between the time mappings are created or updated and when they are included in EvaluateUserConsents results.
3871 ///
3872 /// # Arguments
3873 ///
3874 /// * `request` - No description provided.
3875 /// * `consentStore` - Required. Name of the consent store to retrieve User data mappings from.
3876 pub fn locations_datasets_consent_stores_evaluate_user_consents(
3877 &self,
3878 request: EvaluateUserConsentsRequest,
3879 consent_store: &str,
3880 ) -> ProjectLocationDatasetConsentStoreEvaluateUserConsentCall<'a, C> {
3881 ProjectLocationDatasetConsentStoreEvaluateUserConsentCall {
3882 hub: self.hub,
3883 _request: request,
3884 _consent_store: consent_store.to_string(),
3885 _delegate: Default::default(),
3886 _additional_params: Default::default(),
3887 _scopes: Default::default(),
3888 }
3889 }
3890
3891 /// Create a builder to help you perform the following task:
3892 ///
3893 /// Gets the specified consent store.
3894 ///
3895 /// # Arguments
3896 ///
3897 /// * `name` - Required. The resource name of the consent store to get.
3898 pub fn locations_datasets_consent_stores_get(
3899 &self,
3900 name: &str,
3901 ) -> ProjectLocationDatasetConsentStoreGetCall<'a, C> {
3902 ProjectLocationDatasetConsentStoreGetCall {
3903 hub: self.hub,
3904 _name: name.to_string(),
3905 _delegate: Default::default(),
3906 _additional_params: Default::default(),
3907 _scopes: Default::default(),
3908 }
3909 }
3910
3911 /// Create a builder to help you perform the following task:
3912 ///
3913 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3914 ///
3915 /// # Arguments
3916 ///
3917 /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3918 pub fn locations_datasets_consent_stores_get_iam_policy(
3919 &self,
3920 resource: &str,
3921 ) -> ProjectLocationDatasetConsentStoreGetIamPolicyCall<'a, C> {
3922 ProjectLocationDatasetConsentStoreGetIamPolicyCall {
3923 hub: self.hub,
3924 _resource: resource.to_string(),
3925 _options_requested_policy_version: Default::default(),
3926 _delegate: Default::default(),
3927 _additional_params: Default::default(),
3928 _scopes: Default::default(),
3929 }
3930 }
3931
3932 /// Create a builder to help you perform the following task:
3933 ///
3934 /// Lists the consent stores in the specified dataset.
3935 ///
3936 /// # Arguments
3937 ///
3938 /// * `parent` - Required. Name of the dataset.
3939 pub fn locations_datasets_consent_stores_list(
3940 &self,
3941 parent: &str,
3942 ) -> ProjectLocationDatasetConsentStoreListCall<'a, C> {
3943 ProjectLocationDatasetConsentStoreListCall {
3944 hub: self.hub,
3945 _parent: parent.to_string(),
3946 _page_token: Default::default(),
3947 _page_size: Default::default(),
3948 _filter: Default::default(),
3949 _delegate: Default::default(),
3950 _additional_params: Default::default(),
3951 _scopes: Default::default(),
3952 }
3953 }
3954
3955 /// Create a builder to help you perform the following task:
3956 ///
3957 /// Updates the specified consent store.
3958 ///
3959 /// # Arguments
3960 ///
3961 /// * `request` - No description provided.
3962 /// * `name` - Identifier. Resource name of the consent store, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}`. Cannot be changed after creation.
3963 pub fn locations_datasets_consent_stores_patch(
3964 &self,
3965 request: ConsentStore,
3966 name: &str,
3967 ) -> ProjectLocationDatasetConsentStorePatchCall<'a, C> {
3968 ProjectLocationDatasetConsentStorePatchCall {
3969 hub: self.hub,
3970 _request: request,
3971 _name: name.to_string(),
3972 _update_mask: Default::default(),
3973 _delegate: Default::default(),
3974 _additional_params: Default::default(),
3975 _scopes: Default::default(),
3976 }
3977 }
3978
3979 /// Create a builder to help you perform the following task:
3980 ///
3981 /// Queries all data_ids that are consented for a specified use in the given consent store and writes them to a specified destination. The returned Operation includes a progress counter for the number of User data mappings processed. If the request is successful, a detailed response is returned of type QueryAccessibleDataResponse, contained in the response field when the operation finishes. The metadata field type is OperationMetadata. Errors are logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). For example, the following sample log entry shows a `failed to evaluate consent policy` error that occurred during a QueryAccessibleData call to consent store `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}`. ```json jsonPayload: { @type: "type.googleapis.com/google.cloud.healthcare.logging.QueryAccessibleDataLogEntry" error: { code: 9 message: "failed to evaluate consent policy" } resourceName: "projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}" } logName: "projects/{project_id}/logs/healthcare.googleapis.com%2Fquery_accessible_data" operation: { id: "projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/operations/{operation_id}" producer: "healthcare.googleapis.com/QueryAccessibleData" } receiveTimestamp: "TIMESTAMP" resource: { labels: { consent_store_id: "{consent_store_id}" dataset_id: "{dataset_id}" location: "{location_id}" project_id: "{project_id}" } type: "healthcare_consent_store" } severity: "ERROR" timestamp: "TIMESTAMP" ```
3982 ///
3983 /// # Arguments
3984 ///
3985 /// * `request` - No description provided.
3986 /// * `consentStore` - Required. Name of the consent store to retrieve User data mappings from.
3987 pub fn locations_datasets_consent_stores_query_accessible_data(
3988 &self,
3989 request: QueryAccessibleDataRequest,
3990 consent_store: &str,
3991 ) -> ProjectLocationDatasetConsentStoreQueryAccessibleDataCall<'a, C> {
3992 ProjectLocationDatasetConsentStoreQueryAccessibleDataCall {
3993 hub: self.hub,
3994 _request: request,
3995 _consent_store: consent_store.to_string(),
3996 _delegate: Default::default(),
3997 _additional_params: Default::default(),
3998 _scopes: Default::default(),
3999 }
4000 }
4001
4002 /// Create a builder to help you perform the following task:
4003 ///
4004 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4005 ///
4006 /// # Arguments
4007 ///
4008 /// * `request` - No description provided.
4009 /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4010 pub fn locations_datasets_consent_stores_set_iam_policy(
4011 &self,
4012 request: SetIamPolicyRequest,
4013 resource: &str,
4014 ) -> ProjectLocationDatasetConsentStoreSetIamPolicyCall<'a, C> {
4015 ProjectLocationDatasetConsentStoreSetIamPolicyCall {
4016 hub: self.hub,
4017 _request: request,
4018 _resource: resource.to_string(),
4019 _delegate: Default::default(),
4020 _additional_params: Default::default(),
4021 _scopes: Default::default(),
4022 }
4023 }
4024
4025 /// Create a builder to help you perform the following task:
4026 ///
4027 /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
4028 ///
4029 /// # Arguments
4030 ///
4031 /// * `request` - No description provided.
4032 /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4033 pub fn locations_datasets_consent_stores_test_iam_permissions(
4034 &self,
4035 request: TestIamPermissionsRequest,
4036 resource: &str,
4037 ) -> ProjectLocationDatasetConsentStoreTestIamPermissionCall<'a, C> {
4038 ProjectLocationDatasetConsentStoreTestIamPermissionCall {
4039 hub: self.hub,
4040 _request: request,
4041 _resource: resource.to_string(),
4042 _delegate: Default::default(),
4043 _additional_params: Default::default(),
4044 _scopes: Default::default(),
4045 }
4046 }
4047
4048 /// Create a builder to help you perform the following task:
4049 ///
4050 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4051 ///
4052 /// # Arguments
4053 ///
4054 /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4055 pub fn locations_datasets_data_mapper_workspaces_get_iam_policy(
4056 &self,
4057 resource: &str,
4058 ) -> ProjectLocationDatasetDataMapperWorkspaceGetIamPolicyCall<'a, C> {
4059 ProjectLocationDatasetDataMapperWorkspaceGetIamPolicyCall {
4060 hub: self.hub,
4061 _resource: resource.to_string(),
4062 _options_requested_policy_version: Default::default(),
4063 _delegate: Default::default(),
4064 _additional_params: Default::default(),
4065 _scopes: Default::default(),
4066 }
4067 }
4068
4069 /// Create a builder to help you perform the following task:
4070 ///
4071 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4072 ///
4073 /// # Arguments
4074 ///
4075 /// * `request` - No description provided.
4076 /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4077 pub fn locations_datasets_data_mapper_workspaces_set_iam_policy(
4078 &self,
4079 request: SetIamPolicyRequest,
4080 resource: &str,
4081 ) -> ProjectLocationDatasetDataMapperWorkspaceSetIamPolicyCall<'a, C> {
4082 ProjectLocationDatasetDataMapperWorkspaceSetIamPolicyCall {
4083 hub: self.hub,
4084 _request: request,
4085 _resource: resource.to_string(),
4086 _delegate: Default::default(),
4087 _additional_params: Default::default(),
4088 _scopes: Default::default(),
4089 }
4090 }
4091
4092 /// Create a builder to help you perform the following task:
4093 ///
4094 /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
4095 ///
4096 /// # Arguments
4097 ///
4098 /// * `request` - No description provided.
4099 /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4100 pub fn locations_datasets_data_mapper_workspaces_test_iam_permissions(
4101 &self,
4102 request: TestIamPermissionsRequest,
4103 resource: &str,
4104 ) -> ProjectLocationDatasetDataMapperWorkspaceTestIamPermissionCall<'a, C> {
4105 ProjectLocationDatasetDataMapperWorkspaceTestIamPermissionCall {
4106 hub: self.hub,
4107 _request: request,
4108 _resource: resource.to_string(),
4109 _delegate: Default::default(),
4110 _additional_params: Default::default(),
4111 _scopes: Default::default(),
4112 }
4113 }
4114
4115 /// Create a builder to help you perform the following task:
4116 ///
4117 /// GetSeriesMetrics returns metrics for a series.
4118 ///
4119 /// # Arguments
4120 ///
4121 /// * `series` - Required. The series resource path. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}/dicomWeb/studies/{study_uid}/series/{series_uid}`.
4122 pub fn locations_datasets_dicom_stores_dicom_web_studies_series_get_series_metrics(
4123 &self,
4124 series: &str,
4125 ) -> ProjectLocationDatasetDicomStoreDicomWebStudySeriesGetSeriesMetricCall<'a, C> {
4126 ProjectLocationDatasetDicomStoreDicomWebStudySeriesGetSeriesMetricCall {
4127 hub: self.hub,
4128 _series: series.to_string(),
4129 _delegate: Default::default(),
4130 _additional_params: Default::default(),
4131 _scopes: Default::default(),
4132 }
4133 }
4134
4135 /// Create a builder to help you perform the following task:
4136 ///
4137 /// GetStudyMetrics returns metrics for a study.
4138 ///
4139 /// # Arguments
4140 ///
4141 /// * `study` - Required. The study resource path. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}/dicomWeb/studies/{study_uid}`.
4142 pub fn locations_datasets_dicom_stores_dicom_web_studies_get_study_metrics(
4143 &self,
4144 study: &str,
4145 ) -> ProjectLocationDatasetDicomStoreDicomWebStudyGetStudyMetricCall<'a, C> {
4146 ProjectLocationDatasetDicomStoreDicomWebStudyGetStudyMetricCall {
4147 hub: self.hub,
4148 _study: study.to_string(),
4149 _delegate: Default::default(),
4150 _additional_params: Default::default(),
4151 _scopes: Default::default(),
4152 }
4153 }
4154
4155 /// Create a builder to help you perform the following task:
4156 ///
4157 /// RetrieveFrames returns instances associated with the given study, series, SOP Instance UID and frame numbers. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4}. For details on the implementation of RetrieveFrames, see [DICOM frames](https://cloud.google.com/healthcare/docs/dicom#dicom_frames) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveFrames, see [Retrieve DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-dicom).
4158 ///
4159 /// # Arguments
4160 ///
4161 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4162 /// * `dicomWebPath` - Required. The path of the RetrieveFrames DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}/frames/{frame_list}`.
4163 pub fn locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_frames(
4164 &self,
4165 parent: &str,
4166 dicom_web_path: &str,
4167 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveFrameCall<'a, C> {
4168 ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveFrameCall {
4169 hub: self.hub,
4170 _parent: parent.to_string(),
4171 _dicom_web_path: dicom_web_path.to_string(),
4172 _delegate: Default::default(),
4173 _additional_params: Default::default(),
4174 _scopes: Default::default(),
4175 }
4176 }
4177
4178 /// Create a builder to help you perform the following task:
4179 ///
4180 /// RetrieveRenderedFrames returns instances associated with the given study, series, SOP Instance UID and frame numbers in an acceptable Rendered Media Type. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveRenderedFrames, see [Rendered resources](https://cloud.google.com/healthcare/docs/dicom#rendered_resources) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveRenderedFrames, see [Retrieve consumer image formats](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-consumer).
4181 ///
4182 /// # Arguments
4183 ///
4184 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4185 /// * `dicomWebPath` - Required. The path of the RetrieveRenderedFrames DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}/frames/{frame_list}/rendered`.
4186 pub fn locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_rendered(
4187 &self,
4188 parent: &str,
4189 dicom_web_path: &str,
4190 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveRenderedCall<'a, C> {
4191 ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveRenderedCall {
4192 hub: self.hub,
4193 _parent: parent.to_string(),
4194 _dicom_web_path: dicom_web_path.to_string(),
4195 _delegate: Default::default(),
4196 _additional_params: Default::default(),
4197 _scopes: Default::default(),
4198 }
4199 }
4200
4201 /// Create a builder to help you perform the following task:
4202 ///
4203 /// DeleteInstance deletes an instance associated with the given study, series, and SOP Instance UID. Delete requests are equivalent to the GET requests specified in the Retrieve transaction. Study and series search results can take a few seconds to be updated after an instance is deleted using DeleteInstance. For samples that show how to call DeleteInstance, see [Delete a study, series, or instance](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#delete-dicom).
4204 ///
4205 /// # Arguments
4206 ///
4207 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4208 /// * `dicomWebPath` - Required. The path of the DeleteInstance request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}`.
4209 pub fn locations_datasets_dicom_stores_studies_series_instances_delete(
4210 &self,
4211 parent: &str,
4212 dicom_web_path: &str,
4213 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceDeleteCall<'a, C> {
4214 ProjectLocationDatasetDicomStoreStudySeriesInstanceDeleteCall {
4215 hub: self.hub,
4216 _parent: parent.to_string(),
4217 _dicom_web_path: dicom_web_path.to_string(),
4218 _delegate: Default::default(),
4219 _additional_params: Default::default(),
4220 _scopes: Default::default(),
4221 }
4222 }
4223
4224 /// Create a builder to help you perform the following task:
4225 ///
4226 /// RetrieveInstance returns instance associated with the given study, series, and SOP Instance UID. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveInstance, see [DICOM study/series/instances](https://cloud.google.com/healthcare/docs/dicom#dicom_studyseriesinstances) and [DICOM instances](https://cloud.google.com/healthcare/docs/dicom#dicom_instances) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveInstance, see [Retrieve an instance](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-instance).
4227 ///
4228 /// # Arguments
4229 ///
4230 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4231 /// * `dicomWebPath` - Required. The path of the RetrieveInstance DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}`.
4232 pub fn locations_datasets_dicom_stores_studies_series_instances_retrieve_instance(
4233 &self,
4234 parent: &str,
4235 dicom_web_path: &str,
4236 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveInstanceCall<'a, C> {
4237 ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveInstanceCall {
4238 hub: self.hub,
4239 _parent: parent.to_string(),
4240 _dicom_web_path: dicom_web_path.to_string(),
4241 _delegate: Default::default(),
4242 _additional_params: Default::default(),
4243 _scopes: Default::default(),
4244 }
4245 }
4246
4247 /// Create a builder to help you perform the following task:
4248 ///
4249 /// RetrieveInstanceMetadata returns instance associated with the given study, series, and SOP Instance UID presented as metadata with the bulk data removed. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveInstanceMetadata, see [Metadata resources](https://cloud.google.com/healthcare/docs/dicom#metadata_resources) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveInstanceMetadata, see [Retrieve metadata](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-metadata).
4250 ///
4251 /// # Arguments
4252 ///
4253 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4254 /// * `dicomWebPath` - Required. The path of the RetrieveInstanceMetadata DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}/metadata`.
4255 pub fn locations_datasets_dicom_stores_studies_series_instances_retrieve_metadata(
4256 &self,
4257 parent: &str,
4258 dicom_web_path: &str,
4259 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveMetadataCall<'a, C> {
4260 ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveMetadataCall {
4261 hub: self.hub,
4262 _parent: parent.to_string(),
4263 _dicom_web_path: dicom_web_path.to_string(),
4264 _delegate: Default::default(),
4265 _additional_params: Default::default(),
4266 _scopes: Default::default(),
4267 }
4268 }
4269
4270 /// Create a builder to help you perform the following task:
4271 ///
4272 /// RetrieveRenderedInstance returns instance associated with the given study, series, and SOP Instance UID in an acceptable Rendered Media Type. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveRenderedInstance, see [Rendered resources](https://cloud.google.com/healthcare/docs/dicom#rendered_resources) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveRenderedInstance, see [Retrieve consumer image formats](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-consumer).
4273 ///
4274 /// # Arguments
4275 ///
4276 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4277 /// * `dicomWebPath` - Required. The path of the RetrieveRenderedInstance DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}/rendered`.
4278 pub fn locations_datasets_dicom_stores_studies_series_instances_retrieve_rendered(
4279 &self,
4280 parent: &str,
4281 dicom_web_path: &str,
4282 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveRenderedCall<'a, C> {
4283 ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveRenderedCall {
4284 hub: self.hub,
4285 _parent: parent.to_string(),
4286 _dicom_web_path: dicom_web_path.to_string(),
4287 _delegate: Default::default(),
4288 _additional_params: Default::default(),
4289 _scopes: Default::default(),
4290 }
4291 }
4292
4293 /// Create a builder to help you perform the following task:
4294 ///
4295 /// DeleteSeries deletes all instances within the given study and series. Delete requests are equivalent to the GET requests specified in the Retrieve transaction. The method returns an Operation which will be marked successful when the deletion is complete. Warning: Instances cannot be inserted into a series that is being deleted by an operation until the operation completes. For samples that show how to call DeleteSeries, see [Delete a study, series, or instance](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#delete-dicom).
4296 ///
4297 /// # Arguments
4298 ///
4299 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4300 /// * `dicomWebPath` - Required. The path of the DeleteSeries request. For example, `studies/{study_uid}/series/{series_uid}`.
4301 pub fn locations_datasets_dicom_stores_studies_series_delete(
4302 &self,
4303 parent: &str,
4304 dicom_web_path: &str,
4305 ) -> ProjectLocationDatasetDicomStoreStudySeriesDeleteCall<'a, C> {
4306 ProjectLocationDatasetDicomStoreStudySeriesDeleteCall {
4307 hub: self.hub,
4308 _parent: parent.to_string(),
4309 _dicom_web_path: dicom_web_path.to_string(),
4310 _delegate: Default::default(),
4311 _additional_params: Default::default(),
4312 _scopes: Default::default(),
4313 }
4314 }
4315
4316 /// Create a builder to help you perform the following task:
4317 ///
4318 /// RetrieveSeriesMetadata returns instance associated with the given study and series, presented as metadata with the bulk data removed. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveSeriesMetadata, see [Metadata resources](https://cloud.google.com/healthcare/docs/dicom#metadata_resources) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveSeriesMetadata, see [Retrieve metadata](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-metadata).
4319 ///
4320 /// # Arguments
4321 ///
4322 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4323 /// * `dicomWebPath` - Required. The path of the RetrieveSeriesMetadata DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/metadata`.
4324 pub fn locations_datasets_dicom_stores_studies_series_retrieve_metadata(
4325 &self,
4326 parent: &str,
4327 dicom_web_path: &str,
4328 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveMetadataCall<'a, C> {
4329 ProjectLocationDatasetDicomStoreStudySeriesRetrieveMetadataCall {
4330 hub: self.hub,
4331 _parent: parent.to_string(),
4332 _dicom_web_path: dicom_web_path.to_string(),
4333 _delegate: Default::default(),
4334 _additional_params: Default::default(),
4335 _scopes: Default::default(),
4336 }
4337 }
4338
4339 /// Create a builder to help you perform the following task:
4340 ///
4341 /// RetrieveSeries returns all instances within the given study and series. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveSeries, see [DICOM study/series/instances](https://cloud.google.com/healthcare/docs/dicom#dicom_studyseriesinstances) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveSeries, see [Retrieve DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-dicom).
4342 ///
4343 /// # Arguments
4344 ///
4345 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4346 /// * `dicomWebPath` - Required. The path of the RetrieveSeries DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}`.
4347 pub fn locations_datasets_dicom_stores_studies_series_retrieve_series(
4348 &self,
4349 parent: &str,
4350 dicom_web_path: &str,
4351 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveSeryCall<'a, C> {
4352 ProjectLocationDatasetDicomStoreStudySeriesRetrieveSeryCall {
4353 hub: self.hub,
4354 _parent: parent.to_string(),
4355 _dicom_web_path: dicom_web_path.to_string(),
4356 _delegate: Default::default(),
4357 _additional_params: Default::default(),
4358 _scopes: Default::default(),
4359 }
4360 }
4361
4362 /// Create a builder to help you perform the following task:
4363 ///
4364 /// SearchForInstances returns a list of matching instances. See [Search Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6). For details on the implementation of SearchForInstances, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForInstances, see [Search for DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#search-dicom).
4365 ///
4366 /// # Arguments
4367 ///
4368 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4369 /// * `dicomWebPath` - Required. The path of the SearchForInstancesRequest DICOMweb request. For example, `instances`, `series/{series_uid}/instances`, or `studies/{study_uid}/instances`.
4370 pub fn locations_datasets_dicom_stores_studies_series_search_for_instances(
4371 &self,
4372 parent: &str,
4373 dicom_web_path: &str,
4374 ) -> ProjectLocationDatasetDicomStoreStudySeriesSearchForInstanceCall<'a, C> {
4375 ProjectLocationDatasetDicomStoreStudySeriesSearchForInstanceCall {
4376 hub: self.hub,
4377 _parent: parent.to_string(),
4378 _dicom_web_path: dicom_web_path.to_string(),
4379 _delegate: Default::default(),
4380 _additional_params: Default::default(),
4381 _scopes: Default::default(),
4382 }
4383 }
4384
4385 /// Create a builder to help you perform the following task:
4386 ///
4387 /// DeleteStudy deletes all instances within the given study. Delete requests are equivalent to the GET requests specified in the Retrieve transaction. The method returns an Operation which will be marked successful when the deletion is complete. Warning: Instances cannot be inserted into a study that is being deleted by an operation until the operation completes. For samples that show how to call DeleteStudy, see [Delete a study, series, or instance](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#delete-dicom).
4388 ///
4389 /// # Arguments
4390 ///
4391 /// * `parent` - No description provided.
4392 /// * `dicomWebPath` - Required. The path of the DeleteStudy request. For example, `studies/{study_uid}`.
4393 pub fn locations_datasets_dicom_stores_studies_delete(
4394 &self,
4395 parent: &str,
4396 dicom_web_path: &str,
4397 ) -> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C> {
4398 ProjectLocationDatasetDicomStoreStudyDeleteCall {
4399 hub: self.hub,
4400 _parent: parent.to_string(),
4401 _dicom_web_path: dicom_web_path.to_string(),
4402 _delegate: Default::default(),
4403 _additional_params: Default::default(),
4404 _scopes: Default::default(),
4405 }
4406 }
4407
4408 /// Create a builder to help you perform the following task:
4409 ///
4410 /// RetrieveStudyMetadata returns instance associated with the given study presented as metadata with the bulk data removed. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveStudyMetadata, see [Metadata resources](https://cloud.google.com/healthcare/docs/dicom#metadata_resources) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveStudyMetadata, see [Retrieve metadata](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-metadata).
4411 ///
4412 /// # Arguments
4413 ///
4414 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4415 /// * `dicomWebPath` - Required. The path of the RetrieveStudyMetadata DICOMweb request. For example, `studies/{study_uid}/metadata`.
4416 pub fn locations_datasets_dicom_stores_studies_retrieve_metadata(
4417 &self,
4418 parent: &str,
4419 dicom_web_path: &str,
4420 ) -> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C> {
4421 ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall {
4422 hub: self.hub,
4423 _parent: parent.to_string(),
4424 _dicom_web_path: dicom_web_path.to_string(),
4425 _delegate: Default::default(),
4426 _additional_params: Default::default(),
4427 _scopes: Default::default(),
4428 }
4429 }
4430
4431 /// Create a builder to help you perform the following task:
4432 ///
4433 /// RetrieveStudy returns all instances within the given study. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveStudy, see [DICOM study/series/instances](https://cloud.google.com/healthcare/docs/dicom#dicom_studyseriesinstances) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveStudy, see [Retrieve DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-dicom).
4434 ///
4435 /// # Arguments
4436 ///
4437 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4438 /// * `dicomWebPath` - Required. The path of the RetrieveStudy DICOMweb request. For example, `studies/{study_uid}`.
4439 pub fn locations_datasets_dicom_stores_studies_retrieve_study(
4440 &self,
4441 parent: &str,
4442 dicom_web_path: &str,
4443 ) -> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C> {
4444 ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall {
4445 hub: self.hub,
4446 _parent: parent.to_string(),
4447 _dicom_web_path: dicom_web_path.to_string(),
4448 _delegate: Default::default(),
4449 _additional_params: Default::default(),
4450 _scopes: Default::default(),
4451 }
4452 }
4453
4454 /// Create a builder to help you perform the following task:
4455 ///
4456 /// SearchForInstances returns a list of matching instances. See [Search Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6). For details on the implementation of SearchForInstances, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForInstances, see [Search for DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#search-dicom).
4457 ///
4458 /// # Arguments
4459 ///
4460 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4461 /// * `dicomWebPath` - Required. The path of the SearchForInstancesRequest DICOMweb request. For example, `instances`, `series/{series_uid}/instances`, or `studies/{study_uid}/instances`.
4462 pub fn locations_datasets_dicom_stores_studies_search_for_instances(
4463 &self,
4464 parent: &str,
4465 dicom_web_path: &str,
4466 ) -> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C> {
4467 ProjectLocationDatasetDicomStoreStudySearchForInstanceCall {
4468 hub: self.hub,
4469 _parent: parent.to_string(),
4470 _dicom_web_path: dicom_web_path.to_string(),
4471 _delegate: Default::default(),
4472 _additional_params: Default::default(),
4473 _scopes: Default::default(),
4474 }
4475 }
4476
4477 /// Create a builder to help you perform the following task:
4478 ///
4479 /// SearchForSeries returns a list of matching series. See [Search Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6). For details on the implementation of SearchForSeries, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForSeries, see [Search for DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#search-dicom).
4480 ///
4481 /// # Arguments
4482 ///
4483 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4484 /// * `dicomWebPath` - Required. The path of the SearchForSeries DICOMweb request. For example, `series` or `studies/{study_uid}/series`.
4485 pub fn locations_datasets_dicom_stores_studies_search_for_series(
4486 &self,
4487 parent: &str,
4488 dicom_web_path: &str,
4489 ) -> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C> {
4490 ProjectLocationDatasetDicomStoreStudySearchForSeryCall {
4491 hub: self.hub,
4492 _parent: parent.to_string(),
4493 _dicom_web_path: dicom_web_path.to_string(),
4494 _delegate: Default::default(),
4495 _additional_params: Default::default(),
4496 _scopes: Default::default(),
4497 }
4498 }
4499
4500 /// Create a builder to help you perform the following task:
4501 ///
4502 /// StoreInstances stores DICOM instances associated with study instance unique identifiers (SUID). See [Store Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.5). For details on the implementation of StoreInstances, see [Store transaction](https://cloud.google.com/healthcare/docs/dicom#store_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call StoreInstances, see [Store DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#store-dicom).
4503 ///
4504 /// # Arguments
4505 ///
4506 /// * `request` - No description provided.
4507 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4508 /// * `dicomWebPath` - Required. The path of the StoreInstances DICOMweb request. For example, `studies/[{study_uid}]`. Note that the `study_uid` is optional.
4509 pub fn locations_datasets_dicom_stores_studies_store_instances(
4510 &self,
4511 request: HttpBody,
4512 parent: &str,
4513 dicom_web_path: &str,
4514 ) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C> {
4515 ProjectLocationDatasetDicomStoreStudyStoreInstanceCall {
4516 hub: self.hub,
4517 _request: request,
4518 _parent: parent.to_string(),
4519 _dicom_web_path: dicom_web_path.to_string(),
4520 _delegate: Default::default(),
4521 _additional_params: Default::default(),
4522 _scopes: Default::default(),
4523 }
4524 }
4525
4526 /// Create a builder to help you perform the following task:
4527 ///
4528 /// Creates a new DICOM store within the parent dataset.
4529 ///
4530 /// # Arguments
4531 ///
4532 /// * `request` - No description provided.
4533 /// * `parent` - Required. The name of the dataset this DICOM store belongs to.
4534 pub fn locations_datasets_dicom_stores_create(
4535 &self,
4536 request: DicomStore,
4537 parent: &str,
4538 ) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C> {
4539 ProjectLocationDatasetDicomStoreCreateCall {
4540 hub: self.hub,
4541 _request: request,
4542 _parent: parent.to_string(),
4543 _dicom_store_id: Default::default(),
4544 _delegate: Default::default(),
4545 _additional_params: Default::default(),
4546 _scopes: Default::default(),
4547 }
4548 }
4549
4550 /// Create a builder to help you perform the following task:
4551 ///
4552 /// De-identifies data from the source store and writes it to the destination store. The metadata field type is OperationMetadata. If the request is successful, the response field type is DeidentifyDicomStoreSummary. If errors occur, error is set. The LRO result may still be successful if de-identification fails for some DICOM instances. The output DICOM store will not contain these failed resources. Failed resource totals are tracked in Operation.metadata. Error details are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).
4553 ///
4554 /// # Arguments
4555 ///
4556 /// * `request` - No description provided.
4557 /// * `sourceStore` - Required. Source DICOM store resource name. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4558 pub fn locations_datasets_dicom_stores_deidentify(
4559 &self,
4560 request: DeidentifyDicomStoreRequest,
4561 source_store: &str,
4562 ) -> ProjectLocationDatasetDicomStoreDeidentifyCall<'a, C> {
4563 ProjectLocationDatasetDicomStoreDeidentifyCall {
4564 hub: self.hub,
4565 _request: request,
4566 _source_store: source_store.to_string(),
4567 _delegate: Default::default(),
4568 _additional_params: Default::default(),
4569 _scopes: Default::default(),
4570 }
4571 }
4572
4573 /// Create a builder to help you perform the following task:
4574 ///
4575 /// Deletes the specified DICOM store and removes all images that are contained within it.
4576 ///
4577 /// # Arguments
4578 ///
4579 /// * `name` - Required. The resource name of the DICOM store to delete.
4580 pub fn locations_datasets_dicom_stores_delete(
4581 &self,
4582 name: &str,
4583 ) -> ProjectLocationDatasetDicomStoreDeleteCall<'a, C> {
4584 ProjectLocationDatasetDicomStoreDeleteCall {
4585 hub: self.hub,
4586 _name: name.to_string(),
4587 _delegate: Default::default(),
4588 _additional_params: Default::default(),
4589 _scopes: Default::default(),
4590 }
4591 }
4592
4593 /// Create a builder to help you perform the following task:
4594 ///
4595 /// Exports data to the specified destination by copying it from the DICOM store. Errors are also logged to Cloud Logging. For more information, see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging). The metadata field type is OperationMetadata.
4596 ///
4597 /// # Arguments
4598 ///
4599 /// * `request` - No description provided.
4600 /// * `name` - Required. The DICOM store resource name from which to export the data. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4601 pub fn locations_datasets_dicom_stores_export(
4602 &self,
4603 request: ExportDicomDataRequest,
4604 name: &str,
4605 ) -> ProjectLocationDatasetDicomStoreExportCall<'a, C> {
4606 ProjectLocationDatasetDicomStoreExportCall {
4607 hub: self.hub,
4608 _request: request,
4609 _name: name.to_string(),
4610 _delegate: Default::default(),
4611 _additional_params: Default::default(),
4612 _scopes: Default::default(),
4613 }
4614 }
4615
4616 /// Create a builder to help you perform the following task:
4617 ///
4618 /// Gets the specified DICOM store.
4619 ///
4620 /// # Arguments
4621 ///
4622 /// * `name` - Required. The resource name of the DICOM store to get.
4623 pub fn locations_datasets_dicom_stores_get(
4624 &self,
4625 name: &str,
4626 ) -> ProjectLocationDatasetDicomStoreGetCall<'a, C> {
4627 ProjectLocationDatasetDicomStoreGetCall {
4628 hub: self.hub,
4629 _name: name.to_string(),
4630 _delegate: Default::default(),
4631 _additional_params: Default::default(),
4632 _scopes: Default::default(),
4633 }
4634 }
4635
4636 /// Create a builder to help you perform the following task:
4637 ///
4638 /// Gets metrics associated with the DICOM store.
4639 ///
4640 /// # Arguments
4641 ///
4642 /// * `name` - Required. The resource name of the DICOM store to get metrics for.
4643 pub fn locations_datasets_dicom_stores_get_dicom_store_metrics(
4644 &self,
4645 name: &str,
4646 ) -> ProjectLocationDatasetDicomStoreGetDICOMStoreMetricCall<'a, C> {
4647 ProjectLocationDatasetDicomStoreGetDICOMStoreMetricCall {
4648 hub: self.hub,
4649 _name: name.to_string(),
4650 _delegate: Default::default(),
4651 _additional_params: Default::default(),
4652 _scopes: Default::default(),
4653 }
4654 }
4655
4656 /// Create a builder to help you perform the following task:
4657 ///
4658 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4659 ///
4660 /// # Arguments
4661 ///
4662 /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4663 pub fn locations_datasets_dicom_stores_get_iam_policy(
4664 &self,
4665 resource: &str,
4666 ) -> ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C> {
4667 ProjectLocationDatasetDicomStoreGetIamPolicyCall {
4668 hub: self.hub,
4669 _resource: resource.to_string(),
4670 _options_requested_policy_version: Default::default(),
4671 _delegate: Default::default(),
4672 _additional_params: Default::default(),
4673 _scopes: Default::default(),
4674 }
4675 }
4676
4677 /// Create a builder to help you perform the following task:
4678 ///
4679 /// Imports data into the DICOM store by copying it from the specified source. Errors are logged to Cloud Logging. For more information, see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging). The metadata field type is OperationMetadata.
4680 ///
4681 /// # Arguments
4682 ///
4683 /// * `request` - No description provided.
4684 /// * `name` - Required. The name of the DICOM store resource into which the data is imported. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4685 pub fn locations_datasets_dicom_stores_import(
4686 &self,
4687 request: ImportDicomDataRequest,
4688 name: &str,
4689 ) -> ProjectLocationDatasetDicomStoreImportCall<'a, C> {
4690 ProjectLocationDatasetDicomStoreImportCall {
4691 hub: self.hub,
4692 _request: request,
4693 _name: name.to_string(),
4694 _delegate: Default::default(),
4695 _additional_params: Default::default(),
4696 _scopes: Default::default(),
4697 }
4698 }
4699
4700 /// Create a builder to help you perform the following task:
4701 ///
4702 /// Lists the DICOM stores in the given dataset.
4703 ///
4704 /// # Arguments
4705 ///
4706 /// * `parent` - Required. Name of the dataset.
4707 pub fn locations_datasets_dicom_stores_list(
4708 &self,
4709 parent: &str,
4710 ) -> ProjectLocationDatasetDicomStoreListCall<'a, C> {
4711 ProjectLocationDatasetDicomStoreListCall {
4712 hub: self.hub,
4713 _parent: parent.to_string(),
4714 _page_token: Default::default(),
4715 _page_size: Default::default(),
4716 _filter: Default::default(),
4717 _delegate: Default::default(),
4718 _additional_params: Default::default(),
4719 _scopes: Default::default(),
4720 }
4721 }
4722
4723 /// Create a builder to help you perform the following task:
4724 ///
4725 /// Updates the specified DICOM store.
4726 ///
4727 /// # Arguments
4728 ///
4729 /// * `request` - No description provided.
4730 /// * `name` - Identifier. Resource name of the DICOM store, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4731 pub fn locations_datasets_dicom_stores_patch(
4732 &self,
4733 request: DicomStore,
4734 name: &str,
4735 ) -> ProjectLocationDatasetDicomStorePatchCall<'a, C> {
4736 ProjectLocationDatasetDicomStorePatchCall {
4737 hub: self.hub,
4738 _request: request,
4739 _name: name.to_string(),
4740 _update_mask: Default::default(),
4741 _delegate: Default::default(),
4742 _additional_params: Default::default(),
4743 _scopes: Default::default(),
4744 }
4745 }
4746
4747 /// Create a builder to help you perform the following task:
4748 ///
4749 /// SearchForInstances returns a list of matching instances. See [Search Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6). For details on the implementation of SearchForInstances, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForInstances, see [Search for DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#search-dicom).
4750 ///
4751 /// # Arguments
4752 ///
4753 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4754 /// * `dicomWebPath` - Required. The path of the SearchForInstancesRequest DICOMweb request. For example, `instances`, `series/{series_uid}/instances`, or `studies/{study_uid}/instances`.
4755 pub fn locations_datasets_dicom_stores_search_for_instances(
4756 &self,
4757 parent: &str,
4758 dicom_web_path: &str,
4759 ) -> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C> {
4760 ProjectLocationDatasetDicomStoreSearchForInstanceCall {
4761 hub: self.hub,
4762 _parent: parent.to_string(),
4763 _dicom_web_path: dicom_web_path.to_string(),
4764 _delegate: Default::default(),
4765 _additional_params: Default::default(),
4766 _scopes: Default::default(),
4767 }
4768 }
4769
4770 /// Create a builder to help you perform the following task:
4771 ///
4772 /// SearchForSeries returns a list of matching series. See [Search Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6). For details on the implementation of SearchForSeries, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForSeries, see [Search for DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#search-dicom).
4773 ///
4774 /// # Arguments
4775 ///
4776 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4777 /// * `dicomWebPath` - Required. The path of the SearchForSeries DICOMweb request. For example, `series` or `studies/{study_uid}/series`.
4778 pub fn locations_datasets_dicom_stores_search_for_series(
4779 &self,
4780 parent: &str,
4781 dicom_web_path: &str,
4782 ) -> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C> {
4783 ProjectLocationDatasetDicomStoreSearchForSeryCall {
4784 hub: self.hub,
4785 _parent: parent.to_string(),
4786 _dicom_web_path: dicom_web_path.to_string(),
4787 _delegate: Default::default(),
4788 _additional_params: Default::default(),
4789 _scopes: Default::default(),
4790 }
4791 }
4792
4793 /// Create a builder to help you perform the following task:
4794 ///
4795 /// SearchForStudies returns a list of matching studies. See [Search Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6). For details on the implementation of SearchForStudies, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForStudies, see [Search for DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#search-dicom).
4796 ///
4797 /// # Arguments
4798 ///
4799 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4800 /// * `dicomWebPath` - Required. The path of the SearchForStudies DICOMweb request. For example, `studies`.
4801 pub fn locations_datasets_dicom_stores_search_for_studies(
4802 &self,
4803 parent: &str,
4804 dicom_web_path: &str,
4805 ) -> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C> {
4806 ProjectLocationDatasetDicomStoreSearchForStudyCall {
4807 hub: self.hub,
4808 _parent: parent.to_string(),
4809 _dicom_web_path: dicom_web_path.to_string(),
4810 _delegate: Default::default(),
4811 _additional_params: Default::default(),
4812 _scopes: Default::default(),
4813 }
4814 }
4815
4816 /// Create a builder to help you perform the following task:
4817 ///
4818 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4819 ///
4820 /// # Arguments
4821 ///
4822 /// * `request` - No description provided.
4823 /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4824 pub fn locations_datasets_dicom_stores_set_iam_policy(
4825 &self,
4826 request: SetIamPolicyRequest,
4827 resource: &str,
4828 ) -> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C> {
4829 ProjectLocationDatasetDicomStoreSetIamPolicyCall {
4830 hub: self.hub,
4831 _request: request,
4832 _resource: resource.to_string(),
4833 _delegate: Default::default(),
4834 _additional_params: Default::default(),
4835 _scopes: Default::default(),
4836 }
4837 }
4838
4839 /// Create a builder to help you perform the following task:
4840 ///
4841 /// StoreInstances stores DICOM instances associated with study instance unique identifiers (SUID). See [Store Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.5). For details on the implementation of StoreInstances, see [Store transaction](https://cloud.google.com/healthcare/docs/dicom#store_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call StoreInstances, see [Store DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#store-dicom).
4842 ///
4843 /// # Arguments
4844 ///
4845 /// * `request` - No description provided.
4846 /// * `parent` - Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
4847 /// * `dicomWebPath` - Required. The path of the StoreInstances DICOMweb request. For example, `studies/[{study_uid}]`. Note that the `study_uid` is optional.
4848 pub fn locations_datasets_dicom_stores_store_instances(
4849 &self,
4850 request: HttpBody,
4851 parent: &str,
4852 dicom_web_path: &str,
4853 ) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C> {
4854 ProjectLocationDatasetDicomStoreStoreInstanceCall {
4855 hub: self.hub,
4856 _request: request,
4857 _parent: parent.to_string(),
4858 _dicom_web_path: dicom_web_path.to_string(),
4859 _delegate: Default::default(),
4860 _additional_params: Default::default(),
4861 _scopes: Default::default(),
4862 }
4863 }
4864
4865 /// Create a builder to help you perform the following task:
4866 ///
4867 /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
4868 ///
4869 /// # Arguments
4870 ///
4871 /// * `request` - No description provided.
4872 /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4873 pub fn locations_datasets_dicom_stores_test_iam_permissions(
4874 &self,
4875 request: TestIamPermissionsRequest,
4876 resource: &str,
4877 ) -> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C> {
4878 ProjectLocationDatasetDicomStoreTestIamPermissionCall {
4879 hub: self.hub,
4880 _request: request,
4881 _resource: resource.to_string(),
4882 _delegate: Default::default(),
4883 _additional_params: Default::default(),
4884 _scopes: Default::default(),
4885 }
4886 }
4887
4888 /// Create a builder to help you perform the following task:
4889 ///
4890 /// Retrieves a Patient resource and resources related to that patient. Implements the FHIR extended operation Patient-everything ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/patient-operations.html#everything), [STU3](http://hl7.org/implement/standards/fhir/STU3/patient-operations.html#everything), [R4](http://hl7.org/implement/standards/fhir/R4/patient-operations.html#everything)). On success, the response body contains a JSON-encoded representation of a `Bundle` resource of type `searchset`, containing the results of the operation. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. The resources in scope for the response are: * The patient resource itself. * All the resources directly referenced by the patient resource. * Resources directly referencing the patient resource that meet the inclusion criteria. The inclusion criteria are based on the membership rules in the patient compartment definition ([DSTU2](http://hl7.org/fhir/DSTU2/compartment-patient.html), [STU3](http://www.hl7.org/fhir/stu3/compartmentdefinition-patient.html), [R4](http://hl7.org/fhir/R4/compartmentdefinition-patient.html)), which details the eligible resource types and referencing search parameters. For samples that show how to call `Patient-everything`, see [Getting all patient compartment resources](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#getting_all_patient_compartment_resources).
4891 ///
4892 /// # Arguments
4893 ///
4894 /// * `name` - Required. Name of the `Patient` resource for which the information is required.
4895 pub fn locations_datasets_fhir_stores_fhir__patient_everything(
4896 &self,
4897 name: &str,
4898 ) -> ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C> {
4899 ProjectLocationDatasetFhirStoreFhirPatientEverythingCall {
4900 hub: self.hub,
4901 _name: name.to_string(),
4902 _start: Default::default(),
4903 _end: Default::default(),
4904 __type: Default::default(),
4905 __since: Default::default(),
4906 __page_token: Default::default(),
4907 __count: Default::default(),
4908 _delegate: Default::default(),
4909 _additional_params: Default::default(),
4910 _scopes: Default::default(),
4911 }
4912 }
4913
4914 /// Create a builder to help you perform the following task:
4915 ///
4916 /// Deletes all the historical versions of a resource (excluding the current version) from the FHIR store. To remove all versions of a resource, first delete the current version and then call this method. This is not a FHIR standard operation. For samples that show how to call `Resource-purge`, see [Deleting historical versions of a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#deleting_historical_versions_of_a_fhir_resource).
4917 ///
4918 /// # Arguments
4919 ///
4920 /// * `name` - Required. The name of the resource to purge.
4921 pub fn locations_datasets_fhir_stores_fhir__resource_purge(
4922 &self,
4923 name: &str,
4924 ) -> ProjectLocationDatasetFhirStoreFhirResourcePurgeCall<'a, C> {
4925 ProjectLocationDatasetFhirStoreFhirResourcePurgeCall {
4926 hub: self.hub,
4927 _name: name.to_string(),
4928 _delegate: Default::default(),
4929 _additional_params: Default::default(),
4930 _scopes: Default::default(),
4931 }
4932 }
4933
4934 /// Create a builder to help you perform the following task:
4935 ///
4936 /// Validates an input FHIR resource's conformance to its profiles and the profiles configured on the FHIR store. Implements the FHIR extended operation $validate ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/resource-operations.html#validate), [STU3](http://hl7.org/implement/standards/fhir/STU3/resource-operations.html#validate), or [R4](http://hl7.org/implement/standards/fhir/R4/resource-operation-validate.html)). The request body must contain a JSON-encoded FHIR resource, and the request headers must contain `Content-Type: application/fhir+json`. The `Parameters` input syntax is not supported. The `profile` query parameter can be used to request that the resource only be validated against a specific profile. If a profile with the given URL cannot be found in the FHIR store then an error is returned. Errors generated by validation contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead.
4937 ///
4938 /// # Arguments
4939 ///
4940 /// * `request` - No description provided.
4941 /// * `parent` - Required. The name of the FHIR store that holds the profiles being used for validation.
4942 /// * `type` - Required. The FHIR resource type of the resource being validated. For a complete list, see the FHIR Resource Index ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](http://hl7.org/implement/standards/fhir/STU3/resourcelist.html), or [R4](http://hl7.org/implement/standards/fhir/R4/resourcelist.html)). Must match the resource type in the provided content.
4943 pub fn locations_datasets_fhir_stores_fhir__resource_validate(
4944 &self,
4945 request: HttpBody,
4946 parent: &str,
4947 type_: &str,
4948 ) -> ProjectLocationDatasetFhirStoreFhirResourceValidateCall<'a, C> {
4949 ProjectLocationDatasetFhirStoreFhirResourceValidateCall {
4950 hub: self.hub,
4951 _request: request,
4952 _parent: parent.to_string(),
4953 _type_: type_.to_string(),
4954 _profile: Default::default(),
4955 _delegate: Default::default(),
4956 _additional_params: Default::default(),
4957 _scopes: Default::default(),
4958 }
4959 }
4960
4961 /// Create a builder to help you perform the following task:
4962 ///
4963 /// Gets the FHIR capability statement ([STU3](http://hl7.org/implement/standards/fhir/STU3/capabilitystatement.html), [R4](http://hl7.org/implement/standards/fhir/R4/capabilitystatement.html)), or the [conformance statement](http://hl7.org/implement/standards/fhir/DSTU2/conformance.html) in the DSTU2 case for the store, which contains a description of functionality supported by the server. Implements the FHIR standard capabilities interaction ([STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#capabilities), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#capabilities)), or the [conformance interaction](http://hl7.org/implement/standards/fhir/DSTU2/http.html#conformance) in the DSTU2 case. On success, the response body contains a JSON-encoded representation of a `CapabilityStatement` resource.
4964 ///
4965 /// # Arguments
4966 ///
4967 /// * `name` - Required. Name of the FHIR store to retrieve the capabilities for.
4968 pub fn locations_datasets_fhir_stores_fhir_capabilities(
4969 &self,
4970 name: &str,
4971 ) -> ProjectLocationDatasetFhirStoreFhirCapabilityCall<'a, C> {
4972 ProjectLocationDatasetFhirStoreFhirCapabilityCall {
4973 hub: self.hub,
4974 _name: name.to_string(),
4975 _delegate: Default::default(),
4976 _additional_params: Default::default(),
4977 _scopes: Default::default(),
4978 }
4979 }
4980
4981 /// Create a builder to help you perform the following task:
4982 ///
4983 /// Deletes a FHIR resource that match an identifier search query. Implements the FHIR standard conditional delete interaction, limited to searching by resource identifier. If multiple resources match, 412 Precondition Failed error will be returned. Search term for identifier should be in the pattern `identifier=system|value` or `identifier=value` - similar to the `search` method on resources with a specific identifier. Note: Unless resource versioning is disabled by setting the disable_resource_versioning flag on the FHIR store, the deleted resource is moved to a history repository that can still be retrieved through vread and related methods, unless they are removed by the purge method. For samples that show how to call `conditionalDelete`, see [Conditionally deleting a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#conditionally_deleting_a_fhir_resource).
4984 ///
4985 /// # Arguments
4986 ///
4987 /// * `parent` - Required. The name of the FHIR store this resource belongs to.
4988 /// * `type` - Required. The FHIR resource type to delete, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](https://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](https://hl7.org/implement/standards/fhir/R4/resourcelist.html)).
4989 pub fn locations_datasets_fhir_stores_fhir_conditional_delete(
4990 &self,
4991 parent: &str,
4992 type_: &str,
4993 ) -> ProjectLocationDatasetFhirStoreFhirConditionalDeleteCall<'a, C> {
4994 ProjectLocationDatasetFhirStoreFhirConditionalDeleteCall {
4995 hub: self.hub,
4996 _parent: parent.to_string(),
4997 _type_: type_.to_string(),
4998 _delegate: Default::default(),
4999 _additional_params: Default::default(),
5000 _scopes: Default::default(),
5001 }
5002 }
5003
5004 /// Create a builder to help you perform the following task:
5005 ///
5006 /// If a resource is found with the identifier specified in the query parameters, updates part of that resource by applying the operations specified in a [JSON Patch](http://jsonpatch.com/) document. Implements the FHIR standard conditional patch interaction, limited to searching by resource identifier. DSTU2 doesn't define a conditional patch method, but the server supports it in the same way it supports STU3. Search term for identifier should be in the pattern `identifier=system|value` or `identifier=value` - similar to the `search` method on resources with a specific identifier. If the search criteria identify more than one match, the request returns a `412 Precondition Failed` error. The request body must contain a JSON Patch document, and the request headers must contain `Content-Type: application/json-patch+json`. On success, the response body contains a JSON-encoded representation of the updated resource, including the server-assigned version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `conditionalPatch`, see [Conditionally patching a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#conditionally_patching_a_fhir_resource).
5007 ///
5008 /// # Arguments
5009 ///
5010 /// * `request` - No description provided.
5011 /// * `parent` - Required. The name of the FHIR store this resource belongs to.
5012 /// * `type` - Required. The FHIR resource type to update, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](https://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](https://hl7.org/implement/standards/fhir/R4/resourcelist.html)).
5013 pub fn locations_datasets_fhir_stores_fhir_conditional_patch(
5014 &self,
5015 request: HttpBody,
5016 parent: &str,
5017 type_: &str,
5018 ) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchCall<'a, C> {
5019 ProjectLocationDatasetFhirStoreFhirConditionalPatchCall {
5020 hub: self.hub,
5021 _request: request,
5022 _parent: parent.to_string(),
5023 _type_: type_.to_string(),
5024 _delegate: Default::default(),
5025 _additional_params: Default::default(),
5026 _scopes: Default::default(),
5027 }
5028 }
5029
5030 /// Create a builder to help you perform the following task:
5031 ///
5032 /// If a resource is found with the identifier specified in the query parameters, updates the entire contents of that resource. Implements the FHIR standard conditional update interaction, limited to searching by resource identifier. Search term for identifier should be in the pattern `identifier=system|value` or `identifier=value` - similar to the `search` method on resources with a specific identifier. If the search criteria identify more than one match, the request returns a `412 Precondition Failed` error. If the search criteria identify zero matches, and the supplied resource body contains an `id`, and the FHIR store has enable_update_create set, creates the resource with the client-specified ID. It is strongly advised not to include or encode any sensitive data such as patient identifiers in client-specified resource IDs. Those IDs are part of the FHIR resource path recorded in Cloud Audit Logs and Pub/Sub notifications. Those IDs can also be contained in reference fields within other resources. If the search criteria identify zero matches, and the supplied resource body does not contain an `id`, the resource is created with a server-assigned ID as per the create method. The request body must contain a JSON-encoded FHIR resource, and the request headers must contain `Content-Type: application/fhir+json`. On success, the response body contains a JSON-encoded representation of the updated resource, including the server-assigned version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `conditionalUpdate`, see [Conditionally updating a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#conditionally_updating_a_fhir_resource).
5033 ///
5034 /// # Arguments
5035 ///
5036 /// * `request` - No description provided.
5037 /// * `parent` - Required. The name of the FHIR store this resource belongs to.
5038 /// * `type` - Required. The FHIR resource type to update, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](https://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](https://hl7.org/implement/standards/fhir/R4/resourcelist.html)). Must match the resource type in the provided content.
5039 pub fn locations_datasets_fhir_stores_fhir_conditional_update(
5040 &self,
5041 request: HttpBody,
5042 parent: &str,
5043 type_: &str,
5044 ) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateCall<'a, C> {
5045 ProjectLocationDatasetFhirStoreFhirConditionalUpdateCall {
5046 hub: self.hub,
5047 _request: request,
5048 _parent: parent.to_string(),
5049 _type_: type_.to_string(),
5050 _delegate: Default::default(),
5051 _additional_params: Default::default(),
5052 _scopes: Default::default(),
5053 }
5054 }
5055
5056 /// Create a builder to help you perform the following task:
5057 ///
5058 /// Creates a FHIR resource. Implements the FHIR standard create interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#create), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#create), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#create)), which creates a new resource with a server-assigned resource ID. Also supports the FHIR standard conditional create interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#ccreate), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#ccreate), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#ccreate)), specified by supplying an `If-None-Exist` header containing a FHIR search query, limited to searching by resource identifier. If no resources match this search query, the server processes the create operation as normal. When using conditional create, the search term for identifier should be in the pattern `identifier=system|value` or `identifier=value` - similar to the `search` method on resources with a specific identifier. The request body must contain a JSON-encoded FHIR resource, and the request headers must contain `Content-Type: application/fhir+json`. On success, the response body contains a JSON-encoded representation of the resource as it was created on the server, including the server-assigned resource ID and version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `create`, see [Creating a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#creating_a_fhir_resource).
5059 ///
5060 /// # Arguments
5061 ///
5062 /// * `request` - No description provided.
5063 /// * `parent` - Required. The name of the FHIR store this resource belongs to.
5064 /// * `type` - Required. The FHIR resource type to create, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](http://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](http://hl7.org/implement/standards/fhir/R4/resourcelist.html)). Must match the resource type in the provided content.
5065 pub fn locations_datasets_fhir_stores_fhir_create(
5066 &self,
5067 request: HttpBody,
5068 parent: &str,
5069 type_: &str,
5070 ) -> ProjectLocationDatasetFhirStoreFhirCreateCall<'a, C> {
5071 ProjectLocationDatasetFhirStoreFhirCreateCall {
5072 hub: self.hub,
5073 _request: request,
5074 _parent: parent.to_string(),
5075 _type_: type_.to_string(),
5076 _delegate: Default::default(),
5077 _additional_params: Default::default(),
5078 _scopes: Default::default(),
5079 }
5080 }
5081
5082 /// Create a builder to help you perform the following task:
5083 ///
5084 /// Deletes a FHIR resource. Implements the FHIR standard delete interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#delete), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#delete), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#delete)). Note: Unless resource versioning is disabled by setting the disable_resource_versioning flag on the FHIR store, the deleted resources will be moved to a history repository that can still be retrieved through vread and related methods, unless they are removed by the purge method. For samples that show how to call `delete`, see [Deleting a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#deleting_a_fhir_resource).
5085 ///
5086 /// # Arguments
5087 ///
5088 /// * `name` - Required. The name of the resource to delete.
5089 pub fn locations_datasets_fhir_stores_fhir_delete(
5090 &self,
5091 name: &str,
5092 ) -> ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C> {
5093 ProjectLocationDatasetFhirStoreFhirDeleteCall {
5094 hub: self.hub,
5095 _name: name.to_string(),
5096 _delegate: Default::default(),
5097 _additional_params: Default::default(),
5098 _scopes: Default::default(),
5099 }
5100 }
5101
5102 /// Create a builder to help you perform the following task:
5103 ///
5104 /// Executes all the requests in the given Bundle. Implements the FHIR standard batch/transaction interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#transaction), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#transaction), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#transaction)). Supports all interactions within a bundle, except search. This method accepts Bundles of type `batch` and `transaction`, processing them according to the batch processing rules ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#2.1.0.16.1), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#2.21.0.17.1), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#brules)) and transaction processing rules ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#2.1.0.16.2), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#2.21.0.17.2), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#trules)). The request body must contain a JSON-encoded FHIR `Bundle` resource, and the request headers must contain `Content-Type: application/fhir+json`. For a batch bundle or a successful transaction, the response body contains a JSON-encoded representation of a `Bundle` resource of type `batch-response` or `transaction-response` containing one entry for each entry in the request, with the outcome of processing the entry. In the case of an error for a transaction bundle, the response body contains a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. This method checks permissions for each request in the bundle. The `executeBundle` permission is required to call this method, but you must also grant sufficient permissions to execute the individual requests in the bundle. For example, if the bundle contains a request to create a FHIR resource, the caller must also have been granted the `healthcare.fhirResources.create` permission. You can use audit logs to view the permissions for `executeBundle` and each request in the bundle. For more information, see [Viewing Cloud Audit logs](https://cloud.google.com/healthcare-api/docs/how-tos/audit-logging). For samples that show how to call `executeBundle`, see [Managing FHIR resources using FHIR bundles](https://cloud.google.com/healthcare/docs/how-tos/fhir-bundles).
5105 ///
5106 /// # Arguments
5107 ///
5108 /// * `request` - No description provided.
5109 /// * `parent` - Required. Name of the FHIR store in which this bundle will be executed.
5110 pub fn locations_datasets_fhir_stores_fhir_execute_bundle(
5111 &self,
5112 request: HttpBody,
5113 parent: &str,
5114 ) -> ProjectLocationDatasetFhirStoreFhirExecuteBundleCall<'a, C> {
5115 ProjectLocationDatasetFhirStoreFhirExecuteBundleCall {
5116 hub: self.hub,
5117 _request: request,
5118 _parent: parent.to_string(),
5119 _delegate: Default::default(),
5120 _additional_params: Default::default(),
5121 _scopes: Default::default(),
5122 }
5123 }
5124
5125 /// Create a builder to help you perform the following task:
5126 ///
5127 /// Lists all the versions of a resource (including the current version and deleted versions) from the FHIR store. Implements the per-resource form of the FHIR standard history interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#history), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#history), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#history)). On success, the response body contains a JSON-encoded representation of a `Bundle` resource of type `history`, containing the version history sorted from most recent to oldest versions. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `history`, see [Listing FHIR resource versions](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#listing_fhir_resource_versions).
5128 ///
5129 /// # Arguments
5130 ///
5131 /// * `name` - Required. The name of the resource to retrieve.
5132 pub fn locations_datasets_fhir_stores_fhir_history(
5133 &self,
5134 name: &str,
5135 ) -> ProjectLocationDatasetFhirStoreFhirHistoryCall<'a, C> {
5136 ProjectLocationDatasetFhirStoreFhirHistoryCall {
5137 hub: self.hub,
5138 _name: name.to_string(),
5139 __since: Default::default(),
5140 __page_token: Default::default(),
5141 __count: Default::default(),
5142 __at: Default::default(),
5143 _delegate: Default::default(),
5144 _additional_params: Default::default(),
5145 _scopes: Default::default(),
5146 }
5147 }
5148
5149 /// Create a builder to help you perform the following task:
5150 ///
5151 /// Updates part of an existing resource by applying the operations specified in a [JSON Patch](http://jsonpatch.com/) document. Implements the FHIR standard patch interaction ([STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#patch), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#patch)). DSTU2 doesn't define a patch method, but the server supports it in the same way it supports STU3. The request body must contain a JSON Patch document, and the request headers must contain `Content-Type: application/json-patch+json`. On success, the response body contains a JSON-encoded representation of the updated resource, including the server-assigned version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `patch`, see [Patching a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#patching_a_fhir_resource).
5152 ///
5153 /// # Arguments
5154 ///
5155 /// * `request` - No description provided.
5156 /// * `name` - Required. The name of the resource to update.
5157 pub fn locations_datasets_fhir_stores_fhir_patch(
5158 &self,
5159 request: HttpBody,
5160 name: &str,
5161 ) -> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C> {
5162 ProjectLocationDatasetFhirStoreFhirPatchCall {
5163 hub: self.hub,
5164 _request: request,
5165 _name: name.to_string(),
5166 _delegate: Default::default(),
5167 _additional_params: Default::default(),
5168 _scopes: Default::default(),
5169 }
5170 }
5171
5172 /// Create a builder to help you perform the following task:
5173 ///
5174 /// Gets the contents of a FHIR resource. Implements the FHIR standard read interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#read), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#read), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#read)). Also supports the FHIR standard conditional read interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#cread), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#cread), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#cread)) specified by supplying an `If-Modified-Since` header with a date/time value or an `If-None-Match` header with an ETag value. On success, the response body contains a JSON-encoded representation of the resource. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `read`, see [Getting a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#getting_a_fhir_resource).
5175 ///
5176 /// # Arguments
5177 ///
5178 /// * `name` - Required. The name of the resource to retrieve.
5179 pub fn locations_datasets_fhir_stores_fhir_read(
5180 &self,
5181 name: &str,
5182 ) -> ProjectLocationDatasetFhirStoreFhirReadCall<'a, C> {
5183 ProjectLocationDatasetFhirStoreFhirReadCall {
5184 hub: self.hub,
5185 _name: name.to_string(),
5186 _delegate: Default::default(),
5187 _additional_params: Default::default(),
5188 _scopes: Default::default(),
5189 }
5190 }
5191
5192 /// Create a builder to help you perform the following task:
5193 ///
5194 /// Searches for resources in the given FHIR store according to criteria specified as query parameters. Implements the FHIR standard search interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#search), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#search), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#search)) using the search semantics described in the FHIR Search specification ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/search.html), [STU3](http://hl7.org/implement/standards/fhir/STU3/search.html), [R4](http://hl7.org/implement/standards/fhir/R4/search.html)). Supports four methods of search defined by the specification: * `GET [base]?[parameters]` to search across all resources. * `GET [base]/[type]?[parameters]` to search resources of a specified type. * `POST [base]/_search?[parameters]` as an alternate form having the same semantics as the `GET` method across all resources. * `POST [base]/[type]/_search?[parameters]` as an alternate form having the same semantics as the `GET` method for the specified type. The `GET` and `POST` methods do not support compartment searches. The `POST` method does not support `application/x-www-form-urlencoded` search parameters. On success, the response body contains a JSON-encoded representation of a `Bundle` resource of type `searchset`, containing the results of the search. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. The server's capability statement, retrieved through capabilities, indicates what search parameters are supported on each FHIR resource. A list of all search parameters defined by the specification can be found in the FHIR Search Parameter Registry ([STU3](http://hl7.org/implement/standards/fhir/STU3/searchparameter-registry.html), [R4](http://hl7.org/implement/standards/fhir/R4/searchparameter-registry.html)). FHIR search parameters for DSTU2 can be found on each resource's definition page. Supported search modifiers: `:missing`, `:exact`, `:contains`, `:text`, `:in`, `:not-in`, `:above`, `:below`, `:[type]`, `:not`, and `recurse` (DSTU2 and STU3) or `:iterate` (R4). Supported search result parameters: `_sort`, `_count`, `_include`, `_revinclude`, `_summary=text`, `_summary=data`, and `_elements`. The maximum number of search results returned defaults to 100, which can be overridden by the `_count` parameter up to a maximum limit of 1000. The server might return fewer resources than requested to prevent excessively large responses. If there are additional results, the returned `Bundle` contains a link of `relation` "next", which has a `_page_token` parameter for an opaque pagination token that can be used to retrieve the next page. Resources with a total size larger than 5MB or a field count larger than 50,000 might not be fully searchable as the server might trim its generated search index in those cases. Note: FHIR resources are indexed asynchronously, so there might be a slight delay between the time a resource is created or changed, and the time when the change reflects in search results. The only exception is resource identifier data, which is indexed synchronously as a special index. As a result, searching using resource identifier is not subject to indexing delay. To use the special synchronous index, the search term for identifier should be in the pattern `identifier=[system]|[value]` or `identifier=[value]`, and any of the following search result parameters can be used: * `_count` * `_include` * `_revinclude` * `_summary` * `_elements` If your query contains any other search parameters, the standard asynchronous index will be used instead. Note that searching against the special index is optimized for resolving a small number of matches. The search isn't optimized if your identifier search criteria matches a large number (i.e. more than 2,000) of resources. For a search query that will match a large number of resources, you can avoiding using the special synchronous index by including an additional `_sort` parameter in your query. Use `_sort=-_lastUpdated` if you want to keep the default sorting order. Note: The special synchronous identifier index are currently disabled for DocumentReference and DocumentManifest searches. For samples and detailed information, see [Searching for FHIR resources](https://cloud.google.com/healthcare/docs/how-tos/fhir-search) and [Advanced FHIR search features](https://cloud.google.com/healthcare/docs/how-tos/fhir-advanced-search).
5195 ///
5196 /// # Arguments
5197 ///
5198 /// * `request` - No description provided.
5199 /// * `parent` - Required. Name of the FHIR store to retrieve resources from.
5200 pub fn locations_datasets_fhir_stores_fhir_search(
5201 &self,
5202 request: SearchResourcesRequest,
5203 parent: &str,
5204 ) -> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C> {
5205 ProjectLocationDatasetFhirStoreFhirSearchCall {
5206 hub: self.hub,
5207 _request: request,
5208 _parent: parent.to_string(),
5209 _delegate: Default::default(),
5210 _additional_params: Default::default(),
5211 _scopes: Default::default(),
5212 }
5213 }
5214
5215 /// Create a builder to help you perform the following task:
5216 ///
5217 /// Searches for resources in the given FHIR store according to criteria specified as query parameters. Implements the FHIR standard search interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#search), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#search), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#search)) using the search semantics described in the FHIR Search specification ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/search.html), [STU3](http://hl7.org/implement/standards/fhir/STU3/search.html), [R4](http://hl7.org/implement/standards/fhir/R4/search.html)). Supports four methods of search defined by the specification: * `GET [base]?[parameters]` to search across all resources. * `GET [base]/[type]?[parameters]` to search resources of a specified type. * `POST [base]/_search?[parameters]` as an alternate form having the same semantics as the `GET` method across all resources. * `POST [base]/[type]/_search?[parameters]` as an alternate form having the same semantics as the `GET` method for the specified type. The `GET` and `POST` methods do not support compartment searches. The `POST` method does not support `application/x-www-form-urlencoded` search parameters. On success, the response body contains a JSON-encoded representation of a `Bundle` resource of type `searchset`, containing the results of the search. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. The server's capability statement, retrieved through capabilities, indicates what search parameters are supported on each FHIR resource. A list of all search parameters defined by the specification can be found in the FHIR Search Parameter Registry ([STU3](http://hl7.org/implement/standards/fhir/STU3/searchparameter-registry.html), [R4](http://hl7.org/implement/standards/fhir/R4/searchparameter-registry.html)). FHIR search parameters for DSTU2 can be found on each resource's definition page. Supported search modifiers: `:missing`, `:exact`, `:contains`, `:text`, `:in`, `:not-in`, `:above`, `:below`, `:[type]`, `:not`, and `recurse` (DSTU2 and STU3) or `:iterate` (R4). Supported search result parameters: `_sort`, `_count`, `_include`, `_revinclude`, `_summary=text`, `_summary=data`, and `_elements`. The maximum number of search results returned defaults to 100, which can be overridden by the `_count` parameter up to a maximum limit of 1000. The server might return fewer resources than requested to prevent excessively large responses. If there are additional results, the returned `Bundle` contains a link of `relation` "next", which has a `_page_token` parameter for an opaque pagination token that can be used to retrieve the next page. Resources with a total size larger than 5MB or a field count larger than 50,000 might not be fully searchable as the server might trim its generated search index in those cases. Note: FHIR resources are indexed asynchronously, so there might be a slight delay between the time a resource is created or changed, and the time when the change reflects in search results. The only exception is resource identifier data, which is indexed synchronously as a special index. As a result, searching using resource identifier is not subject to indexing delay. To use the special synchronous index, the search term for identifier should be in the pattern `identifier=[system]|[value]` or `identifier=[value]`, and any of the following search result parameters can be used: * `_count` * `_include` * `_revinclude` * `_summary` * `_elements` If your query contains any other search parameters, the standard asynchronous index will be used instead. Note that searching against the special index is optimized for resolving a small number of matches. The search isn't optimized if your identifier search criteria matches a large number (i.e. more than 2,000) of resources. For a search query that will match a large number of resources, you can avoiding using the special synchronous index by including an additional `_sort` parameter in your query. Use `_sort=-_lastUpdated` if you want to keep the default sorting order. Note: The special synchronous identifier index are currently disabled for DocumentReference and DocumentManifest searches. For samples and detailed information, see [Searching for FHIR resources](https://cloud.google.com/healthcare/docs/how-tos/fhir-search) and [Advanced FHIR search features](https://cloud.google.com/healthcare/docs/how-tos/fhir-advanced-search).
5218 ///
5219 /// # Arguments
5220 ///
5221 /// * `request` - No description provided.
5222 /// * `parent` - Required. Name of the FHIR store to retrieve resources from.
5223 /// * `resourceType` - Required. The FHIR resource type to search, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](http://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](http://hl7.org/implement/standards/fhir/R4/resourcelist.html)).
5224 pub fn locations_datasets_fhir_stores_fhir_search_type(
5225 &self,
5226 request: SearchResourcesRequest,
5227 parent: &str,
5228 resource_type: &str,
5229 ) -> ProjectLocationDatasetFhirStoreFhirSearchTypeCall<'a, C> {
5230 ProjectLocationDatasetFhirStoreFhirSearchTypeCall {
5231 hub: self.hub,
5232 _request: request,
5233 _parent: parent.to_string(),
5234 _resource_type: resource_type.to_string(),
5235 _delegate: Default::default(),
5236 _additional_params: Default::default(),
5237 _scopes: Default::default(),
5238 }
5239 }
5240
5241 /// Create a builder to help you perform the following task:
5242 ///
5243 /// Updates the entire contents of a resource. Implements the FHIR standard update interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#update), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#update), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#update)). If the specified resource does not exist and the FHIR store has enable_update_create set, creates the resource with the client-specified ID. It is strongly advised not to include or encode any sensitive data such as patient identifiers in client-specified resource IDs. Those IDs are part of the FHIR resource path recorded in Cloud Audit Logs and Pub/Sub notifications. Those IDs can also be contained in reference fields within other resources. The request body must contain a JSON-encoded FHIR resource, and the request headers must contain `Content-Type: application/fhir+json`. The resource must contain an `id` element having an identical value to the ID in the REST path of the request. On success, the response body contains a JSON-encoded representation of the updated resource, including the server-assigned version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `update`, see [Updating a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#updating_a_fhir_resource).
5244 ///
5245 /// # Arguments
5246 ///
5247 /// * `request` - No description provided.
5248 /// * `name` - Required. The name of the resource to update.
5249 pub fn locations_datasets_fhir_stores_fhir_update(
5250 &self,
5251 request: HttpBody,
5252 name: &str,
5253 ) -> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C> {
5254 ProjectLocationDatasetFhirStoreFhirUpdateCall {
5255 hub: self.hub,
5256 _request: request,
5257 _name: name.to_string(),
5258 _delegate: Default::default(),
5259 _additional_params: Default::default(),
5260 _scopes: Default::default(),
5261 }
5262 }
5263
5264 /// Create a builder to help you perform the following task:
5265 ///
5266 /// Gets the contents of a version (current or historical) of a FHIR resource by version ID. Implements the FHIR standard vread interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#vread), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#vread), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#vread)). On success, the response body contains a JSON-encoded representation of the resource. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `vread`, see [Retrieving a FHIR resource version](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#retrieving_a_fhir_resource_version).
5267 ///
5268 /// # Arguments
5269 ///
5270 /// * `name` - Required. The name of the resource version to retrieve.
5271 pub fn locations_datasets_fhir_stores_fhir_vread(
5272 &self,
5273 name: &str,
5274 ) -> ProjectLocationDatasetFhirStoreFhirVreadCall<'a, C> {
5275 ProjectLocationDatasetFhirStoreFhirVreadCall {
5276 hub: self.hub,
5277 _name: name.to_string(),
5278 _delegate: Default::default(),
5279 _additional_params: Default::default(),
5280 _scopes: Default::default(),
5281 }
5282 }
5283
5284 /// Create a builder to help you perform the following task:
5285 ///
5286 /// Creates a new FHIR store within the parent dataset.
5287 ///
5288 /// # Arguments
5289 ///
5290 /// * `request` - No description provided.
5291 /// * `parent` - Required. The name of the dataset this FHIR store belongs to.
5292 pub fn locations_datasets_fhir_stores_create(
5293 &self,
5294 request: FhirStore,
5295 parent: &str,
5296 ) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C> {
5297 ProjectLocationDatasetFhirStoreCreateCall {
5298 hub: self.hub,
5299 _request: request,
5300 _parent: parent.to_string(),
5301 _fhir_store_id: Default::default(),
5302 _delegate: Default::default(),
5303 _additional_params: Default::default(),
5304 _scopes: Default::default(),
5305 }
5306 }
5307
5308 /// Create a builder to help you perform the following task:
5309 ///
5310 /// De-identifies data from the source store and writes it to the destination store. The metadata field type is OperationMetadata. If the request is successful, the response field type is DeidentifyFhirStoreSummary. If errors occur, error is set. Error details are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).
5311 ///
5312 /// # Arguments
5313 ///
5314 /// * `request` - No description provided.
5315 /// * `sourceStore` - Required. Source FHIR store resource name. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
5316 pub fn locations_datasets_fhir_stores_deidentify(
5317 &self,
5318 request: DeidentifyFhirStoreRequest,
5319 source_store: &str,
5320 ) -> ProjectLocationDatasetFhirStoreDeidentifyCall<'a, C> {
5321 ProjectLocationDatasetFhirStoreDeidentifyCall {
5322 hub: self.hub,
5323 _request: request,
5324 _source_store: source_store.to_string(),
5325 _delegate: Default::default(),
5326 _additional_params: Default::default(),
5327 _scopes: Default::default(),
5328 }
5329 }
5330
5331 /// Create a builder to help you perform the following task:
5332 ///
5333 /// Deletes the specified FHIR store and removes all resources within it.
5334 ///
5335 /// # Arguments
5336 ///
5337 /// * `name` - Required. The resource name of the FHIR store to delete.
5338 pub fn locations_datasets_fhir_stores_delete(
5339 &self,
5340 name: &str,
5341 ) -> ProjectLocationDatasetFhirStoreDeleteCall<'a, C> {
5342 ProjectLocationDatasetFhirStoreDeleteCall {
5343 hub: self.hub,
5344 _name: name.to_string(),
5345 _delegate: Default::default(),
5346 _additional_params: Default::default(),
5347 _scopes: Default::default(),
5348 }
5349 }
5350
5351 /// Create a builder to help you perform the following task:
5352 ///
5353 /// Export resources from the FHIR store to the specified destination. This method returns an Operation that can be used to track the status of the export by calling GetOperation. Immediate fatal errors appear in the error field, errors are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). Otherwise, when the operation finishes, a detailed response of type ExportResourcesResponse is returned in the response field. The metadata field type for this operation is OperationMetadata.
5354 ///
5355 /// # Arguments
5356 ///
5357 /// * `request` - No description provided.
5358 /// * `name` - Required. The name of the FHIR store to export resource from, in the format of `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
5359 pub fn locations_datasets_fhir_stores_export(
5360 &self,
5361 request: ExportResourcesRequest,
5362 name: &str,
5363 ) -> ProjectLocationDatasetFhirStoreExportCall<'a, C> {
5364 ProjectLocationDatasetFhirStoreExportCall {
5365 hub: self.hub,
5366 _request: request,
5367 _name: name.to_string(),
5368 _delegate: Default::default(),
5369 _additional_params: Default::default(),
5370 _scopes: Default::default(),
5371 }
5372 }
5373
5374 /// Create a builder to help you perform the following task:
5375 ///
5376 /// Gets the configuration of the specified FHIR store.
5377 ///
5378 /// # Arguments
5379 ///
5380 /// * `name` - Required. The resource name of the FHIR store to get.
5381 pub fn locations_datasets_fhir_stores_get(
5382 &self,
5383 name: &str,
5384 ) -> ProjectLocationDatasetFhirStoreGetCall<'a, C> {
5385 ProjectLocationDatasetFhirStoreGetCall {
5386 hub: self.hub,
5387 _name: name.to_string(),
5388 _delegate: Default::default(),
5389 _additional_params: Default::default(),
5390 _scopes: Default::default(),
5391 }
5392 }
5393
5394 /// Create a builder to help you perform the following task:
5395 ///
5396 /// Gets metrics associated with the FHIR store.
5397 ///
5398 /// # Arguments
5399 ///
5400 /// * `name` - Required. The resource name of the FHIR store to get metrics for.
5401 pub fn locations_datasets_fhir_stores_get_fhir_store_metrics(
5402 &self,
5403 name: &str,
5404 ) -> ProjectLocationDatasetFhirStoreGetFHIRStoreMetricCall<'a, C> {
5405 ProjectLocationDatasetFhirStoreGetFHIRStoreMetricCall {
5406 hub: self.hub,
5407 _name: name.to_string(),
5408 _delegate: Default::default(),
5409 _additional_params: Default::default(),
5410 _scopes: Default::default(),
5411 }
5412 }
5413
5414 /// Create a builder to help you perform the following task:
5415 ///
5416 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
5417 ///
5418 /// # Arguments
5419 ///
5420 /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5421 pub fn locations_datasets_fhir_stores_get_iam_policy(
5422 &self,
5423 resource: &str,
5424 ) -> ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C> {
5425 ProjectLocationDatasetFhirStoreGetIamPolicyCall {
5426 hub: self.hub,
5427 _resource: resource.to_string(),
5428 _options_requested_policy_version: Default::default(),
5429 _delegate: Default::default(),
5430 _additional_params: Default::default(),
5431 _scopes: Default::default(),
5432 }
5433 }
5434
5435 /// Create a builder to help you perform the following task:
5436 ///
5437 /// Imports resources to the FHIR store by loading data from the specified sources. This method is optimized to load large quantities of data using import semantics that ignore some FHIR store configuration options and are not suitable for all use cases. It is primarily intended to load data into an empty FHIR store that is not being used by other clients. In cases where this method is not appropriate, consider using ExecuteBundle to load data. Every resource in the input must contain a client-supplied ID. Each resource is stored using the supplied ID regardless of the enable_update_create setting on the FHIR store. It is strongly advised not to include or encode any sensitive data such as patient identifiers in client-specified resource IDs. Those IDs are part of the FHIR resource path recorded in Cloud Audit Logs and Cloud Pub/Sub notifications. Those IDs can also be contained in reference fields within other resources. The import process does not enforce referential integrity, regardless of the disable_referential_integrity setting on the FHIR store. This allows the import of resources with arbitrary interdependencies without considering grouping or ordering, but if the input data contains invalid references or if some resources fail to be imported, the FHIR store might be left in a state that violates referential integrity. The import process does not trigger Pub/Sub notification or BigQuery streaming update, regardless of how those are configured on the FHIR store. If a resource with the specified ID already exists, the most recent version of the resource is overwritten without creating a new historical version, regardless of the disable_resource_versioning setting on the FHIR store. If transient failures occur during the import, it's possible that successfully imported resources will be overwritten more than once. The import operation is idempotent unless the input data contains multiple valid resources with the same ID but different contents. In that case, after the import completes, the store contains exactly one resource with that ID but there is no ordering guarantee on which version of the contents it will have. The operation result counters do not count duplicate IDs as an error and count one success for each resource in the input, which might result in a success count larger than the number of resources in the FHIR store. This often occurs when importing data organized in bundles produced by Patient-everything where each bundle contains its own copy of a resource such as Practitioner that might be referred to by many patients. If some resources fail to import, for example due to parsing errors, successfully imported resources are not rolled back. The location and format of the input data is specified by the parameters in ImportResourcesRequest. Note that if no format is specified, this method assumes the `BUNDLE` format. When using the `BUNDLE` format this method ignores the `Bundle.type` field, except that `history` bundles are rejected, and does not apply any of the bundle processing semantics for batch or transaction bundles. Unlike in ExecuteBundle, transaction bundles are not executed as a single transaction and bundle-internal references are not rewritten. The bundle is treated as a collection of resources to be written as provided in `Bundle.entry.resource`, ignoring `Bundle.entry.request`. As an example, this allows the import of `searchset` bundles produced by a FHIR search or Patient-everything operation. This method returns an Operation that can be used to track the status of the import by calling GetOperation. Immediate fatal errors appear in the error field, errors are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). Otherwise, when the operation finishes, a detailed response of type ImportResourcesResponse is returned in the response field. The metadata field type for this operation is OperationMetadata.
5438 ///
5439 /// # Arguments
5440 ///
5441 /// * `request` - No description provided.
5442 /// * `name` - Required. The name of the FHIR store to import FHIR resources to, in the format of `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
5443 pub fn locations_datasets_fhir_stores_import(
5444 &self,
5445 request: ImportResourcesRequest,
5446 name: &str,
5447 ) -> ProjectLocationDatasetFhirStoreImportCall<'a, C> {
5448 ProjectLocationDatasetFhirStoreImportCall {
5449 hub: self.hub,
5450 _request: request,
5451 _name: name.to_string(),
5452 _delegate: Default::default(),
5453 _additional_params: Default::default(),
5454 _scopes: Default::default(),
5455 }
5456 }
5457
5458 /// Create a builder to help you perform the following task:
5459 ///
5460 /// Lists the FHIR stores in the given dataset.
5461 ///
5462 /// # Arguments
5463 ///
5464 /// * `parent` - Required. Name of the dataset.
5465 pub fn locations_datasets_fhir_stores_list(
5466 &self,
5467 parent: &str,
5468 ) -> ProjectLocationDatasetFhirStoreListCall<'a, C> {
5469 ProjectLocationDatasetFhirStoreListCall {
5470 hub: self.hub,
5471 _parent: parent.to_string(),
5472 _page_token: Default::default(),
5473 _page_size: Default::default(),
5474 _filter: Default::default(),
5475 _delegate: Default::default(),
5476 _additional_params: Default::default(),
5477 _scopes: Default::default(),
5478 }
5479 }
5480
5481 /// Create a builder to help you perform the following task:
5482 ///
5483 /// Updates the configuration of the specified FHIR store.
5484 ///
5485 /// # Arguments
5486 ///
5487 /// * `request` - No description provided.
5488 /// * `name` - Output only. Identifier. Resource name of the FHIR store, of the form `projects/{project_id}/locations/{location}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
5489 pub fn locations_datasets_fhir_stores_patch(
5490 &self,
5491 request: FhirStore,
5492 name: &str,
5493 ) -> ProjectLocationDatasetFhirStorePatchCall<'a, C> {
5494 ProjectLocationDatasetFhirStorePatchCall {
5495 hub: self.hub,
5496 _request: request,
5497 _name: name.to_string(),
5498 _update_mask: Default::default(),
5499 _delegate: Default::default(),
5500 _additional_params: Default::default(),
5501 _scopes: Default::default(),
5502 }
5503 }
5504
5505 /// Create a builder to help you perform the following task:
5506 ///
5507 /// Rolls back resources from the FHIR store to the specified time. This method returns an Operation that can be used to track the status of the rollback by calling GetOperation. Immediate fatal errors appear in the error field, errors are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). Otherwise, when the operation finishes, a detailed response of type RollbackFhirResourcesResponse is returned in the response field. The metadata field type for this operation is OperationMetadata.
5508 ///
5509 /// # Arguments
5510 ///
5511 /// * `request` - No description provided.
5512 /// * `name` - Required. The name of the FHIR store to rollback, in the format of "projects/{project_id}/locations/{location_id}/datasets/{dataset_id} /fhirStores/{fhir_store_id}".
5513 pub fn locations_datasets_fhir_stores_rollback(
5514 &self,
5515 request: RollbackFhirResourcesRequest,
5516 name: &str,
5517 ) -> ProjectLocationDatasetFhirStoreRollbackCall<'a, C> {
5518 ProjectLocationDatasetFhirStoreRollbackCall {
5519 hub: self.hub,
5520 _request: request,
5521 _name: name.to_string(),
5522 _delegate: Default::default(),
5523 _additional_params: Default::default(),
5524 _scopes: Default::default(),
5525 }
5526 }
5527
5528 /// Create a builder to help you perform the following task:
5529 ///
5530 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
5531 ///
5532 /// # Arguments
5533 ///
5534 /// * `request` - No description provided.
5535 /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5536 pub fn locations_datasets_fhir_stores_set_iam_policy(
5537 &self,
5538 request: SetIamPolicyRequest,
5539 resource: &str,
5540 ) -> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C> {
5541 ProjectLocationDatasetFhirStoreSetIamPolicyCall {
5542 hub: self.hub,
5543 _request: request,
5544 _resource: resource.to_string(),
5545 _delegate: Default::default(),
5546 _additional_params: Default::default(),
5547 _scopes: Default::default(),
5548 }
5549 }
5550
5551 /// Create a builder to help you perform the following task:
5552 ///
5553 /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
5554 ///
5555 /// # Arguments
5556 ///
5557 /// * `request` - No description provided.
5558 /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5559 pub fn locations_datasets_fhir_stores_test_iam_permissions(
5560 &self,
5561 request: TestIamPermissionsRequest,
5562 resource: &str,
5563 ) -> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C> {
5564 ProjectLocationDatasetFhirStoreTestIamPermissionCall {
5565 hub: self.hub,
5566 _request: request,
5567 _resource: resource.to_string(),
5568 _delegate: Default::default(),
5569 _additional_params: Default::default(),
5570 _scopes: Default::default(),
5571 }
5572 }
5573
5574 /// Create a builder to help you perform the following task:
5575 ///
5576 /// Parses and stores an HL7v2 message. This method triggers an asynchronous notification to any Pub/Sub topic configured in Hl7V2Store.Hl7V2NotificationConfig, if the filtering matches the message. If an MLLP adapter is configured to listen to a Pub/Sub topic, the adapter transmits the message when a notification is received.
5577 ///
5578 /// # Arguments
5579 ///
5580 /// * `request` - No description provided.
5581 /// * `parent` - Required. The name of the HL7v2 store this message belongs to.
5582 pub fn locations_datasets_hl7_v2_stores_messages_create(
5583 &self,
5584 request: CreateMessageRequest,
5585 parent: &str,
5586 ) -> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C> {
5587 ProjectLocationDatasetHl7V2StoreMessageCreateCall {
5588 hub: self.hub,
5589 _request: request,
5590 _parent: parent.to_string(),
5591 _delegate: Default::default(),
5592 _additional_params: Default::default(),
5593 _scopes: Default::default(),
5594 }
5595 }
5596
5597 /// Create a builder to help you perform the following task:
5598 ///
5599 /// Deletes an HL7v2 message.
5600 ///
5601 /// # Arguments
5602 ///
5603 /// * `name` - Required. The resource name of the HL7v2 message to delete.
5604 pub fn locations_datasets_hl7_v2_stores_messages_delete(
5605 &self,
5606 name: &str,
5607 ) -> ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C> {
5608 ProjectLocationDatasetHl7V2StoreMessageDeleteCall {
5609 hub: self.hub,
5610 _name: name.to_string(),
5611 _delegate: Default::default(),
5612 _additional_params: Default::default(),
5613 _scopes: Default::default(),
5614 }
5615 }
5616
5617 /// Create a builder to help you perform the following task:
5618 ///
5619 /// Gets an HL7v2 message.
5620 ///
5621 /// # Arguments
5622 ///
5623 /// * `name` - Required. The resource name of the HL7v2 message to retrieve.
5624 pub fn locations_datasets_hl7_v2_stores_messages_get(
5625 &self,
5626 name: &str,
5627 ) -> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C> {
5628 ProjectLocationDatasetHl7V2StoreMessageGetCall {
5629 hub: self.hub,
5630 _name: name.to_string(),
5631 _view: Default::default(),
5632 _delegate: Default::default(),
5633 _additional_params: Default::default(),
5634 _scopes: Default::default(),
5635 }
5636 }
5637
5638 /// Create a builder to help you perform the following task:
5639 ///
5640 /// Parses and stores an HL7v2 message. This method triggers an asynchronous notification to any Pub/Sub topic configured in Hl7V2Store.Hl7V2NotificationConfig, if the filtering matches the message. If an MLLP adapter is configured to listen to a Pub/Sub topic, the adapter transmits the message when a notification is received. If the method is successful, it generates a response containing an HL7v2 acknowledgment (`ACK`) message. If the method encounters an error, it returns a negative acknowledgment (`NACK`) message. This behavior is suitable for replying to HL7v2 interface systems that expect these acknowledgments.
5641 ///
5642 /// # Arguments
5643 ///
5644 /// * `request` - No description provided.
5645 /// * `parent` - Required. The name of the HL7v2 store this message belongs to.
5646 pub fn locations_datasets_hl7_v2_stores_messages_ingest(
5647 &self,
5648 request: IngestMessageRequest,
5649 parent: &str,
5650 ) -> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C> {
5651 ProjectLocationDatasetHl7V2StoreMessageIngestCall {
5652 hub: self.hub,
5653 _request: request,
5654 _parent: parent.to_string(),
5655 _delegate: Default::default(),
5656 _additional_params: Default::default(),
5657 _scopes: Default::default(),
5658 }
5659 }
5660
5661 /// Create a builder to help you perform the following task:
5662 ///
5663 /// Lists all the messages in the given HL7v2 store with support for filtering. Note: HL7v2 messages are indexed asynchronously, so there might be a slight delay between the time a message is created and when it can be found through a filter.
5664 ///
5665 /// # Arguments
5666 ///
5667 /// * `parent` - Required. Name of the HL7v2 store to retrieve messages from.
5668 pub fn locations_datasets_hl7_v2_stores_messages_list(
5669 &self,
5670 parent: &str,
5671 ) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C> {
5672 ProjectLocationDatasetHl7V2StoreMessageListCall {
5673 hub: self.hub,
5674 _parent: parent.to_string(),
5675 _view: Default::default(),
5676 _page_token: Default::default(),
5677 _page_size: Default::default(),
5678 _order_by: Default::default(),
5679 _filter: Default::default(),
5680 _delegate: Default::default(),
5681 _additional_params: Default::default(),
5682 _scopes: Default::default(),
5683 }
5684 }
5685
5686 /// Create a builder to help you perform the following task:
5687 ///
5688 /// Update the message. The contents of the message in Message.data and data extracted from the contents such as Message.create_time cannot be altered. Only the Message.labels field is allowed to be updated. The labels in the request are merged with the existing set of labels. Existing labels with the same keys are updated.
5689 ///
5690 /// # Arguments
5691 ///
5692 /// * `request` - No description provided.
5693 /// * `name` - Output only. Resource name of the Message, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7V2Stores/{hl7_v2_store_id}/messages/{message_id}`. Assigned by the server.
5694 pub fn locations_datasets_hl7_v2_stores_messages_patch(
5695 &self,
5696 request: Message,
5697 name: &str,
5698 ) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C> {
5699 ProjectLocationDatasetHl7V2StoreMessagePatchCall {
5700 hub: self.hub,
5701 _request: request,
5702 _name: name.to_string(),
5703 _update_mask: Default::default(),
5704 _delegate: Default::default(),
5705 _additional_params: Default::default(),
5706 _scopes: Default::default(),
5707 }
5708 }
5709
5710 /// Create a builder to help you perform the following task:
5711 ///
5712 /// Creates a new HL7v2 store within the parent dataset.
5713 ///
5714 /// # Arguments
5715 ///
5716 /// * `request` - No description provided.
5717 /// * `parent` - Required. The name of the dataset this HL7v2 store belongs to.
5718 pub fn locations_datasets_hl7_v2_stores_create(
5719 &self,
5720 request: Hl7V2Store,
5721 parent: &str,
5722 ) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C> {
5723 ProjectLocationDatasetHl7V2StoreCreateCall {
5724 hub: self.hub,
5725 _request: request,
5726 _parent: parent.to_string(),
5727 _hl7_v2_store_id: Default::default(),
5728 _delegate: Default::default(),
5729 _additional_params: Default::default(),
5730 _scopes: Default::default(),
5731 }
5732 }
5733
5734 /// Create a builder to help you perform the following task:
5735 ///
5736 /// Deletes the specified HL7v2 store and removes all messages that it contains.
5737 ///
5738 /// # Arguments
5739 ///
5740 /// * `name` - Required. The resource name of the HL7v2 store to delete.
5741 pub fn locations_datasets_hl7_v2_stores_delete(
5742 &self,
5743 name: &str,
5744 ) -> ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C> {
5745 ProjectLocationDatasetHl7V2StoreDeleteCall {
5746 hub: self.hub,
5747 _name: name.to_string(),
5748 _delegate: Default::default(),
5749 _additional_params: Default::default(),
5750 _scopes: Default::default(),
5751 }
5752 }
5753
5754 /// Create a builder to help you perform the following task:
5755 ///
5756 /// Exports the messages to a destination. To filter messages to be exported, define a filter using the start and end time, relative to the message generation time (MSH.7). This API returns an Operation that can be used to track the status of the job by calling GetOperation. Immediate fatal errors appear in the error field. Otherwise, when the operation finishes, a detailed response of type ExportMessagesResponse is returned in the response field. The metadata field type for this operation is OperationMetadata.
5757 ///
5758 /// # Arguments
5759 ///
5760 /// * `request` - No description provided.
5761 /// * `name` - Required. The name of the source HL7v2 store, in the format `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7v2Stores/{hl7v2_store_id}`
5762 pub fn locations_datasets_hl7_v2_stores_export(
5763 &self,
5764 request: ExportMessagesRequest,
5765 name: &str,
5766 ) -> ProjectLocationDatasetHl7V2StoreExportCall<'a, C> {
5767 ProjectLocationDatasetHl7V2StoreExportCall {
5768 hub: self.hub,
5769 _request: request,
5770 _name: name.to_string(),
5771 _delegate: Default::default(),
5772 _additional_params: Default::default(),
5773 _scopes: Default::default(),
5774 }
5775 }
5776
5777 /// Create a builder to help you perform the following task:
5778 ///
5779 /// Gets the specified HL7v2 store.
5780 ///
5781 /// # Arguments
5782 ///
5783 /// * `name` - Required. The resource name of the HL7v2 store to get.
5784 pub fn locations_datasets_hl7_v2_stores_get(
5785 &self,
5786 name: &str,
5787 ) -> ProjectLocationDatasetHl7V2StoreGetCall<'a, C> {
5788 ProjectLocationDatasetHl7V2StoreGetCall {
5789 hub: self.hub,
5790 _name: name.to_string(),
5791 _delegate: Default::default(),
5792 _additional_params: Default::default(),
5793 _scopes: Default::default(),
5794 }
5795 }
5796
5797 /// Create a builder to help you perform the following task:
5798 ///
5799 /// Gets metrics associated with the HL7v2 store.
5800 ///
5801 /// # Arguments
5802 ///
5803 /// * `name` - Required. The resource name of the HL7v2 store to get metrics for, in the format `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7V2Stores/{hl7v2_store_id}`.
5804 pub fn locations_datasets_hl7_v2_stores_get_hl7v2_store_metrics(
5805 &self,
5806 name: &str,
5807 ) -> ProjectLocationDatasetHl7V2StoreGetHL7v2StoreMetricCall<'a, C> {
5808 ProjectLocationDatasetHl7V2StoreGetHL7v2StoreMetricCall {
5809 hub: self.hub,
5810 _name: name.to_string(),
5811 _delegate: Default::default(),
5812 _additional_params: Default::default(),
5813 _scopes: Default::default(),
5814 }
5815 }
5816
5817 /// Create a builder to help you perform the following task:
5818 ///
5819 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
5820 ///
5821 /// # Arguments
5822 ///
5823 /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5824 pub fn locations_datasets_hl7_v2_stores_get_iam_policy(
5825 &self,
5826 resource: &str,
5827 ) -> ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C> {
5828 ProjectLocationDatasetHl7V2StoreGetIamPolicyCall {
5829 hub: self.hub,
5830 _resource: resource.to_string(),
5831 _options_requested_policy_version: Default::default(),
5832 _delegate: Default::default(),
5833 _additional_params: Default::default(),
5834 _scopes: Default::default(),
5835 }
5836 }
5837
5838 /// Create a builder to help you perform the following task:
5839 ///
5840 /// Import messages to the HL7v2 store by loading data from the specified sources. This method is optimized to load large quantities of data using import semantics that ignore some HL7v2 store configuration options and are not suitable for all use cases. It is primarily intended to load data into an empty HL7v2 store that is not being used by other clients. An existing message will be overwritten if a duplicate message is imported. A duplicate message is a message with the same raw bytes as a message that already exists in this HL7v2 store. When a message is overwritten, its labels will also be overwritten. The import operation is idempotent unless the input data contains multiple valid messages with the same raw bytes but different labels. In that case, after the import completes, the store contains exactly one message with those raw bytes but there is no ordering guarantee on which version of the labels it has. The operation result counters do not count duplicated raw bytes as an error and count one success for each message in the input, which might result in a success count larger than the number of messages in the HL7v2 store. If some messages fail to import, for example due to parsing errors, successfully imported messages are not rolled back. This method returns an Operation that can be used to track the status of the import by calling GetOperation. Immediate fatal errors appear in the error field, errors are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). Otherwise, when the operation finishes, a response of type ImportMessagesResponse is returned in the response field. The metadata field type for this operation is OperationMetadata.
5841 ///
5842 /// # Arguments
5843 ///
5844 /// * `request` - No description provided.
5845 /// * `name` - Required. The name of the target HL7v2 store, in the format `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7v2Stores/{hl7v2_store_id}`
5846 pub fn locations_datasets_hl7_v2_stores_import(
5847 &self,
5848 request: ImportMessagesRequest,
5849 name: &str,
5850 ) -> ProjectLocationDatasetHl7V2StoreImportCall<'a, C> {
5851 ProjectLocationDatasetHl7V2StoreImportCall {
5852 hub: self.hub,
5853 _request: request,
5854 _name: name.to_string(),
5855 _delegate: Default::default(),
5856 _additional_params: Default::default(),
5857 _scopes: Default::default(),
5858 }
5859 }
5860
5861 /// Create a builder to help you perform the following task:
5862 ///
5863 /// Lists the HL7v2 stores in the given dataset.
5864 ///
5865 /// # Arguments
5866 ///
5867 /// * `parent` - Required. Name of the dataset.
5868 pub fn locations_datasets_hl7_v2_stores_list(
5869 &self,
5870 parent: &str,
5871 ) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C> {
5872 ProjectLocationDatasetHl7V2StoreListCall {
5873 hub: self.hub,
5874 _parent: parent.to_string(),
5875 _page_token: Default::default(),
5876 _page_size: Default::default(),
5877 _filter: Default::default(),
5878 _delegate: Default::default(),
5879 _additional_params: Default::default(),
5880 _scopes: Default::default(),
5881 }
5882 }
5883
5884 /// Create a builder to help you perform the following task:
5885 ///
5886 /// Updates the HL7v2 store.
5887 ///
5888 /// # Arguments
5889 ///
5890 /// * `request` - No description provided.
5891 /// * `name` - Identifier. Resource name of the HL7v2 store, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7V2Stores/{hl7v2_store_id}`.
5892 pub fn locations_datasets_hl7_v2_stores_patch(
5893 &self,
5894 request: Hl7V2Store,
5895 name: &str,
5896 ) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C> {
5897 ProjectLocationDatasetHl7V2StorePatchCall {
5898 hub: self.hub,
5899 _request: request,
5900 _name: name.to_string(),
5901 _update_mask: Default::default(),
5902 _delegate: Default::default(),
5903 _additional_params: Default::default(),
5904 _scopes: Default::default(),
5905 }
5906 }
5907
5908 /// Create a builder to help you perform the following task:
5909 ///
5910 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
5911 ///
5912 /// # Arguments
5913 ///
5914 /// * `request` - No description provided.
5915 /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5916 pub fn locations_datasets_hl7_v2_stores_set_iam_policy(
5917 &self,
5918 request: SetIamPolicyRequest,
5919 resource: &str,
5920 ) -> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C> {
5921 ProjectLocationDatasetHl7V2StoreSetIamPolicyCall {
5922 hub: self.hub,
5923 _request: request,
5924 _resource: resource.to_string(),
5925 _delegate: Default::default(),
5926 _additional_params: Default::default(),
5927 _scopes: Default::default(),
5928 }
5929 }
5930
5931 /// Create a builder to help you perform the following task:
5932 ///
5933 /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
5934 ///
5935 /// # Arguments
5936 ///
5937 /// * `request` - No description provided.
5938 /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5939 pub fn locations_datasets_hl7_v2_stores_test_iam_permissions(
5940 &self,
5941 request: TestIamPermissionsRequest,
5942 resource: &str,
5943 ) -> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C> {
5944 ProjectLocationDatasetHl7V2StoreTestIamPermissionCall {
5945 hub: self.hub,
5946 _request: request,
5947 _resource: resource.to_string(),
5948 _delegate: Default::default(),
5949 _additional_params: Default::default(),
5950 _scopes: Default::default(),
5951 }
5952 }
5953
5954 /// Create a builder to help you perform the following task:
5955 ///
5956 /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
5957 ///
5958 /// # Arguments
5959 ///
5960 /// * `request` - No description provided.
5961 /// * `name` - The name of the operation resource to be cancelled.
5962 pub fn locations_datasets_operations_cancel(
5963 &self,
5964 request: CancelOperationRequest,
5965 name: &str,
5966 ) -> ProjectLocationDatasetOperationCancelCall<'a, C> {
5967 ProjectLocationDatasetOperationCancelCall {
5968 hub: self.hub,
5969 _request: request,
5970 _name: name.to_string(),
5971 _delegate: Default::default(),
5972 _additional_params: Default::default(),
5973 _scopes: Default::default(),
5974 }
5975 }
5976
5977 /// Create a builder to help you perform the following task:
5978 ///
5979 /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
5980 ///
5981 /// # Arguments
5982 ///
5983 /// * `name` - The name of the operation resource.
5984 pub fn locations_datasets_operations_get(
5985 &self,
5986 name: &str,
5987 ) -> ProjectLocationDatasetOperationGetCall<'a, C> {
5988 ProjectLocationDatasetOperationGetCall {
5989 hub: self.hub,
5990 _name: name.to_string(),
5991 _delegate: Default::default(),
5992 _additional_params: Default::default(),
5993 _scopes: Default::default(),
5994 }
5995 }
5996
5997 /// Create a builder to help you perform the following task:
5998 ///
5999 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
6000 ///
6001 /// # Arguments
6002 ///
6003 /// * `name` - The name of the operation's parent resource.
6004 pub fn locations_datasets_operations_list(
6005 &self,
6006 name: &str,
6007 ) -> ProjectLocationDatasetOperationListCall<'a, C> {
6008 ProjectLocationDatasetOperationListCall {
6009 hub: self.hub,
6010 _name: name.to_string(),
6011 _page_token: Default::default(),
6012 _page_size: Default::default(),
6013 _filter: Default::default(),
6014 _delegate: Default::default(),
6015 _additional_params: Default::default(),
6016 _scopes: Default::default(),
6017 }
6018 }
6019
6020 /// Create a builder to help you perform the following task:
6021 ///
6022 /// Creates a new health dataset. Results are returned through the Operation interface which returns either an `Operation.response` which contains a Dataset or `Operation.error`. The metadata field type is OperationMetadata.
6023 ///
6024 /// # Arguments
6025 ///
6026 /// * `request` - No description provided.
6027 /// * `parent` - Required. The name of the project where the server creates the dataset. For example, `projects/{project_id}/locations/{location_id}`.
6028 pub fn locations_datasets_create(
6029 &self,
6030 request: Dataset,
6031 parent: &str,
6032 ) -> ProjectLocationDatasetCreateCall<'a, C> {
6033 ProjectLocationDatasetCreateCall {
6034 hub: self.hub,
6035 _request: request,
6036 _parent: parent.to_string(),
6037 _dataset_id: Default::default(),
6038 _delegate: Default::default(),
6039 _additional_params: Default::default(),
6040 _scopes: Default::default(),
6041 }
6042 }
6043
6044 /// Create a builder to help you perform the following task:
6045 ///
6046 /// Creates a new dataset containing de-identified data from the source dataset. The metadata field type is OperationMetadata. If the request is successful, the response field type is DeidentifySummary. If errors occur, error is set. The LRO result may still be successful if de-identification fails for some DICOM instances. The new de-identified dataset will not contain these failed resources. Failed resource totals are tracked in Operation.metadata. Error details are also logged to Cloud Logging. For more information, see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging).
6047 ///
6048 /// # Arguments
6049 ///
6050 /// * `request` - No description provided.
6051 /// * `sourceDataset` - Required. Source dataset resource name. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
6052 pub fn locations_datasets_deidentify(
6053 &self,
6054 request: DeidentifyDatasetRequest,
6055 source_dataset: &str,
6056 ) -> ProjectLocationDatasetDeidentifyCall<'a, C> {
6057 ProjectLocationDatasetDeidentifyCall {
6058 hub: self.hub,
6059 _request: request,
6060 _source_dataset: source_dataset.to_string(),
6061 _delegate: Default::default(),
6062 _additional_params: Default::default(),
6063 _scopes: Default::default(),
6064 }
6065 }
6066
6067 /// Create a builder to help you perform the following task:
6068 ///
6069 /// Deletes the specified health dataset and all data contained in the dataset. Deleting a dataset does not affect the sources from which the dataset was imported (if any).
6070 ///
6071 /// # Arguments
6072 ///
6073 /// * `name` - Required. The name of the dataset to delete. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
6074 pub fn locations_datasets_delete(&self, name: &str) -> ProjectLocationDatasetDeleteCall<'a, C> {
6075 ProjectLocationDatasetDeleteCall {
6076 hub: self.hub,
6077 _name: name.to_string(),
6078 _delegate: Default::default(),
6079 _additional_params: Default::default(),
6080 _scopes: Default::default(),
6081 }
6082 }
6083
6084 /// Create a builder to help you perform the following task:
6085 ///
6086 /// Gets any metadata associated with a dataset.
6087 ///
6088 /// # Arguments
6089 ///
6090 /// * `name` - Required. The name of the dataset to read. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
6091 pub fn locations_datasets_get(&self, name: &str) -> ProjectLocationDatasetGetCall<'a, C> {
6092 ProjectLocationDatasetGetCall {
6093 hub: self.hub,
6094 _name: name.to_string(),
6095 _delegate: Default::default(),
6096 _additional_params: Default::default(),
6097 _scopes: Default::default(),
6098 }
6099 }
6100
6101 /// Create a builder to help you perform the following task:
6102 ///
6103 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
6104 ///
6105 /// # Arguments
6106 ///
6107 /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
6108 pub fn locations_datasets_get_iam_policy(
6109 &self,
6110 resource: &str,
6111 ) -> ProjectLocationDatasetGetIamPolicyCall<'a, C> {
6112 ProjectLocationDatasetGetIamPolicyCall {
6113 hub: self.hub,
6114 _resource: resource.to_string(),
6115 _options_requested_policy_version: Default::default(),
6116 _delegate: Default::default(),
6117 _additional_params: Default::default(),
6118 _scopes: Default::default(),
6119 }
6120 }
6121
6122 /// Create a builder to help you perform the following task:
6123 ///
6124 /// Lists the health datasets in the current project.
6125 ///
6126 /// # Arguments
6127 ///
6128 /// * `parent` - Required. The name of the project whose datasets should be listed. For example, `projects/{project_id}/locations/{location_id}`.
6129 pub fn locations_datasets_list(&self, parent: &str) -> ProjectLocationDatasetListCall<'a, C> {
6130 ProjectLocationDatasetListCall {
6131 hub: self.hub,
6132 _parent: parent.to_string(),
6133 _page_token: Default::default(),
6134 _page_size: Default::default(),
6135 _delegate: Default::default(),
6136 _additional_params: Default::default(),
6137 _scopes: Default::default(),
6138 }
6139 }
6140
6141 /// Create a builder to help you perform the following task:
6142 ///
6143 /// Updates dataset metadata.
6144 ///
6145 /// # Arguments
6146 ///
6147 /// * `request` - No description provided.
6148 /// * `name` - Identifier. Resource name of the dataset, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
6149 pub fn locations_datasets_patch(
6150 &self,
6151 request: Dataset,
6152 name: &str,
6153 ) -> ProjectLocationDatasetPatchCall<'a, C> {
6154 ProjectLocationDatasetPatchCall {
6155 hub: self.hub,
6156 _request: request,
6157 _name: name.to_string(),
6158 _update_mask: Default::default(),
6159 _delegate: Default::default(),
6160 _additional_params: Default::default(),
6161 _scopes: Default::default(),
6162 }
6163 }
6164
6165 /// Create a builder to help you perform the following task:
6166 ///
6167 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
6168 ///
6169 /// # Arguments
6170 ///
6171 /// * `request` - No description provided.
6172 /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
6173 pub fn locations_datasets_set_iam_policy(
6174 &self,
6175 request: SetIamPolicyRequest,
6176 resource: &str,
6177 ) -> ProjectLocationDatasetSetIamPolicyCall<'a, C> {
6178 ProjectLocationDatasetSetIamPolicyCall {
6179 hub: self.hub,
6180 _request: request,
6181 _resource: resource.to_string(),
6182 _delegate: Default::default(),
6183 _additional_params: Default::default(),
6184 _scopes: Default::default(),
6185 }
6186 }
6187
6188 /// Create a builder to help you perform the following task:
6189 ///
6190 /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
6191 ///
6192 /// # Arguments
6193 ///
6194 /// * `request` - No description provided.
6195 /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
6196 pub fn locations_datasets_test_iam_permissions(
6197 &self,
6198 request: TestIamPermissionsRequest,
6199 resource: &str,
6200 ) -> ProjectLocationDatasetTestIamPermissionCall<'a, C> {
6201 ProjectLocationDatasetTestIamPermissionCall {
6202 hub: self.hub,
6203 _request: request,
6204 _resource: resource.to_string(),
6205 _delegate: Default::default(),
6206 _additional_params: Default::default(),
6207 _scopes: Default::default(),
6208 }
6209 }
6210
6211 /// Create a builder to help you perform the following task:
6212 ///
6213 /// Analyze heathcare entity in a document. Its response includes the recognized entity mentions and the relationships between them. AnalyzeEntities uses context aware models to detect entities.
6214 ///
6215 /// # Arguments
6216 ///
6217 /// * `request` - No description provided.
6218 /// * `nlpService` - The resource name of the service of the form: "projects/{project_id}/locations/{location_id}/services/nlp".
6219 pub fn locations_services_nlp_analyze_entities(
6220 &self,
6221 request: AnalyzeEntitiesRequest,
6222 nlp_service: &str,
6223 ) -> ProjectLocationServiceNlpAnalyzeEntityCall<'a, C> {
6224 ProjectLocationServiceNlpAnalyzeEntityCall {
6225 hub: self.hub,
6226 _request: request,
6227 _nlp_service: nlp_service.to_string(),
6228 _delegate: Default::default(),
6229 _additional_params: Default::default(),
6230 _scopes: Default::default(),
6231 }
6232 }
6233
6234 /// Create a builder to help you perform the following task:
6235 ///
6236 /// Gets information about a location.
6237 ///
6238 /// # Arguments
6239 ///
6240 /// * `name` - Resource name for the location.
6241 pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
6242 ProjectLocationGetCall {
6243 hub: self.hub,
6244 _name: name.to_string(),
6245 _delegate: Default::default(),
6246 _additional_params: Default::default(),
6247 _scopes: Default::default(),
6248 }
6249 }
6250
6251 /// Create a builder to help you perform the following task:
6252 ///
6253 /// Lists information about the supported locations for this service.
6254 ///
6255 /// # Arguments
6256 ///
6257 /// * `name` - The resource that owns the locations collection, if applicable.
6258 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
6259 ProjectLocationListCall {
6260 hub: self.hub,
6261 _name: name.to_string(),
6262 _page_token: Default::default(),
6263 _page_size: Default::default(),
6264 _filter: Default::default(),
6265 _delegate: Default::default(),
6266 _additional_params: Default::default(),
6267 _scopes: Default::default(),
6268 }
6269 }
6270}
6271
6272// ###################
6273// CallBuilders ###
6274// #################
6275
6276/// Creates a new Attribute definition in the parent consent store.
6277///
6278/// A builder for the *locations.datasets.consentStores.attributeDefinitions.create* method supported by a *project* resource.
6279/// It is not used directly, but through a [`ProjectMethods`] instance.
6280///
6281/// # Example
6282///
6283/// Instantiate a resource method builder
6284///
6285/// ```test_harness,no_run
6286/// # extern crate hyper;
6287/// # extern crate hyper_rustls;
6288/// # extern crate google_healthcare1 as healthcare1;
6289/// use healthcare1::api::AttributeDefinition;
6290/// # async fn dox() {
6291/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6292///
6293/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6294/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6295/// # secret,
6296/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6297/// # ).build().await.unwrap();
6298///
6299/// # let client = hyper_util::client::legacy::Client::builder(
6300/// # hyper_util::rt::TokioExecutor::new()
6301/// # )
6302/// # .build(
6303/// # hyper_rustls::HttpsConnectorBuilder::new()
6304/// # .with_native_roots()
6305/// # .unwrap()
6306/// # .https_or_http()
6307/// # .enable_http1()
6308/// # .build()
6309/// # );
6310/// # let mut hub = CloudHealthcare::new(client, auth);
6311/// // As the method needs a request, you would usually fill it with the desired information
6312/// // into the respective structure. Some of the parts shown here might not be applicable !
6313/// // Values shown here are possibly random and not representative !
6314/// let mut req = AttributeDefinition::default();
6315///
6316/// // You can configure optional parameters by calling the respective setters at will, and
6317/// // execute the final call using `doit()`.
6318/// // Values shown here are possibly random and not representative !
6319/// let result = hub.projects().locations_datasets_consent_stores_attribute_definitions_create(req, "parent")
6320/// .attribute_definition_id("duo")
6321/// .doit().await;
6322/// # }
6323/// ```
6324pub struct ProjectLocationDatasetConsentStoreAttributeDefinitionCreateCall<'a, C>
6325where
6326 C: 'a,
6327{
6328 hub: &'a CloudHealthcare<C>,
6329 _request: AttributeDefinition,
6330 _parent: String,
6331 _attribute_definition_id: Option<String>,
6332 _delegate: Option<&'a mut dyn common::Delegate>,
6333 _additional_params: HashMap<String, String>,
6334 _scopes: BTreeSet<String>,
6335}
6336
6337impl<'a, C> common::CallBuilder
6338 for ProjectLocationDatasetConsentStoreAttributeDefinitionCreateCall<'a, C>
6339{
6340}
6341
6342impl<'a, C> ProjectLocationDatasetConsentStoreAttributeDefinitionCreateCall<'a, C>
6343where
6344 C: common::Connector,
6345{
6346 /// Perform the operation you have build so far.
6347 pub async fn doit(mut self) -> common::Result<(common::Response, AttributeDefinition)> {
6348 use std::borrow::Cow;
6349 use std::io::{Read, Seek};
6350
6351 use common::{url::Params, ToParts};
6352 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6353
6354 let mut dd = common::DefaultDelegate;
6355 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6356 dlg.begin(common::MethodInfo {
6357 id: "healthcare.projects.locations.datasets.consentStores.attributeDefinitions.create",
6358 http_method: hyper::Method::POST,
6359 });
6360
6361 for &field in ["alt", "parent", "attributeDefinitionId"].iter() {
6362 if self._additional_params.contains_key(field) {
6363 dlg.finished(false);
6364 return Err(common::Error::FieldClash(field));
6365 }
6366 }
6367
6368 let mut params = Params::with_capacity(5 + self._additional_params.len());
6369 params.push("parent", self._parent);
6370 if let Some(value) = self._attribute_definition_id.as_ref() {
6371 params.push("attributeDefinitionId", value);
6372 }
6373
6374 params.extend(self._additional_params.iter());
6375
6376 params.push("alt", "json");
6377 let mut url = self.hub._base_url.clone() + "v1/{+parent}/attributeDefinitions";
6378 if self._scopes.is_empty() {
6379 self._scopes
6380 .insert(Scope::CloudHealthcare.as_ref().to_string());
6381 }
6382
6383 #[allow(clippy::single_element_loop)]
6384 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6385 url = params.uri_replacement(url, param_name, find_this, true);
6386 }
6387 {
6388 let to_remove = ["parent"];
6389 params.remove_params(&to_remove);
6390 }
6391
6392 let url = params.parse_with_url(&url);
6393
6394 let mut json_mime_type = mime::APPLICATION_JSON;
6395 let mut request_value_reader = {
6396 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6397 common::remove_json_null_values(&mut value);
6398 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6399 serde_json::to_writer(&mut dst, &value).unwrap();
6400 dst
6401 };
6402 let request_size = request_value_reader
6403 .seek(std::io::SeekFrom::End(0))
6404 .unwrap();
6405 request_value_reader
6406 .seek(std::io::SeekFrom::Start(0))
6407 .unwrap();
6408
6409 loop {
6410 let token = match self
6411 .hub
6412 .auth
6413 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6414 .await
6415 {
6416 Ok(token) => token,
6417 Err(e) => match dlg.token(e) {
6418 Ok(token) => token,
6419 Err(e) => {
6420 dlg.finished(false);
6421 return Err(common::Error::MissingToken(e));
6422 }
6423 },
6424 };
6425 request_value_reader
6426 .seek(std::io::SeekFrom::Start(0))
6427 .unwrap();
6428 let mut req_result = {
6429 let client = &self.hub.client;
6430 dlg.pre_request();
6431 let mut req_builder = hyper::Request::builder()
6432 .method(hyper::Method::POST)
6433 .uri(url.as_str())
6434 .header(USER_AGENT, self.hub._user_agent.clone());
6435
6436 if let Some(token) = token.as_ref() {
6437 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6438 }
6439
6440 let request = req_builder
6441 .header(CONTENT_TYPE, json_mime_type.to_string())
6442 .header(CONTENT_LENGTH, request_size as u64)
6443 .body(common::to_body(
6444 request_value_reader.get_ref().clone().into(),
6445 ));
6446
6447 client.request(request.unwrap()).await
6448 };
6449
6450 match req_result {
6451 Err(err) => {
6452 if let common::Retry::After(d) = dlg.http_error(&err) {
6453 sleep(d).await;
6454 continue;
6455 }
6456 dlg.finished(false);
6457 return Err(common::Error::HttpError(err));
6458 }
6459 Ok(res) => {
6460 let (mut parts, body) = res.into_parts();
6461 let mut body = common::Body::new(body);
6462 if !parts.status.is_success() {
6463 let bytes = common::to_bytes(body).await.unwrap_or_default();
6464 let error = serde_json::from_str(&common::to_string(&bytes));
6465 let response = common::to_response(parts, bytes.into());
6466
6467 if let common::Retry::After(d) =
6468 dlg.http_failure(&response, error.as_ref().ok())
6469 {
6470 sleep(d).await;
6471 continue;
6472 }
6473
6474 dlg.finished(false);
6475
6476 return Err(match error {
6477 Ok(value) => common::Error::BadRequest(value),
6478 _ => common::Error::Failure(response),
6479 });
6480 }
6481 let response = {
6482 let bytes = common::to_bytes(body).await.unwrap_or_default();
6483 let encoded = common::to_string(&bytes);
6484 match serde_json::from_str(&encoded) {
6485 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6486 Err(error) => {
6487 dlg.response_json_decode_error(&encoded, &error);
6488 return Err(common::Error::JsonDecodeError(
6489 encoded.to_string(),
6490 error,
6491 ));
6492 }
6493 }
6494 };
6495
6496 dlg.finished(true);
6497 return Ok(response);
6498 }
6499 }
6500 }
6501 }
6502
6503 ///
6504 /// Sets the *request* property to the given value.
6505 ///
6506 /// Even though the property as already been set when instantiating this call,
6507 /// we provide this method for API completeness.
6508 pub fn request(
6509 mut self,
6510 new_value: AttributeDefinition,
6511 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionCreateCall<'a, C> {
6512 self._request = new_value;
6513 self
6514 }
6515 /// Required. The name of the consent store that this Attribute definition belongs to.
6516 ///
6517 /// Sets the *parent* path property to the given value.
6518 ///
6519 /// Even though the property as already been set when instantiating this call,
6520 /// we provide this method for API completeness.
6521 pub fn parent(
6522 mut self,
6523 new_value: &str,
6524 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionCreateCall<'a, C> {
6525 self._parent = new_value.to_string();
6526 self
6527 }
6528 /// Required. The ID of the Attribute definition to create. The string must match the following regex: `_a-zA-Z{0,255}` and must not be a reserved keyword within the Common Expression Language as listed on https://github.com/google/cel-spec/blob/master/doc/langdef.md.
6529 ///
6530 /// Sets the *attribute definition id* query property to the given value.
6531 pub fn attribute_definition_id(
6532 mut self,
6533 new_value: &str,
6534 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionCreateCall<'a, C> {
6535 self._attribute_definition_id = Some(new_value.to_string());
6536 self
6537 }
6538 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6539 /// while executing the actual API request.
6540 ///
6541 /// ````text
6542 /// It should be used to handle progress information, and to implement a certain level of resilience.
6543 /// ````
6544 ///
6545 /// Sets the *delegate* property to the given value.
6546 pub fn delegate(
6547 mut self,
6548 new_value: &'a mut dyn common::Delegate,
6549 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionCreateCall<'a, C> {
6550 self._delegate = Some(new_value);
6551 self
6552 }
6553
6554 /// Set any additional parameter of the query string used in the request.
6555 /// It should be used to set parameters which are not yet available through their own
6556 /// setters.
6557 ///
6558 /// Please note that this method must not be used to set any of the known parameters
6559 /// which have their own setter method. If done anyway, the request will fail.
6560 ///
6561 /// # Additional Parameters
6562 ///
6563 /// * *$.xgafv* (query-string) - V1 error format.
6564 /// * *access_token* (query-string) - OAuth access token.
6565 /// * *alt* (query-string) - Data format for response.
6566 /// * *callback* (query-string) - JSONP
6567 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6568 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6569 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6570 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6571 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6572 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6573 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6574 pub fn param<T>(
6575 mut self,
6576 name: T,
6577 value: T,
6578 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionCreateCall<'a, C>
6579 where
6580 T: AsRef<str>,
6581 {
6582 self._additional_params
6583 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6584 self
6585 }
6586
6587 /// Identifies the authorization scope for the method you are building.
6588 ///
6589 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6590 /// [`Scope::CloudHealthcare`].
6591 ///
6592 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6593 /// tokens for more than one scope.
6594 ///
6595 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6596 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6597 /// sufficient, a read-write scope will do as well.
6598 pub fn add_scope<St>(
6599 mut self,
6600 scope: St,
6601 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionCreateCall<'a, C>
6602 where
6603 St: AsRef<str>,
6604 {
6605 self._scopes.insert(String::from(scope.as_ref()));
6606 self
6607 }
6608 /// Identifies the authorization scope(s) for the method you are building.
6609 ///
6610 /// See [`Self::add_scope()`] for details.
6611 pub fn add_scopes<I, St>(
6612 mut self,
6613 scopes: I,
6614 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionCreateCall<'a, C>
6615 where
6616 I: IntoIterator<Item = St>,
6617 St: AsRef<str>,
6618 {
6619 self._scopes
6620 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6621 self
6622 }
6623
6624 /// Removes all scopes, and no default scope will be used either.
6625 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6626 /// for details).
6627 pub fn clear_scopes(
6628 mut self,
6629 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionCreateCall<'a, C> {
6630 self._scopes.clear();
6631 self
6632 }
6633}
6634
6635/// Deletes the specified Attribute definition. Fails if the Attribute definition is referenced by any User data mapping, or the latest revision of any Consent.
6636///
6637/// A builder for the *locations.datasets.consentStores.attributeDefinitions.delete* method supported by a *project* resource.
6638/// It is not used directly, but through a [`ProjectMethods`] instance.
6639///
6640/// # Example
6641///
6642/// Instantiate a resource method builder
6643///
6644/// ```test_harness,no_run
6645/// # extern crate hyper;
6646/// # extern crate hyper_rustls;
6647/// # extern crate google_healthcare1 as healthcare1;
6648/// # async fn dox() {
6649/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6650///
6651/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6652/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6653/// # secret,
6654/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6655/// # ).build().await.unwrap();
6656///
6657/// # let client = hyper_util::client::legacy::Client::builder(
6658/// # hyper_util::rt::TokioExecutor::new()
6659/// # )
6660/// # .build(
6661/// # hyper_rustls::HttpsConnectorBuilder::new()
6662/// # .with_native_roots()
6663/// # .unwrap()
6664/// # .https_or_http()
6665/// # .enable_http1()
6666/// # .build()
6667/// # );
6668/// # let mut hub = CloudHealthcare::new(client, auth);
6669/// // You can configure optional parameters by calling the respective setters at will, and
6670/// // execute the final call using `doit()`.
6671/// // Values shown here are possibly random and not representative !
6672/// let result = hub.projects().locations_datasets_consent_stores_attribute_definitions_delete("name")
6673/// .doit().await;
6674/// # }
6675/// ```
6676pub struct ProjectLocationDatasetConsentStoreAttributeDefinitionDeleteCall<'a, C>
6677where
6678 C: 'a,
6679{
6680 hub: &'a CloudHealthcare<C>,
6681 _name: String,
6682 _delegate: Option<&'a mut dyn common::Delegate>,
6683 _additional_params: HashMap<String, String>,
6684 _scopes: BTreeSet<String>,
6685}
6686
6687impl<'a, C> common::CallBuilder
6688 for ProjectLocationDatasetConsentStoreAttributeDefinitionDeleteCall<'a, C>
6689{
6690}
6691
6692impl<'a, C> ProjectLocationDatasetConsentStoreAttributeDefinitionDeleteCall<'a, C>
6693where
6694 C: common::Connector,
6695{
6696 /// Perform the operation you have build so far.
6697 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
6698 use std::borrow::Cow;
6699 use std::io::{Read, Seek};
6700
6701 use common::{url::Params, ToParts};
6702 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6703
6704 let mut dd = common::DefaultDelegate;
6705 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6706 dlg.begin(common::MethodInfo {
6707 id: "healthcare.projects.locations.datasets.consentStores.attributeDefinitions.delete",
6708 http_method: hyper::Method::DELETE,
6709 });
6710
6711 for &field in ["alt", "name"].iter() {
6712 if self._additional_params.contains_key(field) {
6713 dlg.finished(false);
6714 return Err(common::Error::FieldClash(field));
6715 }
6716 }
6717
6718 let mut params = Params::with_capacity(3 + self._additional_params.len());
6719 params.push("name", self._name);
6720
6721 params.extend(self._additional_params.iter());
6722
6723 params.push("alt", "json");
6724 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6725 if self._scopes.is_empty() {
6726 self._scopes
6727 .insert(Scope::CloudHealthcare.as_ref().to_string());
6728 }
6729
6730 #[allow(clippy::single_element_loop)]
6731 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6732 url = params.uri_replacement(url, param_name, find_this, true);
6733 }
6734 {
6735 let to_remove = ["name"];
6736 params.remove_params(&to_remove);
6737 }
6738
6739 let url = params.parse_with_url(&url);
6740
6741 loop {
6742 let token = match self
6743 .hub
6744 .auth
6745 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6746 .await
6747 {
6748 Ok(token) => token,
6749 Err(e) => match dlg.token(e) {
6750 Ok(token) => token,
6751 Err(e) => {
6752 dlg.finished(false);
6753 return Err(common::Error::MissingToken(e));
6754 }
6755 },
6756 };
6757 let mut req_result = {
6758 let client = &self.hub.client;
6759 dlg.pre_request();
6760 let mut req_builder = hyper::Request::builder()
6761 .method(hyper::Method::DELETE)
6762 .uri(url.as_str())
6763 .header(USER_AGENT, self.hub._user_agent.clone());
6764
6765 if let Some(token) = token.as_ref() {
6766 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6767 }
6768
6769 let request = req_builder
6770 .header(CONTENT_LENGTH, 0_u64)
6771 .body(common::to_body::<String>(None));
6772
6773 client.request(request.unwrap()).await
6774 };
6775
6776 match req_result {
6777 Err(err) => {
6778 if let common::Retry::After(d) = dlg.http_error(&err) {
6779 sleep(d).await;
6780 continue;
6781 }
6782 dlg.finished(false);
6783 return Err(common::Error::HttpError(err));
6784 }
6785 Ok(res) => {
6786 let (mut parts, body) = res.into_parts();
6787 let mut body = common::Body::new(body);
6788 if !parts.status.is_success() {
6789 let bytes = common::to_bytes(body).await.unwrap_or_default();
6790 let error = serde_json::from_str(&common::to_string(&bytes));
6791 let response = common::to_response(parts, bytes.into());
6792
6793 if let common::Retry::After(d) =
6794 dlg.http_failure(&response, error.as_ref().ok())
6795 {
6796 sleep(d).await;
6797 continue;
6798 }
6799
6800 dlg.finished(false);
6801
6802 return Err(match error {
6803 Ok(value) => common::Error::BadRequest(value),
6804 _ => common::Error::Failure(response),
6805 });
6806 }
6807 let response = {
6808 let bytes = common::to_bytes(body).await.unwrap_or_default();
6809 let encoded = common::to_string(&bytes);
6810 match serde_json::from_str(&encoded) {
6811 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6812 Err(error) => {
6813 dlg.response_json_decode_error(&encoded, &error);
6814 return Err(common::Error::JsonDecodeError(
6815 encoded.to_string(),
6816 error,
6817 ));
6818 }
6819 }
6820 };
6821
6822 dlg.finished(true);
6823 return Ok(response);
6824 }
6825 }
6826 }
6827 }
6828
6829 /// Required. The resource name of the Attribute definition to delete. To preserve referential integrity, Attribute definitions referenced by a User data mapping or the latest revision of a Consent cannot be deleted.
6830 ///
6831 /// Sets the *name* path property to the given value.
6832 ///
6833 /// Even though the property as already been set when instantiating this call,
6834 /// we provide this method for API completeness.
6835 pub fn name(
6836 mut self,
6837 new_value: &str,
6838 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionDeleteCall<'a, C> {
6839 self._name = new_value.to_string();
6840 self
6841 }
6842 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6843 /// while executing the actual API request.
6844 ///
6845 /// ````text
6846 /// It should be used to handle progress information, and to implement a certain level of resilience.
6847 /// ````
6848 ///
6849 /// Sets the *delegate* property to the given value.
6850 pub fn delegate(
6851 mut self,
6852 new_value: &'a mut dyn common::Delegate,
6853 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionDeleteCall<'a, C> {
6854 self._delegate = Some(new_value);
6855 self
6856 }
6857
6858 /// Set any additional parameter of the query string used in the request.
6859 /// It should be used to set parameters which are not yet available through their own
6860 /// setters.
6861 ///
6862 /// Please note that this method must not be used to set any of the known parameters
6863 /// which have their own setter method. If done anyway, the request will fail.
6864 ///
6865 /// # Additional Parameters
6866 ///
6867 /// * *$.xgafv* (query-string) - V1 error format.
6868 /// * *access_token* (query-string) - OAuth access token.
6869 /// * *alt* (query-string) - Data format for response.
6870 /// * *callback* (query-string) - JSONP
6871 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6872 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6873 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6874 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6875 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6876 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6877 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6878 pub fn param<T>(
6879 mut self,
6880 name: T,
6881 value: T,
6882 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionDeleteCall<'a, C>
6883 where
6884 T: AsRef<str>,
6885 {
6886 self._additional_params
6887 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6888 self
6889 }
6890
6891 /// Identifies the authorization scope for the method you are building.
6892 ///
6893 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6894 /// [`Scope::CloudHealthcare`].
6895 ///
6896 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6897 /// tokens for more than one scope.
6898 ///
6899 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6900 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6901 /// sufficient, a read-write scope will do as well.
6902 pub fn add_scope<St>(
6903 mut self,
6904 scope: St,
6905 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionDeleteCall<'a, C>
6906 where
6907 St: AsRef<str>,
6908 {
6909 self._scopes.insert(String::from(scope.as_ref()));
6910 self
6911 }
6912 /// Identifies the authorization scope(s) for the method you are building.
6913 ///
6914 /// See [`Self::add_scope()`] for details.
6915 pub fn add_scopes<I, St>(
6916 mut self,
6917 scopes: I,
6918 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionDeleteCall<'a, C>
6919 where
6920 I: IntoIterator<Item = St>,
6921 St: AsRef<str>,
6922 {
6923 self._scopes
6924 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6925 self
6926 }
6927
6928 /// Removes all scopes, and no default scope will be used either.
6929 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6930 /// for details).
6931 pub fn clear_scopes(
6932 mut self,
6933 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionDeleteCall<'a, C> {
6934 self._scopes.clear();
6935 self
6936 }
6937}
6938
6939/// Gets the specified Attribute definition.
6940///
6941/// A builder for the *locations.datasets.consentStores.attributeDefinitions.get* method supported by a *project* resource.
6942/// It is not used directly, but through a [`ProjectMethods`] instance.
6943///
6944/// # Example
6945///
6946/// Instantiate a resource method builder
6947///
6948/// ```test_harness,no_run
6949/// # extern crate hyper;
6950/// # extern crate hyper_rustls;
6951/// # extern crate google_healthcare1 as healthcare1;
6952/// # async fn dox() {
6953/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6954///
6955/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6956/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6957/// # secret,
6958/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6959/// # ).build().await.unwrap();
6960///
6961/// # let client = hyper_util::client::legacy::Client::builder(
6962/// # hyper_util::rt::TokioExecutor::new()
6963/// # )
6964/// # .build(
6965/// # hyper_rustls::HttpsConnectorBuilder::new()
6966/// # .with_native_roots()
6967/// # .unwrap()
6968/// # .https_or_http()
6969/// # .enable_http1()
6970/// # .build()
6971/// # );
6972/// # let mut hub = CloudHealthcare::new(client, auth);
6973/// // You can configure optional parameters by calling the respective setters at will, and
6974/// // execute the final call using `doit()`.
6975/// // Values shown here are possibly random and not representative !
6976/// let result = hub.projects().locations_datasets_consent_stores_attribute_definitions_get("name")
6977/// .doit().await;
6978/// # }
6979/// ```
6980pub struct ProjectLocationDatasetConsentStoreAttributeDefinitionGetCall<'a, C>
6981where
6982 C: 'a,
6983{
6984 hub: &'a CloudHealthcare<C>,
6985 _name: String,
6986 _delegate: Option<&'a mut dyn common::Delegate>,
6987 _additional_params: HashMap<String, String>,
6988 _scopes: BTreeSet<String>,
6989}
6990
6991impl<'a, C> common::CallBuilder
6992 for ProjectLocationDatasetConsentStoreAttributeDefinitionGetCall<'a, C>
6993{
6994}
6995
6996impl<'a, C> ProjectLocationDatasetConsentStoreAttributeDefinitionGetCall<'a, C>
6997where
6998 C: common::Connector,
6999{
7000 /// Perform the operation you have build so far.
7001 pub async fn doit(mut self) -> common::Result<(common::Response, AttributeDefinition)> {
7002 use std::borrow::Cow;
7003 use std::io::{Read, Seek};
7004
7005 use common::{url::Params, ToParts};
7006 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7007
7008 let mut dd = common::DefaultDelegate;
7009 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7010 dlg.begin(common::MethodInfo {
7011 id: "healthcare.projects.locations.datasets.consentStores.attributeDefinitions.get",
7012 http_method: hyper::Method::GET,
7013 });
7014
7015 for &field in ["alt", "name"].iter() {
7016 if self._additional_params.contains_key(field) {
7017 dlg.finished(false);
7018 return Err(common::Error::FieldClash(field));
7019 }
7020 }
7021
7022 let mut params = Params::with_capacity(3 + self._additional_params.len());
7023 params.push("name", self._name);
7024
7025 params.extend(self._additional_params.iter());
7026
7027 params.push("alt", "json");
7028 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7029 if self._scopes.is_empty() {
7030 self._scopes
7031 .insert(Scope::CloudHealthcare.as_ref().to_string());
7032 }
7033
7034 #[allow(clippy::single_element_loop)]
7035 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7036 url = params.uri_replacement(url, param_name, find_this, true);
7037 }
7038 {
7039 let to_remove = ["name"];
7040 params.remove_params(&to_remove);
7041 }
7042
7043 let url = params.parse_with_url(&url);
7044
7045 loop {
7046 let token = match self
7047 .hub
7048 .auth
7049 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7050 .await
7051 {
7052 Ok(token) => token,
7053 Err(e) => match dlg.token(e) {
7054 Ok(token) => token,
7055 Err(e) => {
7056 dlg.finished(false);
7057 return Err(common::Error::MissingToken(e));
7058 }
7059 },
7060 };
7061 let mut req_result = {
7062 let client = &self.hub.client;
7063 dlg.pre_request();
7064 let mut req_builder = hyper::Request::builder()
7065 .method(hyper::Method::GET)
7066 .uri(url.as_str())
7067 .header(USER_AGENT, self.hub._user_agent.clone());
7068
7069 if let Some(token) = token.as_ref() {
7070 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7071 }
7072
7073 let request = req_builder
7074 .header(CONTENT_LENGTH, 0_u64)
7075 .body(common::to_body::<String>(None));
7076
7077 client.request(request.unwrap()).await
7078 };
7079
7080 match req_result {
7081 Err(err) => {
7082 if let common::Retry::After(d) = dlg.http_error(&err) {
7083 sleep(d).await;
7084 continue;
7085 }
7086 dlg.finished(false);
7087 return Err(common::Error::HttpError(err));
7088 }
7089 Ok(res) => {
7090 let (mut parts, body) = res.into_parts();
7091 let mut body = common::Body::new(body);
7092 if !parts.status.is_success() {
7093 let bytes = common::to_bytes(body).await.unwrap_or_default();
7094 let error = serde_json::from_str(&common::to_string(&bytes));
7095 let response = common::to_response(parts, bytes.into());
7096
7097 if let common::Retry::After(d) =
7098 dlg.http_failure(&response, error.as_ref().ok())
7099 {
7100 sleep(d).await;
7101 continue;
7102 }
7103
7104 dlg.finished(false);
7105
7106 return Err(match error {
7107 Ok(value) => common::Error::BadRequest(value),
7108 _ => common::Error::Failure(response),
7109 });
7110 }
7111 let response = {
7112 let bytes = common::to_bytes(body).await.unwrap_or_default();
7113 let encoded = common::to_string(&bytes);
7114 match serde_json::from_str(&encoded) {
7115 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7116 Err(error) => {
7117 dlg.response_json_decode_error(&encoded, &error);
7118 return Err(common::Error::JsonDecodeError(
7119 encoded.to_string(),
7120 error,
7121 ));
7122 }
7123 }
7124 };
7125
7126 dlg.finished(true);
7127 return Ok(response);
7128 }
7129 }
7130 }
7131 }
7132
7133 /// Required. The resource name of the Attribute definition to get.
7134 ///
7135 /// Sets the *name* path property to the given value.
7136 ///
7137 /// Even though the property as already been set when instantiating this call,
7138 /// we provide this method for API completeness.
7139 pub fn name(
7140 mut self,
7141 new_value: &str,
7142 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionGetCall<'a, C> {
7143 self._name = new_value.to_string();
7144 self
7145 }
7146 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7147 /// while executing the actual API request.
7148 ///
7149 /// ````text
7150 /// It should be used to handle progress information, and to implement a certain level of resilience.
7151 /// ````
7152 ///
7153 /// Sets the *delegate* property to the given value.
7154 pub fn delegate(
7155 mut self,
7156 new_value: &'a mut dyn common::Delegate,
7157 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionGetCall<'a, C> {
7158 self._delegate = Some(new_value);
7159 self
7160 }
7161
7162 /// Set any additional parameter of the query string used in the request.
7163 /// It should be used to set parameters which are not yet available through their own
7164 /// setters.
7165 ///
7166 /// Please note that this method must not be used to set any of the known parameters
7167 /// which have their own setter method. If done anyway, the request will fail.
7168 ///
7169 /// # Additional Parameters
7170 ///
7171 /// * *$.xgafv* (query-string) - V1 error format.
7172 /// * *access_token* (query-string) - OAuth access token.
7173 /// * *alt* (query-string) - Data format for response.
7174 /// * *callback* (query-string) - JSONP
7175 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7176 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7177 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7178 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7179 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7180 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7181 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7182 pub fn param<T>(
7183 mut self,
7184 name: T,
7185 value: T,
7186 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionGetCall<'a, C>
7187 where
7188 T: AsRef<str>,
7189 {
7190 self._additional_params
7191 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7192 self
7193 }
7194
7195 /// Identifies the authorization scope for the method you are building.
7196 ///
7197 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7198 /// [`Scope::CloudHealthcare`].
7199 ///
7200 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7201 /// tokens for more than one scope.
7202 ///
7203 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7204 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7205 /// sufficient, a read-write scope will do as well.
7206 pub fn add_scope<St>(
7207 mut self,
7208 scope: St,
7209 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionGetCall<'a, C>
7210 where
7211 St: AsRef<str>,
7212 {
7213 self._scopes.insert(String::from(scope.as_ref()));
7214 self
7215 }
7216 /// Identifies the authorization scope(s) for the method you are building.
7217 ///
7218 /// See [`Self::add_scope()`] for details.
7219 pub fn add_scopes<I, St>(
7220 mut self,
7221 scopes: I,
7222 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionGetCall<'a, C>
7223 where
7224 I: IntoIterator<Item = St>,
7225 St: AsRef<str>,
7226 {
7227 self._scopes
7228 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7229 self
7230 }
7231
7232 /// Removes all scopes, and no default scope will be used either.
7233 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7234 /// for details).
7235 pub fn clear_scopes(
7236 mut self,
7237 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionGetCall<'a, C> {
7238 self._scopes.clear();
7239 self
7240 }
7241}
7242
7243/// Lists the Attribute definitions in the specified consent store.
7244///
7245/// A builder for the *locations.datasets.consentStores.attributeDefinitions.list* method supported by a *project* resource.
7246/// It is not used directly, but through a [`ProjectMethods`] instance.
7247///
7248/// # Example
7249///
7250/// Instantiate a resource method builder
7251///
7252/// ```test_harness,no_run
7253/// # extern crate hyper;
7254/// # extern crate hyper_rustls;
7255/// # extern crate google_healthcare1 as healthcare1;
7256/// # async fn dox() {
7257/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7258///
7259/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7260/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7261/// # secret,
7262/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7263/// # ).build().await.unwrap();
7264///
7265/// # let client = hyper_util::client::legacy::Client::builder(
7266/// # hyper_util::rt::TokioExecutor::new()
7267/// # )
7268/// # .build(
7269/// # hyper_rustls::HttpsConnectorBuilder::new()
7270/// # .with_native_roots()
7271/// # .unwrap()
7272/// # .https_or_http()
7273/// # .enable_http1()
7274/// # .build()
7275/// # );
7276/// # let mut hub = CloudHealthcare::new(client, auth);
7277/// // You can configure optional parameters by calling the respective setters at will, and
7278/// // execute the final call using `doit()`.
7279/// // Values shown here are possibly random and not representative !
7280/// let result = hub.projects().locations_datasets_consent_stores_attribute_definitions_list("parent")
7281/// .page_token("gubergren")
7282/// .page_size(-16)
7283/// .filter("est")
7284/// .doit().await;
7285/// # }
7286/// ```
7287pub struct ProjectLocationDatasetConsentStoreAttributeDefinitionListCall<'a, C>
7288where
7289 C: 'a,
7290{
7291 hub: &'a CloudHealthcare<C>,
7292 _parent: String,
7293 _page_token: Option<String>,
7294 _page_size: Option<i32>,
7295 _filter: Option<String>,
7296 _delegate: Option<&'a mut dyn common::Delegate>,
7297 _additional_params: HashMap<String, String>,
7298 _scopes: BTreeSet<String>,
7299}
7300
7301impl<'a, C> common::CallBuilder
7302 for ProjectLocationDatasetConsentStoreAttributeDefinitionListCall<'a, C>
7303{
7304}
7305
7306impl<'a, C> ProjectLocationDatasetConsentStoreAttributeDefinitionListCall<'a, C>
7307where
7308 C: common::Connector,
7309{
7310 /// Perform the operation you have build so far.
7311 pub async fn doit(
7312 mut self,
7313 ) -> common::Result<(common::Response, ListAttributeDefinitionsResponse)> {
7314 use std::borrow::Cow;
7315 use std::io::{Read, Seek};
7316
7317 use common::{url::Params, ToParts};
7318 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7319
7320 let mut dd = common::DefaultDelegate;
7321 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7322 dlg.begin(common::MethodInfo {
7323 id: "healthcare.projects.locations.datasets.consentStores.attributeDefinitions.list",
7324 http_method: hyper::Method::GET,
7325 });
7326
7327 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
7328 if self._additional_params.contains_key(field) {
7329 dlg.finished(false);
7330 return Err(common::Error::FieldClash(field));
7331 }
7332 }
7333
7334 let mut params = Params::with_capacity(6 + self._additional_params.len());
7335 params.push("parent", self._parent);
7336 if let Some(value) = self._page_token.as_ref() {
7337 params.push("pageToken", value);
7338 }
7339 if let Some(value) = self._page_size.as_ref() {
7340 params.push("pageSize", value.to_string());
7341 }
7342 if let Some(value) = self._filter.as_ref() {
7343 params.push("filter", value);
7344 }
7345
7346 params.extend(self._additional_params.iter());
7347
7348 params.push("alt", "json");
7349 let mut url = self.hub._base_url.clone() + "v1/{+parent}/attributeDefinitions";
7350 if self._scopes.is_empty() {
7351 self._scopes
7352 .insert(Scope::CloudHealthcare.as_ref().to_string());
7353 }
7354
7355 #[allow(clippy::single_element_loop)]
7356 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7357 url = params.uri_replacement(url, param_name, find_this, true);
7358 }
7359 {
7360 let to_remove = ["parent"];
7361 params.remove_params(&to_remove);
7362 }
7363
7364 let url = params.parse_with_url(&url);
7365
7366 loop {
7367 let token = match self
7368 .hub
7369 .auth
7370 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7371 .await
7372 {
7373 Ok(token) => token,
7374 Err(e) => match dlg.token(e) {
7375 Ok(token) => token,
7376 Err(e) => {
7377 dlg.finished(false);
7378 return Err(common::Error::MissingToken(e));
7379 }
7380 },
7381 };
7382 let mut req_result = {
7383 let client = &self.hub.client;
7384 dlg.pre_request();
7385 let mut req_builder = hyper::Request::builder()
7386 .method(hyper::Method::GET)
7387 .uri(url.as_str())
7388 .header(USER_AGENT, self.hub._user_agent.clone());
7389
7390 if let Some(token) = token.as_ref() {
7391 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7392 }
7393
7394 let request = req_builder
7395 .header(CONTENT_LENGTH, 0_u64)
7396 .body(common::to_body::<String>(None));
7397
7398 client.request(request.unwrap()).await
7399 };
7400
7401 match req_result {
7402 Err(err) => {
7403 if let common::Retry::After(d) = dlg.http_error(&err) {
7404 sleep(d).await;
7405 continue;
7406 }
7407 dlg.finished(false);
7408 return Err(common::Error::HttpError(err));
7409 }
7410 Ok(res) => {
7411 let (mut parts, body) = res.into_parts();
7412 let mut body = common::Body::new(body);
7413 if !parts.status.is_success() {
7414 let bytes = common::to_bytes(body).await.unwrap_or_default();
7415 let error = serde_json::from_str(&common::to_string(&bytes));
7416 let response = common::to_response(parts, bytes.into());
7417
7418 if let common::Retry::After(d) =
7419 dlg.http_failure(&response, error.as_ref().ok())
7420 {
7421 sleep(d).await;
7422 continue;
7423 }
7424
7425 dlg.finished(false);
7426
7427 return Err(match error {
7428 Ok(value) => common::Error::BadRequest(value),
7429 _ => common::Error::Failure(response),
7430 });
7431 }
7432 let response = {
7433 let bytes = common::to_bytes(body).await.unwrap_or_default();
7434 let encoded = common::to_string(&bytes);
7435 match serde_json::from_str(&encoded) {
7436 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7437 Err(error) => {
7438 dlg.response_json_decode_error(&encoded, &error);
7439 return Err(common::Error::JsonDecodeError(
7440 encoded.to_string(),
7441 error,
7442 ));
7443 }
7444 }
7445 };
7446
7447 dlg.finished(true);
7448 return Ok(response);
7449 }
7450 }
7451 }
7452 }
7453
7454 /// Required. Name of the consent store to retrieve Attribute definitions from.
7455 ///
7456 /// Sets the *parent* path property to the given value.
7457 ///
7458 /// Even though the property as already been set when instantiating this call,
7459 /// we provide this method for API completeness.
7460 pub fn parent(
7461 mut self,
7462 new_value: &str,
7463 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionListCall<'a, C> {
7464 self._parent = new_value.to_string();
7465 self
7466 }
7467 /// Optional. Token to retrieve the next page of results or empty to get the first page.
7468 ///
7469 /// Sets the *page token* query property to the given value.
7470 pub fn page_token(
7471 mut self,
7472 new_value: &str,
7473 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionListCall<'a, C> {
7474 self._page_token = Some(new_value.to_string());
7475 self
7476 }
7477 /// Optional. Limit on the number of Attribute definitions to return in a single response. If not specified, 100 is used. May not be larger than 1000.
7478 ///
7479 /// Sets the *page size* query property to the given value.
7480 pub fn page_size(
7481 mut self,
7482 new_value: i32,
7483 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionListCall<'a, C> {
7484 self._page_size = Some(new_value);
7485 self
7486 }
7487 /// Optional. Restricts the attributes returned to those matching a filter. The only field available for filtering is `category`. For example, `filter=category=\"REQUEST\"`.
7488 ///
7489 /// Sets the *filter* query property to the given value.
7490 pub fn filter(
7491 mut self,
7492 new_value: &str,
7493 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionListCall<'a, C> {
7494 self._filter = Some(new_value.to_string());
7495 self
7496 }
7497 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7498 /// while executing the actual API request.
7499 ///
7500 /// ````text
7501 /// It should be used to handle progress information, and to implement a certain level of resilience.
7502 /// ````
7503 ///
7504 /// Sets the *delegate* property to the given value.
7505 pub fn delegate(
7506 mut self,
7507 new_value: &'a mut dyn common::Delegate,
7508 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionListCall<'a, C> {
7509 self._delegate = Some(new_value);
7510 self
7511 }
7512
7513 /// Set any additional parameter of the query string used in the request.
7514 /// It should be used to set parameters which are not yet available through their own
7515 /// setters.
7516 ///
7517 /// Please note that this method must not be used to set any of the known parameters
7518 /// which have their own setter method. If done anyway, the request will fail.
7519 ///
7520 /// # Additional Parameters
7521 ///
7522 /// * *$.xgafv* (query-string) - V1 error format.
7523 /// * *access_token* (query-string) - OAuth access token.
7524 /// * *alt* (query-string) - Data format for response.
7525 /// * *callback* (query-string) - JSONP
7526 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7527 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7528 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7529 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7530 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7531 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7532 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7533 pub fn param<T>(
7534 mut self,
7535 name: T,
7536 value: T,
7537 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionListCall<'a, C>
7538 where
7539 T: AsRef<str>,
7540 {
7541 self._additional_params
7542 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7543 self
7544 }
7545
7546 /// Identifies the authorization scope for the method you are building.
7547 ///
7548 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7549 /// [`Scope::CloudHealthcare`].
7550 ///
7551 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7552 /// tokens for more than one scope.
7553 ///
7554 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7555 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7556 /// sufficient, a read-write scope will do as well.
7557 pub fn add_scope<St>(
7558 mut self,
7559 scope: St,
7560 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionListCall<'a, C>
7561 where
7562 St: AsRef<str>,
7563 {
7564 self._scopes.insert(String::from(scope.as_ref()));
7565 self
7566 }
7567 /// Identifies the authorization scope(s) for the method you are building.
7568 ///
7569 /// See [`Self::add_scope()`] for details.
7570 pub fn add_scopes<I, St>(
7571 mut self,
7572 scopes: I,
7573 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionListCall<'a, C>
7574 where
7575 I: IntoIterator<Item = St>,
7576 St: AsRef<str>,
7577 {
7578 self._scopes
7579 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7580 self
7581 }
7582
7583 /// Removes all scopes, and no default scope will be used either.
7584 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7585 /// for details).
7586 pub fn clear_scopes(
7587 mut self,
7588 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionListCall<'a, C> {
7589 self._scopes.clear();
7590 self
7591 }
7592}
7593
7594/// Updates the specified Attribute definition.
7595///
7596/// A builder for the *locations.datasets.consentStores.attributeDefinitions.patch* method supported by a *project* resource.
7597/// It is not used directly, but through a [`ProjectMethods`] instance.
7598///
7599/// # Example
7600///
7601/// Instantiate a resource method builder
7602///
7603/// ```test_harness,no_run
7604/// # extern crate hyper;
7605/// # extern crate hyper_rustls;
7606/// # extern crate google_healthcare1 as healthcare1;
7607/// use healthcare1::api::AttributeDefinition;
7608/// # async fn dox() {
7609/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7610///
7611/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7612/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7613/// # secret,
7614/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7615/// # ).build().await.unwrap();
7616///
7617/// # let client = hyper_util::client::legacy::Client::builder(
7618/// # hyper_util::rt::TokioExecutor::new()
7619/// # )
7620/// # .build(
7621/// # hyper_rustls::HttpsConnectorBuilder::new()
7622/// # .with_native_roots()
7623/// # .unwrap()
7624/// # .https_or_http()
7625/// # .enable_http1()
7626/// # .build()
7627/// # );
7628/// # let mut hub = CloudHealthcare::new(client, auth);
7629/// // As the method needs a request, you would usually fill it with the desired information
7630/// // into the respective structure. Some of the parts shown here might not be applicable !
7631/// // Values shown here are possibly random and not representative !
7632/// let mut req = AttributeDefinition::default();
7633///
7634/// // You can configure optional parameters by calling the respective setters at will, and
7635/// // execute the final call using `doit()`.
7636/// // Values shown here are possibly random and not representative !
7637/// let result = hub.projects().locations_datasets_consent_stores_attribute_definitions_patch(req, "name")
7638/// .update_mask(FieldMask::new::<&str>(&[]))
7639/// .doit().await;
7640/// # }
7641/// ```
7642pub struct ProjectLocationDatasetConsentStoreAttributeDefinitionPatchCall<'a, C>
7643where
7644 C: 'a,
7645{
7646 hub: &'a CloudHealthcare<C>,
7647 _request: AttributeDefinition,
7648 _name: String,
7649 _update_mask: Option<common::FieldMask>,
7650 _delegate: Option<&'a mut dyn common::Delegate>,
7651 _additional_params: HashMap<String, String>,
7652 _scopes: BTreeSet<String>,
7653}
7654
7655impl<'a, C> common::CallBuilder
7656 for ProjectLocationDatasetConsentStoreAttributeDefinitionPatchCall<'a, C>
7657{
7658}
7659
7660impl<'a, C> ProjectLocationDatasetConsentStoreAttributeDefinitionPatchCall<'a, C>
7661where
7662 C: common::Connector,
7663{
7664 /// Perform the operation you have build so far.
7665 pub async fn doit(mut self) -> common::Result<(common::Response, AttributeDefinition)> {
7666 use std::borrow::Cow;
7667 use std::io::{Read, Seek};
7668
7669 use common::{url::Params, ToParts};
7670 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7671
7672 let mut dd = common::DefaultDelegate;
7673 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7674 dlg.begin(common::MethodInfo {
7675 id: "healthcare.projects.locations.datasets.consentStores.attributeDefinitions.patch",
7676 http_method: hyper::Method::PATCH,
7677 });
7678
7679 for &field in ["alt", "name", "updateMask"].iter() {
7680 if self._additional_params.contains_key(field) {
7681 dlg.finished(false);
7682 return Err(common::Error::FieldClash(field));
7683 }
7684 }
7685
7686 let mut params = Params::with_capacity(5 + self._additional_params.len());
7687 params.push("name", self._name);
7688 if let Some(value) = self._update_mask.as_ref() {
7689 params.push("updateMask", value.to_string());
7690 }
7691
7692 params.extend(self._additional_params.iter());
7693
7694 params.push("alt", "json");
7695 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7696 if self._scopes.is_empty() {
7697 self._scopes
7698 .insert(Scope::CloudHealthcare.as_ref().to_string());
7699 }
7700
7701 #[allow(clippy::single_element_loop)]
7702 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7703 url = params.uri_replacement(url, param_name, find_this, true);
7704 }
7705 {
7706 let to_remove = ["name"];
7707 params.remove_params(&to_remove);
7708 }
7709
7710 let url = params.parse_with_url(&url);
7711
7712 let mut json_mime_type = mime::APPLICATION_JSON;
7713 let mut request_value_reader = {
7714 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7715 common::remove_json_null_values(&mut value);
7716 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7717 serde_json::to_writer(&mut dst, &value).unwrap();
7718 dst
7719 };
7720 let request_size = request_value_reader
7721 .seek(std::io::SeekFrom::End(0))
7722 .unwrap();
7723 request_value_reader
7724 .seek(std::io::SeekFrom::Start(0))
7725 .unwrap();
7726
7727 loop {
7728 let token = match self
7729 .hub
7730 .auth
7731 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7732 .await
7733 {
7734 Ok(token) => token,
7735 Err(e) => match dlg.token(e) {
7736 Ok(token) => token,
7737 Err(e) => {
7738 dlg.finished(false);
7739 return Err(common::Error::MissingToken(e));
7740 }
7741 },
7742 };
7743 request_value_reader
7744 .seek(std::io::SeekFrom::Start(0))
7745 .unwrap();
7746 let mut req_result = {
7747 let client = &self.hub.client;
7748 dlg.pre_request();
7749 let mut req_builder = hyper::Request::builder()
7750 .method(hyper::Method::PATCH)
7751 .uri(url.as_str())
7752 .header(USER_AGENT, self.hub._user_agent.clone());
7753
7754 if let Some(token) = token.as_ref() {
7755 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7756 }
7757
7758 let request = req_builder
7759 .header(CONTENT_TYPE, json_mime_type.to_string())
7760 .header(CONTENT_LENGTH, request_size as u64)
7761 .body(common::to_body(
7762 request_value_reader.get_ref().clone().into(),
7763 ));
7764
7765 client.request(request.unwrap()).await
7766 };
7767
7768 match req_result {
7769 Err(err) => {
7770 if let common::Retry::After(d) = dlg.http_error(&err) {
7771 sleep(d).await;
7772 continue;
7773 }
7774 dlg.finished(false);
7775 return Err(common::Error::HttpError(err));
7776 }
7777 Ok(res) => {
7778 let (mut parts, body) = res.into_parts();
7779 let mut body = common::Body::new(body);
7780 if !parts.status.is_success() {
7781 let bytes = common::to_bytes(body).await.unwrap_or_default();
7782 let error = serde_json::from_str(&common::to_string(&bytes));
7783 let response = common::to_response(parts, bytes.into());
7784
7785 if let common::Retry::After(d) =
7786 dlg.http_failure(&response, error.as_ref().ok())
7787 {
7788 sleep(d).await;
7789 continue;
7790 }
7791
7792 dlg.finished(false);
7793
7794 return Err(match error {
7795 Ok(value) => common::Error::BadRequest(value),
7796 _ => common::Error::Failure(response),
7797 });
7798 }
7799 let response = {
7800 let bytes = common::to_bytes(body).await.unwrap_or_default();
7801 let encoded = common::to_string(&bytes);
7802 match serde_json::from_str(&encoded) {
7803 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7804 Err(error) => {
7805 dlg.response_json_decode_error(&encoded, &error);
7806 return Err(common::Error::JsonDecodeError(
7807 encoded.to_string(),
7808 error,
7809 ));
7810 }
7811 }
7812 };
7813
7814 dlg.finished(true);
7815 return Ok(response);
7816 }
7817 }
7818 }
7819 }
7820
7821 ///
7822 /// Sets the *request* property to the given value.
7823 ///
7824 /// Even though the property as already been set when instantiating this call,
7825 /// we provide this method for API completeness.
7826 pub fn request(
7827 mut self,
7828 new_value: AttributeDefinition,
7829 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionPatchCall<'a, C> {
7830 self._request = new_value;
7831 self
7832 }
7833 /// Identifier. Resource name of the Attribute definition, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/attributeDefinitions/{attribute_definition_id}`. Cannot be changed after creation.
7834 ///
7835 /// Sets the *name* path property to the given value.
7836 ///
7837 /// Even though the property as already been set when instantiating this call,
7838 /// we provide this method for API completeness.
7839 pub fn name(
7840 mut self,
7841 new_value: &str,
7842 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionPatchCall<'a, C> {
7843 self._name = new_value.to_string();
7844 self
7845 }
7846 /// Required. The update mask that applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. Only the `description`, `allowed_values`, `consent_default_values` and `data_mapping_default_value` fields can be updated. The updated `allowed_values` must contain all values from the previous `allowed_values`.
7847 ///
7848 /// Sets the *update mask* query property to the given value.
7849 pub fn update_mask(
7850 mut self,
7851 new_value: common::FieldMask,
7852 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionPatchCall<'a, C> {
7853 self._update_mask = Some(new_value);
7854 self
7855 }
7856 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7857 /// while executing the actual API request.
7858 ///
7859 /// ````text
7860 /// It should be used to handle progress information, and to implement a certain level of resilience.
7861 /// ````
7862 ///
7863 /// Sets the *delegate* property to the given value.
7864 pub fn delegate(
7865 mut self,
7866 new_value: &'a mut dyn common::Delegate,
7867 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionPatchCall<'a, C> {
7868 self._delegate = Some(new_value);
7869 self
7870 }
7871
7872 /// Set any additional parameter of the query string used in the request.
7873 /// It should be used to set parameters which are not yet available through their own
7874 /// setters.
7875 ///
7876 /// Please note that this method must not be used to set any of the known parameters
7877 /// which have their own setter method. If done anyway, the request will fail.
7878 ///
7879 /// # Additional Parameters
7880 ///
7881 /// * *$.xgafv* (query-string) - V1 error format.
7882 /// * *access_token* (query-string) - OAuth access token.
7883 /// * *alt* (query-string) - Data format for response.
7884 /// * *callback* (query-string) - JSONP
7885 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7886 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7887 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7888 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7889 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7890 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7891 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7892 pub fn param<T>(
7893 mut self,
7894 name: T,
7895 value: T,
7896 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionPatchCall<'a, C>
7897 where
7898 T: AsRef<str>,
7899 {
7900 self._additional_params
7901 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7902 self
7903 }
7904
7905 /// Identifies the authorization scope for the method you are building.
7906 ///
7907 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7908 /// [`Scope::CloudHealthcare`].
7909 ///
7910 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7911 /// tokens for more than one scope.
7912 ///
7913 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7914 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7915 /// sufficient, a read-write scope will do as well.
7916 pub fn add_scope<St>(
7917 mut self,
7918 scope: St,
7919 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionPatchCall<'a, C>
7920 where
7921 St: AsRef<str>,
7922 {
7923 self._scopes.insert(String::from(scope.as_ref()));
7924 self
7925 }
7926 /// Identifies the authorization scope(s) for the method you are building.
7927 ///
7928 /// See [`Self::add_scope()`] for details.
7929 pub fn add_scopes<I, St>(
7930 mut self,
7931 scopes: I,
7932 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionPatchCall<'a, C>
7933 where
7934 I: IntoIterator<Item = St>,
7935 St: AsRef<str>,
7936 {
7937 self._scopes
7938 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7939 self
7940 }
7941
7942 /// Removes all scopes, and no default scope will be used either.
7943 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7944 /// for details).
7945 pub fn clear_scopes(
7946 mut self,
7947 ) -> ProjectLocationDatasetConsentStoreAttributeDefinitionPatchCall<'a, C> {
7948 self._scopes.clear();
7949 self
7950 }
7951}
7952
7953/// Creates a new Consent artifact in the parent consent store.
7954///
7955/// A builder for the *locations.datasets.consentStores.consentArtifacts.create* method supported by a *project* resource.
7956/// It is not used directly, but through a [`ProjectMethods`] instance.
7957///
7958/// # Example
7959///
7960/// Instantiate a resource method builder
7961///
7962/// ```test_harness,no_run
7963/// # extern crate hyper;
7964/// # extern crate hyper_rustls;
7965/// # extern crate google_healthcare1 as healthcare1;
7966/// use healthcare1::api::ConsentArtifact;
7967/// # async fn dox() {
7968/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7969///
7970/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7971/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7972/// # secret,
7973/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7974/// # ).build().await.unwrap();
7975///
7976/// # let client = hyper_util::client::legacy::Client::builder(
7977/// # hyper_util::rt::TokioExecutor::new()
7978/// # )
7979/// # .build(
7980/// # hyper_rustls::HttpsConnectorBuilder::new()
7981/// # .with_native_roots()
7982/// # .unwrap()
7983/// # .https_or_http()
7984/// # .enable_http1()
7985/// # .build()
7986/// # );
7987/// # let mut hub = CloudHealthcare::new(client, auth);
7988/// // As the method needs a request, you would usually fill it with the desired information
7989/// // into the respective structure. Some of the parts shown here might not be applicable !
7990/// // Values shown here are possibly random and not representative !
7991/// let mut req = ConsentArtifact::default();
7992///
7993/// // You can configure optional parameters by calling the respective setters at will, and
7994/// // execute the final call using `doit()`.
7995/// // Values shown here are possibly random and not representative !
7996/// let result = hub.projects().locations_datasets_consent_stores_consent_artifacts_create(req, "parent")
7997/// .doit().await;
7998/// # }
7999/// ```
8000pub struct ProjectLocationDatasetConsentStoreConsentArtifactCreateCall<'a, C>
8001where
8002 C: 'a,
8003{
8004 hub: &'a CloudHealthcare<C>,
8005 _request: ConsentArtifact,
8006 _parent: String,
8007 _delegate: Option<&'a mut dyn common::Delegate>,
8008 _additional_params: HashMap<String, String>,
8009 _scopes: BTreeSet<String>,
8010}
8011
8012impl<'a, C> common::CallBuilder
8013 for ProjectLocationDatasetConsentStoreConsentArtifactCreateCall<'a, C>
8014{
8015}
8016
8017impl<'a, C> ProjectLocationDatasetConsentStoreConsentArtifactCreateCall<'a, C>
8018where
8019 C: common::Connector,
8020{
8021 /// Perform the operation you have build so far.
8022 pub async fn doit(mut self) -> common::Result<(common::Response, ConsentArtifact)> {
8023 use std::borrow::Cow;
8024 use std::io::{Read, Seek};
8025
8026 use common::{url::Params, ToParts};
8027 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8028
8029 let mut dd = common::DefaultDelegate;
8030 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8031 dlg.begin(common::MethodInfo {
8032 id: "healthcare.projects.locations.datasets.consentStores.consentArtifacts.create",
8033 http_method: hyper::Method::POST,
8034 });
8035
8036 for &field in ["alt", "parent"].iter() {
8037 if self._additional_params.contains_key(field) {
8038 dlg.finished(false);
8039 return Err(common::Error::FieldClash(field));
8040 }
8041 }
8042
8043 let mut params = Params::with_capacity(4 + self._additional_params.len());
8044 params.push("parent", self._parent);
8045
8046 params.extend(self._additional_params.iter());
8047
8048 params.push("alt", "json");
8049 let mut url = self.hub._base_url.clone() + "v1/{+parent}/consentArtifacts";
8050 if self._scopes.is_empty() {
8051 self._scopes
8052 .insert(Scope::CloudHealthcare.as_ref().to_string());
8053 }
8054
8055 #[allow(clippy::single_element_loop)]
8056 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8057 url = params.uri_replacement(url, param_name, find_this, true);
8058 }
8059 {
8060 let to_remove = ["parent"];
8061 params.remove_params(&to_remove);
8062 }
8063
8064 let url = params.parse_with_url(&url);
8065
8066 let mut json_mime_type = mime::APPLICATION_JSON;
8067 let mut request_value_reader = {
8068 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8069 common::remove_json_null_values(&mut value);
8070 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8071 serde_json::to_writer(&mut dst, &value).unwrap();
8072 dst
8073 };
8074 let request_size = request_value_reader
8075 .seek(std::io::SeekFrom::End(0))
8076 .unwrap();
8077 request_value_reader
8078 .seek(std::io::SeekFrom::Start(0))
8079 .unwrap();
8080
8081 loop {
8082 let token = match self
8083 .hub
8084 .auth
8085 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8086 .await
8087 {
8088 Ok(token) => token,
8089 Err(e) => match dlg.token(e) {
8090 Ok(token) => token,
8091 Err(e) => {
8092 dlg.finished(false);
8093 return Err(common::Error::MissingToken(e));
8094 }
8095 },
8096 };
8097 request_value_reader
8098 .seek(std::io::SeekFrom::Start(0))
8099 .unwrap();
8100 let mut req_result = {
8101 let client = &self.hub.client;
8102 dlg.pre_request();
8103 let mut req_builder = hyper::Request::builder()
8104 .method(hyper::Method::POST)
8105 .uri(url.as_str())
8106 .header(USER_AGENT, self.hub._user_agent.clone());
8107
8108 if let Some(token) = token.as_ref() {
8109 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8110 }
8111
8112 let request = req_builder
8113 .header(CONTENT_TYPE, json_mime_type.to_string())
8114 .header(CONTENT_LENGTH, request_size as u64)
8115 .body(common::to_body(
8116 request_value_reader.get_ref().clone().into(),
8117 ));
8118
8119 client.request(request.unwrap()).await
8120 };
8121
8122 match req_result {
8123 Err(err) => {
8124 if let common::Retry::After(d) = dlg.http_error(&err) {
8125 sleep(d).await;
8126 continue;
8127 }
8128 dlg.finished(false);
8129 return Err(common::Error::HttpError(err));
8130 }
8131 Ok(res) => {
8132 let (mut parts, body) = res.into_parts();
8133 let mut body = common::Body::new(body);
8134 if !parts.status.is_success() {
8135 let bytes = common::to_bytes(body).await.unwrap_or_default();
8136 let error = serde_json::from_str(&common::to_string(&bytes));
8137 let response = common::to_response(parts, bytes.into());
8138
8139 if let common::Retry::After(d) =
8140 dlg.http_failure(&response, error.as_ref().ok())
8141 {
8142 sleep(d).await;
8143 continue;
8144 }
8145
8146 dlg.finished(false);
8147
8148 return Err(match error {
8149 Ok(value) => common::Error::BadRequest(value),
8150 _ => common::Error::Failure(response),
8151 });
8152 }
8153 let response = {
8154 let bytes = common::to_bytes(body).await.unwrap_or_default();
8155 let encoded = common::to_string(&bytes);
8156 match serde_json::from_str(&encoded) {
8157 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8158 Err(error) => {
8159 dlg.response_json_decode_error(&encoded, &error);
8160 return Err(common::Error::JsonDecodeError(
8161 encoded.to_string(),
8162 error,
8163 ));
8164 }
8165 }
8166 };
8167
8168 dlg.finished(true);
8169 return Ok(response);
8170 }
8171 }
8172 }
8173 }
8174
8175 ///
8176 /// Sets the *request* property to the given value.
8177 ///
8178 /// Even though the property as already been set when instantiating this call,
8179 /// we provide this method for API completeness.
8180 pub fn request(
8181 mut self,
8182 new_value: ConsentArtifact,
8183 ) -> ProjectLocationDatasetConsentStoreConsentArtifactCreateCall<'a, C> {
8184 self._request = new_value;
8185 self
8186 }
8187 /// Required. The name of the consent store this Consent artifact belongs to.
8188 ///
8189 /// Sets the *parent* path property to the given value.
8190 ///
8191 /// Even though the property as already been set when instantiating this call,
8192 /// we provide this method for API completeness.
8193 pub fn parent(
8194 mut self,
8195 new_value: &str,
8196 ) -> ProjectLocationDatasetConsentStoreConsentArtifactCreateCall<'a, C> {
8197 self._parent = new_value.to_string();
8198 self
8199 }
8200 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8201 /// while executing the actual API request.
8202 ///
8203 /// ````text
8204 /// It should be used to handle progress information, and to implement a certain level of resilience.
8205 /// ````
8206 ///
8207 /// Sets the *delegate* property to the given value.
8208 pub fn delegate(
8209 mut self,
8210 new_value: &'a mut dyn common::Delegate,
8211 ) -> ProjectLocationDatasetConsentStoreConsentArtifactCreateCall<'a, C> {
8212 self._delegate = Some(new_value);
8213 self
8214 }
8215
8216 /// Set any additional parameter of the query string used in the request.
8217 /// It should be used to set parameters which are not yet available through their own
8218 /// setters.
8219 ///
8220 /// Please note that this method must not be used to set any of the known parameters
8221 /// which have their own setter method. If done anyway, the request will fail.
8222 ///
8223 /// # Additional Parameters
8224 ///
8225 /// * *$.xgafv* (query-string) - V1 error format.
8226 /// * *access_token* (query-string) - OAuth access token.
8227 /// * *alt* (query-string) - Data format for response.
8228 /// * *callback* (query-string) - JSONP
8229 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8230 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8231 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8232 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8233 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8234 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8235 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8236 pub fn param<T>(
8237 mut self,
8238 name: T,
8239 value: T,
8240 ) -> ProjectLocationDatasetConsentStoreConsentArtifactCreateCall<'a, C>
8241 where
8242 T: AsRef<str>,
8243 {
8244 self._additional_params
8245 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8246 self
8247 }
8248
8249 /// Identifies the authorization scope for the method you are building.
8250 ///
8251 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8252 /// [`Scope::CloudHealthcare`].
8253 ///
8254 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8255 /// tokens for more than one scope.
8256 ///
8257 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8258 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8259 /// sufficient, a read-write scope will do as well.
8260 pub fn add_scope<St>(
8261 mut self,
8262 scope: St,
8263 ) -> ProjectLocationDatasetConsentStoreConsentArtifactCreateCall<'a, C>
8264 where
8265 St: AsRef<str>,
8266 {
8267 self._scopes.insert(String::from(scope.as_ref()));
8268 self
8269 }
8270 /// Identifies the authorization scope(s) for the method you are building.
8271 ///
8272 /// See [`Self::add_scope()`] for details.
8273 pub fn add_scopes<I, St>(
8274 mut self,
8275 scopes: I,
8276 ) -> ProjectLocationDatasetConsentStoreConsentArtifactCreateCall<'a, C>
8277 where
8278 I: IntoIterator<Item = St>,
8279 St: AsRef<str>,
8280 {
8281 self._scopes
8282 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8283 self
8284 }
8285
8286 /// Removes all scopes, and no default scope will be used either.
8287 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8288 /// for details).
8289 pub fn clear_scopes(
8290 mut self,
8291 ) -> ProjectLocationDatasetConsentStoreConsentArtifactCreateCall<'a, C> {
8292 self._scopes.clear();
8293 self
8294 }
8295}
8296
8297/// Deletes the specified Consent artifact. Fails if the artifact is referenced by the latest revision of any Consent.
8298///
8299/// A builder for the *locations.datasets.consentStores.consentArtifacts.delete* method supported by a *project* resource.
8300/// It is not used directly, but through a [`ProjectMethods`] instance.
8301///
8302/// # Example
8303///
8304/// Instantiate a resource method builder
8305///
8306/// ```test_harness,no_run
8307/// # extern crate hyper;
8308/// # extern crate hyper_rustls;
8309/// # extern crate google_healthcare1 as healthcare1;
8310/// # async fn dox() {
8311/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8312///
8313/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8314/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8315/// # secret,
8316/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8317/// # ).build().await.unwrap();
8318///
8319/// # let client = hyper_util::client::legacy::Client::builder(
8320/// # hyper_util::rt::TokioExecutor::new()
8321/// # )
8322/// # .build(
8323/// # hyper_rustls::HttpsConnectorBuilder::new()
8324/// # .with_native_roots()
8325/// # .unwrap()
8326/// # .https_or_http()
8327/// # .enable_http1()
8328/// # .build()
8329/// # );
8330/// # let mut hub = CloudHealthcare::new(client, auth);
8331/// // You can configure optional parameters by calling the respective setters at will, and
8332/// // execute the final call using `doit()`.
8333/// // Values shown here are possibly random and not representative !
8334/// let result = hub.projects().locations_datasets_consent_stores_consent_artifacts_delete("name")
8335/// .doit().await;
8336/// # }
8337/// ```
8338pub struct ProjectLocationDatasetConsentStoreConsentArtifactDeleteCall<'a, C>
8339where
8340 C: 'a,
8341{
8342 hub: &'a CloudHealthcare<C>,
8343 _name: String,
8344 _delegate: Option<&'a mut dyn common::Delegate>,
8345 _additional_params: HashMap<String, String>,
8346 _scopes: BTreeSet<String>,
8347}
8348
8349impl<'a, C> common::CallBuilder
8350 for ProjectLocationDatasetConsentStoreConsentArtifactDeleteCall<'a, C>
8351{
8352}
8353
8354impl<'a, C> ProjectLocationDatasetConsentStoreConsentArtifactDeleteCall<'a, C>
8355where
8356 C: common::Connector,
8357{
8358 /// Perform the operation you have build so far.
8359 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
8360 use std::borrow::Cow;
8361 use std::io::{Read, Seek};
8362
8363 use common::{url::Params, ToParts};
8364 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8365
8366 let mut dd = common::DefaultDelegate;
8367 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8368 dlg.begin(common::MethodInfo {
8369 id: "healthcare.projects.locations.datasets.consentStores.consentArtifacts.delete",
8370 http_method: hyper::Method::DELETE,
8371 });
8372
8373 for &field in ["alt", "name"].iter() {
8374 if self._additional_params.contains_key(field) {
8375 dlg.finished(false);
8376 return Err(common::Error::FieldClash(field));
8377 }
8378 }
8379
8380 let mut params = Params::with_capacity(3 + self._additional_params.len());
8381 params.push("name", self._name);
8382
8383 params.extend(self._additional_params.iter());
8384
8385 params.push("alt", "json");
8386 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8387 if self._scopes.is_empty() {
8388 self._scopes
8389 .insert(Scope::CloudHealthcare.as_ref().to_string());
8390 }
8391
8392 #[allow(clippy::single_element_loop)]
8393 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8394 url = params.uri_replacement(url, param_name, find_this, true);
8395 }
8396 {
8397 let to_remove = ["name"];
8398 params.remove_params(&to_remove);
8399 }
8400
8401 let url = params.parse_with_url(&url);
8402
8403 loop {
8404 let token = match self
8405 .hub
8406 .auth
8407 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8408 .await
8409 {
8410 Ok(token) => token,
8411 Err(e) => match dlg.token(e) {
8412 Ok(token) => token,
8413 Err(e) => {
8414 dlg.finished(false);
8415 return Err(common::Error::MissingToken(e));
8416 }
8417 },
8418 };
8419 let mut req_result = {
8420 let client = &self.hub.client;
8421 dlg.pre_request();
8422 let mut req_builder = hyper::Request::builder()
8423 .method(hyper::Method::DELETE)
8424 .uri(url.as_str())
8425 .header(USER_AGENT, self.hub._user_agent.clone());
8426
8427 if let Some(token) = token.as_ref() {
8428 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8429 }
8430
8431 let request = req_builder
8432 .header(CONTENT_LENGTH, 0_u64)
8433 .body(common::to_body::<String>(None));
8434
8435 client.request(request.unwrap()).await
8436 };
8437
8438 match req_result {
8439 Err(err) => {
8440 if let common::Retry::After(d) = dlg.http_error(&err) {
8441 sleep(d).await;
8442 continue;
8443 }
8444 dlg.finished(false);
8445 return Err(common::Error::HttpError(err));
8446 }
8447 Ok(res) => {
8448 let (mut parts, body) = res.into_parts();
8449 let mut body = common::Body::new(body);
8450 if !parts.status.is_success() {
8451 let bytes = common::to_bytes(body).await.unwrap_or_default();
8452 let error = serde_json::from_str(&common::to_string(&bytes));
8453 let response = common::to_response(parts, bytes.into());
8454
8455 if let common::Retry::After(d) =
8456 dlg.http_failure(&response, error.as_ref().ok())
8457 {
8458 sleep(d).await;
8459 continue;
8460 }
8461
8462 dlg.finished(false);
8463
8464 return Err(match error {
8465 Ok(value) => common::Error::BadRequest(value),
8466 _ => common::Error::Failure(response),
8467 });
8468 }
8469 let response = {
8470 let bytes = common::to_bytes(body).await.unwrap_or_default();
8471 let encoded = common::to_string(&bytes);
8472 match serde_json::from_str(&encoded) {
8473 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8474 Err(error) => {
8475 dlg.response_json_decode_error(&encoded, &error);
8476 return Err(common::Error::JsonDecodeError(
8477 encoded.to_string(),
8478 error,
8479 ));
8480 }
8481 }
8482 };
8483
8484 dlg.finished(true);
8485 return Ok(response);
8486 }
8487 }
8488 }
8489 }
8490
8491 /// Required. The resource name of the Consent artifact to delete. To preserve referential integrity, Consent artifacts referenced by the latest revision of a Consent cannot be deleted.
8492 ///
8493 /// Sets the *name* path property to the given value.
8494 ///
8495 /// Even though the property as already been set when instantiating this call,
8496 /// we provide this method for API completeness.
8497 pub fn name(
8498 mut self,
8499 new_value: &str,
8500 ) -> ProjectLocationDatasetConsentStoreConsentArtifactDeleteCall<'a, C> {
8501 self._name = new_value.to_string();
8502 self
8503 }
8504 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8505 /// while executing the actual API request.
8506 ///
8507 /// ````text
8508 /// It should be used to handle progress information, and to implement a certain level of resilience.
8509 /// ````
8510 ///
8511 /// Sets the *delegate* property to the given value.
8512 pub fn delegate(
8513 mut self,
8514 new_value: &'a mut dyn common::Delegate,
8515 ) -> ProjectLocationDatasetConsentStoreConsentArtifactDeleteCall<'a, C> {
8516 self._delegate = Some(new_value);
8517 self
8518 }
8519
8520 /// Set any additional parameter of the query string used in the request.
8521 /// It should be used to set parameters which are not yet available through their own
8522 /// setters.
8523 ///
8524 /// Please note that this method must not be used to set any of the known parameters
8525 /// which have their own setter method. If done anyway, the request will fail.
8526 ///
8527 /// # Additional Parameters
8528 ///
8529 /// * *$.xgafv* (query-string) - V1 error format.
8530 /// * *access_token* (query-string) - OAuth access token.
8531 /// * *alt* (query-string) - Data format for response.
8532 /// * *callback* (query-string) - JSONP
8533 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8534 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8535 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8536 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8537 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8538 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8539 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8540 pub fn param<T>(
8541 mut self,
8542 name: T,
8543 value: T,
8544 ) -> ProjectLocationDatasetConsentStoreConsentArtifactDeleteCall<'a, C>
8545 where
8546 T: AsRef<str>,
8547 {
8548 self._additional_params
8549 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8550 self
8551 }
8552
8553 /// Identifies the authorization scope for the method you are building.
8554 ///
8555 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8556 /// [`Scope::CloudHealthcare`].
8557 ///
8558 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8559 /// tokens for more than one scope.
8560 ///
8561 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8562 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8563 /// sufficient, a read-write scope will do as well.
8564 pub fn add_scope<St>(
8565 mut self,
8566 scope: St,
8567 ) -> ProjectLocationDatasetConsentStoreConsentArtifactDeleteCall<'a, C>
8568 where
8569 St: AsRef<str>,
8570 {
8571 self._scopes.insert(String::from(scope.as_ref()));
8572 self
8573 }
8574 /// Identifies the authorization scope(s) for the method you are building.
8575 ///
8576 /// See [`Self::add_scope()`] for details.
8577 pub fn add_scopes<I, St>(
8578 mut self,
8579 scopes: I,
8580 ) -> ProjectLocationDatasetConsentStoreConsentArtifactDeleteCall<'a, C>
8581 where
8582 I: IntoIterator<Item = St>,
8583 St: AsRef<str>,
8584 {
8585 self._scopes
8586 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8587 self
8588 }
8589
8590 /// Removes all scopes, and no default scope will be used either.
8591 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8592 /// for details).
8593 pub fn clear_scopes(
8594 mut self,
8595 ) -> ProjectLocationDatasetConsentStoreConsentArtifactDeleteCall<'a, C> {
8596 self._scopes.clear();
8597 self
8598 }
8599}
8600
8601/// Gets the specified Consent artifact.
8602///
8603/// A builder for the *locations.datasets.consentStores.consentArtifacts.get* method supported by a *project* resource.
8604/// It is not used directly, but through a [`ProjectMethods`] instance.
8605///
8606/// # Example
8607///
8608/// Instantiate a resource method builder
8609///
8610/// ```test_harness,no_run
8611/// # extern crate hyper;
8612/// # extern crate hyper_rustls;
8613/// # extern crate google_healthcare1 as healthcare1;
8614/// # async fn dox() {
8615/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8616///
8617/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8618/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8619/// # secret,
8620/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8621/// # ).build().await.unwrap();
8622///
8623/// # let client = hyper_util::client::legacy::Client::builder(
8624/// # hyper_util::rt::TokioExecutor::new()
8625/// # )
8626/// # .build(
8627/// # hyper_rustls::HttpsConnectorBuilder::new()
8628/// # .with_native_roots()
8629/// # .unwrap()
8630/// # .https_or_http()
8631/// # .enable_http1()
8632/// # .build()
8633/// # );
8634/// # let mut hub = CloudHealthcare::new(client, auth);
8635/// // You can configure optional parameters by calling the respective setters at will, and
8636/// // execute the final call using `doit()`.
8637/// // Values shown here are possibly random and not representative !
8638/// let result = hub.projects().locations_datasets_consent_stores_consent_artifacts_get("name")
8639/// .doit().await;
8640/// # }
8641/// ```
8642pub struct ProjectLocationDatasetConsentStoreConsentArtifactGetCall<'a, C>
8643where
8644 C: 'a,
8645{
8646 hub: &'a CloudHealthcare<C>,
8647 _name: String,
8648 _delegate: Option<&'a mut dyn common::Delegate>,
8649 _additional_params: HashMap<String, String>,
8650 _scopes: BTreeSet<String>,
8651}
8652
8653impl<'a, C> common::CallBuilder
8654 for ProjectLocationDatasetConsentStoreConsentArtifactGetCall<'a, C>
8655{
8656}
8657
8658impl<'a, C> ProjectLocationDatasetConsentStoreConsentArtifactGetCall<'a, C>
8659where
8660 C: common::Connector,
8661{
8662 /// Perform the operation you have build so far.
8663 pub async fn doit(mut self) -> common::Result<(common::Response, ConsentArtifact)> {
8664 use std::borrow::Cow;
8665 use std::io::{Read, Seek};
8666
8667 use common::{url::Params, ToParts};
8668 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8669
8670 let mut dd = common::DefaultDelegate;
8671 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8672 dlg.begin(common::MethodInfo {
8673 id: "healthcare.projects.locations.datasets.consentStores.consentArtifacts.get",
8674 http_method: hyper::Method::GET,
8675 });
8676
8677 for &field in ["alt", "name"].iter() {
8678 if self._additional_params.contains_key(field) {
8679 dlg.finished(false);
8680 return Err(common::Error::FieldClash(field));
8681 }
8682 }
8683
8684 let mut params = Params::with_capacity(3 + self._additional_params.len());
8685 params.push("name", self._name);
8686
8687 params.extend(self._additional_params.iter());
8688
8689 params.push("alt", "json");
8690 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8691 if self._scopes.is_empty() {
8692 self._scopes
8693 .insert(Scope::CloudHealthcare.as_ref().to_string());
8694 }
8695
8696 #[allow(clippy::single_element_loop)]
8697 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8698 url = params.uri_replacement(url, param_name, find_this, true);
8699 }
8700 {
8701 let to_remove = ["name"];
8702 params.remove_params(&to_remove);
8703 }
8704
8705 let url = params.parse_with_url(&url);
8706
8707 loop {
8708 let token = match self
8709 .hub
8710 .auth
8711 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8712 .await
8713 {
8714 Ok(token) => token,
8715 Err(e) => match dlg.token(e) {
8716 Ok(token) => token,
8717 Err(e) => {
8718 dlg.finished(false);
8719 return Err(common::Error::MissingToken(e));
8720 }
8721 },
8722 };
8723 let mut req_result = {
8724 let client = &self.hub.client;
8725 dlg.pre_request();
8726 let mut req_builder = hyper::Request::builder()
8727 .method(hyper::Method::GET)
8728 .uri(url.as_str())
8729 .header(USER_AGENT, self.hub._user_agent.clone());
8730
8731 if let Some(token) = token.as_ref() {
8732 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8733 }
8734
8735 let request = req_builder
8736 .header(CONTENT_LENGTH, 0_u64)
8737 .body(common::to_body::<String>(None));
8738
8739 client.request(request.unwrap()).await
8740 };
8741
8742 match req_result {
8743 Err(err) => {
8744 if let common::Retry::After(d) = dlg.http_error(&err) {
8745 sleep(d).await;
8746 continue;
8747 }
8748 dlg.finished(false);
8749 return Err(common::Error::HttpError(err));
8750 }
8751 Ok(res) => {
8752 let (mut parts, body) = res.into_parts();
8753 let mut body = common::Body::new(body);
8754 if !parts.status.is_success() {
8755 let bytes = common::to_bytes(body).await.unwrap_or_default();
8756 let error = serde_json::from_str(&common::to_string(&bytes));
8757 let response = common::to_response(parts, bytes.into());
8758
8759 if let common::Retry::After(d) =
8760 dlg.http_failure(&response, error.as_ref().ok())
8761 {
8762 sleep(d).await;
8763 continue;
8764 }
8765
8766 dlg.finished(false);
8767
8768 return Err(match error {
8769 Ok(value) => common::Error::BadRequest(value),
8770 _ => common::Error::Failure(response),
8771 });
8772 }
8773 let response = {
8774 let bytes = common::to_bytes(body).await.unwrap_or_default();
8775 let encoded = common::to_string(&bytes);
8776 match serde_json::from_str(&encoded) {
8777 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8778 Err(error) => {
8779 dlg.response_json_decode_error(&encoded, &error);
8780 return Err(common::Error::JsonDecodeError(
8781 encoded.to_string(),
8782 error,
8783 ));
8784 }
8785 }
8786 };
8787
8788 dlg.finished(true);
8789 return Ok(response);
8790 }
8791 }
8792 }
8793 }
8794
8795 /// Required. The resource name of the Consent artifact to retrieve.
8796 ///
8797 /// Sets the *name* path property to the given value.
8798 ///
8799 /// Even though the property as already been set when instantiating this call,
8800 /// we provide this method for API completeness.
8801 pub fn name(
8802 mut self,
8803 new_value: &str,
8804 ) -> ProjectLocationDatasetConsentStoreConsentArtifactGetCall<'a, C> {
8805 self._name = new_value.to_string();
8806 self
8807 }
8808 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8809 /// while executing the actual API request.
8810 ///
8811 /// ````text
8812 /// It should be used to handle progress information, and to implement a certain level of resilience.
8813 /// ````
8814 ///
8815 /// Sets the *delegate* property to the given value.
8816 pub fn delegate(
8817 mut self,
8818 new_value: &'a mut dyn common::Delegate,
8819 ) -> ProjectLocationDatasetConsentStoreConsentArtifactGetCall<'a, C> {
8820 self._delegate = Some(new_value);
8821 self
8822 }
8823
8824 /// Set any additional parameter of the query string used in the request.
8825 /// It should be used to set parameters which are not yet available through their own
8826 /// setters.
8827 ///
8828 /// Please note that this method must not be used to set any of the known parameters
8829 /// which have their own setter method. If done anyway, the request will fail.
8830 ///
8831 /// # Additional Parameters
8832 ///
8833 /// * *$.xgafv* (query-string) - V1 error format.
8834 /// * *access_token* (query-string) - OAuth access token.
8835 /// * *alt* (query-string) - Data format for response.
8836 /// * *callback* (query-string) - JSONP
8837 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8838 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8839 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8840 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8841 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8842 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8843 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8844 pub fn param<T>(
8845 mut self,
8846 name: T,
8847 value: T,
8848 ) -> ProjectLocationDatasetConsentStoreConsentArtifactGetCall<'a, C>
8849 where
8850 T: AsRef<str>,
8851 {
8852 self._additional_params
8853 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8854 self
8855 }
8856
8857 /// Identifies the authorization scope for the method you are building.
8858 ///
8859 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8860 /// [`Scope::CloudHealthcare`].
8861 ///
8862 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8863 /// tokens for more than one scope.
8864 ///
8865 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8866 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8867 /// sufficient, a read-write scope will do as well.
8868 pub fn add_scope<St>(
8869 mut self,
8870 scope: St,
8871 ) -> ProjectLocationDatasetConsentStoreConsentArtifactGetCall<'a, C>
8872 where
8873 St: AsRef<str>,
8874 {
8875 self._scopes.insert(String::from(scope.as_ref()));
8876 self
8877 }
8878 /// Identifies the authorization scope(s) for the method you are building.
8879 ///
8880 /// See [`Self::add_scope()`] for details.
8881 pub fn add_scopes<I, St>(
8882 mut self,
8883 scopes: I,
8884 ) -> ProjectLocationDatasetConsentStoreConsentArtifactGetCall<'a, C>
8885 where
8886 I: IntoIterator<Item = St>,
8887 St: AsRef<str>,
8888 {
8889 self._scopes
8890 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8891 self
8892 }
8893
8894 /// Removes all scopes, and no default scope will be used either.
8895 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8896 /// for details).
8897 pub fn clear_scopes(
8898 mut self,
8899 ) -> ProjectLocationDatasetConsentStoreConsentArtifactGetCall<'a, C> {
8900 self._scopes.clear();
8901 self
8902 }
8903}
8904
8905/// Lists the Consent artifacts in the specified consent store.
8906///
8907/// A builder for the *locations.datasets.consentStores.consentArtifacts.list* method supported by a *project* resource.
8908/// It is not used directly, but through a [`ProjectMethods`] instance.
8909///
8910/// # Example
8911///
8912/// Instantiate a resource method builder
8913///
8914/// ```test_harness,no_run
8915/// # extern crate hyper;
8916/// # extern crate hyper_rustls;
8917/// # extern crate google_healthcare1 as healthcare1;
8918/// # async fn dox() {
8919/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8920///
8921/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8922/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8923/// # secret,
8924/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8925/// # ).build().await.unwrap();
8926///
8927/// # let client = hyper_util::client::legacy::Client::builder(
8928/// # hyper_util::rt::TokioExecutor::new()
8929/// # )
8930/// # .build(
8931/// # hyper_rustls::HttpsConnectorBuilder::new()
8932/// # .with_native_roots()
8933/// # .unwrap()
8934/// # .https_or_http()
8935/// # .enable_http1()
8936/// # .build()
8937/// # );
8938/// # let mut hub = CloudHealthcare::new(client, auth);
8939/// // You can configure optional parameters by calling the respective setters at will, and
8940/// // execute the final call using `doit()`.
8941/// // Values shown here are possibly random and not representative !
8942/// let result = hub.projects().locations_datasets_consent_stores_consent_artifacts_list("parent")
8943/// .page_token("dolor")
8944/// .page_size(-56)
8945/// .filter("eos")
8946/// .doit().await;
8947/// # }
8948/// ```
8949pub struct ProjectLocationDatasetConsentStoreConsentArtifactListCall<'a, C>
8950where
8951 C: 'a,
8952{
8953 hub: &'a CloudHealthcare<C>,
8954 _parent: String,
8955 _page_token: Option<String>,
8956 _page_size: Option<i32>,
8957 _filter: Option<String>,
8958 _delegate: Option<&'a mut dyn common::Delegate>,
8959 _additional_params: HashMap<String, String>,
8960 _scopes: BTreeSet<String>,
8961}
8962
8963impl<'a, C> common::CallBuilder
8964 for ProjectLocationDatasetConsentStoreConsentArtifactListCall<'a, C>
8965{
8966}
8967
8968impl<'a, C> ProjectLocationDatasetConsentStoreConsentArtifactListCall<'a, C>
8969where
8970 C: common::Connector,
8971{
8972 /// Perform the operation you have build so far.
8973 pub async fn doit(
8974 mut self,
8975 ) -> common::Result<(common::Response, ListConsentArtifactsResponse)> {
8976 use std::borrow::Cow;
8977 use std::io::{Read, Seek};
8978
8979 use common::{url::Params, ToParts};
8980 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8981
8982 let mut dd = common::DefaultDelegate;
8983 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8984 dlg.begin(common::MethodInfo {
8985 id: "healthcare.projects.locations.datasets.consentStores.consentArtifacts.list",
8986 http_method: hyper::Method::GET,
8987 });
8988
8989 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
8990 if self._additional_params.contains_key(field) {
8991 dlg.finished(false);
8992 return Err(common::Error::FieldClash(field));
8993 }
8994 }
8995
8996 let mut params = Params::with_capacity(6 + self._additional_params.len());
8997 params.push("parent", self._parent);
8998 if let Some(value) = self._page_token.as_ref() {
8999 params.push("pageToken", value);
9000 }
9001 if let Some(value) = self._page_size.as_ref() {
9002 params.push("pageSize", value.to_string());
9003 }
9004 if let Some(value) = self._filter.as_ref() {
9005 params.push("filter", value);
9006 }
9007
9008 params.extend(self._additional_params.iter());
9009
9010 params.push("alt", "json");
9011 let mut url = self.hub._base_url.clone() + "v1/{+parent}/consentArtifacts";
9012 if self._scopes.is_empty() {
9013 self._scopes
9014 .insert(Scope::CloudHealthcare.as_ref().to_string());
9015 }
9016
9017 #[allow(clippy::single_element_loop)]
9018 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9019 url = params.uri_replacement(url, param_name, find_this, true);
9020 }
9021 {
9022 let to_remove = ["parent"];
9023 params.remove_params(&to_remove);
9024 }
9025
9026 let url = params.parse_with_url(&url);
9027
9028 loop {
9029 let token = match self
9030 .hub
9031 .auth
9032 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9033 .await
9034 {
9035 Ok(token) => token,
9036 Err(e) => match dlg.token(e) {
9037 Ok(token) => token,
9038 Err(e) => {
9039 dlg.finished(false);
9040 return Err(common::Error::MissingToken(e));
9041 }
9042 },
9043 };
9044 let mut req_result = {
9045 let client = &self.hub.client;
9046 dlg.pre_request();
9047 let mut req_builder = hyper::Request::builder()
9048 .method(hyper::Method::GET)
9049 .uri(url.as_str())
9050 .header(USER_AGENT, self.hub._user_agent.clone());
9051
9052 if let Some(token) = token.as_ref() {
9053 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9054 }
9055
9056 let request = req_builder
9057 .header(CONTENT_LENGTH, 0_u64)
9058 .body(common::to_body::<String>(None));
9059
9060 client.request(request.unwrap()).await
9061 };
9062
9063 match req_result {
9064 Err(err) => {
9065 if let common::Retry::After(d) = dlg.http_error(&err) {
9066 sleep(d).await;
9067 continue;
9068 }
9069 dlg.finished(false);
9070 return Err(common::Error::HttpError(err));
9071 }
9072 Ok(res) => {
9073 let (mut parts, body) = res.into_parts();
9074 let mut body = common::Body::new(body);
9075 if !parts.status.is_success() {
9076 let bytes = common::to_bytes(body).await.unwrap_or_default();
9077 let error = serde_json::from_str(&common::to_string(&bytes));
9078 let response = common::to_response(parts, bytes.into());
9079
9080 if let common::Retry::After(d) =
9081 dlg.http_failure(&response, error.as_ref().ok())
9082 {
9083 sleep(d).await;
9084 continue;
9085 }
9086
9087 dlg.finished(false);
9088
9089 return Err(match error {
9090 Ok(value) => common::Error::BadRequest(value),
9091 _ => common::Error::Failure(response),
9092 });
9093 }
9094 let response = {
9095 let bytes = common::to_bytes(body).await.unwrap_or_default();
9096 let encoded = common::to_string(&bytes);
9097 match serde_json::from_str(&encoded) {
9098 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9099 Err(error) => {
9100 dlg.response_json_decode_error(&encoded, &error);
9101 return Err(common::Error::JsonDecodeError(
9102 encoded.to_string(),
9103 error,
9104 ));
9105 }
9106 }
9107 };
9108
9109 dlg.finished(true);
9110 return Ok(response);
9111 }
9112 }
9113 }
9114 }
9115
9116 /// Required. Name of the consent store to retrieve consent artifacts from.
9117 ///
9118 /// Sets the *parent* path property to the given value.
9119 ///
9120 /// Even though the property as already been set when instantiating this call,
9121 /// we provide this method for API completeness.
9122 pub fn parent(
9123 mut self,
9124 new_value: &str,
9125 ) -> ProjectLocationDatasetConsentStoreConsentArtifactListCall<'a, C> {
9126 self._parent = new_value.to_string();
9127 self
9128 }
9129 /// Optional. The next_page_token value returned from the previous List request, if any.
9130 ///
9131 /// Sets the *page token* query property to the given value.
9132 pub fn page_token(
9133 mut self,
9134 new_value: &str,
9135 ) -> ProjectLocationDatasetConsentStoreConsentArtifactListCall<'a, C> {
9136 self._page_token = Some(new_value.to_string());
9137 self
9138 }
9139 /// Optional. Limit on the number of consent artifacts to return in a single response. If not specified, 100 is used. May not be larger than 1000.
9140 ///
9141 /// Sets the *page size* query property to the given value.
9142 pub fn page_size(
9143 mut self,
9144 new_value: i32,
9145 ) -> ProjectLocationDatasetConsentStoreConsentArtifactListCall<'a, C> {
9146 self._page_size = Some(new_value);
9147 self
9148 }
9149 /// Optional. Restricts the artifacts returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. The fields available for filtering are: - user_id. For example, `filter=user_id=\"user123\"`. - consent_content_version - metadata. For example, `filter=Metadata(\"testkey\")=\"value\"` or `filter=HasMetadata(\"testkey\")`.
9150 ///
9151 /// Sets the *filter* query property to the given value.
9152 pub fn filter(
9153 mut self,
9154 new_value: &str,
9155 ) -> ProjectLocationDatasetConsentStoreConsentArtifactListCall<'a, C> {
9156 self._filter = Some(new_value.to_string());
9157 self
9158 }
9159 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9160 /// while executing the actual API request.
9161 ///
9162 /// ````text
9163 /// It should be used to handle progress information, and to implement a certain level of resilience.
9164 /// ````
9165 ///
9166 /// Sets the *delegate* property to the given value.
9167 pub fn delegate(
9168 mut self,
9169 new_value: &'a mut dyn common::Delegate,
9170 ) -> ProjectLocationDatasetConsentStoreConsentArtifactListCall<'a, C> {
9171 self._delegate = Some(new_value);
9172 self
9173 }
9174
9175 /// Set any additional parameter of the query string used in the request.
9176 /// It should be used to set parameters which are not yet available through their own
9177 /// setters.
9178 ///
9179 /// Please note that this method must not be used to set any of the known parameters
9180 /// which have their own setter method. If done anyway, the request will fail.
9181 ///
9182 /// # Additional Parameters
9183 ///
9184 /// * *$.xgafv* (query-string) - V1 error format.
9185 /// * *access_token* (query-string) - OAuth access token.
9186 /// * *alt* (query-string) - Data format for response.
9187 /// * *callback* (query-string) - JSONP
9188 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9189 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9190 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9191 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9192 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9193 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9194 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9195 pub fn param<T>(
9196 mut self,
9197 name: T,
9198 value: T,
9199 ) -> ProjectLocationDatasetConsentStoreConsentArtifactListCall<'a, C>
9200 where
9201 T: AsRef<str>,
9202 {
9203 self._additional_params
9204 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9205 self
9206 }
9207
9208 /// Identifies the authorization scope for the method you are building.
9209 ///
9210 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9211 /// [`Scope::CloudHealthcare`].
9212 ///
9213 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9214 /// tokens for more than one scope.
9215 ///
9216 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9217 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9218 /// sufficient, a read-write scope will do as well.
9219 pub fn add_scope<St>(
9220 mut self,
9221 scope: St,
9222 ) -> ProjectLocationDatasetConsentStoreConsentArtifactListCall<'a, C>
9223 where
9224 St: AsRef<str>,
9225 {
9226 self._scopes.insert(String::from(scope.as_ref()));
9227 self
9228 }
9229 /// Identifies the authorization scope(s) for the method you are building.
9230 ///
9231 /// See [`Self::add_scope()`] for details.
9232 pub fn add_scopes<I, St>(
9233 mut self,
9234 scopes: I,
9235 ) -> ProjectLocationDatasetConsentStoreConsentArtifactListCall<'a, C>
9236 where
9237 I: IntoIterator<Item = St>,
9238 St: AsRef<str>,
9239 {
9240 self._scopes
9241 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9242 self
9243 }
9244
9245 /// Removes all scopes, and no default scope will be used either.
9246 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9247 /// for details).
9248 pub fn clear_scopes(
9249 mut self,
9250 ) -> ProjectLocationDatasetConsentStoreConsentArtifactListCall<'a, C> {
9251 self._scopes.clear();
9252 self
9253 }
9254}
9255
9256/// Activates the latest revision of the specified Consent by committing a new revision with `state` updated to `ACTIVE`. If the latest revision of the specified Consent is in the `ACTIVE` state, no new revision is committed. A FAILED_PRECONDITION error occurs if the latest revision of the specified Consent is in the `REJECTED` or `REVOKED` state.
9257///
9258/// A builder for the *locations.datasets.consentStores.consents.activate* method supported by a *project* resource.
9259/// It is not used directly, but through a [`ProjectMethods`] instance.
9260///
9261/// # Example
9262///
9263/// Instantiate a resource method builder
9264///
9265/// ```test_harness,no_run
9266/// # extern crate hyper;
9267/// # extern crate hyper_rustls;
9268/// # extern crate google_healthcare1 as healthcare1;
9269/// use healthcare1::api::ActivateConsentRequest;
9270/// # async fn dox() {
9271/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9272///
9273/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9274/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9275/// # secret,
9276/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9277/// # ).build().await.unwrap();
9278///
9279/// # let client = hyper_util::client::legacy::Client::builder(
9280/// # hyper_util::rt::TokioExecutor::new()
9281/// # )
9282/// # .build(
9283/// # hyper_rustls::HttpsConnectorBuilder::new()
9284/// # .with_native_roots()
9285/// # .unwrap()
9286/// # .https_or_http()
9287/// # .enable_http1()
9288/// # .build()
9289/// # );
9290/// # let mut hub = CloudHealthcare::new(client, auth);
9291/// // As the method needs a request, you would usually fill it with the desired information
9292/// // into the respective structure. Some of the parts shown here might not be applicable !
9293/// // Values shown here are possibly random and not representative !
9294/// let mut req = ActivateConsentRequest::default();
9295///
9296/// // You can configure optional parameters by calling the respective setters at will, and
9297/// // execute the final call using `doit()`.
9298/// // Values shown here are possibly random and not representative !
9299/// let result = hub.projects().locations_datasets_consent_stores_consents_activate(req, "name")
9300/// .doit().await;
9301/// # }
9302/// ```
9303pub struct ProjectLocationDatasetConsentStoreConsentActivateCall<'a, C>
9304where
9305 C: 'a,
9306{
9307 hub: &'a CloudHealthcare<C>,
9308 _request: ActivateConsentRequest,
9309 _name: String,
9310 _delegate: Option<&'a mut dyn common::Delegate>,
9311 _additional_params: HashMap<String, String>,
9312 _scopes: BTreeSet<String>,
9313}
9314
9315impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreConsentActivateCall<'a, C> {}
9316
9317impl<'a, C> ProjectLocationDatasetConsentStoreConsentActivateCall<'a, C>
9318where
9319 C: common::Connector,
9320{
9321 /// Perform the operation you have build so far.
9322 pub async fn doit(mut self) -> common::Result<(common::Response, Consent)> {
9323 use std::borrow::Cow;
9324 use std::io::{Read, Seek};
9325
9326 use common::{url::Params, ToParts};
9327 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9328
9329 let mut dd = common::DefaultDelegate;
9330 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9331 dlg.begin(common::MethodInfo {
9332 id: "healthcare.projects.locations.datasets.consentStores.consents.activate",
9333 http_method: hyper::Method::POST,
9334 });
9335
9336 for &field in ["alt", "name"].iter() {
9337 if self._additional_params.contains_key(field) {
9338 dlg.finished(false);
9339 return Err(common::Error::FieldClash(field));
9340 }
9341 }
9342
9343 let mut params = Params::with_capacity(4 + self._additional_params.len());
9344 params.push("name", self._name);
9345
9346 params.extend(self._additional_params.iter());
9347
9348 params.push("alt", "json");
9349 let mut url = self.hub._base_url.clone() + "v1/{+name}:activate";
9350 if self._scopes.is_empty() {
9351 self._scopes
9352 .insert(Scope::CloudHealthcare.as_ref().to_string());
9353 }
9354
9355 #[allow(clippy::single_element_loop)]
9356 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9357 url = params.uri_replacement(url, param_name, find_this, true);
9358 }
9359 {
9360 let to_remove = ["name"];
9361 params.remove_params(&to_remove);
9362 }
9363
9364 let url = params.parse_with_url(&url);
9365
9366 let mut json_mime_type = mime::APPLICATION_JSON;
9367 let mut request_value_reader = {
9368 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9369 common::remove_json_null_values(&mut value);
9370 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9371 serde_json::to_writer(&mut dst, &value).unwrap();
9372 dst
9373 };
9374 let request_size = request_value_reader
9375 .seek(std::io::SeekFrom::End(0))
9376 .unwrap();
9377 request_value_reader
9378 .seek(std::io::SeekFrom::Start(0))
9379 .unwrap();
9380
9381 loop {
9382 let token = match self
9383 .hub
9384 .auth
9385 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9386 .await
9387 {
9388 Ok(token) => token,
9389 Err(e) => match dlg.token(e) {
9390 Ok(token) => token,
9391 Err(e) => {
9392 dlg.finished(false);
9393 return Err(common::Error::MissingToken(e));
9394 }
9395 },
9396 };
9397 request_value_reader
9398 .seek(std::io::SeekFrom::Start(0))
9399 .unwrap();
9400 let mut req_result = {
9401 let client = &self.hub.client;
9402 dlg.pre_request();
9403 let mut req_builder = hyper::Request::builder()
9404 .method(hyper::Method::POST)
9405 .uri(url.as_str())
9406 .header(USER_AGENT, self.hub._user_agent.clone());
9407
9408 if let Some(token) = token.as_ref() {
9409 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9410 }
9411
9412 let request = req_builder
9413 .header(CONTENT_TYPE, json_mime_type.to_string())
9414 .header(CONTENT_LENGTH, request_size as u64)
9415 .body(common::to_body(
9416 request_value_reader.get_ref().clone().into(),
9417 ));
9418
9419 client.request(request.unwrap()).await
9420 };
9421
9422 match req_result {
9423 Err(err) => {
9424 if let common::Retry::After(d) = dlg.http_error(&err) {
9425 sleep(d).await;
9426 continue;
9427 }
9428 dlg.finished(false);
9429 return Err(common::Error::HttpError(err));
9430 }
9431 Ok(res) => {
9432 let (mut parts, body) = res.into_parts();
9433 let mut body = common::Body::new(body);
9434 if !parts.status.is_success() {
9435 let bytes = common::to_bytes(body).await.unwrap_or_default();
9436 let error = serde_json::from_str(&common::to_string(&bytes));
9437 let response = common::to_response(parts, bytes.into());
9438
9439 if let common::Retry::After(d) =
9440 dlg.http_failure(&response, error.as_ref().ok())
9441 {
9442 sleep(d).await;
9443 continue;
9444 }
9445
9446 dlg.finished(false);
9447
9448 return Err(match error {
9449 Ok(value) => common::Error::BadRequest(value),
9450 _ => common::Error::Failure(response),
9451 });
9452 }
9453 let response = {
9454 let bytes = common::to_bytes(body).await.unwrap_or_default();
9455 let encoded = common::to_string(&bytes);
9456 match serde_json::from_str(&encoded) {
9457 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9458 Err(error) => {
9459 dlg.response_json_decode_error(&encoded, &error);
9460 return Err(common::Error::JsonDecodeError(
9461 encoded.to_string(),
9462 error,
9463 ));
9464 }
9465 }
9466 };
9467
9468 dlg.finished(true);
9469 return Ok(response);
9470 }
9471 }
9472 }
9473 }
9474
9475 ///
9476 /// Sets the *request* property to the given value.
9477 ///
9478 /// Even though the property as already been set when instantiating this call,
9479 /// we provide this method for API completeness.
9480 pub fn request(
9481 mut self,
9482 new_value: ActivateConsentRequest,
9483 ) -> ProjectLocationDatasetConsentStoreConsentActivateCall<'a, C> {
9484 self._request = new_value;
9485 self
9486 }
9487 /// Required. The resource name of the Consent to activate, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. An INVALID_ARGUMENT error occurs if `revision_id` is specified in the name.
9488 ///
9489 /// Sets the *name* path property to the given value.
9490 ///
9491 /// Even though the property as already been set when instantiating this call,
9492 /// we provide this method for API completeness.
9493 pub fn name(
9494 mut self,
9495 new_value: &str,
9496 ) -> ProjectLocationDatasetConsentStoreConsentActivateCall<'a, C> {
9497 self._name = new_value.to_string();
9498 self
9499 }
9500 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9501 /// while executing the actual API request.
9502 ///
9503 /// ````text
9504 /// It should be used to handle progress information, and to implement a certain level of resilience.
9505 /// ````
9506 ///
9507 /// Sets the *delegate* property to the given value.
9508 pub fn delegate(
9509 mut self,
9510 new_value: &'a mut dyn common::Delegate,
9511 ) -> ProjectLocationDatasetConsentStoreConsentActivateCall<'a, C> {
9512 self._delegate = Some(new_value);
9513 self
9514 }
9515
9516 /// Set any additional parameter of the query string used in the request.
9517 /// It should be used to set parameters which are not yet available through their own
9518 /// setters.
9519 ///
9520 /// Please note that this method must not be used to set any of the known parameters
9521 /// which have their own setter method. If done anyway, the request will fail.
9522 ///
9523 /// # Additional Parameters
9524 ///
9525 /// * *$.xgafv* (query-string) - V1 error format.
9526 /// * *access_token* (query-string) - OAuth access token.
9527 /// * *alt* (query-string) - Data format for response.
9528 /// * *callback* (query-string) - JSONP
9529 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9530 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9531 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9532 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9533 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9534 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9535 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9536 pub fn param<T>(
9537 mut self,
9538 name: T,
9539 value: T,
9540 ) -> ProjectLocationDatasetConsentStoreConsentActivateCall<'a, C>
9541 where
9542 T: AsRef<str>,
9543 {
9544 self._additional_params
9545 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9546 self
9547 }
9548
9549 /// Identifies the authorization scope for the method you are building.
9550 ///
9551 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9552 /// [`Scope::CloudHealthcare`].
9553 ///
9554 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9555 /// tokens for more than one scope.
9556 ///
9557 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9558 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9559 /// sufficient, a read-write scope will do as well.
9560 pub fn add_scope<St>(
9561 mut self,
9562 scope: St,
9563 ) -> ProjectLocationDatasetConsentStoreConsentActivateCall<'a, C>
9564 where
9565 St: AsRef<str>,
9566 {
9567 self._scopes.insert(String::from(scope.as_ref()));
9568 self
9569 }
9570 /// Identifies the authorization scope(s) for the method you are building.
9571 ///
9572 /// See [`Self::add_scope()`] for details.
9573 pub fn add_scopes<I, St>(
9574 mut self,
9575 scopes: I,
9576 ) -> ProjectLocationDatasetConsentStoreConsentActivateCall<'a, C>
9577 where
9578 I: IntoIterator<Item = St>,
9579 St: AsRef<str>,
9580 {
9581 self._scopes
9582 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9583 self
9584 }
9585
9586 /// Removes all scopes, and no default scope will be used either.
9587 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9588 /// for details).
9589 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStoreConsentActivateCall<'a, C> {
9590 self._scopes.clear();
9591 self
9592 }
9593}
9594
9595/// Creates a new Consent in the parent consent store.
9596///
9597/// A builder for the *locations.datasets.consentStores.consents.create* method supported by a *project* resource.
9598/// It is not used directly, but through a [`ProjectMethods`] instance.
9599///
9600/// # Example
9601///
9602/// Instantiate a resource method builder
9603///
9604/// ```test_harness,no_run
9605/// # extern crate hyper;
9606/// # extern crate hyper_rustls;
9607/// # extern crate google_healthcare1 as healthcare1;
9608/// use healthcare1::api::Consent;
9609/// # async fn dox() {
9610/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9611///
9612/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9613/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9614/// # secret,
9615/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9616/// # ).build().await.unwrap();
9617///
9618/// # let client = hyper_util::client::legacy::Client::builder(
9619/// # hyper_util::rt::TokioExecutor::new()
9620/// # )
9621/// # .build(
9622/// # hyper_rustls::HttpsConnectorBuilder::new()
9623/// # .with_native_roots()
9624/// # .unwrap()
9625/// # .https_or_http()
9626/// # .enable_http1()
9627/// # .build()
9628/// # );
9629/// # let mut hub = CloudHealthcare::new(client, auth);
9630/// // As the method needs a request, you would usually fill it with the desired information
9631/// // into the respective structure. Some of the parts shown here might not be applicable !
9632/// // Values shown here are possibly random and not representative !
9633/// let mut req = Consent::default();
9634///
9635/// // You can configure optional parameters by calling the respective setters at will, and
9636/// // execute the final call using `doit()`.
9637/// // Values shown here are possibly random and not representative !
9638/// let result = hub.projects().locations_datasets_consent_stores_consents_create(req, "parent")
9639/// .doit().await;
9640/// # }
9641/// ```
9642pub struct ProjectLocationDatasetConsentStoreConsentCreateCall<'a, C>
9643where
9644 C: 'a,
9645{
9646 hub: &'a CloudHealthcare<C>,
9647 _request: Consent,
9648 _parent: String,
9649 _delegate: Option<&'a mut dyn common::Delegate>,
9650 _additional_params: HashMap<String, String>,
9651 _scopes: BTreeSet<String>,
9652}
9653
9654impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreConsentCreateCall<'a, C> {}
9655
9656impl<'a, C> ProjectLocationDatasetConsentStoreConsentCreateCall<'a, C>
9657where
9658 C: common::Connector,
9659{
9660 /// Perform the operation you have build so far.
9661 pub async fn doit(mut self) -> common::Result<(common::Response, Consent)> {
9662 use std::borrow::Cow;
9663 use std::io::{Read, Seek};
9664
9665 use common::{url::Params, ToParts};
9666 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9667
9668 let mut dd = common::DefaultDelegate;
9669 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9670 dlg.begin(common::MethodInfo {
9671 id: "healthcare.projects.locations.datasets.consentStores.consents.create",
9672 http_method: hyper::Method::POST,
9673 });
9674
9675 for &field in ["alt", "parent"].iter() {
9676 if self._additional_params.contains_key(field) {
9677 dlg.finished(false);
9678 return Err(common::Error::FieldClash(field));
9679 }
9680 }
9681
9682 let mut params = Params::with_capacity(4 + self._additional_params.len());
9683 params.push("parent", self._parent);
9684
9685 params.extend(self._additional_params.iter());
9686
9687 params.push("alt", "json");
9688 let mut url = self.hub._base_url.clone() + "v1/{+parent}/consents";
9689 if self._scopes.is_empty() {
9690 self._scopes
9691 .insert(Scope::CloudHealthcare.as_ref().to_string());
9692 }
9693
9694 #[allow(clippy::single_element_loop)]
9695 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9696 url = params.uri_replacement(url, param_name, find_this, true);
9697 }
9698 {
9699 let to_remove = ["parent"];
9700 params.remove_params(&to_remove);
9701 }
9702
9703 let url = params.parse_with_url(&url);
9704
9705 let mut json_mime_type = mime::APPLICATION_JSON;
9706 let mut request_value_reader = {
9707 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9708 common::remove_json_null_values(&mut value);
9709 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9710 serde_json::to_writer(&mut dst, &value).unwrap();
9711 dst
9712 };
9713 let request_size = request_value_reader
9714 .seek(std::io::SeekFrom::End(0))
9715 .unwrap();
9716 request_value_reader
9717 .seek(std::io::SeekFrom::Start(0))
9718 .unwrap();
9719
9720 loop {
9721 let token = match self
9722 .hub
9723 .auth
9724 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9725 .await
9726 {
9727 Ok(token) => token,
9728 Err(e) => match dlg.token(e) {
9729 Ok(token) => token,
9730 Err(e) => {
9731 dlg.finished(false);
9732 return Err(common::Error::MissingToken(e));
9733 }
9734 },
9735 };
9736 request_value_reader
9737 .seek(std::io::SeekFrom::Start(0))
9738 .unwrap();
9739 let mut req_result = {
9740 let client = &self.hub.client;
9741 dlg.pre_request();
9742 let mut req_builder = hyper::Request::builder()
9743 .method(hyper::Method::POST)
9744 .uri(url.as_str())
9745 .header(USER_AGENT, self.hub._user_agent.clone());
9746
9747 if let Some(token) = token.as_ref() {
9748 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9749 }
9750
9751 let request = req_builder
9752 .header(CONTENT_TYPE, json_mime_type.to_string())
9753 .header(CONTENT_LENGTH, request_size as u64)
9754 .body(common::to_body(
9755 request_value_reader.get_ref().clone().into(),
9756 ));
9757
9758 client.request(request.unwrap()).await
9759 };
9760
9761 match req_result {
9762 Err(err) => {
9763 if let common::Retry::After(d) = dlg.http_error(&err) {
9764 sleep(d).await;
9765 continue;
9766 }
9767 dlg.finished(false);
9768 return Err(common::Error::HttpError(err));
9769 }
9770 Ok(res) => {
9771 let (mut parts, body) = res.into_parts();
9772 let mut body = common::Body::new(body);
9773 if !parts.status.is_success() {
9774 let bytes = common::to_bytes(body).await.unwrap_or_default();
9775 let error = serde_json::from_str(&common::to_string(&bytes));
9776 let response = common::to_response(parts, bytes.into());
9777
9778 if let common::Retry::After(d) =
9779 dlg.http_failure(&response, error.as_ref().ok())
9780 {
9781 sleep(d).await;
9782 continue;
9783 }
9784
9785 dlg.finished(false);
9786
9787 return Err(match error {
9788 Ok(value) => common::Error::BadRequest(value),
9789 _ => common::Error::Failure(response),
9790 });
9791 }
9792 let response = {
9793 let bytes = common::to_bytes(body).await.unwrap_or_default();
9794 let encoded = common::to_string(&bytes);
9795 match serde_json::from_str(&encoded) {
9796 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9797 Err(error) => {
9798 dlg.response_json_decode_error(&encoded, &error);
9799 return Err(common::Error::JsonDecodeError(
9800 encoded.to_string(),
9801 error,
9802 ));
9803 }
9804 }
9805 };
9806
9807 dlg.finished(true);
9808 return Ok(response);
9809 }
9810 }
9811 }
9812 }
9813
9814 ///
9815 /// Sets the *request* property to the given value.
9816 ///
9817 /// Even though the property as already been set when instantiating this call,
9818 /// we provide this method for API completeness.
9819 pub fn request(
9820 mut self,
9821 new_value: Consent,
9822 ) -> ProjectLocationDatasetConsentStoreConsentCreateCall<'a, C> {
9823 self._request = new_value;
9824 self
9825 }
9826 /// Required. Name of the consent store.
9827 ///
9828 /// Sets the *parent* path property to the given value.
9829 ///
9830 /// Even though the property as already been set when instantiating this call,
9831 /// we provide this method for API completeness.
9832 pub fn parent(
9833 mut self,
9834 new_value: &str,
9835 ) -> ProjectLocationDatasetConsentStoreConsentCreateCall<'a, C> {
9836 self._parent = new_value.to_string();
9837 self
9838 }
9839 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9840 /// while executing the actual API request.
9841 ///
9842 /// ````text
9843 /// It should be used to handle progress information, and to implement a certain level of resilience.
9844 /// ````
9845 ///
9846 /// Sets the *delegate* property to the given value.
9847 pub fn delegate(
9848 mut self,
9849 new_value: &'a mut dyn common::Delegate,
9850 ) -> ProjectLocationDatasetConsentStoreConsentCreateCall<'a, C> {
9851 self._delegate = Some(new_value);
9852 self
9853 }
9854
9855 /// Set any additional parameter of the query string used in the request.
9856 /// It should be used to set parameters which are not yet available through their own
9857 /// setters.
9858 ///
9859 /// Please note that this method must not be used to set any of the known parameters
9860 /// which have their own setter method. If done anyway, the request will fail.
9861 ///
9862 /// # Additional Parameters
9863 ///
9864 /// * *$.xgafv* (query-string) - V1 error format.
9865 /// * *access_token* (query-string) - OAuth access token.
9866 /// * *alt* (query-string) - Data format for response.
9867 /// * *callback* (query-string) - JSONP
9868 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9869 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9870 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9871 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9872 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9873 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9874 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9875 pub fn param<T>(
9876 mut self,
9877 name: T,
9878 value: T,
9879 ) -> ProjectLocationDatasetConsentStoreConsentCreateCall<'a, C>
9880 where
9881 T: AsRef<str>,
9882 {
9883 self._additional_params
9884 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9885 self
9886 }
9887
9888 /// Identifies the authorization scope for the method you are building.
9889 ///
9890 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9891 /// [`Scope::CloudHealthcare`].
9892 ///
9893 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9894 /// tokens for more than one scope.
9895 ///
9896 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9897 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9898 /// sufficient, a read-write scope will do as well.
9899 pub fn add_scope<St>(
9900 mut self,
9901 scope: St,
9902 ) -> ProjectLocationDatasetConsentStoreConsentCreateCall<'a, C>
9903 where
9904 St: AsRef<str>,
9905 {
9906 self._scopes.insert(String::from(scope.as_ref()));
9907 self
9908 }
9909 /// Identifies the authorization scope(s) for the method you are building.
9910 ///
9911 /// See [`Self::add_scope()`] for details.
9912 pub fn add_scopes<I, St>(
9913 mut self,
9914 scopes: I,
9915 ) -> ProjectLocationDatasetConsentStoreConsentCreateCall<'a, C>
9916 where
9917 I: IntoIterator<Item = St>,
9918 St: AsRef<str>,
9919 {
9920 self._scopes
9921 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9922 self
9923 }
9924
9925 /// Removes all scopes, and no default scope will be used either.
9926 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9927 /// for details).
9928 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStoreConsentCreateCall<'a, C> {
9929 self._scopes.clear();
9930 self
9931 }
9932}
9933
9934/// Deletes the Consent and its revisions. To keep a record of the Consent but mark it inactive, see [RevokeConsent]. To delete a revision of a Consent, see [DeleteConsentRevision]. This operation does not delete the related Consent artifact.
9935///
9936/// A builder for the *locations.datasets.consentStores.consents.delete* method supported by a *project* resource.
9937/// It is not used directly, but through a [`ProjectMethods`] instance.
9938///
9939/// # Example
9940///
9941/// Instantiate a resource method builder
9942///
9943/// ```test_harness,no_run
9944/// # extern crate hyper;
9945/// # extern crate hyper_rustls;
9946/// # extern crate google_healthcare1 as healthcare1;
9947/// # async fn dox() {
9948/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9949///
9950/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9951/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9952/// # secret,
9953/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9954/// # ).build().await.unwrap();
9955///
9956/// # let client = hyper_util::client::legacy::Client::builder(
9957/// # hyper_util::rt::TokioExecutor::new()
9958/// # )
9959/// # .build(
9960/// # hyper_rustls::HttpsConnectorBuilder::new()
9961/// # .with_native_roots()
9962/// # .unwrap()
9963/// # .https_or_http()
9964/// # .enable_http1()
9965/// # .build()
9966/// # );
9967/// # let mut hub = CloudHealthcare::new(client, auth);
9968/// // You can configure optional parameters by calling the respective setters at will, and
9969/// // execute the final call using `doit()`.
9970/// // Values shown here are possibly random and not representative !
9971/// let result = hub.projects().locations_datasets_consent_stores_consents_delete("name")
9972/// .doit().await;
9973/// # }
9974/// ```
9975pub struct ProjectLocationDatasetConsentStoreConsentDeleteCall<'a, C>
9976where
9977 C: 'a,
9978{
9979 hub: &'a CloudHealthcare<C>,
9980 _name: String,
9981 _delegate: Option<&'a mut dyn common::Delegate>,
9982 _additional_params: HashMap<String, String>,
9983 _scopes: BTreeSet<String>,
9984}
9985
9986impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreConsentDeleteCall<'a, C> {}
9987
9988impl<'a, C> ProjectLocationDatasetConsentStoreConsentDeleteCall<'a, C>
9989where
9990 C: common::Connector,
9991{
9992 /// Perform the operation you have build so far.
9993 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
9994 use std::borrow::Cow;
9995 use std::io::{Read, Seek};
9996
9997 use common::{url::Params, ToParts};
9998 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9999
10000 let mut dd = common::DefaultDelegate;
10001 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10002 dlg.begin(common::MethodInfo {
10003 id: "healthcare.projects.locations.datasets.consentStores.consents.delete",
10004 http_method: hyper::Method::DELETE,
10005 });
10006
10007 for &field in ["alt", "name"].iter() {
10008 if self._additional_params.contains_key(field) {
10009 dlg.finished(false);
10010 return Err(common::Error::FieldClash(field));
10011 }
10012 }
10013
10014 let mut params = Params::with_capacity(3 + self._additional_params.len());
10015 params.push("name", self._name);
10016
10017 params.extend(self._additional_params.iter());
10018
10019 params.push("alt", "json");
10020 let mut url = self.hub._base_url.clone() + "v1/{+name}";
10021 if self._scopes.is_empty() {
10022 self._scopes
10023 .insert(Scope::CloudHealthcare.as_ref().to_string());
10024 }
10025
10026 #[allow(clippy::single_element_loop)]
10027 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10028 url = params.uri_replacement(url, param_name, find_this, true);
10029 }
10030 {
10031 let to_remove = ["name"];
10032 params.remove_params(&to_remove);
10033 }
10034
10035 let url = params.parse_with_url(&url);
10036
10037 loop {
10038 let token = match self
10039 .hub
10040 .auth
10041 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10042 .await
10043 {
10044 Ok(token) => token,
10045 Err(e) => match dlg.token(e) {
10046 Ok(token) => token,
10047 Err(e) => {
10048 dlg.finished(false);
10049 return Err(common::Error::MissingToken(e));
10050 }
10051 },
10052 };
10053 let mut req_result = {
10054 let client = &self.hub.client;
10055 dlg.pre_request();
10056 let mut req_builder = hyper::Request::builder()
10057 .method(hyper::Method::DELETE)
10058 .uri(url.as_str())
10059 .header(USER_AGENT, self.hub._user_agent.clone());
10060
10061 if let Some(token) = token.as_ref() {
10062 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10063 }
10064
10065 let request = req_builder
10066 .header(CONTENT_LENGTH, 0_u64)
10067 .body(common::to_body::<String>(None));
10068
10069 client.request(request.unwrap()).await
10070 };
10071
10072 match req_result {
10073 Err(err) => {
10074 if let common::Retry::After(d) = dlg.http_error(&err) {
10075 sleep(d).await;
10076 continue;
10077 }
10078 dlg.finished(false);
10079 return Err(common::Error::HttpError(err));
10080 }
10081 Ok(res) => {
10082 let (mut parts, body) = res.into_parts();
10083 let mut body = common::Body::new(body);
10084 if !parts.status.is_success() {
10085 let bytes = common::to_bytes(body).await.unwrap_or_default();
10086 let error = serde_json::from_str(&common::to_string(&bytes));
10087 let response = common::to_response(parts, bytes.into());
10088
10089 if let common::Retry::After(d) =
10090 dlg.http_failure(&response, error.as_ref().ok())
10091 {
10092 sleep(d).await;
10093 continue;
10094 }
10095
10096 dlg.finished(false);
10097
10098 return Err(match error {
10099 Ok(value) => common::Error::BadRequest(value),
10100 _ => common::Error::Failure(response),
10101 });
10102 }
10103 let response = {
10104 let bytes = common::to_bytes(body).await.unwrap_or_default();
10105 let encoded = common::to_string(&bytes);
10106 match serde_json::from_str(&encoded) {
10107 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10108 Err(error) => {
10109 dlg.response_json_decode_error(&encoded, &error);
10110 return Err(common::Error::JsonDecodeError(
10111 encoded.to_string(),
10112 error,
10113 ));
10114 }
10115 }
10116 };
10117
10118 dlg.finished(true);
10119 return Ok(response);
10120 }
10121 }
10122 }
10123 }
10124
10125 /// Required. The resource name of the Consent to delete, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. An INVALID_ARGUMENT error occurs if `revision_id` is specified in the name.
10126 ///
10127 /// Sets the *name* path property to the given value.
10128 ///
10129 /// Even though the property as already been set when instantiating this call,
10130 /// we provide this method for API completeness.
10131 pub fn name(
10132 mut self,
10133 new_value: &str,
10134 ) -> ProjectLocationDatasetConsentStoreConsentDeleteCall<'a, C> {
10135 self._name = new_value.to_string();
10136 self
10137 }
10138 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10139 /// while executing the actual API request.
10140 ///
10141 /// ````text
10142 /// It should be used to handle progress information, and to implement a certain level of resilience.
10143 /// ````
10144 ///
10145 /// Sets the *delegate* property to the given value.
10146 pub fn delegate(
10147 mut self,
10148 new_value: &'a mut dyn common::Delegate,
10149 ) -> ProjectLocationDatasetConsentStoreConsentDeleteCall<'a, C> {
10150 self._delegate = Some(new_value);
10151 self
10152 }
10153
10154 /// Set any additional parameter of the query string used in the request.
10155 /// It should be used to set parameters which are not yet available through their own
10156 /// setters.
10157 ///
10158 /// Please note that this method must not be used to set any of the known parameters
10159 /// which have their own setter method. If done anyway, the request will fail.
10160 ///
10161 /// # Additional Parameters
10162 ///
10163 /// * *$.xgafv* (query-string) - V1 error format.
10164 /// * *access_token* (query-string) - OAuth access token.
10165 /// * *alt* (query-string) - Data format for response.
10166 /// * *callback* (query-string) - JSONP
10167 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10168 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10169 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10170 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10171 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10172 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10173 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10174 pub fn param<T>(
10175 mut self,
10176 name: T,
10177 value: T,
10178 ) -> ProjectLocationDatasetConsentStoreConsentDeleteCall<'a, C>
10179 where
10180 T: AsRef<str>,
10181 {
10182 self._additional_params
10183 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10184 self
10185 }
10186
10187 /// Identifies the authorization scope for the method you are building.
10188 ///
10189 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10190 /// [`Scope::CloudHealthcare`].
10191 ///
10192 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10193 /// tokens for more than one scope.
10194 ///
10195 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10196 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10197 /// sufficient, a read-write scope will do as well.
10198 pub fn add_scope<St>(
10199 mut self,
10200 scope: St,
10201 ) -> ProjectLocationDatasetConsentStoreConsentDeleteCall<'a, C>
10202 where
10203 St: AsRef<str>,
10204 {
10205 self._scopes.insert(String::from(scope.as_ref()));
10206 self
10207 }
10208 /// Identifies the authorization scope(s) for the method you are building.
10209 ///
10210 /// See [`Self::add_scope()`] for details.
10211 pub fn add_scopes<I, St>(
10212 mut self,
10213 scopes: I,
10214 ) -> ProjectLocationDatasetConsentStoreConsentDeleteCall<'a, C>
10215 where
10216 I: IntoIterator<Item = St>,
10217 St: AsRef<str>,
10218 {
10219 self._scopes
10220 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10221 self
10222 }
10223
10224 /// Removes all scopes, and no default scope will be used either.
10225 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10226 /// for details).
10227 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStoreConsentDeleteCall<'a, C> {
10228 self._scopes.clear();
10229 self
10230 }
10231}
10232
10233/// Deletes the specified revision of a Consent. An INVALID_ARGUMENT error occurs if the specified revision is the latest revision.
10234///
10235/// A builder for the *locations.datasets.consentStores.consents.deleteRevision* method supported by a *project* resource.
10236/// It is not used directly, but through a [`ProjectMethods`] instance.
10237///
10238/// # Example
10239///
10240/// Instantiate a resource method builder
10241///
10242/// ```test_harness,no_run
10243/// # extern crate hyper;
10244/// # extern crate hyper_rustls;
10245/// # extern crate google_healthcare1 as healthcare1;
10246/// # async fn dox() {
10247/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10248///
10249/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10250/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10251/// # secret,
10252/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10253/// # ).build().await.unwrap();
10254///
10255/// # let client = hyper_util::client::legacy::Client::builder(
10256/// # hyper_util::rt::TokioExecutor::new()
10257/// # )
10258/// # .build(
10259/// # hyper_rustls::HttpsConnectorBuilder::new()
10260/// # .with_native_roots()
10261/// # .unwrap()
10262/// # .https_or_http()
10263/// # .enable_http1()
10264/// # .build()
10265/// # );
10266/// # let mut hub = CloudHealthcare::new(client, auth);
10267/// // You can configure optional parameters by calling the respective setters at will, and
10268/// // execute the final call using `doit()`.
10269/// // Values shown here are possibly random and not representative !
10270/// let result = hub.projects().locations_datasets_consent_stores_consents_delete_revision("name")
10271/// .doit().await;
10272/// # }
10273/// ```
10274pub struct ProjectLocationDatasetConsentStoreConsentDeleteRevisionCall<'a, C>
10275where
10276 C: 'a,
10277{
10278 hub: &'a CloudHealthcare<C>,
10279 _name: String,
10280 _delegate: Option<&'a mut dyn common::Delegate>,
10281 _additional_params: HashMap<String, String>,
10282 _scopes: BTreeSet<String>,
10283}
10284
10285impl<'a, C> common::CallBuilder
10286 for ProjectLocationDatasetConsentStoreConsentDeleteRevisionCall<'a, C>
10287{
10288}
10289
10290impl<'a, C> ProjectLocationDatasetConsentStoreConsentDeleteRevisionCall<'a, C>
10291where
10292 C: common::Connector,
10293{
10294 /// Perform the operation you have build so far.
10295 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
10296 use std::borrow::Cow;
10297 use std::io::{Read, Seek};
10298
10299 use common::{url::Params, ToParts};
10300 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10301
10302 let mut dd = common::DefaultDelegate;
10303 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10304 dlg.begin(common::MethodInfo {
10305 id: "healthcare.projects.locations.datasets.consentStores.consents.deleteRevision",
10306 http_method: hyper::Method::DELETE,
10307 });
10308
10309 for &field in ["alt", "name"].iter() {
10310 if self._additional_params.contains_key(field) {
10311 dlg.finished(false);
10312 return Err(common::Error::FieldClash(field));
10313 }
10314 }
10315
10316 let mut params = Params::with_capacity(3 + self._additional_params.len());
10317 params.push("name", self._name);
10318
10319 params.extend(self._additional_params.iter());
10320
10321 params.push("alt", "json");
10322 let mut url = self.hub._base_url.clone() + "v1/{+name}:deleteRevision";
10323 if self._scopes.is_empty() {
10324 self._scopes
10325 .insert(Scope::CloudHealthcare.as_ref().to_string());
10326 }
10327
10328 #[allow(clippy::single_element_loop)]
10329 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10330 url = params.uri_replacement(url, param_name, find_this, true);
10331 }
10332 {
10333 let to_remove = ["name"];
10334 params.remove_params(&to_remove);
10335 }
10336
10337 let url = params.parse_with_url(&url);
10338
10339 loop {
10340 let token = match self
10341 .hub
10342 .auth
10343 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10344 .await
10345 {
10346 Ok(token) => token,
10347 Err(e) => match dlg.token(e) {
10348 Ok(token) => token,
10349 Err(e) => {
10350 dlg.finished(false);
10351 return Err(common::Error::MissingToken(e));
10352 }
10353 },
10354 };
10355 let mut req_result = {
10356 let client = &self.hub.client;
10357 dlg.pre_request();
10358 let mut req_builder = hyper::Request::builder()
10359 .method(hyper::Method::DELETE)
10360 .uri(url.as_str())
10361 .header(USER_AGENT, self.hub._user_agent.clone());
10362
10363 if let Some(token) = token.as_ref() {
10364 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10365 }
10366
10367 let request = req_builder
10368 .header(CONTENT_LENGTH, 0_u64)
10369 .body(common::to_body::<String>(None));
10370
10371 client.request(request.unwrap()).await
10372 };
10373
10374 match req_result {
10375 Err(err) => {
10376 if let common::Retry::After(d) = dlg.http_error(&err) {
10377 sleep(d).await;
10378 continue;
10379 }
10380 dlg.finished(false);
10381 return Err(common::Error::HttpError(err));
10382 }
10383 Ok(res) => {
10384 let (mut parts, body) = res.into_parts();
10385 let mut body = common::Body::new(body);
10386 if !parts.status.is_success() {
10387 let bytes = common::to_bytes(body).await.unwrap_or_default();
10388 let error = serde_json::from_str(&common::to_string(&bytes));
10389 let response = common::to_response(parts, bytes.into());
10390
10391 if let common::Retry::After(d) =
10392 dlg.http_failure(&response, error.as_ref().ok())
10393 {
10394 sleep(d).await;
10395 continue;
10396 }
10397
10398 dlg.finished(false);
10399
10400 return Err(match error {
10401 Ok(value) => common::Error::BadRequest(value),
10402 _ => common::Error::Failure(response),
10403 });
10404 }
10405 let response = {
10406 let bytes = common::to_bytes(body).await.unwrap_or_default();
10407 let encoded = common::to_string(&bytes);
10408 match serde_json::from_str(&encoded) {
10409 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10410 Err(error) => {
10411 dlg.response_json_decode_error(&encoded, &error);
10412 return Err(common::Error::JsonDecodeError(
10413 encoded.to_string(),
10414 error,
10415 ));
10416 }
10417 }
10418 };
10419
10420 dlg.finished(true);
10421 return Ok(response);
10422 }
10423 }
10424 }
10425 }
10426
10427 /// Required. The resource name of the Consent revision to delete, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}@{revision_id}`. An INVALID_ARGUMENT error occurs if `revision_id` is not specified in the name.
10428 ///
10429 /// Sets the *name* path property to the given value.
10430 ///
10431 /// Even though the property as already been set when instantiating this call,
10432 /// we provide this method for API completeness.
10433 pub fn name(
10434 mut self,
10435 new_value: &str,
10436 ) -> ProjectLocationDatasetConsentStoreConsentDeleteRevisionCall<'a, C> {
10437 self._name = new_value.to_string();
10438 self
10439 }
10440 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10441 /// while executing the actual API request.
10442 ///
10443 /// ````text
10444 /// It should be used to handle progress information, and to implement a certain level of resilience.
10445 /// ````
10446 ///
10447 /// Sets the *delegate* property to the given value.
10448 pub fn delegate(
10449 mut self,
10450 new_value: &'a mut dyn common::Delegate,
10451 ) -> ProjectLocationDatasetConsentStoreConsentDeleteRevisionCall<'a, C> {
10452 self._delegate = Some(new_value);
10453 self
10454 }
10455
10456 /// Set any additional parameter of the query string used in the request.
10457 /// It should be used to set parameters which are not yet available through their own
10458 /// setters.
10459 ///
10460 /// Please note that this method must not be used to set any of the known parameters
10461 /// which have their own setter method. If done anyway, the request will fail.
10462 ///
10463 /// # Additional Parameters
10464 ///
10465 /// * *$.xgafv* (query-string) - V1 error format.
10466 /// * *access_token* (query-string) - OAuth access token.
10467 /// * *alt* (query-string) - Data format for response.
10468 /// * *callback* (query-string) - JSONP
10469 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10470 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10471 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10472 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10473 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10474 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10475 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10476 pub fn param<T>(
10477 mut self,
10478 name: T,
10479 value: T,
10480 ) -> ProjectLocationDatasetConsentStoreConsentDeleteRevisionCall<'a, C>
10481 where
10482 T: AsRef<str>,
10483 {
10484 self._additional_params
10485 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10486 self
10487 }
10488
10489 /// Identifies the authorization scope for the method you are building.
10490 ///
10491 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10492 /// [`Scope::CloudHealthcare`].
10493 ///
10494 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10495 /// tokens for more than one scope.
10496 ///
10497 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10498 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10499 /// sufficient, a read-write scope will do as well.
10500 pub fn add_scope<St>(
10501 mut self,
10502 scope: St,
10503 ) -> ProjectLocationDatasetConsentStoreConsentDeleteRevisionCall<'a, C>
10504 where
10505 St: AsRef<str>,
10506 {
10507 self._scopes.insert(String::from(scope.as_ref()));
10508 self
10509 }
10510 /// Identifies the authorization scope(s) for the method you are building.
10511 ///
10512 /// See [`Self::add_scope()`] for details.
10513 pub fn add_scopes<I, St>(
10514 mut self,
10515 scopes: I,
10516 ) -> ProjectLocationDatasetConsentStoreConsentDeleteRevisionCall<'a, C>
10517 where
10518 I: IntoIterator<Item = St>,
10519 St: AsRef<str>,
10520 {
10521 self._scopes
10522 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10523 self
10524 }
10525
10526 /// Removes all scopes, and no default scope will be used either.
10527 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10528 /// for details).
10529 pub fn clear_scopes(
10530 mut self,
10531 ) -> ProjectLocationDatasetConsentStoreConsentDeleteRevisionCall<'a, C> {
10532 self._scopes.clear();
10533 self
10534 }
10535}
10536
10537/// Gets the specified revision of a Consent, or the latest revision if `revision_id` is not specified in the resource name.
10538///
10539/// A builder for the *locations.datasets.consentStores.consents.get* method supported by a *project* resource.
10540/// It is not used directly, but through a [`ProjectMethods`] instance.
10541///
10542/// # Example
10543///
10544/// Instantiate a resource method builder
10545///
10546/// ```test_harness,no_run
10547/// # extern crate hyper;
10548/// # extern crate hyper_rustls;
10549/// # extern crate google_healthcare1 as healthcare1;
10550/// # async fn dox() {
10551/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10552///
10553/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10554/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10555/// # secret,
10556/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10557/// # ).build().await.unwrap();
10558///
10559/// # let client = hyper_util::client::legacy::Client::builder(
10560/// # hyper_util::rt::TokioExecutor::new()
10561/// # )
10562/// # .build(
10563/// # hyper_rustls::HttpsConnectorBuilder::new()
10564/// # .with_native_roots()
10565/// # .unwrap()
10566/// # .https_or_http()
10567/// # .enable_http1()
10568/// # .build()
10569/// # );
10570/// # let mut hub = CloudHealthcare::new(client, auth);
10571/// // You can configure optional parameters by calling the respective setters at will, and
10572/// // execute the final call using `doit()`.
10573/// // Values shown here are possibly random and not representative !
10574/// let result = hub.projects().locations_datasets_consent_stores_consents_get("name")
10575/// .doit().await;
10576/// # }
10577/// ```
10578pub struct ProjectLocationDatasetConsentStoreConsentGetCall<'a, C>
10579where
10580 C: 'a,
10581{
10582 hub: &'a CloudHealthcare<C>,
10583 _name: String,
10584 _delegate: Option<&'a mut dyn common::Delegate>,
10585 _additional_params: HashMap<String, String>,
10586 _scopes: BTreeSet<String>,
10587}
10588
10589impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreConsentGetCall<'a, C> {}
10590
10591impl<'a, C> ProjectLocationDatasetConsentStoreConsentGetCall<'a, C>
10592where
10593 C: common::Connector,
10594{
10595 /// Perform the operation you have build so far.
10596 pub async fn doit(mut self) -> common::Result<(common::Response, Consent)> {
10597 use std::borrow::Cow;
10598 use std::io::{Read, Seek};
10599
10600 use common::{url::Params, ToParts};
10601 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10602
10603 let mut dd = common::DefaultDelegate;
10604 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10605 dlg.begin(common::MethodInfo {
10606 id: "healthcare.projects.locations.datasets.consentStores.consents.get",
10607 http_method: hyper::Method::GET,
10608 });
10609
10610 for &field in ["alt", "name"].iter() {
10611 if self._additional_params.contains_key(field) {
10612 dlg.finished(false);
10613 return Err(common::Error::FieldClash(field));
10614 }
10615 }
10616
10617 let mut params = Params::with_capacity(3 + self._additional_params.len());
10618 params.push("name", self._name);
10619
10620 params.extend(self._additional_params.iter());
10621
10622 params.push("alt", "json");
10623 let mut url = self.hub._base_url.clone() + "v1/{+name}";
10624 if self._scopes.is_empty() {
10625 self._scopes
10626 .insert(Scope::CloudHealthcare.as_ref().to_string());
10627 }
10628
10629 #[allow(clippy::single_element_loop)]
10630 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10631 url = params.uri_replacement(url, param_name, find_this, true);
10632 }
10633 {
10634 let to_remove = ["name"];
10635 params.remove_params(&to_remove);
10636 }
10637
10638 let url = params.parse_with_url(&url);
10639
10640 loop {
10641 let token = match self
10642 .hub
10643 .auth
10644 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10645 .await
10646 {
10647 Ok(token) => token,
10648 Err(e) => match dlg.token(e) {
10649 Ok(token) => token,
10650 Err(e) => {
10651 dlg.finished(false);
10652 return Err(common::Error::MissingToken(e));
10653 }
10654 },
10655 };
10656 let mut req_result = {
10657 let client = &self.hub.client;
10658 dlg.pre_request();
10659 let mut req_builder = hyper::Request::builder()
10660 .method(hyper::Method::GET)
10661 .uri(url.as_str())
10662 .header(USER_AGENT, self.hub._user_agent.clone());
10663
10664 if let Some(token) = token.as_ref() {
10665 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10666 }
10667
10668 let request = req_builder
10669 .header(CONTENT_LENGTH, 0_u64)
10670 .body(common::to_body::<String>(None));
10671
10672 client.request(request.unwrap()).await
10673 };
10674
10675 match req_result {
10676 Err(err) => {
10677 if let common::Retry::After(d) = dlg.http_error(&err) {
10678 sleep(d).await;
10679 continue;
10680 }
10681 dlg.finished(false);
10682 return Err(common::Error::HttpError(err));
10683 }
10684 Ok(res) => {
10685 let (mut parts, body) = res.into_parts();
10686 let mut body = common::Body::new(body);
10687 if !parts.status.is_success() {
10688 let bytes = common::to_bytes(body).await.unwrap_or_default();
10689 let error = serde_json::from_str(&common::to_string(&bytes));
10690 let response = common::to_response(parts, bytes.into());
10691
10692 if let common::Retry::After(d) =
10693 dlg.http_failure(&response, error.as_ref().ok())
10694 {
10695 sleep(d).await;
10696 continue;
10697 }
10698
10699 dlg.finished(false);
10700
10701 return Err(match error {
10702 Ok(value) => common::Error::BadRequest(value),
10703 _ => common::Error::Failure(response),
10704 });
10705 }
10706 let response = {
10707 let bytes = common::to_bytes(body).await.unwrap_or_default();
10708 let encoded = common::to_string(&bytes);
10709 match serde_json::from_str(&encoded) {
10710 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10711 Err(error) => {
10712 dlg.response_json_decode_error(&encoded, &error);
10713 return Err(common::Error::JsonDecodeError(
10714 encoded.to_string(),
10715 error,
10716 ));
10717 }
10718 }
10719 };
10720
10721 dlg.finished(true);
10722 return Ok(response);
10723 }
10724 }
10725 }
10726 }
10727
10728 /// Required. The resource name of the Consent to retrieve, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. In order to retrieve a previous revision of the Consent, also provide the revision ID: `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}@{revision_id}`
10729 ///
10730 /// Sets the *name* path property to the given value.
10731 ///
10732 /// Even though the property as already been set when instantiating this call,
10733 /// we provide this method for API completeness.
10734 pub fn name(
10735 mut self,
10736 new_value: &str,
10737 ) -> ProjectLocationDatasetConsentStoreConsentGetCall<'a, C> {
10738 self._name = new_value.to_string();
10739 self
10740 }
10741 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10742 /// while executing the actual API request.
10743 ///
10744 /// ````text
10745 /// It should be used to handle progress information, and to implement a certain level of resilience.
10746 /// ````
10747 ///
10748 /// Sets the *delegate* property to the given value.
10749 pub fn delegate(
10750 mut self,
10751 new_value: &'a mut dyn common::Delegate,
10752 ) -> ProjectLocationDatasetConsentStoreConsentGetCall<'a, C> {
10753 self._delegate = Some(new_value);
10754 self
10755 }
10756
10757 /// Set any additional parameter of the query string used in the request.
10758 /// It should be used to set parameters which are not yet available through their own
10759 /// setters.
10760 ///
10761 /// Please note that this method must not be used to set any of the known parameters
10762 /// which have their own setter method. If done anyway, the request will fail.
10763 ///
10764 /// # Additional Parameters
10765 ///
10766 /// * *$.xgafv* (query-string) - V1 error format.
10767 /// * *access_token* (query-string) - OAuth access token.
10768 /// * *alt* (query-string) - Data format for response.
10769 /// * *callback* (query-string) - JSONP
10770 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10771 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10772 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10773 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10774 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10775 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10776 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10777 pub fn param<T>(
10778 mut self,
10779 name: T,
10780 value: T,
10781 ) -> ProjectLocationDatasetConsentStoreConsentGetCall<'a, C>
10782 where
10783 T: AsRef<str>,
10784 {
10785 self._additional_params
10786 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10787 self
10788 }
10789
10790 /// Identifies the authorization scope for the method you are building.
10791 ///
10792 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10793 /// [`Scope::CloudHealthcare`].
10794 ///
10795 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10796 /// tokens for more than one scope.
10797 ///
10798 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10799 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10800 /// sufficient, a read-write scope will do as well.
10801 pub fn add_scope<St>(
10802 mut self,
10803 scope: St,
10804 ) -> ProjectLocationDatasetConsentStoreConsentGetCall<'a, C>
10805 where
10806 St: AsRef<str>,
10807 {
10808 self._scopes.insert(String::from(scope.as_ref()));
10809 self
10810 }
10811 /// Identifies the authorization scope(s) for the method you are building.
10812 ///
10813 /// See [`Self::add_scope()`] for details.
10814 pub fn add_scopes<I, St>(
10815 mut self,
10816 scopes: I,
10817 ) -> ProjectLocationDatasetConsentStoreConsentGetCall<'a, C>
10818 where
10819 I: IntoIterator<Item = St>,
10820 St: AsRef<str>,
10821 {
10822 self._scopes
10823 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10824 self
10825 }
10826
10827 /// Removes all scopes, and no default scope will be used either.
10828 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10829 /// for details).
10830 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStoreConsentGetCall<'a, C> {
10831 self._scopes.clear();
10832 self
10833 }
10834}
10835
10836/// Lists the Consent in the given consent store, returning each Consent's latest revision.
10837///
10838/// A builder for the *locations.datasets.consentStores.consents.list* method supported by a *project* resource.
10839/// It is not used directly, but through a [`ProjectMethods`] instance.
10840///
10841/// # Example
10842///
10843/// Instantiate a resource method builder
10844///
10845/// ```test_harness,no_run
10846/// # extern crate hyper;
10847/// # extern crate hyper_rustls;
10848/// # extern crate google_healthcare1 as healthcare1;
10849/// # async fn dox() {
10850/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10851///
10852/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10853/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10854/// # secret,
10855/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10856/// # ).build().await.unwrap();
10857///
10858/// # let client = hyper_util::client::legacy::Client::builder(
10859/// # hyper_util::rt::TokioExecutor::new()
10860/// # )
10861/// # .build(
10862/// # hyper_rustls::HttpsConnectorBuilder::new()
10863/// # .with_native_roots()
10864/// # .unwrap()
10865/// # .https_or_http()
10866/// # .enable_http1()
10867/// # .build()
10868/// # );
10869/// # let mut hub = CloudHealthcare::new(client, auth);
10870/// // You can configure optional parameters by calling the respective setters at will, and
10871/// // execute the final call using `doit()`.
10872/// // Values shown here are possibly random and not representative !
10873/// let result = hub.projects().locations_datasets_consent_stores_consents_list("parent")
10874/// .page_token("kasd")
10875/// .page_size(-24)
10876/// .filter("sed")
10877/// .doit().await;
10878/// # }
10879/// ```
10880pub struct ProjectLocationDatasetConsentStoreConsentListCall<'a, C>
10881where
10882 C: 'a,
10883{
10884 hub: &'a CloudHealthcare<C>,
10885 _parent: String,
10886 _page_token: Option<String>,
10887 _page_size: Option<i32>,
10888 _filter: Option<String>,
10889 _delegate: Option<&'a mut dyn common::Delegate>,
10890 _additional_params: HashMap<String, String>,
10891 _scopes: BTreeSet<String>,
10892}
10893
10894impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreConsentListCall<'a, C> {}
10895
10896impl<'a, C> ProjectLocationDatasetConsentStoreConsentListCall<'a, C>
10897where
10898 C: common::Connector,
10899{
10900 /// Perform the operation you have build so far.
10901 pub async fn doit(mut self) -> common::Result<(common::Response, ListConsentsResponse)> {
10902 use std::borrow::Cow;
10903 use std::io::{Read, Seek};
10904
10905 use common::{url::Params, ToParts};
10906 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10907
10908 let mut dd = common::DefaultDelegate;
10909 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10910 dlg.begin(common::MethodInfo {
10911 id: "healthcare.projects.locations.datasets.consentStores.consents.list",
10912 http_method: hyper::Method::GET,
10913 });
10914
10915 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
10916 if self._additional_params.contains_key(field) {
10917 dlg.finished(false);
10918 return Err(common::Error::FieldClash(field));
10919 }
10920 }
10921
10922 let mut params = Params::with_capacity(6 + self._additional_params.len());
10923 params.push("parent", self._parent);
10924 if let Some(value) = self._page_token.as_ref() {
10925 params.push("pageToken", value);
10926 }
10927 if let Some(value) = self._page_size.as_ref() {
10928 params.push("pageSize", value.to_string());
10929 }
10930 if let Some(value) = self._filter.as_ref() {
10931 params.push("filter", value);
10932 }
10933
10934 params.extend(self._additional_params.iter());
10935
10936 params.push("alt", "json");
10937 let mut url = self.hub._base_url.clone() + "v1/{+parent}/consents";
10938 if self._scopes.is_empty() {
10939 self._scopes
10940 .insert(Scope::CloudHealthcare.as_ref().to_string());
10941 }
10942
10943 #[allow(clippy::single_element_loop)]
10944 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10945 url = params.uri_replacement(url, param_name, find_this, true);
10946 }
10947 {
10948 let to_remove = ["parent"];
10949 params.remove_params(&to_remove);
10950 }
10951
10952 let url = params.parse_with_url(&url);
10953
10954 loop {
10955 let token = match self
10956 .hub
10957 .auth
10958 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10959 .await
10960 {
10961 Ok(token) => token,
10962 Err(e) => match dlg.token(e) {
10963 Ok(token) => token,
10964 Err(e) => {
10965 dlg.finished(false);
10966 return Err(common::Error::MissingToken(e));
10967 }
10968 },
10969 };
10970 let mut req_result = {
10971 let client = &self.hub.client;
10972 dlg.pre_request();
10973 let mut req_builder = hyper::Request::builder()
10974 .method(hyper::Method::GET)
10975 .uri(url.as_str())
10976 .header(USER_AGENT, self.hub._user_agent.clone());
10977
10978 if let Some(token) = token.as_ref() {
10979 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10980 }
10981
10982 let request = req_builder
10983 .header(CONTENT_LENGTH, 0_u64)
10984 .body(common::to_body::<String>(None));
10985
10986 client.request(request.unwrap()).await
10987 };
10988
10989 match req_result {
10990 Err(err) => {
10991 if let common::Retry::After(d) = dlg.http_error(&err) {
10992 sleep(d).await;
10993 continue;
10994 }
10995 dlg.finished(false);
10996 return Err(common::Error::HttpError(err));
10997 }
10998 Ok(res) => {
10999 let (mut parts, body) = res.into_parts();
11000 let mut body = common::Body::new(body);
11001 if !parts.status.is_success() {
11002 let bytes = common::to_bytes(body).await.unwrap_or_default();
11003 let error = serde_json::from_str(&common::to_string(&bytes));
11004 let response = common::to_response(parts, bytes.into());
11005
11006 if let common::Retry::After(d) =
11007 dlg.http_failure(&response, error.as_ref().ok())
11008 {
11009 sleep(d).await;
11010 continue;
11011 }
11012
11013 dlg.finished(false);
11014
11015 return Err(match error {
11016 Ok(value) => common::Error::BadRequest(value),
11017 _ => common::Error::Failure(response),
11018 });
11019 }
11020 let response = {
11021 let bytes = common::to_bytes(body).await.unwrap_or_default();
11022 let encoded = common::to_string(&bytes);
11023 match serde_json::from_str(&encoded) {
11024 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11025 Err(error) => {
11026 dlg.response_json_decode_error(&encoded, &error);
11027 return Err(common::Error::JsonDecodeError(
11028 encoded.to_string(),
11029 error,
11030 ));
11031 }
11032 }
11033 };
11034
11035 dlg.finished(true);
11036 return Ok(response);
11037 }
11038 }
11039 }
11040 }
11041
11042 /// Required. Name of the consent store to retrieve Consents from.
11043 ///
11044 /// Sets the *parent* path property to the given value.
11045 ///
11046 /// Even though the property as already been set when instantiating this call,
11047 /// we provide this method for API completeness.
11048 pub fn parent(
11049 mut self,
11050 new_value: &str,
11051 ) -> ProjectLocationDatasetConsentStoreConsentListCall<'a, C> {
11052 self._parent = new_value.to_string();
11053 self
11054 }
11055 /// Optional. The next_page_token value returned from the previous List request, if any.
11056 ///
11057 /// Sets the *page token* query property to the given value.
11058 pub fn page_token(
11059 mut self,
11060 new_value: &str,
11061 ) -> ProjectLocationDatasetConsentStoreConsentListCall<'a, C> {
11062 self._page_token = Some(new_value.to_string());
11063 self
11064 }
11065 /// Optional. Limit on the number of Consents to return in a single response. If not specified, 100 is used. May not be larger than 1000.
11066 ///
11067 /// Sets the *page size* query property to the given value.
11068 pub fn page_size(
11069 mut self,
11070 new_value: i32,
11071 ) -> ProjectLocationDatasetConsentStoreConsentListCall<'a, C> {
11072 self._page_size = Some(new_value);
11073 self
11074 }
11075 /// Optional. Restricts the Consents returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. The fields available for filtering are: - user_id. For example, `filter='user_id="user123"'`. - consent_artifact - state - revision_create_time - metadata. For example, `filter=Metadata(\"testkey\")=\"value\"` or `filter=HasMetadata(\"testkey\")`.
11076 ///
11077 /// Sets the *filter* query property to the given value.
11078 pub fn filter(
11079 mut self,
11080 new_value: &str,
11081 ) -> ProjectLocationDatasetConsentStoreConsentListCall<'a, C> {
11082 self._filter = Some(new_value.to_string());
11083 self
11084 }
11085 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11086 /// while executing the actual API request.
11087 ///
11088 /// ````text
11089 /// It should be used to handle progress information, and to implement a certain level of resilience.
11090 /// ````
11091 ///
11092 /// Sets the *delegate* property to the given value.
11093 pub fn delegate(
11094 mut self,
11095 new_value: &'a mut dyn common::Delegate,
11096 ) -> ProjectLocationDatasetConsentStoreConsentListCall<'a, C> {
11097 self._delegate = Some(new_value);
11098 self
11099 }
11100
11101 /// Set any additional parameter of the query string used in the request.
11102 /// It should be used to set parameters which are not yet available through their own
11103 /// setters.
11104 ///
11105 /// Please note that this method must not be used to set any of the known parameters
11106 /// which have their own setter method. If done anyway, the request will fail.
11107 ///
11108 /// # Additional Parameters
11109 ///
11110 /// * *$.xgafv* (query-string) - V1 error format.
11111 /// * *access_token* (query-string) - OAuth access token.
11112 /// * *alt* (query-string) - Data format for response.
11113 /// * *callback* (query-string) - JSONP
11114 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11115 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11116 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11117 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11118 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11119 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11120 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11121 pub fn param<T>(
11122 mut self,
11123 name: T,
11124 value: T,
11125 ) -> ProjectLocationDatasetConsentStoreConsentListCall<'a, C>
11126 where
11127 T: AsRef<str>,
11128 {
11129 self._additional_params
11130 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11131 self
11132 }
11133
11134 /// Identifies the authorization scope for the method you are building.
11135 ///
11136 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11137 /// [`Scope::CloudHealthcare`].
11138 ///
11139 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11140 /// tokens for more than one scope.
11141 ///
11142 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11143 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11144 /// sufficient, a read-write scope will do as well.
11145 pub fn add_scope<St>(
11146 mut self,
11147 scope: St,
11148 ) -> ProjectLocationDatasetConsentStoreConsentListCall<'a, C>
11149 where
11150 St: AsRef<str>,
11151 {
11152 self._scopes.insert(String::from(scope.as_ref()));
11153 self
11154 }
11155 /// Identifies the authorization scope(s) for the method you are building.
11156 ///
11157 /// See [`Self::add_scope()`] for details.
11158 pub fn add_scopes<I, St>(
11159 mut self,
11160 scopes: I,
11161 ) -> ProjectLocationDatasetConsentStoreConsentListCall<'a, C>
11162 where
11163 I: IntoIterator<Item = St>,
11164 St: AsRef<str>,
11165 {
11166 self._scopes
11167 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11168 self
11169 }
11170
11171 /// Removes all scopes, and no default scope will be used either.
11172 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11173 /// for details).
11174 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStoreConsentListCall<'a, C> {
11175 self._scopes.clear();
11176 self
11177 }
11178}
11179
11180/// Lists the revisions of the specified Consent in reverse chronological order.
11181///
11182/// A builder for the *locations.datasets.consentStores.consents.listRevisions* method supported by a *project* resource.
11183/// It is not used directly, but through a [`ProjectMethods`] instance.
11184///
11185/// # Example
11186///
11187/// Instantiate a resource method builder
11188///
11189/// ```test_harness,no_run
11190/// # extern crate hyper;
11191/// # extern crate hyper_rustls;
11192/// # extern crate google_healthcare1 as healthcare1;
11193/// # async fn dox() {
11194/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11195///
11196/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11197/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11198/// # secret,
11199/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11200/// # ).build().await.unwrap();
11201///
11202/// # let client = hyper_util::client::legacy::Client::builder(
11203/// # hyper_util::rt::TokioExecutor::new()
11204/// # )
11205/// # .build(
11206/// # hyper_rustls::HttpsConnectorBuilder::new()
11207/// # .with_native_roots()
11208/// # .unwrap()
11209/// # .https_or_http()
11210/// # .enable_http1()
11211/// # .build()
11212/// # );
11213/// # let mut hub = CloudHealthcare::new(client, auth);
11214/// // You can configure optional parameters by calling the respective setters at will, and
11215/// // execute the final call using `doit()`.
11216/// // Values shown here are possibly random and not representative !
11217/// let result = hub.projects().locations_datasets_consent_stores_consents_list_revisions("name")
11218/// .page_token("et")
11219/// .page_size(-76)
11220/// .filter("erat")
11221/// .doit().await;
11222/// # }
11223/// ```
11224pub struct ProjectLocationDatasetConsentStoreConsentListRevisionCall<'a, C>
11225where
11226 C: 'a,
11227{
11228 hub: &'a CloudHealthcare<C>,
11229 _name: String,
11230 _page_token: Option<String>,
11231 _page_size: Option<i32>,
11232 _filter: Option<String>,
11233 _delegate: Option<&'a mut dyn common::Delegate>,
11234 _additional_params: HashMap<String, String>,
11235 _scopes: BTreeSet<String>,
11236}
11237
11238impl<'a, C> common::CallBuilder
11239 for ProjectLocationDatasetConsentStoreConsentListRevisionCall<'a, C>
11240{
11241}
11242
11243impl<'a, C> ProjectLocationDatasetConsentStoreConsentListRevisionCall<'a, C>
11244where
11245 C: common::Connector,
11246{
11247 /// Perform the operation you have build so far.
11248 pub async fn doit(
11249 mut self,
11250 ) -> common::Result<(common::Response, ListConsentRevisionsResponse)> {
11251 use std::borrow::Cow;
11252 use std::io::{Read, Seek};
11253
11254 use common::{url::Params, ToParts};
11255 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11256
11257 let mut dd = common::DefaultDelegate;
11258 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11259 dlg.begin(common::MethodInfo {
11260 id: "healthcare.projects.locations.datasets.consentStores.consents.listRevisions",
11261 http_method: hyper::Method::GET,
11262 });
11263
11264 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
11265 if self._additional_params.contains_key(field) {
11266 dlg.finished(false);
11267 return Err(common::Error::FieldClash(field));
11268 }
11269 }
11270
11271 let mut params = Params::with_capacity(6 + self._additional_params.len());
11272 params.push("name", self._name);
11273 if let Some(value) = self._page_token.as_ref() {
11274 params.push("pageToken", value);
11275 }
11276 if let Some(value) = self._page_size.as_ref() {
11277 params.push("pageSize", value.to_string());
11278 }
11279 if let Some(value) = self._filter.as_ref() {
11280 params.push("filter", value);
11281 }
11282
11283 params.extend(self._additional_params.iter());
11284
11285 params.push("alt", "json");
11286 let mut url = self.hub._base_url.clone() + "v1/{+name}:listRevisions";
11287 if self._scopes.is_empty() {
11288 self._scopes
11289 .insert(Scope::CloudHealthcare.as_ref().to_string());
11290 }
11291
11292 #[allow(clippy::single_element_loop)]
11293 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11294 url = params.uri_replacement(url, param_name, find_this, true);
11295 }
11296 {
11297 let to_remove = ["name"];
11298 params.remove_params(&to_remove);
11299 }
11300
11301 let url = params.parse_with_url(&url);
11302
11303 loop {
11304 let token = match self
11305 .hub
11306 .auth
11307 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11308 .await
11309 {
11310 Ok(token) => token,
11311 Err(e) => match dlg.token(e) {
11312 Ok(token) => token,
11313 Err(e) => {
11314 dlg.finished(false);
11315 return Err(common::Error::MissingToken(e));
11316 }
11317 },
11318 };
11319 let mut req_result = {
11320 let client = &self.hub.client;
11321 dlg.pre_request();
11322 let mut req_builder = hyper::Request::builder()
11323 .method(hyper::Method::GET)
11324 .uri(url.as_str())
11325 .header(USER_AGENT, self.hub._user_agent.clone());
11326
11327 if let Some(token) = token.as_ref() {
11328 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11329 }
11330
11331 let request = req_builder
11332 .header(CONTENT_LENGTH, 0_u64)
11333 .body(common::to_body::<String>(None));
11334
11335 client.request(request.unwrap()).await
11336 };
11337
11338 match req_result {
11339 Err(err) => {
11340 if let common::Retry::After(d) = dlg.http_error(&err) {
11341 sleep(d).await;
11342 continue;
11343 }
11344 dlg.finished(false);
11345 return Err(common::Error::HttpError(err));
11346 }
11347 Ok(res) => {
11348 let (mut parts, body) = res.into_parts();
11349 let mut body = common::Body::new(body);
11350 if !parts.status.is_success() {
11351 let bytes = common::to_bytes(body).await.unwrap_or_default();
11352 let error = serde_json::from_str(&common::to_string(&bytes));
11353 let response = common::to_response(parts, bytes.into());
11354
11355 if let common::Retry::After(d) =
11356 dlg.http_failure(&response, error.as_ref().ok())
11357 {
11358 sleep(d).await;
11359 continue;
11360 }
11361
11362 dlg.finished(false);
11363
11364 return Err(match error {
11365 Ok(value) => common::Error::BadRequest(value),
11366 _ => common::Error::Failure(response),
11367 });
11368 }
11369 let response = {
11370 let bytes = common::to_bytes(body).await.unwrap_or_default();
11371 let encoded = common::to_string(&bytes);
11372 match serde_json::from_str(&encoded) {
11373 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11374 Err(error) => {
11375 dlg.response_json_decode_error(&encoded, &error);
11376 return Err(common::Error::JsonDecodeError(
11377 encoded.to_string(),
11378 error,
11379 ));
11380 }
11381 }
11382 };
11383
11384 dlg.finished(true);
11385 return Ok(response);
11386 }
11387 }
11388 }
11389 }
11390
11391 /// Required. The resource name of the Consent to retrieve revisions for.
11392 ///
11393 /// Sets the *name* path property to the given value.
11394 ///
11395 /// Even though the property as already been set when instantiating this call,
11396 /// we provide this method for API completeness.
11397 pub fn name(
11398 mut self,
11399 new_value: &str,
11400 ) -> ProjectLocationDatasetConsentStoreConsentListRevisionCall<'a, C> {
11401 self._name = new_value.to_string();
11402 self
11403 }
11404 /// Optional. Token to retrieve the next page of results or empty if there are no more results in the list.
11405 ///
11406 /// Sets the *page token* query property to the given value.
11407 pub fn page_token(
11408 mut self,
11409 new_value: &str,
11410 ) -> ProjectLocationDatasetConsentStoreConsentListRevisionCall<'a, C> {
11411 self._page_token = Some(new_value.to_string());
11412 self
11413 }
11414 /// Optional. Limit on the number of revisions to return in a single response. If not specified, 100 is used. May not be larger than 1000.
11415 ///
11416 /// Sets the *page size* query property to the given value.
11417 pub fn page_size(
11418 mut self,
11419 new_value: i32,
11420 ) -> ProjectLocationDatasetConsentStoreConsentListRevisionCall<'a, C> {
11421 self._page_size = Some(new_value);
11422 self
11423 }
11424 /// Optional. Restricts the revisions returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. Fields available for filtering are: - user_id. For example, `filter='user_id="user123"'`. - consent_artifact - state - revision_create_time - metadata. For example, `filter=Metadata(\"testkey\")=\"value\"` or `filter=HasMetadata(\"testkey\")`.
11425 ///
11426 /// Sets the *filter* query property to the given value.
11427 pub fn filter(
11428 mut self,
11429 new_value: &str,
11430 ) -> ProjectLocationDatasetConsentStoreConsentListRevisionCall<'a, C> {
11431 self._filter = Some(new_value.to_string());
11432 self
11433 }
11434 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11435 /// while executing the actual API request.
11436 ///
11437 /// ````text
11438 /// It should be used to handle progress information, and to implement a certain level of resilience.
11439 /// ````
11440 ///
11441 /// Sets the *delegate* property to the given value.
11442 pub fn delegate(
11443 mut self,
11444 new_value: &'a mut dyn common::Delegate,
11445 ) -> ProjectLocationDatasetConsentStoreConsentListRevisionCall<'a, C> {
11446 self._delegate = Some(new_value);
11447 self
11448 }
11449
11450 /// Set any additional parameter of the query string used in the request.
11451 /// It should be used to set parameters which are not yet available through their own
11452 /// setters.
11453 ///
11454 /// Please note that this method must not be used to set any of the known parameters
11455 /// which have their own setter method. If done anyway, the request will fail.
11456 ///
11457 /// # Additional Parameters
11458 ///
11459 /// * *$.xgafv* (query-string) - V1 error format.
11460 /// * *access_token* (query-string) - OAuth access token.
11461 /// * *alt* (query-string) - Data format for response.
11462 /// * *callback* (query-string) - JSONP
11463 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11464 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11465 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11466 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11467 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11468 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11469 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11470 pub fn param<T>(
11471 mut self,
11472 name: T,
11473 value: T,
11474 ) -> ProjectLocationDatasetConsentStoreConsentListRevisionCall<'a, C>
11475 where
11476 T: AsRef<str>,
11477 {
11478 self._additional_params
11479 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11480 self
11481 }
11482
11483 /// Identifies the authorization scope for the method you are building.
11484 ///
11485 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11486 /// [`Scope::CloudHealthcare`].
11487 ///
11488 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11489 /// tokens for more than one scope.
11490 ///
11491 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11492 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11493 /// sufficient, a read-write scope will do as well.
11494 pub fn add_scope<St>(
11495 mut self,
11496 scope: St,
11497 ) -> ProjectLocationDatasetConsentStoreConsentListRevisionCall<'a, C>
11498 where
11499 St: AsRef<str>,
11500 {
11501 self._scopes.insert(String::from(scope.as_ref()));
11502 self
11503 }
11504 /// Identifies the authorization scope(s) for the method you are building.
11505 ///
11506 /// See [`Self::add_scope()`] for details.
11507 pub fn add_scopes<I, St>(
11508 mut self,
11509 scopes: I,
11510 ) -> ProjectLocationDatasetConsentStoreConsentListRevisionCall<'a, C>
11511 where
11512 I: IntoIterator<Item = St>,
11513 St: AsRef<str>,
11514 {
11515 self._scopes
11516 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11517 self
11518 }
11519
11520 /// Removes all scopes, and no default scope will be used either.
11521 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11522 /// for details).
11523 pub fn clear_scopes(
11524 mut self,
11525 ) -> ProjectLocationDatasetConsentStoreConsentListRevisionCall<'a, C> {
11526 self._scopes.clear();
11527 self
11528 }
11529}
11530
11531/// Updates the latest revision of the specified Consent by committing a new revision with the changes. A FAILED_PRECONDITION error occurs if the latest revision of the specified Consent is in the `REJECTED` or `REVOKED` state.
11532///
11533/// A builder for the *locations.datasets.consentStores.consents.patch* method supported by a *project* resource.
11534/// It is not used directly, but through a [`ProjectMethods`] instance.
11535///
11536/// # Example
11537///
11538/// Instantiate a resource method builder
11539///
11540/// ```test_harness,no_run
11541/// # extern crate hyper;
11542/// # extern crate hyper_rustls;
11543/// # extern crate google_healthcare1 as healthcare1;
11544/// use healthcare1::api::Consent;
11545/// # async fn dox() {
11546/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11547///
11548/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11549/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11550/// # secret,
11551/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11552/// # ).build().await.unwrap();
11553///
11554/// # let client = hyper_util::client::legacy::Client::builder(
11555/// # hyper_util::rt::TokioExecutor::new()
11556/// # )
11557/// # .build(
11558/// # hyper_rustls::HttpsConnectorBuilder::new()
11559/// # .with_native_roots()
11560/// # .unwrap()
11561/// # .https_or_http()
11562/// # .enable_http1()
11563/// # .build()
11564/// # );
11565/// # let mut hub = CloudHealthcare::new(client, auth);
11566/// // As the method needs a request, you would usually fill it with the desired information
11567/// // into the respective structure. Some of the parts shown here might not be applicable !
11568/// // Values shown here are possibly random and not representative !
11569/// let mut req = Consent::default();
11570///
11571/// // You can configure optional parameters by calling the respective setters at will, and
11572/// // execute the final call using `doit()`.
11573/// // Values shown here are possibly random and not representative !
11574/// let result = hub.projects().locations_datasets_consent_stores_consents_patch(req, "name")
11575/// .update_mask(FieldMask::new::<&str>(&[]))
11576/// .doit().await;
11577/// # }
11578/// ```
11579pub struct ProjectLocationDatasetConsentStoreConsentPatchCall<'a, C>
11580where
11581 C: 'a,
11582{
11583 hub: &'a CloudHealthcare<C>,
11584 _request: Consent,
11585 _name: String,
11586 _update_mask: Option<common::FieldMask>,
11587 _delegate: Option<&'a mut dyn common::Delegate>,
11588 _additional_params: HashMap<String, String>,
11589 _scopes: BTreeSet<String>,
11590}
11591
11592impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreConsentPatchCall<'a, C> {}
11593
11594impl<'a, C> ProjectLocationDatasetConsentStoreConsentPatchCall<'a, C>
11595where
11596 C: common::Connector,
11597{
11598 /// Perform the operation you have build so far.
11599 pub async fn doit(mut self) -> common::Result<(common::Response, Consent)> {
11600 use std::borrow::Cow;
11601 use std::io::{Read, Seek};
11602
11603 use common::{url::Params, ToParts};
11604 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11605
11606 let mut dd = common::DefaultDelegate;
11607 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11608 dlg.begin(common::MethodInfo {
11609 id: "healthcare.projects.locations.datasets.consentStores.consents.patch",
11610 http_method: hyper::Method::PATCH,
11611 });
11612
11613 for &field in ["alt", "name", "updateMask"].iter() {
11614 if self._additional_params.contains_key(field) {
11615 dlg.finished(false);
11616 return Err(common::Error::FieldClash(field));
11617 }
11618 }
11619
11620 let mut params = Params::with_capacity(5 + self._additional_params.len());
11621 params.push("name", self._name);
11622 if let Some(value) = self._update_mask.as_ref() {
11623 params.push("updateMask", value.to_string());
11624 }
11625
11626 params.extend(self._additional_params.iter());
11627
11628 params.push("alt", "json");
11629 let mut url = self.hub._base_url.clone() + "v1/{+name}";
11630 if self._scopes.is_empty() {
11631 self._scopes
11632 .insert(Scope::CloudHealthcare.as_ref().to_string());
11633 }
11634
11635 #[allow(clippy::single_element_loop)]
11636 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11637 url = params.uri_replacement(url, param_name, find_this, true);
11638 }
11639 {
11640 let to_remove = ["name"];
11641 params.remove_params(&to_remove);
11642 }
11643
11644 let url = params.parse_with_url(&url);
11645
11646 let mut json_mime_type = mime::APPLICATION_JSON;
11647 let mut request_value_reader = {
11648 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11649 common::remove_json_null_values(&mut value);
11650 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11651 serde_json::to_writer(&mut dst, &value).unwrap();
11652 dst
11653 };
11654 let request_size = request_value_reader
11655 .seek(std::io::SeekFrom::End(0))
11656 .unwrap();
11657 request_value_reader
11658 .seek(std::io::SeekFrom::Start(0))
11659 .unwrap();
11660
11661 loop {
11662 let token = match self
11663 .hub
11664 .auth
11665 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11666 .await
11667 {
11668 Ok(token) => token,
11669 Err(e) => match dlg.token(e) {
11670 Ok(token) => token,
11671 Err(e) => {
11672 dlg.finished(false);
11673 return Err(common::Error::MissingToken(e));
11674 }
11675 },
11676 };
11677 request_value_reader
11678 .seek(std::io::SeekFrom::Start(0))
11679 .unwrap();
11680 let mut req_result = {
11681 let client = &self.hub.client;
11682 dlg.pre_request();
11683 let mut req_builder = hyper::Request::builder()
11684 .method(hyper::Method::PATCH)
11685 .uri(url.as_str())
11686 .header(USER_AGENT, self.hub._user_agent.clone());
11687
11688 if let Some(token) = token.as_ref() {
11689 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11690 }
11691
11692 let request = req_builder
11693 .header(CONTENT_TYPE, json_mime_type.to_string())
11694 .header(CONTENT_LENGTH, request_size as u64)
11695 .body(common::to_body(
11696 request_value_reader.get_ref().clone().into(),
11697 ));
11698
11699 client.request(request.unwrap()).await
11700 };
11701
11702 match req_result {
11703 Err(err) => {
11704 if let common::Retry::After(d) = dlg.http_error(&err) {
11705 sleep(d).await;
11706 continue;
11707 }
11708 dlg.finished(false);
11709 return Err(common::Error::HttpError(err));
11710 }
11711 Ok(res) => {
11712 let (mut parts, body) = res.into_parts();
11713 let mut body = common::Body::new(body);
11714 if !parts.status.is_success() {
11715 let bytes = common::to_bytes(body).await.unwrap_or_default();
11716 let error = serde_json::from_str(&common::to_string(&bytes));
11717 let response = common::to_response(parts, bytes.into());
11718
11719 if let common::Retry::After(d) =
11720 dlg.http_failure(&response, error.as_ref().ok())
11721 {
11722 sleep(d).await;
11723 continue;
11724 }
11725
11726 dlg.finished(false);
11727
11728 return Err(match error {
11729 Ok(value) => common::Error::BadRequest(value),
11730 _ => common::Error::Failure(response),
11731 });
11732 }
11733 let response = {
11734 let bytes = common::to_bytes(body).await.unwrap_or_default();
11735 let encoded = common::to_string(&bytes);
11736 match serde_json::from_str(&encoded) {
11737 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11738 Err(error) => {
11739 dlg.response_json_decode_error(&encoded, &error);
11740 return Err(common::Error::JsonDecodeError(
11741 encoded.to_string(),
11742 error,
11743 ));
11744 }
11745 }
11746 };
11747
11748 dlg.finished(true);
11749 return Ok(response);
11750 }
11751 }
11752 }
11753 }
11754
11755 ///
11756 /// Sets the *request* property to the given value.
11757 ///
11758 /// Even though the property as already been set when instantiating this call,
11759 /// we provide this method for API completeness.
11760 pub fn request(
11761 mut self,
11762 new_value: Consent,
11763 ) -> ProjectLocationDatasetConsentStoreConsentPatchCall<'a, C> {
11764 self._request = new_value;
11765 self
11766 }
11767 /// Identifier. Resource name of the Consent, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. Cannot be changed after creation.
11768 ///
11769 /// Sets the *name* path property to the given value.
11770 ///
11771 /// Even though the property as already been set when instantiating this call,
11772 /// we provide this method for API completeness.
11773 pub fn name(
11774 mut self,
11775 new_value: &str,
11776 ) -> ProjectLocationDatasetConsentStoreConsentPatchCall<'a, C> {
11777 self._name = new_value.to_string();
11778 self
11779 }
11780 /// Required. The update mask to apply to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. Only the `user_id`, `policies`, `consent_artifact`, and `metadata` fields can be updated.
11781 ///
11782 /// Sets the *update mask* query property to the given value.
11783 pub fn update_mask(
11784 mut self,
11785 new_value: common::FieldMask,
11786 ) -> ProjectLocationDatasetConsentStoreConsentPatchCall<'a, C> {
11787 self._update_mask = Some(new_value);
11788 self
11789 }
11790 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11791 /// while executing the actual API request.
11792 ///
11793 /// ````text
11794 /// It should be used to handle progress information, and to implement a certain level of resilience.
11795 /// ````
11796 ///
11797 /// Sets the *delegate* property to the given value.
11798 pub fn delegate(
11799 mut self,
11800 new_value: &'a mut dyn common::Delegate,
11801 ) -> ProjectLocationDatasetConsentStoreConsentPatchCall<'a, C> {
11802 self._delegate = Some(new_value);
11803 self
11804 }
11805
11806 /// Set any additional parameter of the query string used in the request.
11807 /// It should be used to set parameters which are not yet available through their own
11808 /// setters.
11809 ///
11810 /// Please note that this method must not be used to set any of the known parameters
11811 /// which have their own setter method. If done anyway, the request will fail.
11812 ///
11813 /// # Additional Parameters
11814 ///
11815 /// * *$.xgafv* (query-string) - V1 error format.
11816 /// * *access_token* (query-string) - OAuth access token.
11817 /// * *alt* (query-string) - Data format for response.
11818 /// * *callback* (query-string) - JSONP
11819 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11820 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11821 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11822 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11823 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11824 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11825 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11826 pub fn param<T>(
11827 mut self,
11828 name: T,
11829 value: T,
11830 ) -> ProjectLocationDatasetConsentStoreConsentPatchCall<'a, C>
11831 where
11832 T: AsRef<str>,
11833 {
11834 self._additional_params
11835 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11836 self
11837 }
11838
11839 /// Identifies the authorization scope for the method you are building.
11840 ///
11841 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11842 /// [`Scope::CloudHealthcare`].
11843 ///
11844 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11845 /// tokens for more than one scope.
11846 ///
11847 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11848 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11849 /// sufficient, a read-write scope will do as well.
11850 pub fn add_scope<St>(
11851 mut self,
11852 scope: St,
11853 ) -> ProjectLocationDatasetConsentStoreConsentPatchCall<'a, C>
11854 where
11855 St: AsRef<str>,
11856 {
11857 self._scopes.insert(String::from(scope.as_ref()));
11858 self
11859 }
11860 /// Identifies the authorization scope(s) for the method you are building.
11861 ///
11862 /// See [`Self::add_scope()`] for details.
11863 pub fn add_scopes<I, St>(
11864 mut self,
11865 scopes: I,
11866 ) -> ProjectLocationDatasetConsentStoreConsentPatchCall<'a, C>
11867 where
11868 I: IntoIterator<Item = St>,
11869 St: AsRef<str>,
11870 {
11871 self._scopes
11872 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11873 self
11874 }
11875
11876 /// Removes all scopes, and no default scope will be used either.
11877 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11878 /// for details).
11879 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStoreConsentPatchCall<'a, C> {
11880 self._scopes.clear();
11881 self
11882 }
11883}
11884
11885/// Rejects the latest revision of the specified Consent by committing a new revision with `state` updated to `REJECTED`. If the latest revision of the specified Consent is in the `REJECTED` state, no new revision is committed. A FAILED_PRECONDITION error occurs if the latest revision of the specified Consent is in the `ACTIVE` or `REVOKED` state.
11886///
11887/// A builder for the *locations.datasets.consentStores.consents.reject* method supported by a *project* resource.
11888/// It is not used directly, but through a [`ProjectMethods`] instance.
11889///
11890/// # Example
11891///
11892/// Instantiate a resource method builder
11893///
11894/// ```test_harness,no_run
11895/// # extern crate hyper;
11896/// # extern crate hyper_rustls;
11897/// # extern crate google_healthcare1 as healthcare1;
11898/// use healthcare1::api::RejectConsentRequest;
11899/// # async fn dox() {
11900/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11901///
11902/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11903/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11904/// # secret,
11905/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11906/// # ).build().await.unwrap();
11907///
11908/// # let client = hyper_util::client::legacy::Client::builder(
11909/// # hyper_util::rt::TokioExecutor::new()
11910/// # )
11911/// # .build(
11912/// # hyper_rustls::HttpsConnectorBuilder::new()
11913/// # .with_native_roots()
11914/// # .unwrap()
11915/// # .https_or_http()
11916/// # .enable_http1()
11917/// # .build()
11918/// # );
11919/// # let mut hub = CloudHealthcare::new(client, auth);
11920/// // As the method needs a request, you would usually fill it with the desired information
11921/// // into the respective structure. Some of the parts shown here might not be applicable !
11922/// // Values shown here are possibly random and not representative !
11923/// let mut req = RejectConsentRequest::default();
11924///
11925/// // You can configure optional parameters by calling the respective setters at will, and
11926/// // execute the final call using `doit()`.
11927/// // Values shown here are possibly random and not representative !
11928/// let result = hub.projects().locations_datasets_consent_stores_consents_reject(req, "name")
11929/// .doit().await;
11930/// # }
11931/// ```
11932pub struct ProjectLocationDatasetConsentStoreConsentRejectCall<'a, C>
11933where
11934 C: 'a,
11935{
11936 hub: &'a CloudHealthcare<C>,
11937 _request: RejectConsentRequest,
11938 _name: String,
11939 _delegate: Option<&'a mut dyn common::Delegate>,
11940 _additional_params: HashMap<String, String>,
11941 _scopes: BTreeSet<String>,
11942}
11943
11944impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreConsentRejectCall<'a, C> {}
11945
11946impl<'a, C> ProjectLocationDatasetConsentStoreConsentRejectCall<'a, C>
11947where
11948 C: common::Connector,
11949{
11950 /// Perform the operation you have build so far.
11951 pub async fn doit(mut self) -> common::Result<(common::Response, Consent)> {
11952 use std::borrow::Cow;
11953 use std::io::{Read, Seek};
11954
11955 use common::{url::Params, ToParts};
11956 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11957
11958 let mut dd = common::DefaultDelegate;
11959 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11960 dlg.begin(common::MethodInfo {
11961 id: "healthcare.projects.locations.datasets.consentStores.consents.reject",
11962 http_method: hyper::Method::POST,
11963 });
11964
11965 for &field in ["alt", "name"].iter() {
11966 if self._additional_params.contains_key(field) {
11967 dlg.finished(false);
11968 return Err(common::Error::FieldClash(field));
11969 }
11970 }
11971
11972 let mut params = Params::with_capacity(4 + self._additional_params.len());
11973 params.push("name", self._name);
11974
11975 params.extend(self._additional_params.iter());
11976
11977 params.push("alt", "json");
11978 let mut url = self.hub._base_url.clone() + "v1/{+name}:reject";
11979 if self._scopes.is_empty() {
11980 self._scopes
11981 .insert(Scope::CloudHealthcare.as_ref().to_string());
11982 }
11983
11984 #[allow(clippy::single_element_loop)]
11985 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11986 url = params.uri_replacement(url, param_name, find_this, true);
11987 }
11988 {
11989 let to_remove = ["name"];
11990 params.remove_params(&to_remove);
11991 }
11992
11993 let url = params.parse_with_url(&url);
11994
11995 let mut json_mime_type = mime::APPLICATION_JSON;
11996 let mut request_value_reader = {
11997 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11998 common::remove_json_null_values(&mut value);
11999 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12000 serde_json::to_writer(&mut dst, &value).unwrap();
12001 dst
12002 };
12003 let request_size = request_value_reader
12004 .seek(std::io::SeekFrom::End(0))
12005 .unwrap();
12006 request_value_reader
12007 .seek(std::io::SeekFrom::Start(0))
12008 .unwrap();
12009
12010 loop {
12011 let token = match self
12012 .hub
12013 .auth
12014 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12015 .await
12016 {
12017 Ok(token) => token,
12018 Err(e) => match dlg.token(e) {
12019 Ok(token) => token,
12020 Err(e) => {
12021 dlg.finished(false);
12022 return Err(common::Error::MissingToken(e));
12023 }
12024 },
12025 };
12026 request_value_reader
12027 .seek(std::io::SeekFrom::Start(0))
12028 .unwrap();
12029 let mut req_result = {
12030 let client = &self.hub.client;
12031 dlg.pre_request();
12032 let mut req_builder = hyper::Request::builder()
12033 .method(hyper::Method::POST)
12034 .uri(url.as_str())
12035 .header(USER_AGENT, self.hub._user_agent.clone());
12036
12037 if let Some(token) = token.as_ref() {
12038 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12039 }
12040
12041 let request = req_builder
12042 .header(CONTENT_TYPE, json_mime_type.to_string())
12043 .header(CONTENT_LENGTH, request_size as u64)
12044 .body(common::to_body(
12045 request_value_reader.get_ref().clone().into(),
12046 ));
12047
12048 client.request(request.unwrap()).await
12049 };
12050
12051 match req_result {
12052 Err(err) => {
12053 if let common::Retry::After(d) = dlg.http_error(&err) {
12054 sleep(d).await;
12055 continue;
12056 }
12057 dlg.finished(false);
12058 return Err(common::Error::HttpError(err));
12059 }
12060 Ok(res) => {
12061 let (mut parts, body) = res.into_parts();
12062 let mut body = common::Body::new(body);
12063 if !parts.status.is_success() {
12064 let bytes = common::to_bytes(body).await.unwrap_or_default();
12065 let error = serde_json::from_str(&common::to_string(&bytes));
12066 let response = common::to_response(parts, bytes.into());
12067
12068 if let common::Retry::After(d) =
12069 dlg.http_failure(&response, error.as_ref().ok())
12070 {
12071 sleep(d).await;
12072 continue;
12073 }
12074
12075 dlg.finished(false);
12076
12077 return Err(match error {
12078 Ok(value) => common::Error::BadRequest(value),
12079 _ => common::Error::Failure(response),
12080 });
12081 }
12082 let response = {
12083 let bytes = common::to_bytes(body).await.unwrap_or_default();
12084 let encoded = common::to_string(&bytes);
12085 match serde_json::from_str(&encoded) {
12086 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12087 Err(error) => {
12088 dlg.response_json_decode_error(&encoded, &error);
12089 return Err(common::Error::JsonDecodeError(
12090 encoded.to_string(),
12091 error,
12092 ));
12093 }
12094 }
12095 };
12096
12097 dlg.finished(true);
12098 return Ok(response);
12099 }
12100 }
12101 }
12102 }
12103
12104 ///
12105 /// Sets the *request* property to the given value.
12106 ///
12107 /// Even though the property as already been set when instantiating this call,
12108 /// we provide this method for API completeness.
12109 pub fn request(
12110 mut self,
12111 new_value: RejectConsentRequest,
12112 ) -> ProjectLocationDatasetConsentStoreConsentRejectCall<'a, C> {
12113 self._request = new_value;
12114 self
12115 }
12116 /// Required. The resource name of the Consent to reject, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. An INVALID_ARGUMENT error occurs if `revision_id` is specified in the name.
12117 ///
12118 /// Sets the *name* path property to the given value.
12119 ///
12120 /// Even though the property as already been set when instantiating this call,
12121 /// we provide this method for API completeness.
12122 pub fn name(
12123 mut self,
12124 new_value: &str,
12125 ) -> ProjectLocationDatasetConsentStoreConsentRejectCall<'a, C> {
12126 self._name = new_value.to_string();
12127 self
12128 }
12129 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12130 /// while executing the actual API request.
12131 ///
12132 /// ````text
12133 /// It should be used to handle progress information, and to implement a certain level of resilience.
12134 /// ````
12135 ///
12136 /// Sets the *delegate* property to the given value.
12137 pub fn delegate(
12138 mut self,
12139 new_value: &'a mut dyn common::Delegate,
12140 ) -> ProjectLocationDatasetConsentStoreConsentRejectCall<'a, C> {
12141 self._delegate = Some(new_value);
12142 self
12143 }
12144
12145 /// Set any additional parameter of the query string used in the request.
12146 /// It should be used to set parameters which are not yet available through their own
12147 /// setters.
12148 ///
12149 /// Please note that this method must not be used to set any of the known parameters
12150 /// which have their own setter method. If done anyway, the request will fail.
12151 ///
12152 /// # Additional Parameters
12153 ///
12154 /// * *$.xgafv* (query-string) - V1 error format.
12155 /// * *access_token* (query-string) - OAuth access token.
12156 /// * *alt* (query-string) - Data format for response.
12157 /// * *callback* (query-string) - JSONP
12158 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12159 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12160 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12161 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12162 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12163 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12164 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12165 pub fn param<T>(
12166 mut self,
12167 name: T,
12168 value: T,
12169 ) -> ProjectLocationDatasetConsentStoreConsentRejectCall<'a, C>
12170 where
12171 T: AsRef<str>,
12172 {
12173 self._additional_params
12174 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12175 self
12176 }
12177
12178 /// Identifies the authorization scope for the method you are building.
12179 ///
12180 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12181 /// [`Scope::CloudHealthcare`].
12182 ///
12183 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12184 /// tokens for more than one scope.
12185 ///
12186 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12187 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12188 /// sufficient, a read-write scope will do as well.
12189 pub fn add_scope<St>(
12190 mut self,
12191 scope: St,
12192 ) -> ProjectLocationDatasetConsentStoreConsentRejectCall<'a, C>
12193 where
12194 St: AsRef<str>,
12195 {
12196 self._scopes.insert(String::from(scope.as_ref()));
12197 self
12198 }
12199 /// Identifies the authorization scope(s) for the method you are building.
12200 ///
12201 /// See [`Self::add_scope()`] for details.
12202 pub fn add_scopes<I, St>(
12203 mut self,
12204 scopes: I,
12205 ) -> ProjectLocationDatasetConsentStoreConsentRejectCall<'a, C>
12206 where
12207 I: IntoIterator<Item = St>,
12208 St: AsRef<str>,
12209 {
12210 self._scopes
12211 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12212 self
12213 }
12214
12215 /// Removes all scopes, and no default scope will be used either.
12216 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12217 /// for details).
12218 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStoreConsentRejectCall<'a, C> {
12219 self._scopes.clear();
12220 self
12221 }
12222}
12223
12224/// Revokes the latest revision of the specified Consent by committing a new revision with `state` updated to `REVOKED`. If the latest revision of the specified Consent is in the `REVOKED` state, no new revision is committed. A FAILED_PRECONDITION error occurs if the latest revision of the given consent is in `DRAFT` or `REJECTED` state.
12225///
12226/// A builder for the *locations.datasets.consentStores.consents.revoke* method supported by a *project* resource.
12227/// It is not used directly, but through a [`ProjectMethods`] instance.
12228///
12229/// # Example
12230///
12231/// Instantiate a resource method builder
12232///
12233/// ```test_harness,no_run
12234/// # extern crate hyper;
12235/// # extern crate hyper_rustls;
12236/// # extern crate google_healthcare1 as healthcare1;
12237/// use healthcare1::api::RevokeConsentRequest;
12238/// # async fn dox() {
12239/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12240///
12241/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12242/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12243/// # secret,
12244/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12245/// # ).build().await.unwrap();
12246///
12247/// # let client = hyper_util::client::legacy::Client::builder(
12248/// # hyper_util::rt::TokioExecutor::new()
12249/// # )
12250/// # .build(
12251/// # hyper_rustls::HttpsConnectorBuilder::new()
12252/// # .with_native_roots()
12253/// # .unwrap()
12254/// # .https_or_http()
12255/// # .enable_http1()
12256/// # .build()
12257/// # );
12258/// # let mut hub = CloudHealthcare::new(client, auth);
12259/// // As the method needs a request, you would usually fill it with the desired information
12260/// // into the respective structure. Some of the parts shown here might not be applicable !
12261/// // Values shown here are possibly random and not representative !
12262/// let mut req = RevokeConsentRequest::default();
12263///
12264/// // You can configure optional parameters by calling the respective setters at will, and
12265/// // execute the final call using `doit()`.
12266/// // Values shown here are possibly random and not representative !
12267/// let result = hub.projects().locations_datasets_consent_stores_consents_revoke(req, "name")
12268/// .doit().await;
12269/// # }
12270/// ```
12271pub struct ProjectLocationDatasetConsentStoreConsentRevokeCall<'a, C>
12272where
12273 C: 'a,
12274{
12275 hub: &'a CloudHealthcare<C>,
12276 _request: RevokeConsentRequest,
12277 _name: String,
12278 _delegate: Option<&'a mut dyn common::Delegate>,
12279 _additional_params: HashMap<String, String>,
12280 _scopes: BTreeSet<String>,
12281}
12282
12283impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreConsentRevokeCall<'a, C> {}
12284
12285impl<'a, C> ProjectLocationDatasetConsentStoreConsentRevokeCall<'a, C>
12286where
12287 C: common::Connector,
12288{
12289 /// Perform the operation you have build so far.
12290 pub async fn doit(mut self) -> common::Result<(common::Response, Consent)> {
12291 use std::borrow::Cow;
12292 use std::io::{Read, Seek};
12293
12294 use common::{url::Params, ToParts};
12295 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12296
12297 let mut dd = common::DefaultDelegate;
12298 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12299 dlg.begin(common::MethodInfo {
12300 id: "healthcare.projects.locations.datasets.consentStores.consents.revoke",
12301 http_method: hyper::Method::POST,
12302 });
12303
12304 for &field in ["alt", "name"].iter() {
12305 if self._additional_params.contains_key(field) {
12306 dlg.finished(false);
12307 return Err(common::Error::FieldClash(field));
12308 }
12309 }
12310
12311 let mut params = Params::with_capacity(4 + self._additional_params.len());
12312 params.push("name", self._name);
12313
12314 params.extend(self._additional_params.iter());
12315
12316 params.push("alt", "json");
12317 let mut url = self.hub._base_url.clone() + "v1/{+name}:revoke";
12318 if self._scopes.is_empty() {
12319 self._scopes
12320 .insert(Scope::CloudHealthcare.as_ref().to_string());
12321 }
12322
12323 #[allow(clippy::single_element_loop)]
12324 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12325 url = params.uri_replacement(url, param_name, find_this, true);
12326 }
12327 {
12328 let to_remove = ["name"];
12329 params.remove_params(&to_remove);
12330 }
12331
12332 let url = params.parse_with_url(&url);
12333
12334 let mut json_mime_type = mime::APPLICATION_JSON;
12335 let mut request_value_reader = {
12336 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12337 common::remove_json_null_values(&mut value);
12338 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12339 serde_json::to_writer(&mut dst, &value).unwrap();
12340 dst
12341 };
12342 let request_size = request_value_reader
12343 .seek(std::io::SeekFrom::End(0))
12344 .unwrap();
12345 request_value_reader
12346 .seek(std::io::SeekFrom::Start(0))
12347 .unwrap();
12348
12349 loop {
12350 let token = match self
12351 .hub
12352 .auth
12353 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12354 .await
12355 {
12356 Ok(token) => token,
12357 Err(e) => match dlg.token(e) {
12358 Ok(token) => token,
12359 Err(e) => {
12360 dlg.finished(false);
12361 return Err(common::Error::MissingToken(e));
12362 }
12363 },
12364 };
12365 request_value_reader
12366 .seek(std::io::SeekFrom::Start(0))
12367 .unwrap();
12368 let mut req_result = {
12369 let client = &self.hub.client;
12370 dlg.pre_request();
12371 let mut req_builder = hyper::Request::builder()
12372 .method(hyper::Method::POST)
12373 .uri(url.as_str())
12374 .header(USER_AGENT, self.hub._user_agent.clone());
12375
12376 if let Some(token) = token.as_ref() {
12377 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12378 }
12379
12380 let request = req_builder
12381 .header(CONTENT_TYPE, json_mime_type.to_string())
12382 .header(CONTENT_LENGTH, request_size as u64)
12383 .body(common::to_body(
12384 request_value_reader.get_ref().clone().into(),
12385 ));
12386
12387 client.request(request.unwrap()).await
12388 };
12389
12390 match req_result {
12391 Err(err) => {
12392 if let common::Retry::After(d) = dlg.http_error(&err) {
12393 sleep(d).await;
12394 continue;
12395 }
12396 dlg.finished(false);
12397 return Err(common::Error::HttpError(err));
12398 }
12399 Ok(res) => {
12400 let (mut parts, body) = res.into_parts();
12401 let mut body = common::Body::new(body);
12402 if !parts.status.is_success() {
12403 let bytes = common::to_bytes(body).await.unwrap_or_default();
12404 let error = serde_json::from_str(&common::to_string(&bytes));
12405 let response = common::to_response(parts, bytes.into());
12406
12407 if let common::Retry::After(d) =
12408 dlg.http_failure(&response, error.as_ref().ok())
12409 {
12410 sleep(d).await;
12411 continue;
12412 }
12413
12414 dlg.finished(false);
12415
12416 return Err(match error {
12417 Ok(value) => common::Error::BadRequest(value),
12418 _ => common::Error::Failure(response),
12419 });
12420 }
12421 let response = {
12422 let bytes = common::to_bytes(body).await.unwrap_or_default();
12423 let encoded = common::to_string(&bytes);
12424 match serde_json::from_str(&encoded) {
12425 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12426 Err(error) => {
12427 dlg.response_json_decode_error(&encoded, &error);
12428 return Err(common::Error::JsonDecodeError(
12429 encoded.to_string(),
12430 error,
12431 ));
12432 }
12433 }
12434 };
12435
12436 dlg.finished(true);
12437 return Ok(response);
12438 }
12439 }
12440 }
12441 }
12442
12443 ///
12444 /// Sets the *request* property to the given value.
12445 ///
12446 /// Even though the property as already been set when instantiating this call,
12447 /// we provide this method for API completeness.
12448 pub fn request(
12449 mut self,
12450 new_value: RevokeConsentRequest,
12451 ) -> ProjectLocationDatasetConsentStoreConsentRevokeCall<'a, C> {
12452 self._request = new_value;
12453 self
12454 }
12455 /// Required. The resource name of the Consent to revoke, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}`. An INVALID_ARGUMENT error occurs if `revision_id` is specified in the name.
12456 ///
12457 /// Sets the *name* path property to the given value.
12458 ///
12459 /// Even though the property as already been set when instantiating this call,
12460 /// we provide this method for API completeness.
12461 pub fn name(
12462 mut self,
12463 new_value: &str,
12464 ) -> ProjectLocationDatasetConsentStoreConsentRevokeCall<'a, C> {
12465 self._name = new_value.to_string();
12466 self
12467 }
12468 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12469 /// while executing the actual API request.
12470 ///
12471 /// ````text
12472 /// It should be used to handle progress information, and to implement a certain level of resilience.
12473 /// ````
12474 ///
12475 /// Sets the *delegate* property to the given value.
12476 pub fn delegate(
12477 mut self,
12478 new_value: &'a mut dyn common::Delegate,
12479 ) -> ProjectLocationDatasetConsentStoreConsentRevokeCall<'a, C> {
12480 self._delegate = Some(new_value);
12481 self
12482 }
12483
12484 /// Set any additional parameter of the query string used in the request.
12485 /// It should be used to set parameters which are not yet available through their own
12486 /// setters.
12487 ///
12488 /// Please note that this method must not be used to set any of the known parameters
12489 /// which have their own setter method. If done anyway, the request will fail.
12490 ///
12491 /// # Additional Parameters
12492 ///
12493 /// * *$.xgafv* (query-string) - V1 error format.
12494 /// * *access_token* (query-string) - OAuth access token.
12495 /// * *alt* (query-string) - Data format for response.
12496 /// * *callback* (query-string) - JSONP
12497 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12498 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12499 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12500 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12501 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12502 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12503 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12504 pub fn param<T>(
12505 mut self,
12506 name: T,
12507 value: T,
12508 ) -> ProjectLocationDatasetConsentStoreConsentRevokeCall<'a, C>
12509 where
12510 T: AsRef<str>,
12511 {
12512 self._additional_params
12513 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12514 self
12515 }
12516
12517 /// Identifies the authorization scope for the method you are building.
12518 ///
12519 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12520 /// [`Scope::CloudHealthcare`].
12521 ///
12522 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12523 /// tokens for more than one scope.
12524 ///
12525 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12526 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12527 /// sufficient, a read-write scope will do as well.
12528 pub fn add_scope<St>(
12529 mut self,
12530 scope: St,
12531 ) -> ProjectLocationDatasetConsentStoreConsentRevokeCall<'a, C>
12532 where
12533 St: AsRef<str>,
12534 {
12535 self._scopes.insert(String::from(scope.as_ref()));
12536 self
12537 }
12538 /// Identifies the authorization scope(s) for the method you are building.
12539 ///
12540 /// See [`Self::add_scope()`] for details.
12541 pub fn add_scopes<I, St>(
12542 mut self,
12543 scopes: I,
12544 ) -> ProjectLocationDatasetConsentStoreConsentRevokeCall<'a, C>
12545 where
12546 I: IntoIterator<Item = St>,
12547 St: AsRef<str>,
12548 {
12549 self._scopes
12550 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12551 self
12552 }
12553
12554 /// Removes all scopes, and no default scope will be used either.
12555 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12556 /// for details).
12557 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStoreConsentRevokeCall<'a, C> {
12558 self._scopes.clear();
12559 self
12560 }
12561}
12562
12563/// Archives the specified User data mapping.
12564///
12565/// A builder for the *locations.datasets.consentStores.userDataMappings.archive* method supported by a *project* resource.
12566/// It is not used directly, but through a [`ProjectMethods`] instance.
12567///
12568/// # Example
12569///
12570/// Instantiate a resource method builder
12571///
12572/// ```test_harness,no_run
12573/// # extern crate hyper;
12574/// # extern crate hyper_rustls;
12575/// # extern crate google_healthcare1 as healthcare1;
12576/// use healthcare1::api::ArchiveUserDataMappingRequest;
12577/// # async fn dox() {
12578/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12579///
12580/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12581/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12582/// # secret,
12583/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12584/// # ).build().await.unwrap();
12585///
12586/// # let client = hyper_util::client::legacy::Client::builder(
12587/// # hyper_util::rt::TokioExecutor::new()
12588/// # )
12589/// # .build(
12590/// # hyper_rustls::HttpsConnectorBuilder::new()
12591/// # .with_native_roots()
12592/// # .unwrap()
12593/// # .https_or_http()
12594/// # .enable_http1()
12595/// # .build()
12596/// # );
12597/// # let mut hub = CloudHealthcare::new(client, auth);
12598/// // As the method needs a request, you would usually fill it with the desired information
12599/// // into the respective structure. Some of the parts shown here might not be applicable !
12600/// // Values shown here are possibly random and not representative !
12601/// let mut req = ArchiveUserDataMappingRequest::default();
12602///
12603/// // You can configure optional parameters by calling the respective setters at will, and
12604/// // execute the final call using `doit()`.
12605/// // Values shown here are possibly random and not representative !
12606/// let result = hub.projects().locations_datasets_consent_stores_user_data_mappings_archive(req, "name")
12607/// .doit().await;
12608/// # }
12609/// ```
12610pub struct ProjectLocationDatasetConsentStoreUserDataMappingArchiveCall<'a, C>
12611where
12612 C: 'a,
12613{
12614 hub: &'a CloudHealthcare<C>,
12615 _request: ArchiveUserDataMappingRequest,
12616 _name: String,
12617 _delegate: Option<&'a mut dyn common::Delegate>,
12618 _additional_params: HashMap<String, String>,
12619 _scopes: BTreeSet<String>,
12620}
12621
12622impl<'a, C> common::CallBuilder
12623 for ProjectLocationDatasetConsentStoreUserDataMappingArchiveCall<'a, C>
12624{
12625}
12626
12627impl<'a, C> ProjectLocationDatasetConsentStoreUserDataMappingArchiveCall<'a, C>
12628where
12629 C: common::Connector,
12630{
12631 /// Perform the operation you have build so far.
12632 pub async fn doit(
12633 mut self,
12634 ) -> common::Result<(common::Response, ArchiveUserDataMappingResponse)> {
12635 use std::borrow::Cow;
12636 use std::io::{Read, Seek};
12637
12638 use common::{url::Params, ToParts};
12639 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12640
12641 let mut dd = common::DefaultDelegate;
12642 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12643 dlg.begin(common::MethodInfo {
12644 id: "healthcare.projects.locations.datasets.consentStores.userDataMappings.archive",
12645 http_method: hyper::Method::POST,
12646 });
12647
12648 for &field in ["alt", "name"].iter() {
12649 if self._additional_params.contains_key(field) {
12650 dlg.finished(false);
12651 return Err(common::Error::FieldClash(field));
12652 }
12653 }
12654
12655 let mut params = Params::with_capacity(4 + self._additional_params.len());
12656 params.push("name", self._name);
12657
12658 params.extend(self._additional_params.iter());
12659
12660 params.push("alt", "json");
12661 let mut url = self.hub._base_url.clone() + "v1/{+name}:archive";
12662 if self._scopes.is_empty() {
12663 self._scopes
12664 .insert(Scope::CloudHealthcare.as_ref().to_string());
12665 }
12666
12667 #[allow(clippy::single_element_loop)]
12668 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12669 url = params.uri_replacement(url, param_name, find_this, true);
12670 }
12671 {
12672 let to_remove = ["name"];
12673 params.remove_params(&to_remove);
12674 }
12675
12676 let url = params.parse_with_url(&url);
12677
12678 let mut json_mime_type = mime::APPLICATION_JSON;
12679 let mut request_value_reader = {
12680 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12681 common::remove_json_null_values(&mut value);
12682 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12683 serde_json::to_writer(&mut dst, &value).unwrap();
12684 dst
12685 };
12686 let request_size = request_value_reader
12687 .seek(std::io::SeekFrom::End(0))
12688 .unwrap();
12689 request_value_reader
12690 .seek(std::io::SeekFrom::Start(0))
12691 .unwrap();
12692
12693 loop {
12694 let token = match self
12695 .hub
12696 .auth
12697 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12698 .await
12699 {
12700 Ok(token) => token,
12701 Err(e) => match dlg.token(e) {
12702 Ok(token) => token,
12703 Err(e) => {
12704 dlg.finished(false);
12705 return Err(common::Error::MissingToken(e));
12706 }
12707 },
12708 };
12709 request_value_reader
12710 .seek(std::io::SeekFrom::Start(0))
12711 .unwrap();
12712 let mut req_result = {
12713 let client = &self.hub.client;
12714 dlg.pre_request();
12715 let mut req_builder = hyper::Request::builder()
12716 .method(hyper::Method::POST)
12717 .uri(url.as_str())
12718 .header(USER_AGENT, self.hub._user_agent.clone());
12719
12720 if let Some(token) = token.as_ref() {
12721 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12722 }
12723
12724 let request = req_builder
12725 .header(CONTENT_TYPE, json_mime_type.to_string())
12726 .header(CONTENT_LENGTH, request_size as u64)
12727 .body(common::to_body(
12728 request_value_reader.get_ref().clone().into(),
12729 ));
12730
12731 client.request(request.unwrap()).await
12732 };
12733
12734 match req_result {
12735 Err(err) => {
12736 if let common::Retry::After(d) = dlg.http_error(&err) {
12737 sleep(d).await;
12738 continue;
12739 }
12740 dlg.finished(false);
12741 return Err(common::Error::HttpError(err));
12742 }
12743 Ok(res) => {
12744 let (mut parts, body) = res.into_parts();
12745 let mut body = common::Body::new(body);
12746 if !parts.status.is_success() {
12747 let bytes = common::to_bytes(body).await.unwrap_or_default();
12748 let error = serde_json::from_str(&common::to_string(&bytes));
12749 let response = common::to_response(parts, bytes.into());
12750
12751 if let common::Retry::After(d) =
12752 dlg.http_failure(&response, error.as_ref().ok())
12753 {
12754 sleep(d).await;
12755 continue;
12756 }
12757
12758 dlg.finished(false);
12759
12760 return Err(match error {
12761 Ok(value) => common::Error::BadRequest(value),
12762 _ => common::Error::Failure(response),
12763 });
12764 }
12765 let response = {
12766 let bytes = common::to_bytes(body).await.unwrap_or_default();
12767 let encoded = common::to_string(&bytes);
12768 match serde_json::from_str(&encoded) {
12769 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12770 Err(error) => {
12771 dlg.response_json_decode_error(&encoded, &error);
12772 return Err(common::Error::JsonDecodeError(
12773 encoded.to_string(),
12774 error,
12775 ));
12776 }
12777 }
12778 };
12779
12780 dlg.finished(true);
12781 return Ok(response);
12782 }
12783 }
12784 }
12785 }
12786
12787 ///
12788 /// Sets the *request* property to the given value.
12789 ///
12790 /// Even though the property as already been set when instantiating this call,
12791 /// we provide this method for API completeness.
12792 pub fn request(
12793 mut self,
12794 new_value: ArchiveUserDataMappingRequest,
12795 ) -> ProjectLocationDatasetConsentStoreUserDataMappingArchiveCall<'a, C> {
12796 self._request = new_value;
12797 self
12798 }
12799 /// Required. The resource name of the User data mapping to archive.
12800 ///
12801 /// Sets the *name* path property to the given value.
12802 ///
12803 /// Even though the property as already been set when instantiating this call,
12804 /// we provide this method for API completeness.
12805 pub fn name(
12806 mut self,
12807 new_value: &str,
12808 ) -> ProjectLocationDatasetConsentStoreUserDataMappingArchiveCall<'a, C> {
12809 self._name = new_value.to_string();
12810 self
12811 }
12812 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12813 /// while executing the actual API request.
12814 ///
12815 /// ````text
12816 /// It should be used to handle progress information, and to implement a certain level of resilience.
12817 /// ````
12818 ///
12819 /// Sets the *delegate* property to the given value.
12820 pub fn delegate(
12821 mut self,
12822 new_value: &'a mut dyn common::Delegate,
12823 ) -> ProjectLocationDatasetConsentStoreUserDataMappingArchiveCall<'a, C> {
12824 self._delegate = Some(new_value);
12825 self
12826 }
12827
12828 /// Set any additional parameter of the query string used in the request.
12829 /// It should be used to set parameters which are not yet available through their own
12830 /// setters.
12831 ///
12832 /// Please note that this method must not be used to set any of the known parameters
12833 /// which have their own setter method. If done anyway, the request will fail.
12834 ///
12835 /// # Additional Parameters
12836 ///
12837 /// * *$.xgafv* (query-string) - V1 error format.
12838 /// * *access_token* (query-string) - OAuth access token.
12839 /// * *alt* (query-string) - Data format for response.
12840 /// * *callback* (query-string) - JSONP
12841 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12842 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12843 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12844 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12845 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12846 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12847 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12848 pub fn param<T>(
12849 mut self,
12850 name: T,
12851 value: T,
12852 ) -> ProjectLocationDatasetConsentStoreUserDataMappingArchiveCall<'a, C>
12853 where
12854 T: AsRef<str>,
12855 {
12856 self._additional_params
12857 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12858 self
12859 }
12860
12861 /// Identifies the authorization scope for the method you are building.
12862 ///
12863 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12864 /// [`Scope::CloudHealthcare`].
12865 ///
12866 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12867 /// tokens for more than one scope.
12868 ///
12869 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12870 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12871 /// sufficient, a read-write scope will do as well.
12872 pub fn add_scope<St>(
12873 mut self,
12874 scope: St,
12875 ) -> ProjectLocationDatasetConsentStoreUserDataMappingArchiveCall<'a, C>
12876 where
12877 St: AsRef<str>,
12878 {
12879 self._scopes.insert(String::from(scope.as_ref()));
12880 self
12881 }
12882 /// Identifies the authorization scope(s) for the method you are building.
12883 ///
12884 /// See [`Self::add_scope()`] for details.
12885 pub fn add_scopes<I, St>(
12886 mut self,
12887 scopes: I,
12888 ) -> ProjectLocationDatasetConsentStoreUserDataMappingArchiveCall<'a, C>
12889 where
12890 I: IntoIterator<Item = St>,
12891 St: AsRef<str>,
12892 {
12893 self._scopes
12894 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12895 self
12896 }
12897
12898 /// Removes all scopes, and no default scope will be used either.
12899 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12900 /// for details).
12901 pub fn clear_scopes(
12902 mut self,
12903 ) -> ProjectLocationDatasetConsentStoreUserDataMappingArchiveCall<'a, C> {
12904 self._scopes.clear();
12905 self
12906 }
12907}
12908
12909/// Creates a new User data mapping in the parent consent store.
12910///
12911/// A builder for the *locations.datasets.consentStores.userDataMappings.create* method supported by a *project* resource.
12912/// It is not used directly, but through a [`ProjectMethods`] instance.
12913///
12914/// # Example
12915///
12916/// Instantiate a resource method builder
12917///
12918/// ```test_harness,no_run
12919/// # extern crate hyper;
12920/// # extern crate hyper_rustls;
12921/// # extern crate google_healthcare1 as healthcare1;
12922/// use healthcare1::api::UserDataMapping;
12923/// # async fn dox() {
12924/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12925///
12926/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12927/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12928/// # secret,
12929/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12930/// # ).build().await.unwrap();
12931///
12932/// # let client = hyper_util::client::legacy::Client::builder(
12933/// # hyper_util::rt::TokioExecutor::new()
12934/// # )
12935/// # .build(
12936/// # hyper_rustls::HttpsConnectorBuilder::new()
12937/// # .with_native_roots()
12938/// # .unwrap()
12939/// # .https_or_http()
12940/// # .enable_http1()
12941/// # .build()
12942/// # );
12943/// # let mut hub = CloudHealthcare::new(client, auth);
12944/// // As the method needs a request, you would usually fill it with the desired information
12945/// // into the respective structure. Some of the parts shown here might not be applicable !
12946/// // Values shown here are possibly random and not representative !
12947/// let mut req = UserDataMapping::default();
12948///
12949/// // You can configure optional parameters by calling the respective setters at will, and
12950/// // execute the final call using `doit()`.
12951/// // Values shown here are possibly random and not representative !
12952/// let result = hub.projects().locations_datasets_consent_stores_user_data_mappings_create(req, "parent")
12953/// .doit().await;
12954/// # }
12955/// ```
12956pub struct ProjectLocationDatasetConsentStoreUserDataMappingCreateCall<'a, C>
12957where
12958 C: 'a,
12959{
12960 hub: &'a CloudHealthcare<C>,
12961 _request: UserDataMapping,
12962 _parent: String,
12963 _delegate: Option<&'a mut dyn common::Delegate>,
12964 _additional_params: HashMap<String, String>,
12965 _scopes: BTreeSet<String>,
12966}
12967
12968impl<'a, C> common::CallBuilder
12969 for ProjectLocationDatasetConsentStoreUserDataMappingCreateCall<'a, C>
12970{
12971}
12972
12973impl<'a, C> ProjectLocationDatasetConsentStoreUserDataMappingCreateCall<'a, C>
12974where
12975 C: common::Connector,
12976{
12977 /// Perform the operation you have build so far.
12978 pub async fn doit(mut self) -> common::Result<(common::Response, UserDataMapping)> {
12979 use std::borrow::Cow;
12980 use std::io::{Read, Seek};
12981
12982 use common::{url::Params, ToParts};
12983 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12984
12985 let mut dd = common::DefaultDelegate;
12986 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12987 dlg.begin(common::MethodInfo {
12988 id: "healthcare.projects.locations.datasets.consentStores.userDataMappings.create",
12989 http_method: hyper::Method::POST,
12990 });
12991
12992 for &field in ["alt", "parent"].iter() {
12993 if self._additional_params.contains_key(field) {
12994 dlg.finished(false);
12995 return Err(common::Error::FieldClash(field));
12996 }
12997 }
12998
12999 let mut params = Params::with_capacity(4 + self._additional_params.len());
13000 params.push("parent", self._parent);
13001
13002 params.extend(self._additional_params.iter());
13003
13004 params.push("alt", "json");
13005 let mut url = self.hub._base_url.clone() + "v1/{+parent}/userDataMappings";
13006 if self._scopes.is_empty() {
13007 self._scopes
13008 .insert(Scope::CloudHealthcare.as_ref().to_string());
13009 }
13010
13011 #[allow(clippy::single_element_loop)]
13012 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13013 url = params.uri_replacement(url, param_name, find_this, true);
13014 }
13015 {
13016 let to_remove = ["parent"];
13017 params.remove_params(&to_remove);
13018 }
13019
13020 let url = params.parse_with_url(&url);
13021
13022 let mut json_mime_type = mime::APPLICATION_JSON;
13023 let mut request_value_reader = {
13024 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13025 common::remove_json_null_values(&mut value);
13026 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13027 serde_json::to_writer(&mut dst, &value).unwrap();
13028 dst
13029 };
13030 let request_size = request_value_reader
13031 .seek(std::io::SeekFrom::End(0))
13032 .unwrap();
13033 request_value_reader
13034 .seek(std::io::SeekFrom::Start(0))
13035 .unwrap();
13036
13037 loop {
13038 let token = match self
13039 .hub
13040 .auth
13041 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13042 .await
13043 {
13044 Ok(token) => token,
13045 Err(e) => match dlg.token(e) {
13046 Ok(token) => token,
13047 Err(e) => {
13048 dlg.finished(false);
13049 return Err(common::Error::MissingToken(e));
13050 }
13051 },
13052 };
13053 request_value_reader
13054 .seek(std::io::SeekFrom::Start(0))
13055 .unwrap();
13056 let mut req_result = {
13057 let client = &self.hub.client;
13058 dlg.pre_request();
13059 let mut req_builder = hyper::Request::builder()
13060 .method(hyper::Method::POST)
13061 .uri(url.as_str())
13062 .header(USER_AGENT, self.hub._user_agent.clone());
13063
13064 if let Some(token) = token.as_ref() {
13065 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13066 }
13067
13068 let request = req_builder
13069 .header(CONTENT_TYPE, json_mime_type.to_string())
13070 .header(CONTENT_LENGTH, request_size as u64)
13071 .body(common::to_body(
13072 request_value_reader.get_ref().clone().into(),
13073 ));
13074
13075 client.request(request.unwrap()).await
13076 };
13077
13078 match req_result {
13079 Err(err) => {
13080 if let common::Retry::After(d) = dlg.http_error(&err) {
13081 sleep(d).await;
13082 continue;
13083 }
13084 dlg.finished(false);
13085 return Err(common::Error::HttpError(err));
13086 }
13087 Ok(res) => {
13088 let (mut parts, body) = res.into_parts();
13089 let mut body = common::Body::new(body);
13090 if !parts.status.is_success() {
13091 let bytes = common::to_bytes(body).await.unwrap_or_default();
13092 let error = serde_json::from_str(&common::to_string(&bytes));
13093 let response = common::to_response(parts, bytes.into());
13094
13095 if let common::Retry::After(d) =
13096 dlg.http_failure(&response, error.as_ref().ok())
13097 {
13098 sleep(d).await;
13099 continue;
13100 }
13101
13102 dlg.finished(false);
13103
13104 return Err(match error {
13105 Ok(value) => common::Error::BadRequest(value),
13106 _ => common::Error::Failure(response),
13107 });
13108 }
13109 let response = {
13110 let bytes = common::to_bytes(body).await.unwrap_or_default();
13111 let encoded = common::to_string(&bytes);
13112 match serde_json::from_str(&encoded) {
13113 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13114 Err(error) => {
13115 dlg.response_json_decode_error(&encoded, &error);
13116 return Err(common::Error::JsonDecodeError(
13117 encoded.to_string(),
13118 error,
13119 ));
13120 }
13121 }
13122 };
13123
13124 dlg.finished(true);
13125 return Ok(response);
13126 }
13127 }
13128 }
13129 }
13130
13131 ///
13132 /// Sets the *request* property to the given value.
13133 ///
13134 /// Even though the property as already been set when instantiating this call,
13135 /// we provide this method for API completeness.
13136 pub fn request(
13137 mut self,
13138 new_value: UserDataMapping,
13139 ) -> ProjectLocationDatasetConsentStoreUserDataMappingCreateCall<'a, C> {
13140 self._request = new_value;
13141 self
13142 }
13143 /// Required. Name of the consent store.
13144 ///
13145 /// Sets the *parent* path property to the given value.
13146 ///
13147 /// Even though the property as already been set when instantiating this call,
13148 /// we provide this method for API completeness.
13149 pub fn parent(
13150 mut self,
13151 new_value: &str,
13152 ) -> ProjectLocationDatasetConsentStoreUserDataMappingCreateCall<'a, C> {
13153 self._parent = new_value.to_string();
13154 self
13155 }
13156 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13157 /// while executing the actual API request.
13158 ///
13159 /// ````text
13160 /// It should be used to handle progress information, and to implement a certain level of resilience.
13161 /// ````
13162 ///
13163 /// Sets the *delegate* property to the given value.
13164 pub fn delegate(
13165 mut self,
13166 new_value: &'a mut dyn common::Delegate,
13167 ) -> ProjectLocationDatasetConsentStoreUserDataMappingCreateCall<'a, C> {
13168 self._delegate = Some(new_value);
13169 self
13170 }
13171
13172 /// Set any additional parameter of the query string used in the request.
13173 /// It should be used to set parameters which are not yet available through their own
13174 /// setters.
13175 ///
13176 /// Please note that this method must not be used to set any of the known parameters
13177 /// which have their own setter method. If done anyway, the request will fail.
13178 ///
13179 /// # Additional Parameters
13180 ///
13181 /// * *$.xgafv* (query-string) - V1 error format.
13182 /// * *access_token* (query-string) - OAuth access token.
13183 /// * *alt* (query-string) - Data format for response.
13184 /// * *callback* (query-string) - JSONP
13185 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13186 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13187 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13188 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13189 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13190 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13191 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13192 pub fn param<T>(
13193 mut self,
13194 name: T,
13195 value: T,
13196 ) -> ProjectLocationDatasetConsentStoreUserDataMappingCreateCall<'a, C>
13197 where
13198 T: AsRef<str>,
13199 {
13200 self._additional_params
13201 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13202 self
13203 }
13204
13205 /// Identifies the authorization scope for the method you are building.
13206 ///
13207 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13208 /// [`Scope::CloudHealthcare`].
13209 ///
13210 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13211 /// tokens for more than one scope.
13212 ///
13213 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13214 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13215 /// sufficient, a read-write scope will do as well.
13216 pub fn add_scope<St>(
13217 mut self,
13218 scope: St,
13219 ) -> ProjectLocationDatasetConsentStoreUserDataMappingCreateCall<'a, C>
13220 where
13221 St: AsRef<str>,
13222 {
13223 self._scopes.insert(String::from(scope.as_ref()));
13224 self
13225 }
13226 /// Identifies the authorization scope(s) for the method you are building.
13227 ///
13228 /// See [`Self::add_scope()`] for details.
13229 pub fn add_scopes<I, St>(
13230 mut self,
13231 scopes: I,
13232 ) -> ProjectLocationDatasetConsentStoreUserDataMappingCreateCall<'a, C>
13233 where
13234 I: IntoIterator<Item = St>,
13235 St: AsRef<str>,
13236 {
13237 self._scopes
13238 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13239 self
13240 }
13241
13242 /// Removes all scopes, and no default scope will be used either.
13243 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13244 /// for details).
13245 pub fn clear_scopes(
13246 mut self,
13247 ) -> ProjectLocationDatasetConsentStoreUserDataMappingCreateCall<'a, C> {
13248 self._scopes.clear();
13249 self
13250 }
13251}
13252
13253/// Deletes the specified User data mapping.
13254///
13255/// A builder for the *locations.datasets.consentStores.userDataMappings.delete* method supported by a *project* resource.
13256/// It is not used directly, but through a [`ProjectMethods`] instance.
13257///
13258/// # Example
13259///
13260/// Instantiate a resource method builder
13261///
13262/// ```test_harness,no_run
13263/// # extern crate hyper;
13264/// # extern crate hyper_rustls;
13265/// # extern crate google_healthcare1 as healthcare1;
13266/// # async fn dox() {
13267/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13268///
13269/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13270/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13271/// # secret,
13272/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13273/// # ).build().await.unwrap();
13274///
13275/// # let client = hyper_util::client::legacy::Client::builder(
13276/// # hyper_util::rt::TokioExecutor::new()
13277/// # )
13278/// # .build(
13279/// # hyper_rustls::HttpsConnectorBuilder::new()
13280/// # .with_native_roots()
13281/// # .unwrap()
13282/// # .https_or_http()
13283/// # .enable_http1()
13284/// # .build()
13285/// # );
13286/// # let mut hub = CloudHealthcare::new(client, auth);
13287/// // You can configure optional parameters by calling the respective setters at will, and
13288/// // execute the final call using `doit()`.
13289/// // Values shown here are possibly random and not representative !
13290/// let result = hub.projects().locations_datasets_consent_stores_user_data_mappings_delete("name")
13291/// .doit().await;
13292/// # }
13293/// ```
13294pub struct ProjectLocationDatasetConsentStoreUserDataMappingDeleteCall<'a, C>
13295where
13296 C: 'a,
13297{
13298 hub: &'a CloudHealthcare<C>,
13299 _name: String,
13300 _delegate: Option<&'a mut dyn common::Delegate>,
13301 _additional_params: HashMap<String, String>,
13302 _scopes: BTreeSet<String>,
13303}
13304
13305impl<'a, C> common::CallBuilder
13306 for ProjectLocationDatasetConsentStoreUserDataMappingDeleteCall<'a, C>
13307{
13308}
13309
13310impl<'a, C> ProjectLocationDatasetConsentStoreUserDataMappingDeleteCall<'a, C>
13311where
13312 C: common::Connector,
13313{
13314 /// Perform the operation you have build so far.
13315 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
13316 use std::borrow::Cow;
13317 use std::io::{Read, Seek};
13318
13319 use common::{url::Params, ToParts};
13320 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13321
13322 let mut dd = common::DefaultDelegate;
13323 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13324 dlg.begin(common::MethodInfo {
13325 id: "healthcare.projects.locations.datasets.consentStores.userDataMappings.delete",
13326 http_method: hyper::Method::DELETE,
13327 });
13328
13329 for &field in ["alt", "name"].iter() {
13330 if self._additional_params.contains_key(field) {
13331 dlg.finished(false);
13332 return Err(common::Error::FieldClash(field));
13333 }
13334 }
13335
13336 let mut params = Params::with_capacity(3 + self._additional_params.len());
13337 params.push("name", self._name);
13338
13339 params.extend(self._additional_params.iter());
13340
13341 params.push("alt", "json");
13342 let mut url = self.hub._base_url.clone() + "v1/{+name}";
13343 if self._scopes.is_empty() {
13344 self._scopes
13345 .insert(Scope::CloudHealthcare.as_ref().to_string());
13346 }
13347
13348 #[allow(clippy::single_element_loop)]
13349 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13350 url = params.uri_replacement(url, param_name, find_this, true);
13351 }
13352 {
13353 let to_remove = ["name"];
13354 params.remove_params(&to_remove);
13355 }
13356
13357 let url = params.parse_with_url(&url);
13358
13359 loop {
13360 let token = match self
13361 .hub
13362 .auth
13363 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13364 .await
13365 {
13366 Ok(token) => token,
13367 Err(e) => match dlg.token(e) {
13368 Ok(token) => token,
13369 Err(e) => {
13370 dlg.finished(false);
13371 return Err(common::Error::MissingToken(e));
13372 }
13373 },
13374 };
13375 let mut req_result = {
13376 let client = &self.hub.client;
13377 dlg.pre_request();
13378 let mut req_builder = hyper::Request::builder()
13379 .method(hyper::Method::DELETE)
13380 .uri(url.as_str())
13381 .header(USER_AGENT, self.hub._user_agent.clone());
13382
13383 if let Some(token) = token.as_ref() {
13384 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13385 }
13386
13387 let request = req_builder
13388 .header(CONTENT_LENGTH, 0_u64)
13389 .body(common::to_body::<String>(None));
13390
13391 client.request(request.unwrap()).await
13392 };
13393
13394 match req_result {
13395 Err(err) => {
13396 if let common::Retry::After(d) = dlg.http_error(&err) {
13397 sleep(d).await;
13398 continue;
13399 }
13400 dlg.finished(false);
13401 return Err(common::Error::HttpError(err));
13402 }
13403 Ok(res) => {
13404 let (mut parts, body) = res.into_parts();
13405 let mut body = common::Body::new(body);
13406 if !parts.status.is_success() {
13407 let bytes = common::to_bytes(body).await.unwrap_or_default();
13408 let error = serde_json::from_str(&common::to_string(&bytes));
13409 let response = common::to_response(parts, bytes.into());
13410
13411 if let common::Retry::After(d) =
13412 dlg.http_failure(&response, error.as_ref().ok())
13413 {
13414 sleep(d).await;
13415 continue;
13416 }
13417
13418 dlg.finished(false);
13419
13420 return Err(match error {
13421 Ok(value) => common::Error::BadRequest(value),
13422 _ => common::Error::Failure(response),
13423 });
13424 }
13425 let response = {
13426 let bytes = common::to_bytes(body).await.unwrap_or_default();
13427 let encoded = common::to_string(&bytes);
13428 match serde_json::from_str(&encoded) {
13429 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13430 Err(error) => {
13431 dlg.response_json_decode_error(&encoded, &error);
13432 return Err(common::Error::JsonDecodeError(
13433 encoded.to_string(),
13434 error,
13435 ));
13436 }
13437 }
13438 };
13439
13440 dlg.finished(true);
13441 return Ok(response);
13442 }
13443 }
13444 }
13445 }
13446
13447 /// Required. The resource name of the User data mapping to delete.
13448 ///
13449 /// Sets the *name* path property to the given value.
13450 ///
13451 /// Even though the property as already been set when instantiating this call,
13452 /// we provide this method for API completeness.
13453 pub fn name(
13454 mut self,
13455 new_value: &str,
13456 ) -> ProjectLocationDatasetConsentStoreUserDataMappingDeleteCall<'a, C> {
13457 self._name = new_value.to_string();
13458 self
13459 }
13460 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13461 /// while executing the actual API request.
13462 ///
13463 /// ````text
13464 /// It should be used to handle progress information, and to implement a certain level of resilience.
13465 /// ````
13466 ///
13467 /// Sets the *delegate* property to the given value.
13468 pub fn delegate(
13469 mut self,
13470 new_value: &'a mut dyn common::Delegate,
13471 ) -> ProjectLocationDatasetConsentStoreUserDataMappingDeleteCall<'a, C> {
13472 self._delegate = Some(new_value);
13473 self
13474 }
13475
13476 /// Set any additional parameter of the query string used in the request.
13477 /// It should be used to set parameters which are not yet available through their own
13478 /// setters.
13479 ///
13480 /// Please note that this method must not be used to set any of the known parameters
13481 /// which have their own setter method. If done anyway, the request will fail.
13482 ///
13483 /// # Additional Parameters
13484 ///
13485 /// * *$.xgafv* (query-string) - V1 error format.
13486 /// * *access_token* (query-string) - OAuth access token.
13487 /// * *alt* (query-string) - Data format for response.
13488 /// * *callback* (query-string) - JSONP
13489 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13490 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13491 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13492 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13493 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13494 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13495 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13496 pub fn param<T>(
13497 mut self,
13498 name: T,
13499 value: T,
13500 ) -> ProjectLocationDatasetConsentStoreUserDataMappingDeleteCall<'a, C>
13501 where
13502 T: AsRef<str>,
13503 {
13504 self._additional_params
13505 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13506 self
13507 }
13508
13509 /// Identifies the authorization scope for the method you are building.
13510 ///
13511 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13512 /// [`Scope::CloudHealthcare`].
13513 ///
13514 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13515 /// tokens for more than one scope.
13516 ///
13517 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13518 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13519 /// sufficient, a read-write scope will do as well.
13520 pub fn add_scope<St>(
13521 mut self,
13522 scope: St,
13523 ) -> ProjectLocationDatasetConsentStoreUserDataMappingDeleteCall<'a, C>
13524 where
13525 St: AsRef<str>,
13526 {
13527 self._scopes.insert(String::from(scope.as_ref()));
13528 self
13529 }
13530 /// Identifies the authorization scope(s) for the method you are building.
13531 ///
13532 /// See [`Self::add_scope()`] for details.
13533 pub fn add_scopes<I, St>(
13534 mut self,
13535 scopes: I,
13536 ) -> ProjectLocationDatasetConsentStoreUserDataMappingDeleteCall<'a, C>
13537 where
13538 I: IntoIterator<Item = St>,
13539 St: AsRef<str>,
13540 {
13541 self._scopes
13542 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13543 self
13544 }
13545
13546 /// Removes all scopes, and no default scope will be used either.
13547 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13548 /// for details).
13549 pub fn clear_scopes(
13550 mut self,
13551 ) -> ProjectLocationDatasetConsentStoreUserDataMappingDeleteCall<'a, C> {
13552 self._scopes.clear();
13553 self
13554 }
13555}
13556
13557/// Gets the specified User data mapping.
13558///
13559/// A builder for the *locations.datasets.consentStores.userDataMappings.get* method supported by a *project* resource.
13560/// It is not used directly, but through a [`ProjectMethods`] instance.
13561///
13562/// # Example
13563///
13564/// Instantiate a resource method builder
13565///
13566/// ```test_harness,no_run
13567/// # extern crate hyper;
13568/// # extern crate hyper_rustls;
13569/// # extern crate google_healthcare1 as healthcare1;
13570/// # async fn dox() {
13571/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13572///
13573/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13574/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13575/// # secret,
13576/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13577/// # ).build().await.unwrap();
13578///
13579/// # let client = hyper_util::client::legacy::Client::builder(
13580/// # hyper_util::rt::TokioExecutor::new()
13581/// # )
13582/// # .build(
13583/// # hyper_rustls::HttpsConnectorBuilder::new()
13584/// # .with_native_roots()
13585/// # .unwrap()
13586/// # .https_or_http()
13587/// # .enable_http1()
13588/// # .build()
13589/// # );
13590/// # let mut hub = CloudHealthcare::new(client, auth);
13591/// // You can configure optional parameters by calling the respective setters at will, and
13592/// // execute the final call using `doit()`.
13593/// // Values shown here are possibly random and not representative !
13594/// let result = hub.projects().locations_datasets_consent_stores_user_data_mappings_get("name")
13595/// .doit().await;
13596/// # }
13597/// ```
13598pub struct ProjectLocationDatasetConsentStoreUserDataMappingGetCall<'a, C>
13599where
13600 C: 'a,
13601{
13602 hub: &'a CloudHealthcare<C>,
13603 _name: String,
13604 _delegate: Option<&'a mut dyn common::Delegate>,
13605 _additional_params: HashMap<String, String>,
13606 _scopes: BTreeSet<String>,
13607}
13608
13609impl<'a, C> common::CallBuilder
13610 for ProjectLocationDatasetConsentStoreUserDataMappingGetCall<'a, C>
13611{
13612}
13613
13614impl<'a, C> ProjectLocationDatasetConsentStoreUserDataMappingGetCall<'a, C>
13615where
13616 C: common::Connector,
13617{
13618 /// Perform the operation you have build so far.
13619 pub async fn doit(mut self) -> common::Result<(common::Response, UserDataMapping)> {
13620 use std::borrow::Cow;
13621 use std::io::{Read, Seek};
13622
13623 use common::{url::Params, ToParts};
13624 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13625
13626 let mut dd = common::DefaultDelegate;
13627 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13628 dlg.begin(common::MethodInfo {
13629 id: "healthcare.projects.locations.datasets.consentStores.userDataMappings.get",
13630 http_method: hyper::Method::GET,
13631 });
13632
13633 for &field in ["alt", "name"].iter() {
13634 if self._additional_params.contains_key(field) {
13635 dlg.finished(false);
13636 return Err(common::Error::FieldClash(field));
13637 }
13638 }
13639
13640 let mut params = Params::with_capacity(3 + self._additional_params.len());
13641 params.push("name", self._name);
13642
13643 params.extend(self._additional_params.iter());
13644
13645 params.push("alt", "json");
13646 let mut url = self.hub._base_url.clone() + "v1/{+name}";
13647 if self._scopes.is_empty() {
13648 self._scopes
13649 .insert(Scope::CloudHealthcare.as_ref().to_string());
13650 }
13651
13652 #[allow(clippy::single_element_loop)]
13653 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13654 url = params.uri_replacement(url, param_name, find_this, true);
13655 }
13656 {
13657 let to_remove = ["name"];
13658 params.remove_params(&to_remove);
13659 }
13660
13661 let url = params.parse_with_url(&url);
13662
13663 loop {
13664 let token = match self
13665 .hub
13666 .auth
13667 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13668 .await
13669 {
13670 Ok(token) => token,
13671 Err(e) => match dlg.token(e) {
13672 Ok(token) => token,
13673 Err(e) => {
13674 dlg.finished(false);
13675 return Err(common::Error::MissingToken(e));
13676 }
13677 },
13678 };
13679 let mut req_result = {
13680 let client = &self.hub.client;
13681 dlg.pre_request();
13682 let mut req_builder = hyper::Request::builder()
13683 .method(hyper::Method::GET)
13684 .uri(url.as_str())
13685 .header(USER_AGENT, self.hub._user_agent.clone());
13686
13687 if let Some(token) = token.as_ref() {
13688 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13689 }
13690
13691 let request = req_builder
13692 .header(CONTENT_LENGTH, 0_u64)
13693 .body(common::to_body::<String>(None));
13694
13695 client.request(request.unwrap()).await
13696 };
13697
13698 match req_result {
13699 Err(err) => {
13700 if let common::Retry::After(d) = dlg.http_error(&err) {
13701 sleep(d).await;
13702 continue;
13703 }
13704 dlg.finished(false);
13705 return Err(common::Error::HttpError(err));
13706 }
13707 Ok(res) => {
13708 let (mut parts, body) = res.into_parts();
13709 let mut body = common::Body::new(body);
13710 if !parts.status.is_success() {
13711 let bytes = common::to_bytes(body).await.unwrap_or_default();
13712 let error = serde_json::from_str(&common::to_string(&bytes));
13713 let response = common::to_response(parts, bytes.into());
13714
13715 if let common::Retry::After(d) =
13716 dlg.http_failure(&response, error.as_ref().ok())
13717 {
13718 sleep(d).await;
13719 continue;
13720 }
13721
13722 dlg.finished(false);
13723
13724 return Err(match error {
13725 Ok(value) => common::Error::BadRequest(value),
13726 _ => common::Error::Failure(response),
13727 });
13728 }
13729 let response = {
13730 let bytes = common::to_bytes(body).await.unwrap_or_default();
13731 let encoded = common::to_string(&bytes);
13732 match serde_json::from_str(&encoded) {
13733 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13734 Err(error) => {
13735 dlg.response_json_decode_error(&encoded, &error);
13736 return Err(common::Error::JsonDecodeError(
13737 encoded.to_string(),
13738 error,
13739 ));
13740 }
13741 }
13742 };
13743
13744 dlg.finished(true);
13745 return Ok(response);
13746 }
13747 }
13748 }
13749 }
13750
13751 /// Required. The resource name of the User data mapping to retrieve.
13752 ///
13753 /// Sets the *name* path property to the given value.
13754 ///
13755 /// Even though the property as already been set when instantiating this call,
13756 /// we provide this method for API completeness.
13757 pub fn name(
13758 mut self,
13759 new_value: &str,
13760 ) -> ProjectLocationDatasetConsentStoreUserDataMappingGetCall<'a, C> {
13761 self._name = new_value.to_string();
13762 self
13763 }
13764 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13765 /// while executing the actual API request.
13766 ///
13767 /// ````text
13768 /// It should be used to handle progress information, and to implement a certain level of resilience.
13769 /// ````
13770 ///
13771 /// Sets the *delegate* property to the given value.
13772 pub fn delegate(
13773 mut self,
13774 new_value: &'a mut dyn common::Delegate,
13775 ) -> ProjectLocationDatasetConsentStoreUserDataMappingGetCall<'a, C> {
13776 self._delegate = Some(new_value);
13777 self
13778 }
13779
13780 /// Set any additional parameter of the query string used in the request.
13781 /// It should be used to set parameters which are not yet available through their own
13782 /// setters.
13783 ///
13784 /// Please note that this method must not be used to set any of the known parameters
13785 /// which have their own setter method. If done anyway, the request will fail.
13786 ///
13787 /// # Additional Parameters
13788 ///
13789 /// * *$.xgafv* (query-string) - V1 error format.
13790 /// * *access_token* (query-string) - OAuth access token.
13791 /// * *alt* (query-string) - Data format for response.
13792 /// * *callback* (query-string) - JSONP
13793 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13794 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13795 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13796 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13797 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13798 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13799 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13800 pub fn param<T>(
13801 mut self,
13802 name: T,
13803 value: T,
13804 ) -> ProjectLocationDatasetConsentStoreUserDataMappingGetCall<'a, C>
13805 where
13806 T: AsRef<str>,
13807 {
13808 self._additional_params
13809 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13810 self
13811 }
13812
13813 /// Identifies the authorization scope for the method you are building.
13814 ///
13815 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13816 /// [`Scope::CloudHealthcare`].
13817 ///
13818 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13819 /// tokens for more than one scope.
13820 ///
13821 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13822 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13823 /// sufficient, a read-write scope will do as well.
13824 pub fn add_scope<St>(
13825 mut self,
13826 scope: St,
13827 ) -> ProjectLocationDatasetConsentStoreUserDataMappingGetCall<'a, C>
13828 where
13829 St: AsRef<str>,
13830 {
13831 self._scopes.insert(String::from(scope.as_ref()));
13832 self
13833 }
13834 /// Identifies the authorization scope(s) for the method you are building.
13835 ///
13836 /// See [`Self::add_scope()`] for details.
13837 pub fn add_scopes<I, St>(
13838 mut self,
13839 scopes: I,
13840 ) -> ProjectLocationDatasetConsentStoreUserDataMappingGetCall<'a, C>
13841 where
13842 I: IntoIterator<Item = St>,
13843 St: AsRef<str>,
13844 {
13845 self._scopes
13846 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13847 self
13848 }
13849
13850 /// Removes all scopes, and no default scope will be used either.
13851 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13852 /// for details).
13853 pub fn clear_scopes(
13854 mut self,
13855 ) -> ProjectLocationDatasetConsentStoreUserDataMappingGetCall<'a, C> {
13856 self._scopes.clear();
13857 self
13858 }
13859}
13860
13861/// Lists the User data mappings in the specified consent store.
13862///
13863/// A builder for the *locations.datasets.consentStores.userDataMappings.list* method supported by a *project* resource.
13864/// It is not used directly, but through a [`ProjectMethods`] instance.
13865///
13866/// # Example
13867///
13868/// Instantiate a resource method builder
13869///
13870/// ```test_harness,no_run
13871/// # extern crate hyper;
13872/// # extern crate hyper_rustls;
13873/// # extern crate google_healthcare1 as healthcare1;
13874/// # async fn dox() {
13875/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13876///
13877/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13878/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13879/// # secret,
13880/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13881/// # ).build().await.unwrap();
13882///
13883/// # let client = hyper_util::client::legacy::Client::builder(
13884/// # hyper_util::rt::TokioExecutor::new()
13885/// # )
13886/// # .build(
13887/// # hyper_rustls::HttpsConnectorBuilder::new()
13888/// # .with_native_roots()
13889/// # .unwrap()
13890/// # .https_or_http()
13891/// # .enable_http1()
13892/// # .build()
13893/// # );
13894/// # let mut hub = CloudHealthcare::new(client, auth);
13895/// // You can configure optional parameters by calling the respective setters at will, and
13896/// // execute the final call using `doit()`.
13897/// // Values shown here are possibly random and not representative !
13898/// let result = hub.projects().locations_datasets_consent_stores_user_data_mappings_list("parent")
13899/// .page_token("dolor")
13900/// .page_size(-18)
13901/// .filter("et")
13902/// .doit().await;
13903/// # }
13904/// ```
13905pub struct ProjectLocationDatasetConsentStoreUserDataMappingListCall<'a, C>
13906where
13907 C: 'a,
13908{
13909 hub: &'a CloudHealthcare<C>,
13910 _parent: String,
13911 _page_token: Option<String>,
13912 _page_size: Option<i32>,
13913 _filter: Option<String>,
13914 _delegate: Option<&'a mut dyn common::Delegate>,
13915 _additional_params: HashMap<String, String>,
13916 _scopes: BTreeSet<String>,
13917}
13918
13919impl<'a, C> common::CallBuilder
13920 for ProjectLocationDatasetConsentStoreUserDataMappingListCall<'a, C>
13921{
13922}
13923
13924impl<'a, C> ProjectLocationDatasetConsentStoreUserDataMappingListCall<'a, C>
13925where
13926 C: common::Connector,
13927{
13928 /// Perform the operation you have build so far.
13929 pub async fn doit(
13930 mut self,
13931 ) -> common::Result<(common::Response, ListUserDataMappingsResponse)> {
13932 use std::borrow::Cow;
13933 use std::io::{Read, Seek};
13934
13935 use common::{url::Params, ToParts};
13936 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13937
13938 let mut dd = common::DefaultDelegate;
13939 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13940 dlg.begin(common::MethodInfo {
13941 id: "healthcare.projects.locations.datasets.consentStores.userDataMappings.list",
13942 http_method: hyper::Method::GET,
13943 });
13944
13945 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
13946 if self._additional_params.contains_key(field) {
13947 dlg.finished(false);
13948 return Err(common::Error::FieldClash(field));
13949 }
13950 }
13951
13952 let mut params = Params::with_capacity(6 + self._additional_params.len());
13953 params.push("parent", self._parent);
13954 if let Some(value) = self._page_token.as_ref() {
13955 params.push("pageToken", value);
13956 }
13957 if let Some(value) = self._page_size.as_ref() {
13958 params.push("pageSize", value.to_string());
13959 }
13960 if let Some(value) = self._filter.as_ref() {
13961 params.push("filter", value);
13962 }
13963
13964 params.extend(self._additional_params.iter());
13965
13966 params.push("alt", "json");
13967 let mut url = self.hub._base_url.clone() + "v1/{+parent}/userDataMappings";
13968 if self._scopes.is_empty() {
13969 self._scopes
13970 .insert(Scope::CloudHealthcare.as_ref().to_string());
13971 }
13972
13973 #[allow(clippy::single_element_loop)]
13974 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13975 url = params.uri_replacement(url, param_name, find_this, true);
13976 }
13977 {
13978 let to_remove = ["parent"];
13979 params.remove_params(&to_remove);
13980 }
13981
13982 let url = params.parse_with_url(&url);
13983
13984 loop {
13985 let token = match self
13986 .hub
13987 .auth
13988 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13989 .await
13990 {
13991 Ok(token) => token,
13992 Err(e) => match dlg.token(e) {
13993 Ok(token) => token,
13994 Err(e) => {
13995 dlg.finished(false);
13996 return Err(common::Error::MissingToken(e));
13997 }
13998 },
13999 };
14000 let mut req_result = {
14001 let client = &self.hub.client;
14002 dlg.pre_request();
14003 let mut req_builder = hyper::Request::builder()
14004 .method(hyper::Method::GET)
14005 .uri(url.as_str())
14006 .header(USER_AGENT, self.hub._user_agent.clone());
14007
14008 if let Some(token) = token.as_ref() {
14009 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14010 }
14011
14012 let request = req_builder
14013 .header(CONTENT_LENGTH, 0_u64)
14014 .body(common::to_body::<String>(None));
14015
14016 client.request(request.unwrap()).await
14017 };
14018
14019 match req_result {
14020 Err(err) => {
14021 if let common::Retry::After(d) = dlg.http_error(&err) {
14022 sleep(d).await;
14023 continue;
14024 }
14025 dlg.finished(false);
14026 return Err(common::Error::HttpError(err));
14027 }
14028 Ok(res) => {
14029 let (mut parts, body) = res.into_parts();
14030 let mut body = common::Body::new(body);
14031 if !parts.status.is_success() {
14032 let bytes = common::to_bytes(body).await.unwrap_or_default();
14033 let error = serde_json::from_str(&common::to_string(&bytes));
14034 let response = common::to_response(parts, bytes.into());
14035
14036 if let common::Retry::After(d) =
14037 dlg.http_failure(&response, error.as_ref().ok())
14038 {
14039 sleep(d).await;
14040 continue;
14041 }
14042
14043 dlg.finished(false);
14044
14045 return Err(match error {
14046 Ok(value) => common::Error::BadRequest(value),
14047 _ => common::Error::Failure(response),
14048 });
14049 }
14050 let response = {
14051 let bytes = common::to_bytes(body).await.unwrap_or_default();
14052 let encoded = common::to_string(&bytes);
14053 match serde_json::from_str(&encoded) {
14054 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14055 Err(error) => {
14056 dlg.response_json_decode_error(&encoded, &error);
14057 return Err(common::Error::JsonDecodeError(
14058 encoded.to_string(),
14059 error,
14060 ));
14061 }
14062 }
14063 };
14064
14065 dlg.finished(true);
14066 return Ok(response);
14067 }
14068 }
14069 }
14070 }
14071
14072 /// Required. Name of the consent store to retrieve User data mappings from.
14073 ///
14074 /// Sets the *parent* path property to the given value.
14075 ///
14076 /// Even though the property as already been set when instantiating this call,
14077 /// we provide this method for API completeness.
14078 pub fn parent(
14079 mut self,
14080 new_value: &str,
14081 ) -> ProjectLocationDatasetConsentStoreUserDataMappingListCall<'a, C> {
14082 self._parent = new_value.to_string();
14083 self
14084 }
14085 /// Optional. Token to retrieve the next page of results, or empty to get the first page.
14086 ///
14087 /// Sets the *page token* query property to the given value.
14088 pub fn page_token(
14089 mut self,
14090 new_value: &str,
14091 ) -> ProjectLocationDatasetConsentStoreUserDataMappingListCall<'a, C> {
14092 self._page_token = Some(new_value.to_string());
14093 self
14094 }
14095 /// Optional. Limit on the number of User data mappings to return in a single response. If not specified, 100 is used. May not be larger than 1000.
14096 ///
14097 /// Sets the *page size* query property to the given value.
14098 pub fn page_size(
14099 mut self,
14100 new_value: i32,
14101 ) -> ProjectLocationDatasetConsentStoreUserDataMappingListCall<'a, C> {
14102 self._page_size = Some(new_value);
14103 self
14104 }
14105 /// Optional. Restricts the User data mappings returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. The fields available for filtering are: - data_id - user_id. For example, `filter=user_id=\"user123\"`. - archived - archive_time
14106 ///
14107 /// Sets the *filter* query property to the given value.
14108 pub fn filter(
14109 mut self,
14110 new_value: &str,
14111 ) -> ProjectLocationDatasetConsentStoreUserDataMappingListCall<'a, C> {
14112 self._filter = Some(new_value.to_string());
14113 self
14114 }
14115 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14116 /// while executing the actual API request.
14117 ///
14118 /// ````text
14119 /// It should be used to handle progress information, and to implement a certain level of resilience.
14120 /// ````
14121 ///
14122 /// Sets the *delegate* property to the given value.
14123 pub fn delegate(
14124 mut self,
14125 new_value: &'a mut dyn common::Delegate,
14126 ) -> ProjectLocationDatasetConsentStoreUserDataMappingListCall<'a, C> {
14127 self._delegate = Some(new_value);
14128 self
14129 }
14130
14131 /// Set any additional parameter of the query string used in the request.
14132 /// It should be used to set parameters which are not yet available through their own
14133 /// setters.
14134 ///
14135 /// Please note that this method must not be used to set any of the known parameters
14136 /// which have their own setter method. If done anyway, the request will fail.
14137 ///
14138 /// # Additional Parameters
14139 ///
14140 /// * *$.xgafv* (query-string) - V1 error format.
14141 /// * *access_token* (query-string) - OAuth access token.
14142 /// * *alt* (query-string) - Data format for response.
14143 /// * *callback* (query-string) - JSONP
14144 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14145 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14146 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14147 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14148 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14149 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14150 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14151 pub fn param<T>(
14152 mut self,
14153 name: T,
14154 value: T,
14155 ) -> ProjectLocationDatasetConsentStoreUserDataMappingListCall<'a, C>
14156 where
14157 T: AsRef<str>,
14158 {
14159 self._additional_params
14160 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14161 self
14162 }
14163
14164 /// Identifies the authorization scope for the method you are building.
14165 ///
14166 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14167 /// [`Scope::CloudHealthcare`].
14168 ///
14169 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14170 /// tokens for more than one scope.
14171 ///
14172 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14173 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14174 /// sufficient, a read-write scope will do as well.
14175 pub fn add_scope<St>(
14176 mut self,
14177 scope: St,
14178 ) -> ProjectLocationDatasetConsentStoreUserDataMappingListCall<'a, C>
14179 where
14180 St: AsRef<str>,
14181 {
14182 self._scopes.insert(String::from(scope.as_ref()));
14183 self
14184 }
14185 /// Identifies the authorization scope(s) for the method you are building.
14186 ///
14187 /// See [`Self::add_scope()`] for details.
14188 pub fn add_scopes<I, St>(
14189 mut self,
14190 scopes: I,
14191 ) -> ProjectLocationDatasetConsentStoreUserDataMappingListCall<'a, C>
14192 where
14193 I: IntoIterator<Item = St>,
14194 St: AsRef<str>,
14195 {
14196 self._scopes
14197 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14198 self
14199 }
14200
14201 /// Removes all scopes, and no default scope will be used either.
14202 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14203 /// for details).
14204 pub fn clear_scopes(
14205 mut self,
14206 ) -> ProjectLocationDatasetConsentStoreUserDataMappingListCall<'a, C> {
14207 self._scopes.clear();
14208 self
14209 }
14210}
14211
14212/// Updates the specified User data mapping.
14213///
14214/// A builder for the *locations.datasets.consentStores.userDataMappings.patch* method supported by a *project* resource.
14215/// It is not used directly, but through a [`ProjectMethods`] instance.
14216///
14217/// # Example
14218///
14219/// Instantiate a resource method builder
14220///
14221/// ```test_harness,no_run
14222/// # extern crate hyper;
14223/// # extern crate hyper_rustls;
14224/// # extern crate google_healthcare1 as healthcare1;
14225/// use healthcare1::api::UserDataMapping;
14226/// # async fn dox() {
14227/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14228///
14229/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14230/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14231/// # secret,
14232/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14233/// # ).build().await.unwrap();
14234///
14235/// # let client = hyper_util::client::legacy::Client::builder(
14236/// # hyper_util::rt::TokioExecutor::new()
14237/// # )
14238/// # .build(
14239/// # hyper_rustls::HttpsConnectorBuilder::new()
14240/// # .with_native_roots()
14241/// # .unwrap()
14242/// # .https_or_http()
14243/// # .enable_http1()
14244/// # .build()
14245/// # );
14246/// # let mut hub = CloudHealthcare::new(client, auth);
14247/// // As the method needs a request, you would usually fill it with the desired information
14248/// // into the respective structure. Some of the parts shown here might not be applicable !
14249/// // Values shown here are possibly random and not representative !
14250/// let mut req = UserDataMapping::default();
14251///
14252/// // You can configure optional parameters by calling the respective setters at will, and
14253/// // execute the final call using `doit()`.
14254/// // Values shown here are possibly random and not representative !
14255/// let result = hub.projects().locations_datasets_consent_stores_user_data_mappings_patch(req, "name")
14256/// .update_mask(FieldMask::new::<&str>(&[]))
14257/// .doit().await;
14258/// # }
14259/// ```
14260pub struct ProjectLocationDatasetConsentStoreUserDataMappingPatchCall<'a, C>
14261where
14262 C: 'a,
14263{
14264 hub: &'a CloudHealthcare<C>,
14265 _request: UserDataMapping,
14266 _name: String,
14267 _update_mask: Option<common::FieldMask>,
14268 _delegate: Option<&'a mut dyn common::Delegate>,
14269 _additional_params: HashMap<String, String>,
14270 _scopes: BTreeSet<String>,
14271}
14272
14273impl<'a, C> common::CallBuilder
14274 for ProjectLocationDatasetConsentStoreUserDataMappingPatchCall<'a, C>
14275{
14276}
14277
14278impl<'a, C> ProjectLocationDatasetConsentStoreUserDataMappingPatchCall<'a, C>
14279where
14280 C: common::Connector,
14281{
14282 /// Perform the operation you have build so far.
14283 pub async fn doit(mut self) -> common::Result<(common::Response, UserDataMapping)> {
14284 use std::borrow::Cow;
14285 use std::io::{Read, Seek};
14286
14287 use common::{url::Params, ToParts};
14288 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14289
14290 let mut dd = common::DefaultDelegate;
14291 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14292 dlg.begin(common::MethodInfo {
14293 id: "healthcare.projects.locations.datasets.consentStores.userDataMappings.patch",
14294 http_method: hyper::Method::PATCH,
14295 });
14296
14297 for &field in ["alt", "name", "updateMask"].iter() {
14298 if self._additional_params.contains_key(field) {
14299 dlg.finished(false);
14300 return Err(common::Error::FieldClash(field));
14301 }
14302 }
14303
14304 let mut params = Params::with_capacity(5 + self._additional_params.len());
14305 params.push("name", self._name);
14306 if let Some(value) = self._update_mask.as_ref() {
14307 params.push("updateMask", value.to_string());
14308 }
14309
14310 params.extend(self._additional_params.iter());
14311
14312 params.push("alt", "json");
14313 let mut url = self.hub._base_url.clone() + "v1/{+name}";
14314 if self._scopes.is_empty() {
14315 self._scopes
14316 .insert(Scope::CloudHealthcare.as_ref().to_string());
14317 }
14318
14319 #[allow(clippy::single_element_loop)]
14320 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14321 url = params.uri_replacement(url, param_name, find_this, true);
14322 }
14323 {
14324 let to_remove = ["name"];
14325 params.remove_params(&to_remove);
14326 }
14327
14328 let url = params.parse_with_url(&url);
14329
14330 let mut json_mime_type = mime::APPLICATION_JSON;
14331 let mut request_value_reader = {
14332 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14333 common::remove_json_null_values(&mut value);
14334 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14335 serde_json::to_writer(&mut dst, &value).unwrap();
14336 dst
14337 };
14338 let request_size = request_value_reader
14339 .seek(std::io::SeekFrom::End(0))
14340 .unwrap();
14341 request_value_reader
14342 .seek(std::io::SeekFrom::Start(0))
14343 .unwrap();
14344
14345 loop {
14346 let token = match self
14347 .hub
14348 .auth
14349 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14350 .await
14351 {
14352 Ok(token) => token,
14353 Err(e) => match dlg.token(e) {
14354 Ok(token) => token,
14355 Err(e) => {
14356 dlg.finished(false);
14357 return Err(common::Error::MissingToken(e));
14358 }
14359 },
14360 };
14361 request_value_reader
14362 .seek(std::io::SeekFrom::Start(0))
14363 .unwrap();
14364 let mut req_result = {
14365 let client = &self.hub.client;
14366 dlg.pre_request();
14367 let mut req_builder = hyper::Request::builder()
14368 .method(hyper::Method::PATCH)
14369 .uri(url.as_str())
14370 .header(USER_AGENT, self.hub._user_agent.clone());
14371
14372 if let Some(token) = token.as_ref() {
14373 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14374 }
14375
14376 let request = req_builder
14377 .header(CONTENT_TYPE, json_mime_type.to_string())
14378 .header(CONTENT_LENGTH, request_size as u64)
14379 .body(common::to_body(
14380 request_value_reader.get_ref().clone().into(),
14381 ));
14382
14383 client.request(request.unwrap()).await
14384 };
14385
14386 match req_result {
14387 Err(err) => {
14388 if let common::Retry::After(d) = dlg.http_error(&err) {
14389 sleep(d).await;
14390 continue;
14391 }
14392 dlg.finished(false);
14393 return Err(common::Error::HttpError(err));
14394 }
14395 Ok(res) => {
14396 let (mut parts, body) = res.into_parts();
14397 let mut body = common::Body::new(body);
14398 if !parts.status.is_success() {
14399 let bytes = common::to_bytes(body).await.unwrap_or_default();
14400 let error = serde_json::from_str(&common::to_string(&bytes));
14401 let response = common::to_response(parts, bytes.into());
14402
14403 if let common::Retry::After(d) =
14404 dlg.http_failure(&response, error.as_ref().ok())
14405 {
14406 sleep(d).await;
14407 continue;
14408 }
14409
14410 dlg.finished(false);
14411
14412 return Err(match error {
14413 Ok(value) => common::Error::BadRequest(value),
14414 _ => common::Error::Failure(response),
14415 });
14416 }
14417 let response = {
14418 let bytes = common::to_bytes(body).await.unwrap_or_default();
14419 let encoded = common::to_string(&bytes);
14420 match serde_json::from_str(&encoded) {
14421 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14422 Err(error) => {
14423 dlg.response_json_decode_error(&encoded, &error);
14424 return Err(common::Error::JsonDecodeError(
14425 encoded.to_string(),
14426 error,
14427 ));
14428 }
14429 }
14430 };
14431
14432 dlg.finished(true);
14433 return Ok(response);
14434 }
14435 }
14436 }
14437 }
14438
14439 ///
14440 /// Sets the *request* property to the given value.
14441 ///
14442 /// Even though the property as already been set when instantiating this call,
14443 /// we provide this method for API completeness.
14444 pub fn request(
14445 mut self,
14446 new_value: UserDataMapping,
14447 ) -> ProjectLocationDatasetConsentStoreUserDataMappingPatchCall<'a, C> {
14448 self._request = new_value;
14449 self
14450 }
14451 /// Resource name of the User data mapping, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/userDataMappings/{user_data_mapping_id}`.
14452 ///
14453 /// Sets the *name* path property to the given value.
14454 ///
14455 /// Even though the property as already been set when instantiating this call,
14456 /// we provide this method for API completeness.
14457 pub fn name(
14458 mut self,
14459 new_value: &str,
14460 ) -> ProjectLocationDatasetConsentStoreUserDataMappingPatchCall<'a, C> {
14461 self._name = new_value.to_string();
14462 self
14463 }
14464 /// Required. The update mask that applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. Only the `data_id`, `user_id` and `resource_attributes` fields can be updated.
14465 ///
14466 /// Sets the *update mask* query property to the given value.
14467 pub fn update_mask(
14468 mut self,
14469 new_value: common::FieldMask,
14470 ) -> ProjectLocationDatasetConsentStoreUserDataMappingPatchCall<'a, C> {
14471 self._update_mask = Some(new_value);
14472 self
14473 }
14474 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14475 /// while executing the actual API request.
14476 ///
14477 /// ````text
14478 /// It should be used to handle progress information, and to implement a certain level of resilience.
14479 /// ````
14480 ///
14481 /// Sets the *delegate* property to the given value.
14482 pub fn delegate(
14483 mut self,
14484 new_value: &'a mut dyn common::Delegate,
14485 ) -> ProjectLocationDatasetConsentStoreUserDataMappingPatchCall<'a, C> {
14486 self._delegate = Some(new_value);
14487 self
14488 }
14489
14490 /// Set any additional parameter of the query string used in the request.
14491 /// It should be used to set parameters which are not yet available through their own
14492 /// setters.
14493 ///
14494 /// Please note that this method must not be used to set any of the known parameters
14495 /// which have their own setter method. If done anyway, the request will fail.
14496 ///
14497 /// # Additional Parameters
14498 ///
14499 /// * *$.xgafv* (query-string) - V1 error format.
14500 /// * *access_token* (query-string) - OAuth access token.
14501 /// * *alt* (query-string) - Data format for response.
14502 /// * *callback* (query-string) - JSONP
14503 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14504 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14505 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14506 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14507 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14508 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14509 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14510 pub fn param<T>(
14511 mut self,
14512 name: T,
14513 value: T,
14514 ) -> ProjectLocationDatasetConsentStoreUserDataMappingPatchCall<'a, C>
14515 where
14516 T: AsRef<str>,
14517 {
14518 self._additional_params
14519 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14520 self
14521 }
14522
14523 /// Identifies the authorization scope for the method you are building.
14524 ///
14525 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14526 /// [`Scope::CloudHealthcare`].
14527 ///
14528 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14529 /// tokens for more than one scope.
14530 ///
14531 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14532 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14533 /// sufficient, a read-write scope will do as well.
14534 pub fn add_scope<St>(
14535 mut self,
14536 scope: St,
14537 ) -> ProjectLocationDatasetConsentStoreUserDataMappingPatchCall<'a, C>
14538 where
14539 St: AsRef<str>,
14540 {
14541 self._scopes.insert(String::from(scope.as_ref()));
14542 self
14543 }
14544 /// Identifies the authorization scope(s) for the method you are building.
14545 ///
14546 /// See [`Self::add_scope()`] for details.
14547 pub fn add_scopes<I, St>(
14548 mut self,
14549 scopes: I,
14550 ) -> ProjectLocationDatasetConsentStoreUserDataMappingPatchCall<'a, C>
14551 where
14552 I: IntoIterator<Item = St>,
14553 St: AsRef<str>,
14554 {
14555 self._scopes
14556 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14557 self
14558 }
14559
14560 /// Removes all scopes, and no default scope will be used either.
14561 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14562 /// for details).
14563 pub fn clear_scopes(
14564 mut self,
14565 ) -> ProjectLocationDatasetConsentStoreUserDataMappingPatchCall<'a, C> {
14566 self._scopes.clear();
14567 self
14568 }
14569}
14570
14571/// Checks if a particular data_id of a User data mapping in the specified consent store is consented for the specified use.
14572///
14573/// A builder for the *locations.datasets.consentStores.checkDataAccess* method supported by a *project* resource.
14574/// It is not used directly, but through a [`ProjectMethods`] instance.
14575///
14576/// # Example
14577///
14578/// Instantiate a resource method builder
14579///
14580/// ```test_harness,no_run
14581/// # extern crate hyper;
14582/// # extern crate hyper_rustls;
14583/// # extern crate google_healthcare1 as healthcare1;
14584/// use healthcare1::api::CheckDataAccessRequest;
14585/// # async fn dox() {
14586/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14587///
14588/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14589/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14590/// # secret,
14591/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14592/// # ).build().await.unwrap();
14593///
14594/// # let client = hyper_util::client::legacy::Client::builder(
14595/// # hyper_util::rt::TokioExecutor::new()
14596/// # )
14597/// # .build(
14598/// # hyper_rustls::HttpsConnectorBuilder::new()
14599/// # .with_native_roots()
14600/// # .unwrap()
14601/// # .https_or_http()
14602/// # .enable_http1()
14603/// # .build()
14604/// # );
14605/// # let mut hub = CloudHealthcare::new(client, auth);
14606/// // As the method needs a request, you would usually fill it with the desired information
14607/// // into the respective structure. Some of the parts shown here might not be applicable !
14608/// // Values shown here are possibly random and not representative !
14609/// let mut req = CheckDataAccessRequest::default();
14610///
14611/// // You can configure optional parameters by calling the respective setters at will, and
14612/// // execute the final call using `doit()`.
14613/// // Values shown here are possibly random and not representative !
14614/// let result = hub.projects().locations_datasets_consent_stores_check_data_access(req, "consentStore")
14615/// .doit().await;
14616/// # }
14617/// ```
14618pub struct ProjectLocationDatasetConsentStoreCheckDataAccesCall<'a, C>
14619where
14620 C: 'a,
14621{
14622 hub: &'a CloudHealthcare<C>,
14623 _request: CheckDataAccessRequest,
14624 _consent_store: String,
14625 _delegate: Option<&'a mut dyn common::Delegate>,
14626 _additional_params: HashMap<String, String>,
14627 _scopes: BTreeSet<String>,
14628}
14629
14630impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreCheckDataAccesCall<'a, C> {}
14631
14632impl<'a, C> ProjectLocationDatasetConsentStoreCheckDataAccesCall<'a, C>
14633where
14634 C: common::Connector,
14635{
14636 /// Perform the operation you have build so far.
14637 pub async fn doit(mut self) -> common::Result<(common::Response, CheckDataAccessResponse)> {
14638 use std::borrow::Cow;
14639 use std::io::{Read, Seek};
14640
14641 use common::{url::Params, ToParts};
14642 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14643
14644 let mut dd = common::DefaultDelegate;
14645 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14646 dlg.begin(common::MethodInfo {
14647 id: "healthcare.projects.locations.datasets.consentStores.checkDataAccess",
14648 http_method: hyper::Method::POST,
14649 });
14650
14651 for &field in ["alt", "consentStore"].iter() {
14652 if self._additional_params.contains_key(field) {
14653 dlg.finished(false);
14654 return Err(common::Error::FieldClash(field));
14655 }
14656 }
14657
14658 let mut params = Params::with_capacity(4 + self._additional_params.len());
14659 params.push("consentStore", self._consent_store);
14660
14661 params.extend(self._additional_params.iter());
14662
14663 params.push("alt", "json");
14664 let mut url = self.hub._base_url.clone() + "v1/{+consentStore}:checkDataAccess";
14665 if self._scopes.is_empty() {
14666 self._scopes
14667 .insert(Scope::CloudHealthcare.as_ref().to_string());
14668 }
14669
14670 #[allow(clippy::single_element_loop)]
14671 for &(find_this, param_name) in [("{+consentStore}", "consentStore")].iter() {
14672 url = params.uri_replacement(url, param_name, find_this, true);
14673 }
14674 {
14675 let to_remove = ["consentStore"];
14676 params.remove_params(&to_remove);
14677 }
14678
14679 let url = params.parse_with_url(&url);
14680
14681 let mut json_mime_type = mime::APPLICATION_JSON;
14682 let mut request_value_reader = {
14683 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14684 common::remove_json_null_values(&mut value);
14685 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14686 serde_json::to_writer(&mut dst, &value).unwrap();
14687 dst
14688 };
14689 let request_size = request_value_reader
14690 .seek(std::io::SeekFrom::End(0))
14691 .unwrap();
14692 request_value_reader
14693 .seek(std::io::SeekFrom::Start(0))
14694 .unwrap();
14695
14696 loop {
14697 let token = match self
14698 .hub
14699 .auth
14700 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14701 .await
14702 {
14703 Ok(token) => token,
14704 Err(e) => match dlg.token(e) {
14705 Ok(token) => token,
14706 Err(e) => {
14707 dlg.finished(false);
14708 return Err(common::Error::MissingToken(e));
14709 }
14710 },
14711 };
14712 request_value_reader
14713 .seek(std::io::SeekFrom::Start(0))
14714 .unwrap();
14715 let mut req_result = {
14716 let client = &self.hub.client;
14717 dlg.pre_request();
14718 let mut req_builder = hyper::Request::builder()
14719 .method(hyper::Method::POST)
14720 .uri(url.as_str())
14721 .header(USER_AGENT, self.hub._user_agent.clone());
14722
14723 if let Some(token) = token.as_ref() {
14724 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14725 }
14726
14727 let request = req_builder
14728 .header(CONTENT_TYPE, json_mime_type.to_string())
14729 .header(CONTENT_LENGTH, request_size as u64)
14730 .body(common::to_body(
14731 request_value_reader.get_ref().clone().into(),
14732 ));
14733
14734 client.request(request.unwrap()).await
14735 };
14736
14737 match req_result {
14738 Err(err) => {
14739 if let common::Retry::After(d) = dlg.http_error(&err) {
14740 sleep(d).await;
14741 continue;
14742 }
14743 dlg.finished(false);
14744 return Err(common::Error::HttpError(err));
14745 }
14746 Ok(res) => {
14747 let (mut parts, body) = res.into_parts();
14748 let mut body = common::Body::new(body);
14749 if !parts.status.is_success() {
14750 let bytes = common::to_bytes(body).await.unwrap_or_default();
14751 let error = serde_json::from_str(&common::to_string(&bytes));
14752 let response = common::to_response(parts, bytes.into());
14753
14754 if let common::Retry::After(d) =
14755 dlg.http_failure(&response, error.as_ref().ok())
14756 {
14757 sleep(d).await;
14758 continue;
14759 }
14760
14761 dlg.finished(false);
14762
14763 return Err(match error {
14764 Ok(value) => common::Error::BadRequest(value),
14765 _ => common::Error::Failure(response),
14766 });
14767 }
14768 let response = {
14769 let bytes = common::to_bytes(body).await.unwrap_or_default();
14770 let encoded = common::to_string(&bytes);
14771 match serde_json::from_str(&encoded) {
14772 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14773 Err(error) => {
14774 dlg.response_json_decode_error(&encoded, &error);
14775 return Err(common::Error::JsonDecodeError(
14776 encoded.to_string(),
14777 error,
14778 ));
14779 }
14780 }
14781 };
14782
14783 dlg.finished(true);
14784 return Ok(response);
14785 }
14786 }
14787 }
14788 }
14789
14790 ///
14791 /// Sets the *request* property to the given value.
14792 ///
14793 /// Even though the property as already been set when instantiating this call,
14794 /// we provide this method for API completeness.
14795 pub fn request(
14796 mut self,
14797 new_value: CheckDataAccessRequest,
14798 ) -> ProjectLocationDatasetConsentStoreCheckDataAccesCall<'a, C> {
14799 self._request = new_value;
14800 self
14801 }
14802 /// Required. Name of the consent store where the requested data_id is stored, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}`.
14803 ///
14804 /// Sets the *consent store* path property to the given value.
14805 ///
14806 /// Even though the property as already been set when instantiating this call,
14807 /// we provide this method for API completeness.
14808 pub fn consent_store(
14809 mut self,
14810 new_value: &str,
14811 ) -> ProjectLocationDatasetConsentStoreCheckDataAccesCall<'a, C> {
14812 self._consent_store = new_value.to_string();
14813 self
14814 }
14815 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14816 /// while executing the actual API request.
14817 ///
14818 /// ````text
14819 /// It should be used to handle progress information, and to implement a certain level of resilience.
14820 /// ````
14821 ///
14822 /// Sets the *delegate* property to the given value.
14823 pub fn delegate(
14824 mut self,
14825 new_value: &'a mut dyn common::Delegate,
14826 ) -> ProjectLocationDatasetConsentStoreCheckDataAccesCall<'a, C> {
14827 self._delegate = Some(new_value);
14828 self
14829 }
14830
14831 /// Set any additional parameter of the query string used in the request.
14832 /// It should be used to set parameters which are not yet available through their own
14833 /// setters.
14834 ///
14835 /// Please note that this method must not be used to set any of the known parameters
14836 /// which have their own setter method. If done anyway, the request will fail.
14837 ///
14838 /// # Additional Parameters
14839 ///
14840 /// * *$.xgafv* (query-string) - V1 error format.
14841 /// * *access_token* (query-string) - OAuth access token.
14842 /// * *alt* (query-string) - Data format for response.
14843 /// * *callback* (query-string) - JSONP
14844 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14845 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14846 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14847 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14848 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14849 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14850 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14851 pub fn param<T>(
14852 mut self,
14853 name: T,
14854 value: T,
14855 ) -> ProjectLocationDatasetConsentStoreCheckDataAccesCall<'a, C>
14856 where
14857 T: AsRef<str>,
14858 {
14859 self._additional_params
14860 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14861 self
14862 }
14863
14864 /// Identifies the authorization scope for the method you are building.
14865 ///
14866 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14867 /// [`Scope::CloudHealthcare`].
14868 ///
14869 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14870 /// tokens for more than one scope.
14871 ///
14872 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14873 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14874 /// sufficient, a read-write scope will do as well.
14875 pub fn add_scope<St>(
14876 mut self,
14877 scope: St,
14878 ) -> ProjectLocationDatasetConsentStoreCheckDataAccesCall<'a, C>
14879 where
14880 St: AsRef<str>,
14881 {
14882 self._scopes.insert(String::from(scope.as_ref()));
14883 self
14884 }
14885 /// Identifies the authorization scope(s) for the method you are building.
14886 ///
14887 /// See [`Self::add_scope()`] for details.
14888 pub fn add_scopes<I, St>(
14889 mut self,
14890 scopes: I,
14891 ) -> ProjectLocationDatasetConsentStoreCheckDataAccesCall<'a, C>
14892 where
14893 I: IntoIterator<Item = St>,
14894 St: AsRef<str>,
14895 {
14896 self._scopes
14897 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14898 self
14899 }
14900
14901 /// Removes all scopes, and no default scope will be used either.
14902 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14903 /// for details).
14904 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStoreCheckDataAccesCall<'a, C> {
14905 self._scopes.clear();
14906 self
14907 }
14908}
14909
14910/// Creates a new consent store in the parent dataset. Attempting to create a consent store with the same ID as an existing store fails with an ALREADY_EXISTS error.
14911///
14912/// A builder for the *locations.datasets.consentStores.create* method supported by a *project* resource.
14913/// It is not used directly, but through a [`ProjectMethods`] instance.
14914///
14915/// # Example
14916///
14917/// Instantiate a resource method builder
14918///
14919/// ```test_harness,no_run
14920/// # extern crate hyper;
14921/// # extern crate hyper_rustls;
14922/// # extern crate google_healthcare1 as healthcare1;
14923/// use healthcare1::api::ConsentStore;
14924/// # async fn dox() {
14925/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14926///
14927/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14928/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14929/// # secret,
14930/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14931/// # ).build().await.unwrap();
14932///
14933/// # let client = hyper_util::client::legacy::Client::builder(
14934/// # hyper_util::rt::TokioExecutor::new()
14935/// # )
14936/// # .build(
14937/// # hyper_rustls::HttpsConnectorBuilder::new()
14938/// # .with_native_roots()
14939/// # .unwrap()
14940/// # .https_or_http()
14941/// # .enable_http1()
14942/// # .build()
14943/// # );
14944/// # let mut hub = CloudHealthcare::new(client, auth);
14945/// // As the method needs a request, you would usually fill it with the desired information
14946/// // into the respective structure. Some of the parts shown here might not be applicable !
14947/// // Values shown here are possibly random and not representative !
14948/// let mut req = ConsentStore::default();
14949///
14950/// // You can configure optional parameters by calling the respective setters at will, and
14951/// // execute the final call using `doit()`.
14952/// // Values shown here are possibly random and not representative !
14953/// let result = hub.projects().locations_datasets_consent_stores_create(req, "parent")
14954/// .consent_store_id("duo")
14955/// .doit().await;
14956/// # }
14957/// ```
14958pub struct ProjectLocationDatasetConsentStoreCreateCall<'a, C>
14959where
14960 C: 'a,
14961{
14962 hub: &'a CloudHealthcare<C>,
14963 _request: ConsentStore,
14964 _parent: String,
14965 _consent_store_id: Option<String>,
14966 _delegate: Option<&'a mut dyn common::Delegate>,
14967 _additional_params: HashMap<String, String>,
14968 _scopes: BTreeSet<String>,
14969}
14970
14971impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreCreateCall<'a, C> {}
14972
14973impl<'a, C> ProjectLocationDatasetConsentStoreCreateCall<'a, C>
14974where
14975 C: common::Connector,
14976{
14977 /// Perform the operation you have build so far.
14978 pub async fn doit(mut self) -> common::Result<(common::Response, ConsentStore)> {
14979 use std::borrow::Cow;
14980 use std::io::{Read, Seek};
14981
14982 use common::{url::Params, ToParts};
14983 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14984
14985 let mut dd = common::DefaultDelegate;
14986 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14987 dlg.begin(common::MethodInfo {
14988 id: "healthcare.projects.locations.datasets.consentStores.create",
14989 http_method: hyper::Method::POST,
14990 });
14991
14992 for &field in ["alt", "parent", "consentStoreId"].iter() {
14993 if self._additional_params.contains_key(field) {
14994 dlg.finished(false);
14995 return Err(common::Error::FieldClash(field));
14996 }
14997 }
14998
14999 let mut params = Params::with_capacity(5 + self._additional_params.len());
15000 params.push("parent", self._parent);
15001 if let Some(value) = self._consent_store_id.as_ref() {
15002 params.push("consentStoreId", value);
15003 }
15004
15005 params.extend(self._additional_params.iter());
15006
15007 params.push("alt", "json");
15008 let mut url = self.hub._base_url.clone() + "v1/{+parent}/consentStores";
15009 if self._scopes.is_empty() {
15010 self._scopes
15011 .insert(Scope::CloudHealthcare.as_ref().to_string());
15012 }
15013
15014 #[allow(clippy::single_element_loop)]
15015 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15016 url = params.uri_replacement(url, param_name, find_this, true);
15017 }
15018 {
15019 let to_remove = ["parent"];
15020 params.remove_params(&to_remove);
15021 }
15022
15023 let url = params.parse_with_url(&url);
15024
15025 let mut json_mime_type = mime::APPLICATION_JSON;
15026 let mut request_value_reader = {
15027 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15028 common::remove_json_null_values(&mut value);
15029 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15030 serde_json::to_writer(&mut dst, &value).unwrap();
15031 dst
15032 };
15033 let request_size = request_value_reader
15034 .seek(std::io::SeekFrom::End(0))
15035 .unwrap();
15036 request_value_reader
15037 .seek(std::io::SeekFrom::Start(0))
15038 .unwrap();
15039
15040 loop {
15041 let token = match self
15042 .hub
15043 .auth
15044 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15045 .await
15046 {
15047 Ok(token) => token,
15048 Err(e) => match dlg.token(e) {
15049 Ok(token) => token,
15050 Err(e) => {
15051 dlg.finished(false);
15052 return Err(common::Error::MissingToken(e));
15053 }
15054 },
15055 };
15056 request_value_reader
15057 .seek(std::io::SeekFrom::Start(0))
15058 .unwrap();
15059 let mut req_result = {
15060 let client = &self.hub.client;
15061 dlg.pre_request();
15062 let mut req_builder = hyper::Request::builder()
15063 .method(hyper::Method::POST)
15064 .uri(url.as_str())
15065 .header(USER_AGENT, self.hub._user_agent.clone());
15066
15067 if let Some(token) = token.as_ref() {
15068 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15069 }
15070
15071 let request = req_builder
15072 .header(CONTENT_TYPE, json_mime_type.to_string())
15073 .header(CONTENT_LENGTH, request_size as u64)
15074 .body(common::to_body(
15075 request_value_reader.get_ref().clone().into(),
15076 ));
15077
15078 client.request(request.unwrap()).await
15079 };
15080
15081 match req_result {
15082 Err(err) => {
15083 if let common::Retry::After(d) = dlg.http_error(&err) {
15084 sleep(d).await;
15085 continue;
15086 }
15087 dlg.finished(false);
15088 return Err(common::Error::HttpError(err));
15089 }
15090 Ok(res) => {
15091 let (mut parts, body) = res.into_parts();
15092 let mut body = common::Body::new(body);
15093 if !parts.status.is_success() {
15094 let bytes = common::to_bytes(body).await.unwrap_or_default();
15095 let error = serde_json::from_str(&common::to_string(&bytes));
15096 let response = common::to_response(parts, bytes.into());
15097
15098 if let common::Retry::After(d) =
15099 dlg.http_failure(&response, error.as_ref().ok())
15100 {
15101 sleep(d).await;
15102 continue;
15103 }
15104
15105 dlg.finished(false);
15106
15107 return Err(match error {
15108 Ok(value) => common::Error::BadRequest(value),
15109 _ => common::Error::Failure(response),
15110 });
15111 }
15112 let response = {
15113 let bytes = common::to_bytes(body).await.unwrap_or_default();
15114 let encoded = common::to_string(&bytes);
15115 match serde_json::from_str(&encoded) {
15116 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15117 Err(error) => {
15118 dlg.response_json_decode_error(&encoded, &error);
15119 return Err(common::Error::JsonDecodeError(
15120 encoded.to_string(),
15121 error,
15122 ));
15123 }
15124 }
15125 };
15126
15127 dlg.finished(true);
15128 return Ok(response);
15129 }
15130 }
15131 }
15132 }
15133
15134 ///
15135 /// Sets the *request* property to the given value.
15136 ///
15137 /// Even though the property as already been set when instantiating this call,
15138 /// we provide this method for API completeness.
15139 pub fn request(
15140 mut self,
15141 new_value: ConsentStore,
15142 ) -> ProjectLocationDatasetConsentStoreCreateCall<'a, C> {
15143 self._request = new_value;
15144 self
15145 }
15146 /// Required. The name of the dataset this consent store belongs to.
15147 ///
15148 /// Sets the *parent* path property to the given value.
15149 ///
15150 /// Even though the property as already been set when instantiating this call,
15151 /// we provide this method for API completeness.
15152 pub fn parent(
15153 mut self,
15154 new_value: &str,
15155 ) -> ProjectLocationDatasetConsentStoreCreateCall<'a, C> {
15156 self._parent = new_value.to_string();
15157 self
15158 }
15159 /// Required. The ID of the consent store to create. The string must match the following regex: `[\p{L}\p{N}_\-\.]{1,256}`. Cannot be changed after creation.
15160 ///
15161 /// Sets the *consent store id* query property to the given value.
15162 pub fn consent_store_id(
15163 mut self,
15164 new_value: &str,
15165 ) -> ProjectLocationDatasetConsentStoreCreateCall<'a, C> {
15166 self._consent_store_id = Some(new_value.to_string());
15167 self
15168 }
15169 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15170 /// while executing the actual API request.
15171 ///
15172 /// ````text
15173 /// It should be used to handle progress information, and to implement a certain level of resilience.
15174 /// ````
15175 ///
15176 /// Sets the *delegate* property to the given value.
15177 pub fn delegate(
15178 mut self,
15179 new_value: &'a mut dyn common::Delegate,
15180 ) -> ProjectLocationDatasetConsentStoreCreateCall<'a, C> {
15181 self._delegate = Some(new_value);
15182 self
15183 }
15184
15185 /// Set any additional parameter of the query string used in the request.
15186 /// It should be used to set parameters which are not yet available through their own
15187 /// setters.
15188 ///
15189 /// Please note that this method must not be used to set any of the known parameters
15190 /// which have their own setter method. If done anyway, the request will fail.
15191 ///
15192 /// # Additional Parameters
15193 ///
15194 /// * *$.xgafv* (query-string) - V1 error format.
15195 /// * *access_token* (query-string) - OAuth access token.
15196 /// * *alt* (query-string) - Data format for response.
15197 /// * *callback* (query-string) - JSONP
15198 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15199 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15200 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15201 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15202 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15203 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15204 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15205 pub fn param<T>(
15206 mut self,
15207 name: T,
15208 value: T,
15209 ) -> ProjectLocationDatasetConsentStoreCreateCall<'a, C>
15210 where
15211 T: AsRef<str>,
15212 {
15213 self._additional_params
15214 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15215 self
15216 }
15217
15218 /// Identifies the authorization scope for the method you are building.
15219 ///
15220 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15221 /// [`Scope::CloudHealthcare`].
15222 ///
15223 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15224 /// tokens for more than one scope.
15225 ///
15226 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15227 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15228 /// sufficient, a read-write scope will do as well.
15229 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetConsentStoreCreateCall<'a, C>
15230 where
15231 St: AsRef<str>,
15232 {
15233 self._scopes.insert(String::from(scope.as_ref()));
15234 self
15235 }
15236 /// Identifies the authorization scope(s) for the method you are building.
15237 ///
15238 /// See [`Self::add_scope()`] for details.
15239 pub fn add_scopes<I, St>(
15240 mut self,
15241 scopes: I,
15242 ) -> ProjectLocationDatasetConsentStoreCreateCall<'a, C>
15243 where
15244 I: IntoIterator<Item = St>,
15245 St: AsRef<str>,
15246 {
15247 self._scopes
15248 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15249 self
15250 }
15251
15252 /// Removes all scopes, and no default scope will be used either.
15253 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15254 /// for details).
15255 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStoreCreateCall<'a, C> {
15256 self._scopes.clear();
15257 self
15258 }
15259}
15260
15261/// Deletes the specified consent store and removes all the consent store's data.
15262///
15263/// A builder for the *locations.datasets.consentStores.delete* method supported by a *project* resource.
15264/// It is not used directly, but through a [`ProjectMethods`] instance.
15265///
15266/// # Example
15267///
15268/// Instantiate a resource method builder
15269///
15270/// ```test_harness,no_run
15271/// # extern crate hyper;
15272/// # extern crate hyper_rustls;
15273/// # extern crate google_healthcare1 as healthcare1;
15274/// # async fn dox() {
15275/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15276///
15277/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15278/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15279/// # secret,
15280/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15281/// # ).build().await.unwrap();
15282///
15283/// # let client = hyper_util::client::legacy::Client::builder(
15284/// # hyper_util::rt::TokioExecutor::new()
15285/// # )
15286/// # .build(
15287/// # hyper_rustls::HttpsConnectorBuilder::new()
15288/// # .with_native_roots()
15289/// # .unwrap()
15290/// # .https_or_http()
15291/// # .enable_http1()
15292/// # .build()
15293/// # );
15294/// # let mut hub = CloudHealthcare::new(client, auth);
15295/// // You can configure optional parameters by calling the respective setters at will, and
15296/// // execute the final call using `doit()`.
15297/// // Values shown here are possibly random and not representative !
15298/// let result = hub.projects().locations_datasets_consent_stores_delete("name")
15299/// .doit().await;
15300/// # }
15301/// ```
15302pub struct ProjectLocationDatasetConsentStoreDeleteCall<'a, C>
15303where
15304 C: 'a,
15305{
15306 hub: &'a CloudHealthcare<C>,
15307 _name: String,
15308 _delegate: Option<&'a mut dyn common::Delegate>,
15309 _additional_params: HashMap<String, String>,
15310 _scopes: BTreeSet<String>,
15311}
15312
15313impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreDeleteCall<'a, C> {}
15314
15315impl<'a, C> ProjectLocationDatasetConsentStoreDeleteCall<'a, C>
15316where
15317 C: common::Connector,
15318{
15319 /// Perform the operation you have build so far.
15320 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
15321 use std::borrow::Cow;
15322 use std::io::{Read, Seek};
15323
15324 use common::{url::Params, ToParts};
15325 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15326
15327 let mut dd = common::DefaultDelegate;
15328 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15329 dlg.begin(common::MethodInfo {
15330 id: "healthcare.projects.locations.datasets.consentStores.delete",
15331 http_method: hyper::Method::DELETE,
15332 });
15333
15334 for &field in ["alt", "name"].iter() {
15335 if self._additional_params.contains_key(field) {
15336 dlg.finished(false);
15337 return Err(common::Error::FieldClash(field));
15338 }
15339 }
15340
15341 let mut params = Params::with_capacity(3 + self._additional_params.len());
15342 params.push("name", self._name);
15343
15344 params.extend(self._additional_params.iter());
15345
15346 params.push("alt", "json");
15347 let mut url = self.hub._base_url.clone() + "v1/{+name}";
15348 if self._scopes.is_empty() {
15349 self._scopes
15350 .insert(Scope::CloudHealthcare.as_ref().to_string());
15351 }
15352
15353 #[allow(clippy::single_element_loop)]
15354 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15355 url = params.uri_replacement(url, param_name, find_this, true);
15356 }
15357 {
15358 let to_remove = ["name"];
15359 params.remove_params(&to_remove);
15360 }
15361
15362 let url = params.parse_with_url(&url);
15363
15364 loop {
15365 let token = match self
15366 .hub
15367 .auth
15368 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15369 .await
15370 {
15371 Ok(token) => token,
15372 Err(e) => match dlg.token(e) {
15373 Ok(token) => token,
15374 Err(e) => {
15375 dlg.finished(false);
15376 return Err(common::Error::MissingToken(e));
15377 }
15378 },
15379 };
15380 let mut req_result = {
15381 let client = &self.hub.client;
15382 dlg.pre_request();
15383 let mut req_builder = hyper::Request::builder()
15384 .method(hyper::Method::DELETE)
15385 .uri(url.as_str())
15386 .header(USER_AGENT, self.hub._user_agent.clone());
15387
15388 if let Some(token) = token.as_ref() {
15389 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15390 }
15391
15392 let request = req_builder
15393 .header(CONTENT_LENGTH, 0_u64)
15394 .body(common::to_body::<String>(None));
15395
15396 client.request(request.unwrap()).await
15397 };
15398
15399 match req_result {
15400 Err(err) => {
15401 if let common::Retry::After(d) = dlg.http_error(&err) {
15402 sleep(d).await;
15403 continue;
15404 }
15405 dlg.finished(false);
15406 return Err(common::Error::HttpError(err));
15407 }
15408 Ok(res) => {
15409 let (mut parts, body) = res.into_parts();
15410 let mut body = common::Body::new(body);
15411 if !parts.status.is_success() {
15412 let bytes = common::to_bytes(body).await.unwrap_or_default();
15413 let error = serde_json::from_str(&common::to_string(&bytes));
15414 let response = common::to_response(parts, bytes.into());
15415
15416 if let common::Retry::After(d) =
15417 dlg.http_failure(&response, error.as_ref().ok())
15418 {
15419 sleep(d).await;
15420 continue;
15421 }
15422
15423 dlg.finished(false);
15424
15425 return Err(match error {
15426 Ok(value) => common::Error::BadRequest(value),
15427 _ => common::Error::Failure(response),
15428 });
15429 }
15430 let response = {
15431 let bytes = common::to_bytes(body).await.unwrap_or_default();
15432 let encoded = common::to_string(&bytes);
15433 match serde_json::from_str(&encoded) {
15434 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15435 Err(error) => {
15436 dlg.response_json_decode_error(&encoded, &error);
15437 return Err(common::Error::JsonDecodeError(
15438 encoded.to_string(),
15439 error,
15440 ));
15441 }
15442 }
15443 };
15444
15445 dlg.finished(true);
15446 return Ok(response);
15447 }
15448 }
15449 }
15450 }
15451
15452 /// Required. The resource name of the consent store to delete.
15453 ///
15454 /// Sets the *name* path property to the given value.
15455 ///
15456 /// Even though the property as already been set when instantiating this call,
15457 /// we provide this method for API completeness.
15458 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetConsentStoreDeleteCall<'a, C> {
15459 self._name = new_value.to_string();
15460 self
15461 }
15462 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15463 /// while executing the actual API request.
15464 ///
15465 /// ````text
15466 /// It should be used to handle progress information, and to implement a certain level of resilience.
15467 /// ````
15468 ///
15469 /// Sets the *delegate* property to the given value.
15470 pub fn delegate(
15471 mut self,
15472 new_value: &'a mut dyn common::Delegate,
15473 ) -> ProjectLocationDatasetConsentStoreDeleteCall<'a, C> {
15474 self._delegate = Some(new_value);
15475 self
15476 }
15477
15478 /// Set any additional parameter of the query string used in the request.
15479 /// It should be used to set parameters which are not yet available through their own
15480 /// setters.
15481 ///
15482 /// Please note that this method must not be used to set any of the known parameters
15483 /// which have their own setter method. If done anyway, the request will fail.
15484 ///
15485 /// # Additional Parameters
15486 ///
15487 /// * *$.xgafv* (query-string) - V1 error format.
15488 /// * *access_token* (query-string) - OAuth access token.
15489 /// * *alt* (query-string) - Data format for response.
15490 /// * *callback* (query-string) - JSONP
15491 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15492 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15493 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15494 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15495 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15496 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15497 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15498 pub fn param<T>(
15499 mut self,
15500 name: T,
15501 value: T,
15502 ) -> ProjectLocationDatasetConsentStoreDeleteCall<'a, C>
15503 where
15504 T: AsRef<str>,
15505 {
15506 self._additional_params
15507 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15508 self
15509 }
15510
15511 /// Identifies the authorization scope for the method you are building.
15512 ///
15513 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15514 /// [`Scope::CloudHealthcare`].
15515 ///
15516 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15517 /// tokens for more than one scope.
15518 ///
15519 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15520 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15521 /// sufficient, a read-write scope will do as well.
15522 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetConsentStoreDeleteCall<'a, C>
15523 where
15524 St: AsRef<str>,
15525 {
15526 self._scopes.insert(String::from(scope.as_ref()));
15527 self
15528 }
15529 /// Identifies the authorization scope(s) for the method you are building.
15530 ///
15531 /// See [`Self::add_scope()`] for details.
15532 pub fn add_scopes<I, St>(
15533 mut self,
15534 scopes: I,
15535 ) -> ProjectLocationDatasetConsentStoreDeleteCall<'a, C>
15536 where
15537 I: IntoIterator<Item = St>,
15538 St: AsRef<str>,
15539 {
15540 self._scopes
15541 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15542 self
15543 }
15544
15545 /// Removes all scopes, and no default scope will be used either.
15546 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15547 /// for details).
15548 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStoreDeleteCall<'a, C> {
15549 self._scopes.clear();
15550 self
15551 }
15552}
15553
15554/// Evaluates the user's Consents for all matching User data mappings. Note: User data mappings are indexed asynchronously, which can cause a slight delay between the time mappings are created or updated and when they are included in EvaluateUserConsents results.
15555///
15556/// A builder for the *locations.datasets.consentStores.evaluateUserConsents* method supported by a *project* resource.
15557/// It is not used directly, but through a [`ProjectMethods`] instance.
15558///
15559/// # Example
15560///
15561/// Instantiate a resource method builder
15562///
15563/// ```test_harness,no_run
15564/// # extern crate hyper;
15565/// # extern crate hyper_rustls;
15566/// # extern crate google_healthcare1 as healthcare1;
15567/// use healthcare1::api::EvaluateUserConsentsRequest;
15568/// # async fn dox() {
15569/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15570///
15571/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15572/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15573/// # secret,
15574/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15575/// # ).build().await.unwrap();
15576///
15577/// # let client = hyper_util::client::legacy::Client::builder(
15578/// # hyper_util::rt::TokioExecutor::new()
15579/// # )
15580/// # .build(
15581/// # hyper_rustls::HttpsConnectorBuilder::new()
15582/// # .with_native_roots()
15583/// # .unwrap()
15584/// # .https_or_http()
15585/// # .enable_http1()
15586/// # .build()
15587/// # );
15588/// # let mut hub = CloudHealthcare::new(client, auth);
15589/// // As the method needs a request, you would usually fill it with the desired information
15590/// // into the respective structure. Some of the parts shown here might not be applicable !
15591/// // Values shown here are possibly random and not representative !
15592/// let mut req = EvaluateUserConsentsRequest::default();
15593///
15594/// // You can configure optional parameters by calling the respective setters at will, and
15595/// // execute the final call using `doit()`.
15596/// // Values shown here are possibly random and not representative !
15597/// let result = hub.projects().locations_datasets_consent_stores_evaluate_user_consents(req, "consentStore")
15598/// .doit().await;
15599/// # }
15600/// ```
15601pub struct ProjectLocationDatasetConsentStoreEvaluateUserConsentCall<'a, C>
15602where
15603 C: 'a,
15604{
15605 hub: &'a CloudHealthcare<C>,
15606 _request: EvaluateUserConsentsRequest,
15607 _consent_store: String,
15608 _delegate: Option<&'a mut dyn common::Delegate>,
15609 _additional_params: HashMap<String, String>,
15610 _scopes: BTreeSet<String>,
15611}
15612
15613impl<'a, C> common::CallBuilder
15614 for ProjectLocationDatasetConsentStoreEvaluateUserConsentCall<'a, C>
15615{
15616}
15617
15618impl<'a, C> ProjectLocationDatasetConsentStoreEvaluateUserConsentCall<'a, C>
15619where
15620 C: common::Connector,
15621{
15622 /// Perform the operation you have build so far.
15623 pub async fn doit(
15624 mut self,
15625 ) -> common::Result<(common::Response, EvaluateUserConsentsResponse)> {
15626 use std::borrow::Cow;
15627 use std::io::{Read, Seek};
15628
15629 use common::{url::Params, ToParts};
15630 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15631
15632 let mut dd = common::DefaultDelegate;
15633 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15634 dlg.begin(common::MethodInfo {
15635 id: "healthcare.projects.locations.datasets.consentStores.evaluateUserConsents",
15636 http_method: hyper::Method::POST,
15637 });
15638
15639 for &field in ["alt", "consentStore"].iter() {
15640 if self._additional_params.contains_key(field) {
15641 dlg.finished(false);
15642 return Err(common::Error::FieldClash(field));
15643 }
15644 }
15645
15646 let mut params = Params::with_capacity(4 + self._additional_params.len());
15647 params.push("consentStore", self._consent_store);
15648
15649 params.extend(self._additional_params.iter());
15650
15651 params.push("alt", "json");
15652 let mut url = self.hub._base_url.clone() + "v1/{+consentStore}:evaluateUserConsents";
15653 if self._scopes.is_empty() {
15654 self._scopes
15655 .insert(Scope::CloudHealthcare.as_ref().to_string());
15656 }
15657
15658 #[allow(clippy::single_element_loop)]
15659 for &(find_this, param_name) in [("{+consentStore}", "consentStore")].iter() {
15660 url = params.uri_replacement(url, param_name, find_this, true);
15661 }
15662 {
15663 let to_remove = ["consentStore"];
15664 params.remove_params(&to_remove);
15665 }
15666
15667 let url = params.parse_with_url(&url);
15668
15669 let mut json_mime_type = mime::APPLICATION_JSON;
15670 let mut request_value_reader = {
15671 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15672 common::remove_json_null_values(&mut value);
15673 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15674 serde_json::to_writer(&mut dst, &value).unwrap();
15675 dst
15676 };
15677 let request_size = request_value_reader
15678 .seek(std::io::SeekFrom::End(0))
15679 .unwrap();
15680 request_value_reader
15681 .seek(std::io::SeekFrom::Start(0))
15682 .unwrap();
15683
15684 loop {
15685 let token = match self
15686 .hub
15687 .auth
15688 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15689 .await
15690 {
15691 Ok(token) => token,
15692 Err(e) => match dlg.token(e) {
15693 Ok(token) => token,
15694 Err(e) => {
15695 dlg.finished(false);
15696 return Err(common::Error::MissingToken(e));
15697 }
15698 },
15699 };
15700 request_value_reader
15701 .seek(std::io::SeekFrom::Start(0))
15702 .unwrap();
15703 let mut req_result = {
15704 let client = &self.hub.client;
15705 dlg.pre_request();
15706 let mut req_builder = hyper::Request::builder()
15707 .method(hyper::Method::POST)
15708 .uri(url.as_str())
15709 .header(USER_AGENT, self.hub._user_agent.clone());
15710
15711 if let Some(token) = token.as_ref() {
15712 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15713 }
15714
15715 let request = req_builder
15716 .header(CONTENT_TYPE, json_mime_type.to_string())
15717 .header(CONTENT_LENGTH, request_size as u64)
15718 .body(common::to_body(
15719 request_value_reader.get_ref().clone().into(),
15720 ));
15721
15722 client.request(request.unwrap()).await
15723 };
15724
15725 match req_result {
15726 Err(err) => {
15727 if let common::Retry::After(d) = dlg.http_error(&err) {
15728 sleep(d).await;
15729 continue;
15730 }
15731 dlg.finished(false);
15732 return Err(common::Error::HttpError(err));
15733 }
15734 Ok(res) => {
15735 let (mut parts, body) = res.into_parts();
15736 let mut body = common::Body::new(body);
15737 if !parts.status.is_success() {
15738 let bytes = common::to_bytes(body).await.unwrap_or_default();
15739 let error = serde_json::from_str(&common::to_string(&bytes));
15740 let response = common::to_response(parts, bytes.into());
15741
15742 if let common::Retry::After(d) =
15743 dlg.http_failure(&response, error.as_ref().ok())
15744 {
15745 sleep(d).await;
15746 continue;
15747 }
15748
15749 dlg.finished(false);
15750
15751 return Err(match error {
15752 Ok(value) => common::Error::BadRequest(value),
15753 _ => common::Error::Failure(response),
15754 });
15755 }
15756 let response = {
15757 let bytes = common::to_bytes(body).await.unwrap_or_default();
15758 let encoded = common::to_string(&bytes);
15759 match serde_json::from_str(&encoded) {
15760 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15761 Err(error) => {
15762 dlg.response_json_decode_error(&encoded, &error);
15763 return Err(common::Error::JsonDecodeError(
15764 encoded.to_string(),
15765 error,
15766 ));
15767 }
15768 }
15769 };
15770
15771 dlg.finished(true);
15772 return Ok(response);
15773 }
15774 }
15775 }
15776 }
15777
15778 ///
15779 /// Sets the *request* property to the given value.
15780 ///
15781 /// Even though the property as already been set when instantiating this call,
15782 /// we provide this method for API completeness.
15783 pub fn request(
15784 mut self,
15785 new_value: EvaluateUserConsentsRequest,
15786 ) -> ProjectLocationDatasetConsentStoreEvaluateUserConsentCall<'a, C> {
15787 self._request = new_value;
15788 self
15789 }
15790 /// Required. Name of the consent store to retrieve User data mappings from.
15791 ///
15792 /// Sets the *consent store* path property to the given value.
15793 ///
15794 /// Even though the property as already been set when instantiating this call,
15795 /// we provide this method for API completeness.
15796 pub fn consent_store(
15797 mut self,
15798 new_value: &str,
15799 ) -> ProjectLocationDatasetConsentStoreEvaluateUserConsentCall<'a, C> {
15800 self._consent_store = new_value.to_string();
15801 self
15802 }
15803 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15804 /// while executing the actual API request.
15805 ///
15806 /// ````text
15807 /// It should be used to handle progress information, and to implement a certain level of resilience.
15808 /// ````
15809 ///
15810 /// Sets the *delegate* property to the given value.
15811 pub fn delegate(
15812 mut self,
15813 new_value: &'a mut dyn common::Delegate,
15814 ) -> ProjectLocationDatasetConsentStoreEvaluateUserConsentCall<'a, C> {
15815 self._delegate = Some(new_value);
15816 self
15817 }
15818
15819 /// Set any additional parameter of the query string used in the request.
15820 /// It should be used to set parameters which are not yet available through their own
15821 /// setters.
15822 ///
15823 /// Please note that this method must not be used to set any of the known parameters
15824 /// which have their own setter method. If done anyway, the request will fail.
15825 ///
15826 /// # Additional Parameters
15827 ///
15828 /// * *$.xgafv* (query-string) - V1 error format.
15829 /// * *access_token* (query-string) - OAuth access token.
15830 /// * *alt* (query-string) - Data format for response.
15831 /// * *callback* (query-string) - JSONP
15832 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15833 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15834 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15835 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15836 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15837 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15838 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15839 pub fn param<T>(
15840 mut self,
15841 name: T,
15842 value: T,
15843 ) -> ProjectLocationDatasetConsentStoreEvaluateUserConsentCall<'a, C>
15844 where
15845 T: AsRef<str>,
15846 {
15847 self._additional_params
15848 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15849 self
15850 }
15851
15852 /// Identifies the authorization scope for the method you are building.
15853 ///
15854 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15855 /// [`Scope::CloudHealthcare`].
15856 ///
15857 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15858 /// tokens for more than one scope.
15859 ///
15860 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15861 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15862 /// sufficient, a read-write scope will do as well.
15863 pub fn add_scope<St>(
15864 mut self,
15865 scope: St,
15866 ) -> ProjectLocationDatasetConsentStoreEvaluateUserConsentCall<'a, C>
15867 where
15868 St: AsRef<str>,
15869 {
15870 self._scopes.insert(String::from(scope.as_ref()));
15871 self
15872 }
15873 /// Identifies the authorization scope(s) for the method you are building.
15874 ///
15875 /// See [`Self::add_scope()`] for details.
15876 pub fn add_scopes<I, St>(
15877 mut self,
15878 scopes: I,
15879 ) -> ProjectLocationDatasetConsentStoreEvaluateUserConsentCall<'a, C>
15880 where
15881 I: IntoIterator<Item = St>,
15882 St: AsRef<str>,
15883 {
15884 self._scopes
15885 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15886 self
15887 }
15888
15889 /// Removes all scopes, and no default scope will be used either.
15890 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15891 /// for details).
15892 pub fn clear_scopes(
15893 mut self,
15894 ) -> ProjectLocationDatasetConsentStoreEvaluateUserConsentCall<'a, C> {
15895 self._scopes.clear();
15896 self
15897 }
15898}
15899
15900/// Gets the specified consent store.
15901///
15902/// A builder for the *locations.datasets.consentStores.get* method supported by a *project* resource.
15903/// It is not used directly, but through a [`ProjectMethods`] instance.
15904///
15905/// # Example
15906///
15907/// Instantiate a resource method builder
15908///
15909/// ```test_harness,no_run
15910/// # extern crate hyper;
15911/// # extern crate hyper_rustls;
15912/// # extern crate google_healthcare1 as healthcare1;
15913/// # async fn dox() {
15914/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15915///
15916/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15917/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15918/// # secret,
15919/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15920/// # ).build().await.unwrap();
15921///
15922/// # let client = hyper_util::client::legacy::Client::builder(
15923/// # hyper_util::rt::TokioExecutor::new()
15924/// # )
15925/// # .build(
15926/// # hyper_rustls::HttpsConnectorBuilder::new()
15927/// # .with_native_roots()
15928/// # .unwrap()
15929/// # .https_or_http()
15930/// # .enable_http1()
15931/// # .build()
15932/// # );
15933/// # let mut hub = CloudHealthcare::new(client, auth);
15934/// // You can configure optional parameters by calling the respective setters at will, and
15935/// // execute the final call using `doit()`.
15936/// // Values shown here are possibly random and not representative !
15937/// let result = hub.projects().locations_datasets_consent_stores_get("name")
15938/// .doit().await;
15939/// # }
15940/// ```
15941pub struct ProjectLocationDatasetConsentStoreGetCall<'a, C>
15942where
15943 C: 'a,
15944{
15945 hub: &'a CloudHealthcare<C>,
15946 _name: String,
15947 _delegate: Option<&'a mut dyn common::Delegate>,
15948 _additional_params: HashMap<String, String>,
15949 _scopes: BTreeSet<String>,
15950}
15951
15952impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreGetCall<'a, C> {}
15953
15954impl<'a, C> ProjectLocationDatasetConsentStoreGetCall<'a, C>
15955where
15956 C: common::Connector,
15957{
15958 /// Perform the operation you have build so far.
15959 pub async fn doit(mut self) -> common::Result<(common::Response, ConsentStore)> {
15960 use std::borrow::Cow;
15961 use std::io::{Read, Seek};
15962
15963 use common::{url::Params, ToParts};
15964 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15965
15966 let mut dd = common::DefaultDelegate;
15967 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15968 dlg.begin(common::MethodInfo {
15969 id: "healthcare.projects.locations.datasets.consentStores.get",
15970 http_method: hyper::Method::GET,
15971 });
15972
15973 for &field in ["alt", "name"].iter() {
15974 if self._additional_params.contains_key(field) {
15975 dlg.finished(false);
15976 return Err(common::Error::FieldClash(field));
15977 }
15978 }
15979
15980 let mut params = Params::with_capacity(3 + self._additional_params.len());
15981 params.push("name", self._name);
15982
15983 params.extend(self._additional_params.iter());
15984
15985 params.push("alt", "json");
15986 let mut url = self.hub._base_url.clone() + "v1/{+name}";
15987 if self._scopes.is_empty() {
15988 self._scopes
15989 .insert(Scope::CloudHealthcare.as_ref().to_string());
15990 }
15991
15992 #[allow(clippy::single_element_loop)]
15993 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15994 url = params.uri_replacement(url, param_name, find_this, true);
15995 }
15996 {
15997 let to_remove = ["name"];
15998 params.remove_params(&to_remove);
15999 }
16000
16001 let url = params.parse_with_url(&url);
16002
16003 loop {
16004 let token = match self
16005 .hub
16006 .auth
16007 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16008 .await
16009 {
16010 Ok(token) => token,
16011 Err(e) => match dlg.token(e) {
16012 Ok(token) => token,
16013 Err(e) => {
16014 dlg.finished(false);
16015 return Err(common::Error::MissingToken(e));
16016 }
16017 },
16018 };
16019 let mut req_result = {
16020 let client = &self.hub.client;
16021 dlg.pre_request();
16022 let mut req_builder = hyper::Request::builder()
16023 .method(hyper::Method::GET)
16024 .uri(url.as_str())
16025 .header(USER_AGENT, self.hub._user_agent.clone());
16026
16027 if let Some(token) = token.as_ref() {
16028 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16029 }
16030
16031 let request = req_builder
16032 .header(CONTENT_LENGTH, 0_u64)
16033 .body(common::to_body::<String>(None));
16034
16035 client.request(request.unwrap()).await
16036 };
16037
16038 match req_result {
16039 Err(err) => {
16040 if let common::Retry::After(d) = dlg.http_error(&err) {
16041 sleep(d).await;
16042 continue;
16043 }
16044 dlg.finished(false);
16045 return Err(common::Error::HttpError(err));
16046 }
16047 Ok(res) => {
16048 let (mut parts, body) = res.into_parts();
16049 let mut body = common::Body::new(body);
16050 if !parts.status.is_success() {
16051 let bytes = common::to_bytes(body).await.unwrap_or_default();
16052 let error = serde_json::from_str(&common::to_string(&bytes));
16053 let response = common::to_response(parts, bytes.into());
16054
16055 if let common::Retry::After(d) =
16056 dlg.http_failure(&response, error.as_ref().ok())
16057 {
16058 sleep(d).await;
16059 continue;
16060 }
16061
16062 dlg.finished(false);
16063
16064 return Err(match error {
16065 Ok(value) => common::Error::BadRequest(value),
16066 _ => common::Error::Failure(response),
16067 });
16068 }
16069 let response = {
16070 let bytes = common::to_bytes(body).await.unwrap_or_default();
16071 let encoded = common::to_string(&bytes);
16072 match serde_json::from_str(&encoded) {
16073 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16074 Err(error) => {
16075 dlg.response_json_decode_error(&encoded, &error);
16076 return Err(common::Error::JsonDecodeError(
16077 encoded.to_string(),
16078 error,
16079 ));
16080 }
16081 }
16082 };
16083
16084 dlg.finished(true);
16085 return Ok(response);
16086 }
16087 }
16088 }
16089 }
16090
16091 /// Required. The resource name of the consent store to get.
16092 ///
16093 /// Sets the *name* path property to the given value.
16094 ///
16095 /// Even though the property as already been set when instantiating this call,
16096 /// we provide this method for API completeness.
16097 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetConsentStoreGetCall<'a, C> {
16098 self._name = new_value.to_string();
16099 self
16100 }
16101 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16102 /// while executing the actual API request.
16103 ///
16104 /// ````text
16105 /// It should be used to handle progress information, and to implement a certain level of resilience.
16106 /// ````
16107 ///
16108 /// Sets the *delegate* property to the given value.
16109 pub fn delegate(
16110 mut self,
16111 new_value: &'a mut dyn common::Delegate,
16112 ) -> ProjectLocationDatasetConsentStoreGetCall<'a, C> {
16113 self._delegate = Some(new_value);
16114 self
16115 }
16116
16117 /// Set any additional parameter of the query string used in the request.
16118 /// It should be used to set parameters which are not yet available through their own
16119 /// setters.
16120 ///
16121 /// Please note that this method must not be used to set any of the known parameters
16122 /// which have their own setter method. If done anyway, the request will fail.
16123 ///
16124 /// # Additional Parameters
16125 ///
16126 /// * *$.xgafv* (query-string) - V1 error format.
16127 /// * *access_token* (query-string) - OAuth access token.
16128 /// * *alt* (query-string) - Data format for response.
16129 /// * *callback* (query-string) - JSONP
16130 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16131 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16132 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16133 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16134 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16135 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16136 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16137 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetConsentStoreGetCall<'a, C>
16138 where
16139 T: AsRef<str>,
16140 {
16141 self._additional_params
16142 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16143 self
16144 }
16145
16146 /// Identifies the authorization scope for the method you are building.
16147 ///
16148 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16149 /// [`Scope::CloudHealthcare`].
16150 ///
16151 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16152 /// tokens for more than one scope.
16153 ///
16154 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16155 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16156 /// sufficient, a read-write scope will do as well.
16157 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetConsentStoreGetCall<'a, C>
16158 where
16159 St: AsRef<str>,
16160 {
16161 self._scopes.insert(String::from(scope.as_ref()));
16162 self
16163 }
16164 /// Identifies the authorization scope(s) for the method you are building.
16165 ///
16166 /// See [`Self::add_scope()`] for details.
16167 pub fn add_scopes<I, St>(
16168 mut self,
16169 scopes: I,
16170 ) -> ProjectLocationDatasetConsentStoreGetCall<'a, C>
16171 where
16172 I: IntoIterator<Item = St>,
16173 St: AsRef<str>,
16174 {
16175 self._scopes
16176 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16177 self
16178 }
16179
16180 /// Removes all scopes, and no default scope will be used either.
16181 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16182 /// for details).
16183 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStoreGetCall<'a, C> {
16184 self._scopes.clear();
16185 self
16186 }
16187}
16188
16189/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
16190///
16191/// A builder for the *locations.datasets.consentStores.getIamPolicy* method supported by a *project* resource.
16192/// It is not used directly, but through a [`ProjectMethods`] instance.
16193///
16194/// # Example
16195///
16196/// Instantiate a resource method builder
16197///
16198/// ```test_harness,no_run
16199/// # extern crate hyper;
16200/// # extern crate hyper_rustls;
16201/// # extern crate google_healthcare1 as healthcare1;
16202/// # async fn dox() {
16203/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16204///
16205/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16206/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16207/// # secret,
16208/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16209/// # ).build().await.unwrap();
16210///
16211/// # let client = hyper_util::client::legacy::Client::builder(
16212/// # hyper_util::rt::TokioExecutor::new()
16213/// # )
16214/// # .build(
16215/// # hyper_rustls::HttpsConnectorBuilder::new()
16216/// # .with_native_roots()
16217/// # .unwrap()
16218/// # .https_or_http()
16219/// # .enable_http1()
16220/// # .build()
16221/// # );
16222/// # let mut hub = CloudHealthcare::new(client, auth);
16223/// // You can configure optional parameters by calling the respective setters at will, and
16224/// // execute the final call using `doit()`.
16225/// // Values shown here are possibly random and not representative !
16226/// let result = hub.projects().locations_datasets_consent_stores_get_iam_policy("resource")
16227/// .options_requested_policy_version(-76)
16228/// .doit().await;
16229/// # }
16230/// ```
16231pub struct ProjectLocationDatasetConsentStoreGetIamPolicyCall<'a, C>
16232where
16233 C: 'a,
16234{
16235 hub: &'a CloudHealthcare<C>,
16236 _resource: String,
16237 _options_requested_policy_version: Option<i32>,
16238 _delegate: Option<&'a mut dyn common::Delegate>,
16239 _additional_params: HashMap<String, String>,
16240 _scopes: BTreeSet<String>,
16241}
16242
16243impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreGetIamPolicyCall<'a, C> {}
16244
16245impl<'a, C> ProjectLocationDatasetConsentStoreGetIamPolicyCall<'a, C>
16246where
16247 C: common::Connector,
16248{
16249 /// Perform the operation you have build so far.
16250 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
16251 use std::borrow::Cow;
16252 use std::io::{Read, Seek};
16253
16254 use common::{url::Params, ToParts};
16255 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16256
16257 let mut dd = common::DefaultDelegate;
16258 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16259 dlg.begin(common::MethodInfo {
16260 id: "healthcare.projects.locations.datasets.consentStores.getIamPolicy",
16261 http_method: hyper::Method::GET,
16262 });
16263
16264 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
16265 if self._additional_params.contains_key(field) {
16266 dlg.finished(false);
16267 return Err(common::Error::FieldClash(field));
16268 }
16269 }
16270
16271 let mut params = Params::with_capacity(4 + self._additional_params.len());
16272 params.push("resource", self._resource);
16273 if let Some(value) = self._options_requested_policy_version.as_ref() {
16274 params.push("options.requestedPolicyVersion", value.to_string());
16275 }
16276
16277 params.extend(self._additional_params.iter());
16278
16279 params.push("alt", "json");
16280 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
16281 if self._scopes.is_empty() {
16282 self._scopes
16283 .insert(Scope::CloudHealthcare.as_ref().to_string());
16284 }
16285
16286 #[allow(clippy::single_element_loop)]
16287 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16288 url = params.uri_replacement(url, param_name, find_this, true);
16289 }
16290 {
16291 let to_remove = ["resource"];
16292 params.remove_params(&to_remove);
16293 }
16294
16295 let url = params.parse_with_url(&url);
16296
16297 loop {
16298 let token = match self
16299 .hub
16300 .auth
16301 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16302 .await
16303 {
16304 Ok(token) => token,
16305 Err(e) => match dlg.token(e) {
16306 Ok(token) => token,
16307 Err(e) => {
16308 dlg.finished(false);
16309 return Err(common::Error::MissingToken(e));
16310 }
16311 },
16312 };
16313 let mut req_result = {
16314 let client = &self.hub.client;
16315 dlg.pre_request();
16316 let mut req_builder = hyper::Request::builder()
16317 .method(hyper::Method::GET)
16318 .uri(url.as_str())
16319 .header(USER_AGENT, self.hub._user_agent.clone());
16320
16321 if let Some(token) = token.as_ref() {
16322 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16323 }
16324
16325 let request = req_builder
16326 .header(CONTENT_LENGTH, 0_u64)
16327 .body(common::to_body::<String>(None));
16328
16329 client.request(request.unwrap()).await
16330 };
16331
16332 match req_result {
16333 Err(err) => {
16334 if let common::Retry::After(d) = dlg.http_error(&err) {
16335 sleep(d).await;
16336 continue;
16337 }
16338 dlg.finished(false);
16339 return Err(common::Error::HttpError(err));
16340 }
16341 Ok(res) => {
16342 let (mut parts, body) = res.into_parts();
16343 let mut body = common::Body::new(body);
16344 if !parts.status.is_success() {
16345 let bytes = common::to_bytes(body).await.unwrap_or_default();
16346 let error = serde_json::from_str(&common::to_string(&bytes));
16347 let response = common::to_response(parts, bytes.into());
16348
16349 if let common::Retry::After(d) =
16350 dlg.http_failure(&response, error.as_ref().ok())
16351 {
16352 sleep(d).await;
16353 continue;
16354 }
16355
16356 dlg.finished(false);
16357
16358 return Err(match error {
16359 Ok(value) => common::Error::BadRequest(value),
16360 _ => common::Error::Failure(response),
16361 });
16362 }
16363 let response = {
16364 let bytes = common::to_bytes(body).await.unwrap_or_default();
16365 let encoded = common::to_string(&bytes);
16366 match serde_json::from_str(&encoded) {
16367 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16368 Err(error) => {
16369 dlg.response_json_decode_error(&encoded, &error);
16370 return Err(common::Error::JsonDecodeError(
16371 encoded.to_string(),
16372 error,
16373 ));
16374 }
16375 }
16376 };
16377
16378 dlg.finished(true);
16379 return Ok(response);
16380 }
16381 }
16382 }
16383 }
16384
16385 /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
16386 ///
16387 /// Sets the *resource* path property to the given value.
16388 ///
16389 /// Even though the property as already been set when instantiating this call,
16390 /// we provide this method for API completeness.
16391 pub fn resource(
16392 mut self,
16393 new_value: &str,
16394 ) -> ProjectLocationDatasetConsentStoreGetIamPolicyCall<'a, C> {
16395 self._resource = new_value.to_string();
16396 self
16397 }
16398 /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
16399 ///
16400 /// Sets the *options.requested policy version* query property to the given value.
16401 pub fn options_requested_policy_version(
16402 mut self,
16403 new_value: i32,
16404 ) -> ProjectLocationDatasetConsentStoreGetIamPolicyCall<'a, C> {
16405 self._options_requested_policy_version = Some(new_value);
16406 self
16407 }
16408 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16409 /// while executing the actual API request.
16410 ///
16411 /// ````text
16412 /// It should be used to handle progress information, and to implement a certain level of resilience.
16413 /// ````
16414 ///
16415 /// Sets the *delegate* property to the given value.
16416 pub fn delegate(
16417 mut self,
16418 new_value: &'a mut dyn common::Delegate,
16419 ) -> ProjectLocationDatasetConsentStoreGetIamPolicyCall<'a, C> {
16420 self._delegate = Some(new_value);
16421 self
16422 }
16423
16424 /// Set any additional parameter of the query string used in the request.
16425 /// It should be used to set parameters which are not yet available through their own
16426 /// setters.
16427 ///
16428 /// Please note that this method must not be used to set any of the known parameters
16429 /// which have their own setter method. If done anyway, the request will fail.
16430 ///
16431 /// # Additional Parameters
16432 ///
16433 /// * *$.xgafv* (query-string) - V1 error format.
16434 /// * *access_token* (query-string) - OAuth access token.
16435 /// * *alt* (query-string) - Data format for response.
16436 /// * *callback* (query-string) - JSONP
16437 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16438 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16439 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16440 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16441 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16442 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16443 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16444 pub fn param<T>(
16445 mut self,
16446 name: T,
16447 value: T,
16448 ) -> ProjectLocationDatasetConsentStoreGetIamPolicyCall<'a, C>
16449 where
16450 T: AsRef<str>,
16451 {
16452 self._additional_params
16453 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16454 self
16455 }
16456
16457 /// Identifies the authorization scope for the method you are building.
16458 ///
16459 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16460 /// [`Scope::CloudHealthcare`].
16461 ///
16462 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16463 /// tokens for more than one scope.
16464 ///
16465 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16466 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16467 /// sufficient, a read-write scope will do as well.
16468 pub fn add_scope<St>(
16469 mut self,
16470 scope: St,
16471 ) -> ProjectLocationDatasetConsentStoreGetIamPolicyCall<'a, C>
16472 where
16473 St: AsRef<str>,
16474 {
16475 self._scopes.insert(String::from(scope.as_ref()));
16476 self
16477 }
16478 /// Identifies the authorization scope(s) for the method you are building.
16479 ///
16480 /// See [`Self::add_scope()`] for details.
16481 pub fn add_scopes<I, St>(
16482 mut self,
16483 scopes: I,
16484 ) -> ProjectLocationDatasetConsentStoreGetIamPolicyCall<'a, C>
16485 where
16486 I: IntoIterator<Item = St>,
16487 St: AsRef<str>,
16488 {
16489 self._scopes
16490 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16491 self
16492 }
16493
16494 /// Removes all scopes, and no default scope will be used either.
16495 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16496 /// for details).
16497 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStoreGetIamPolicyCall<'a, C> {
16498 self._scopes.clear();
16499 self
16500 }
16501}
16502
16503/// Lists the consent stores in the specified dataset.
16504///
16505/// A builder for the *locations.datasets.consentStores.list* method supported by a *project* resource.
16506/// It is not used directly, but through a [`ProjectMethods`] instance.
16507///
16508/// # Example
16509///
16510/// Instantiate a resource method builder
16511///
16512/// ```test_harness,no_run
16513/// # extern crate hyper;
16514/// # extern crate hyper_rustls;
16515/// # extern crate google_healthcare1 as healthcare1;
16516/// # async fn dox() {
16517/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16518///
16519/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16520/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16521/// # secret,
16522/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16523/// # ).build().await.unwrap();
16524///
16525/// # let client = hyper_util::client::legacy::Client::builder(
16526/// # hyper_util::rt::TokioExecutor::new()
16527/// # )
16528/// # .build(
16529/// # hyper_rustls::HttpsConnectorBuilder::new()
16530/// # .with_native_roots()
16531/// # .unwrap()
16532/// # .https_or_http()
16533/// # .enable_http1()
16534/// # .build()
16535/// # );
16536/// # let mut hub = CloudHealthcare::new(client, auth);
16537/// // You can configure optional parameters by calling the respective setters at will, and
16538/// // execute the final call using `doit()`.
16539/// // Values shown here are possibly random and not representative !
16540/// let result = hub.projects().locations_datasets_consent_stores_list("parent")
16541/// .page_token("Lorem")
16542/// .page_size(-29)
16543/// .filter("no")
16544/// .doit().await;
16545/// # }
16546/// ```
16547pub struct ProjectLocationDatasetConsentStoreListCall<'a, C>
16548where
16549 C: 'a,
16550{
16551 hub: &'a CloudHealthcare<C>,
16552 _parent: String,
16553 _page_token: Option<String>,
16554 _page_size: Option<i32>,
16555 _filter: Option<String>,
16556 _delegate: Option<&'a mut dyn common::Delegate>,
16557 _additional_params: HashMap<String, String>,
16558 _scopes: BTreeSet<String>,
16559}
16560
16561impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreListCall<'a, C> {}
16562
16563impl<'a, C> ProjectLocationDatasetConsentStoreListCall<'a, C>
16564where
16565 C: common::Connector,
16566{
16567 /// Perform the operation you have build so far.
16568 pub async fn doit(mut self) -> common::Result<(common::Response, ListConsentStoresResponse)> {
16569 use std::borrow::Cow;
16570 use std::io::{Read, Seek};
16571
16572 use common::{url::Params, ToParts};
16573 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16574
16575 let mut dd = common::DefaultDelegate;
16576 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16577 dlg.begin(common::MethodInfo {
16578 id: "healthcare.projects.locations.datasets.consentStores.list",
16579 http_method: hyper::Method::GET,
16580 });
16581
16582 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
16583 if self._additional_params.contains_key(field) {
16584 dlg.finished(false);
16585 return Err(common::Error::FieldClash(field));
16586 }
16587 }
16588
16589 let mut params = Params::with_capacity(6 + self._additional_params.len());
16590 params.push("parent", self._parent);
16591 if let Some(value) = self._page_token.as_ref() {
16592 params.push("pageToken", value);
16593 }
16594 if let Some(value) = self._page_size.as_ref() {
16595 params.push("pageSize", value.to_string());
16596 }
16597 if let Some(value) = self._filter.as_ref() {
16598 params.push("filter", value);
16599 }
16600
16601 params.extend(self._additional_params.iter());
16602
16603 params.push("alt", "json");
16604 let mut url = self.hub._base_url.clone() + "v1/{+parent}/consentStores";
16605 if self._scopes.is_empty() {
16606 self._scopes
16607 .insert(Scope::CloudHealthcare.as_ref().to_string());
16608 }
16609
16610 #[allow(clippy::single_element_loop)]
16611 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16612 url = params.uri_replacement(url, param_name, find_this, true);
16613 }
16614 {
16615 let to_remove = ["parent"];
16616 params.remove_params(&to_remove);
16617 }
16618
16619 let url = params.parse_with_url(&url);
16620
16621 loop {
16622 let token = match self
16623 .hub
16624 .auth
16625 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16626 .await
16627 {
16628 Ok(token) => token,
16629 Err(e) => match dlg.token(e) {
16630 Ok(token) => token,
16631 Err(e) => {
16632 dlg.finished(false);
16633 return Err(common::Error::MissingToken(e));
16634 }
16635 },
16636 };
16637 let mut req_result = {
16638 let client = &self.hub.client;
16639 dlg.pre_request();
16640 let mut req_builder = hyper::Request::builder()
16641 .method(hyper::Method::GET)
16642 .uri(url.as_str())
16643 .header(USER_AGENT, self.hub._user_agent.clone());
16644
16645 if let Some(token) = token.as_ref() {
16646 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16647 }
16648
16649 let request = req_builder
16650 .header(CONTENT_LENGTH, 0_u64)
16651 .body(common::to_body::<String>(None));
16652
16653 client.request(request.unwrap()).await
16654 };
16655
16656 match req_result {
16657 Err(err) => {
16658 if let common::Retry::After(d) = dlg.http_error(&err) {
16659 sleep(d).await;
16660 continue;
16661 }
16662 dlg.finished(false);
16663 return Err(common::Error::HttpError(err));
16664 }
16665 Ok(res) => {
16666 let (mut parts, body) = res.into_parts();
16667 let mut body = common::Body::new(body);
16668 if !parts.status.is_success() {
16669 let bytes = common::to_bytes(body).await.unwrap_or_default();
16670 let error = serde_json::from_str(&common::to_string(&bytes));
16671 let response = common::to_response(parts, bytes.into());
16672
16673 if let common::Retry::After(d) =
16674 dlg.http_failure(&response, error.as_ref().ok())
16675 {
16676 sleep(d).await;
16677 continue;
16678 }
16679
16680 dlg.finished(false);
16681
16682 return Err(match error {
16683 Ok(value) => common::Error::BadRequest(value),
16684 _ => common::Error::Failure(response),
16685 });
16686 }
16687 let response = {
16688 let bytes = common::to_bytes(body).await.unwrap_or_default();
16689 let encoded = common::to_string(&bytes);
16690 match serde_json::from_str(&encoded) {
16691 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16692 Err(error) => {
16693 dlg.response_json_decode_error(&encoded, &error);
16694 return Err(common::Error::JsonDecodeError(
16695 encoded.to_string(),
16696 error,
16697 ));
16698 }
16699 }
16700 };
16701
16702 dlg.finished(true);
16703 return Ok(response);
16704 }
16705 }
16706 }
16707 }
16708
16709 /// Required. Name of the dataset.
16710 ///
16711 /// Sets the *parent* path property to the given value.
16712 ///
16713 /// Even though the property as already been set when instantiating this call,
16714 /// we provide this method for API completeness.
16715 pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetConsentStoreListCall<'a, C> {
16716 self._parent = new_value.to_string();
16717 self
16718 }
16719 /// Optional. Token to retrieve the next page of results, or empty to get the first page.
16720 ///
16721 /// Sets the *page token* query property to the given value.
16722 pub fn page_token(
16723 mut self,
16724 new_value: &str,
16725 ) -> ProjectLocationDatasetConsentStoreListCall<'a, C> {
16726 self._page_token = Some(new_value.to_string());
16727 self
16728 }
16729 /// Optional. Limit on the number of consent stores to return in a single response. If not specified, 100 is used. May not be larger than 1000.
16730 ///
16731 /// Sets the *page size* query property to the given value.
16732 pub fn page_size(
16733 mut self,
16734 new_value: i32,
16735 ) -> ProjectLocationDatasetConsentStoreListCall<'a, C> {
16736 self._page_size = Some(new_value);
16737 self
16738 }
16739 /// Optional. Restricts the stores returned to those matching a filter. Only filtering on labels is supported. For example, `filter=labels.key=value`.
16740 ///
16741 /// Sets the *filter* query property to the given value.
16742 pub fn filter(mut self, new_value: &str) -> ProjectLocationDatasetConsentStoreListCall<'a, C> {
16743 self._filter = Some(new_value.to_string());
16744 self
16745 }
16746 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16747 /// while executing the actual API request.
16748 ///
16749 /// ````text
16750 /// It should be used to handle progress information, and to implement a certain level of resilience.
16751 /// ````
16752 ///
16753 /// Sets the *delegate* property to the given value.
16754 pub fn delegate(
16755 mut self,
16756 new_value: &'a mut dyn common::Delegate,
16757 ) -> ProjectLocationDatasetConsentStoreListCall<'a, C> {
16758 self._delegate = Some(new_value);
16759 self
16760 }
16761
16762 /// Set any additional parameter of the query string used in the request.
16763 /// It should be used to set parameters which are not yet available through their own
16764 /// setters.
16765 ///
16766 /// Please note that this method must not be used to set any of the known parameters
16767 /// which have their own setter method. If done anyway, the request will fail.
16768 ///
16769 /// # Additional Parameters
16770 ///
16771 /// * *$.xgafv* (query-string) - V1 error format.
16772 /// * *access_token* (query-string) - OAuth access token.
16773 /// * *alt* (query-string) - Data format for response.
16774 /// * *callback* (query-string) - JSONP
16775 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16776 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16777 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16778 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16779 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16780 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16781 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16782 pub fn param<T>(
16783 mut self,
16784 name: T,
16785 value: T,
16786 ) -> ProjectLocationDatasetConsentStoreListCall<'a, C>
16787 where
16788 T: AsRef<str>,
16789 {
16790 self._additional_params
16791 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16792 self
16793 }
16794
16795 /// Identifies the authorization scope for the method you are building.
16796 ///
16797 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16798 /// [`Scope::CloudHealthcare`].
16799 ///
16800 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16801 /// tokens for more than one scope.
16802 ///
16803 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16804 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16805 /// sufficient, a read-write scope will do as well.
16806 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetConsentStoreListCall<'a, C>
16807 where
16808 St: AsRef<str>,
16809 {
16810 self._scopes.insert(String::from(scope.as_ref()));
16811 self
16812 }
16813 /// Identifies the authorization scope(s) for the method you are building.
16814 ///
16815 /// See [`Self::add_scope()`] for details.
16816 pub fn add_scopes<I, St>(
16817 mut self,
16818 scopes: I,
16819 ) -> ProjectLocationDatasetConsentStoreListCall<'a, C>
16820 where
16821 I: IntoIterator<Item = St>,
16822 St: AsRef<str>,
16823 {
16824 self._scopes
16825 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16826 self
16827 }
16828
16829 /// Removes all scopes, and no default scope will be used either.
16830 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16831 /// for details).
16832 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStoreListCall<'a, C> {
16833 self._scopes.clear();
16834 self
16835 }
16836}
16837
16838/// Updates the specified consent store.
16839///
16840/// A builder for the *locations.datasets.consentStores.patch* method supported by a *project* resource.
16841/// It is not used directly, but through a [`ProjectMethods`] instance.
16842///
16843/// # Example
16844///
16845/// Instantiate a resource method builder
16846///
16847/// ```test_harness,no_run
16848/// # extern crate hyper;
16849/// # extern crate hyper_rustls;
16850/// # extern crate google_healthcare1 as healthcare1;
16851/// use healthcare1::api::ConsentStore;
16852/// # async fn dox() {
16853/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16854///
16855/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16856/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16857/// # secret,
16858/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16859/// # ).build().await.unwrap();
16860///
16861/// # let client = hyper_util::client::legacy::Client::builder(
16862/// # hyper_util::rt::TokioExecutor::new()
16863/// # )
16864/// # .build(
16865/// # hyper_rustls::HttpsConnectorBuilder::new()
16866/// # .with_native_roots()
16867/// # .unwrap()
16868/// # .https_or_http()
16869/// # .enable_http1()
16870/// # .build()
16871/// # );
16872/// # let mut hub = CloudHealthcare::new(client, auth);
16873/// // As the method needs a request, you would usually fill it with the desired information
16874/// // into the respective structure. Some of the parts shown here might not be applicable !
16875/// // Values shown here are possibly random and not representative !
16876/// let mut req = ConsentStore::default();
16877///
16878/// // You can configure optional parameters by calling the respective setters at will, and
16879/// // execute the final call using `doit()`.
16880/// // Values shown here are possibly random and not representative !
16881/// let result = hub.projects().locations_datasets_consent_stores_patch(req, "name")
16882/// .update_mask(FieldMask::new::<&str>(&[]))
16883/// .doit().await;
16884/// # }
16885/// ```
16886pub struct ProjectLocationDatasetConsentStorePatchCall<'a, C>
16887where
16888 C: 'a,
16889{
16890 hub: &'a CloudHealthcare<C>,
16891 _request: ConsentStore,
16892 _name: String,
16893 _update_mask: Option<common::FieldMask>,
16894 _delegate: Option<&'a mut dyn common::Delegate>,
16895 _additional_params: HashMap<String, String>,
16896 _scopes: BTreeSet<String>,
16897}
16898
16899impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStorePatchCall<'a, C> {}
16900
16901impl<'a, C> ProjectLocationDatasetConsentStorePatchCall<'a, C>
16902where
16903 C: common::Connector,
16904{
16905 /// Perform the operation you have build so far.
16906 pub async fn doit(mut self) -> common::Result<(common::Response, ConsentStore)> {
16907 use std::borrow::Cow;
16908 use std::io::{Read, Seek};
16909
16910 use common::{url::Params, ToParts};
16911 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16912
16913 let mut dd = common::DefaultDelegate;
16914 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16915 dlg.begin(common::MethodInfo {
16916 id: "healthcare.projects.locations.datasets.consentStores.patch",
16917 http_method: hyper::Method::PATCH,
16918 });
16919
16920 for &field in ["alt", "name", "updateMask"].iter() {
16921 if self._additional_params.contains_key(field) {
16922 dlg.finished(false);
16923 return Err(common::Error::FieldClash(field));
16924 }
16925 }
16926
16927 let mut params = Params::with_capacity(5 + self._additional_params.len());
16928 params.push("name", self._name);
16929 if let Some(value) = self._update_mask.as_ref() {
16930 params.push("updateMask", value.to_string());
16931 }
16932
16933 params.extend(self._additional_params.iter());
16934
16935 params.push("alt", "json");
16936 let mut url = self.hub._base_url.clone() + "v1/{+name}";
16937 if self._scopes.is_empty() {
16938 self._scopes
16939 .insert(Scope::CloudHealthcare.as_ref().to_string());
16940 }
16941
16942 #[allow(clippy::single_element_loop)]
16943 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16944 url = params.uri_replacement(url, param_name, find_this, true);
16945 }
16946 {
16947 let to_remove = ["name"];
16948 params.remove_params(&to_remove);
16949 }
16950
16951 let url = params.parse_with_url(&url);
16952
16953 let mut json_mime_type = mime::APPLICATION_JSON;
16954 let mut request_value_reader = {
16955 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16956 common::remove_json_null_values(&mut value);
16957 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16958 serde_json::to_writer(&mut dst, &value).unwrap();
16959 dst
16960 };
16961 let request_size = request_value_reader
16962 .seek(std::io::SeekFrom::End(0))
16963 .unwrap();
16964 request_value_reader
16965 .seek(std::io::SeekFrom::Start(0))
16966 .unwrap();
16967
16968 loop {
16969 let token = match self
16970 .hub
16971 .auth
16972 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16973 .await
16974 {
16975 Ok(token) => token,
16976 Err(e) => match dlg.token(e) {
16977 Ok(token) => token,
16978 Err(e) => {
16979 dlg.finished(false);
16980 return Err(common::Error::MissingToken(e));
16981 }
16982 },
16983 };
16984 request_value_reader
16985 .seek(std::io::SeekFrom::Start(0))
16986 .unwrap();
16987 let mut req_result = {
16988 let client = &self.hub.client;
16989 dlg.pre_request();
16990 let mut req_builder = hyper::Request::builder()
16991 .method(hyper::Method::PATCH)
16992 .uri(url.as_str())
16993 .header(USER_AGENT, self.hub._user_agent.clone());
16994
16995 if let Some(token) = token.as_ref() {
16996 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16997 }
16998
16999 let request = req_builder
17000 .header(CONTENT_TYPE, json_mime_type.to_string())
17001 .header(CONTENT_LENGTH, request_size as u64)
17002 .body(common::to_body(
17003 request_value_reader.get_ref().clone().into(),
17004 ));
17005
17006 client.request(request.unwrap()).await
17007 };
17008
17009 match req_result {
17010 Err(err) => {
17011 if let common::Retry::After(d) = dlg.http_error(&err) {
17012 sleep(d).await;
17013 continue;
17014 }
17015 dlg.finished(false);
17016 return Err(common::Error::HttpError(err));
17017 }
17018 Ok(res) => {
17019 let (mut parts, body) = res.into_parts();
17020 let mut body = common::Body::new(body);
17021 if !parts.status.is_success() {
17022 let bytes = common::to_bytes(body).await.unwrap_or_default();
17023 let error = serde_json::from_str(&common::to_string(&bytes));
17024 let response = common::to_response(parts, bytes.into());
17025
17026 if let common::Retry::After(d) =
17027 dlg.http_failure(&response, error.as_ref().ok())
17028 {
17029 sleep(d).await;
17030 continue;
17031 }
17032
17033 dlg.finished(false);
17034
17035 return Err(match error {
17036 Ok(value) => common::Error::BadRequest(value),
17037 _ => common::Error::Failure(response),
17038 });
17039 }
17040 let response = {
17041 let bytes = common::to_bytes(body).await.unwrap_or_default();
17042 let encoded = common::to_string(&bytes);
17043 match serde_json::from_str(&encoded) {
17044 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17045 Err(error) => {
17046 dlg.response_json_decode_error(&encoded, &error);
17047 return Err(common::Error::JsonDecodeError(
17048 encoded.to_string(),
17049 error,
17050 ));
17051 }
17052 }
17053 };
17054
17055 dlg.finished(true);
17056 return Ok(response);
17057 }
17058 }
17059 }
17060 }
17061
17062 ///
17063 /// Sets the *request* property to the given value.
17064 ///
17065 /// Even though the property as already been set when instantiating this call,
17066 /// we provide this method for API completeness.
17067 pub fn request(
17068 mut self,
17069 new_value: ConsentStore,
17070 ) -> ProjectLocationDatasetConsentStorePatchCall<'a, C> {
17071 self._request = new_value;
17072 self
17073 }
17074 /// Identifier. Resource name of the consent store, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}`. Cannot be changed after creation.
17075 ///
17076 /// Sets the *name* path property to the given value.
17077 ///
17078 /// Even though the property as already been set when instantiating this call,
17079 /// we provide this method for API completeness.
17080 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetConsentStorePatchCall<'a, C> {
17081 self._name = new_value.to_string();
17082 self
17083 }
17084 /// Required. The update mask that applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask. Only the `labels`, `default_consent_ttl`, and `enable_consent_create_on_update` fields are allowed to be updated.
17085 ///
17086 /// Sets the *update mask* query property to the given value.
17087 pub fn update_mask(
17088 mut self,
17089 new_value: common::FieldMask,
17090 ) -> ProjectLocationDatasetConsentStorePatchCall<'a, C> {
17091 self._update_mask = Some(new_value);
17092 self
17093 }
17094 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17095 /// while executing the actual API request.
17096 ///
17097 /// ````text
17098 /// It should be used to handle progress information, and to implement a certain level of resilience.
17099 /// ````
17100 ///
17101 /// Sets the *delegate* property to the given value.
17102 pub fn delegate(
17103 mut self,
17104 new_value: &'a mut dyn common::Delegate,
17105 ) -> ProjectLocationDatasetConsentStorePatchCall<'a, C> {
17106 self._delegate = Some(new_value);
17107 self
17108 }
17109
17110 /// Set any additional parameter of the query string used in the request.
17111 /// It should be used to set parameters which are not yet available through their own
17112 /// setters.
17113 ///
17114 /// Please note that this method must not be used to set any of the known parameters
17115 /// which have their own setter method. If done anyway, the request will fail.
17116 ///
17117 /// # Additional Parameters
17118 ///
17119 /// * *$.xgafv* (query-string) - V1 error format.
17120 /// * *access_token* (query-string) - OAuth access token.
17121 /// * *alt* (query-string) - Data format for response.
17122 /// * *callback* (query-string) - JSONP
17123 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17124 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17125 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17126 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17127 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17128 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17129 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17130 pub fn param<T>(
17131 mut self,
17132 name: T,
17133 value: T,
17134 ) -> ProjectLocationDatasetConsentStorePatchCall<'a, C>
17135 where
17136 T: AsRef<str>,
17137 {
17138 self._additional_params
17139 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17140 self
17141 }
17142
17143 /// Identifies the authorization scope for the method you are building.
17144 ///
17145 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17146 /// [`Scope::CloudHealthcare`].
17147 ///
17148 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17149 /// tokens for more than one scope.
17150 ///
17151 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17152 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17153 /// sufficient, a read-write scope will do as well.
17154 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetConsentStorePatchCall<'a, C>
17155 where
17156 St: AsRef<str>,
17157 {
17158 self._scopes.insert(String::from(scope.as_ref()));
17159 self
17160 }
17161 /// Identifies the authorization scope(s) for the method you are building.
17162 ///
17163 /// See [`Self::add_scope()`] for details.
17164 pub fn add_scopes<I, St>(
17165 mut self,
17166 scopes: I,
17167 ) -> ProjectLocationDatasetConsentStorePatchCall<'a, C>
17168 where
17169 I: IntoIterator<Item = St>,
17170 St: AsRef<str>,
17171 {
17172 self._scopes
17173 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17174 self
17175 }
17176
17177 /// Removes all scopes, and no default scope will be used either.
17178 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17179 /// for details).
17180 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStorePatchCall<'a, C> {
17181 self._scopes.clear();
17182 self
17183 }
17184}
17185
17186/// Queries all data_ids that are consented for a specified use in the given consent store and writes them to a specified destination. The returned Operation includes a progress counter for the number of User data mappings processed. If the request is successful, a detailed response is returned of type QueryAccessibleDataResponse, contained in the response field when the operation finishes. The metadata field type is OperationMetadata. Errors are logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). For example, the following sample log entry shows a `failed to evaluate consent policy` error that occurred during a QueryAccessibleData call to consent store `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}`. ```json jsonPayload: { @type: "type.googleapis.com/google.cloud.healthcare.logging.QueryAccessibleDataLogEntry" error: { code: 9 message: "failed to evaluate consent policy" } resourceName: "projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}" } logName: "projects/{project_id}/logs/healthcare.googleapis.com%2Fquery_accessible_data" operation: { id: "projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/operations/{operation_id}" producer: "healthcare.googleapis.com/QueryAccessibleData" } receiveTimestamp: "TIMESTAMP" resource: { labels: { consent_store_id: "{consent_store_id}" dataset_id: "{dataset_id}" location: "{location_id}" project_id: "{project_id}" } type: "healthcare_consent_store" } severity: "ERROR" timestamp: "TIMESTAMP" ```
17187///
17188/// A builder for the *locations.datasets.consentStores.queryAccessibleData* method supported by a *project* resource.
17189/// It is not used directly, but through a [`ProjectMethods`] instance.
17190///
17191/// # Example
17192///
17193/// Instantiate a resource method builder
17194///
17195/// ```test_harness,no_run
17196/// # extern crate hyper;
17197/// # extern crate hyper_rustls;
17198/// # extern crate google_healthcare1 as healthcare1;
17199/// use healthcare1::api::QueryAccessibleDataRequest;
17200/// # async fn dox() {
17201/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17202///
17203/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17204/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17205/// # secret,
17206/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17207/// # ).build().await.unwrap();
17208///
17209/// # let client = hyper_util::client::legacy::Client::builder(
17210/// # hyper_util::rt::TokioExecutor::new()
17211/// # )
17212/// # .build(
17213/// # hyper_rustls::HttpsConnectorBuilder::new()
17214/// # .with_native_roots()
17215/// # .unwrap()
17216/// # .https_or_http()
17217/// # .enable_http1()
17218/// # .build()
17219/// # );
17220/// # let mut hub = CloudHealthcare::new(client, auth);
17221/// // As the method needs a request, you would usually fill it with the desired information
17222/// // into the respective structure. Some of the parts shown here might not be applicable !
17223/// // Values shown here are possibly random and not representative !
17224/// let mut req = QueryAccessibleDataRequest::default();
17225///
17226/// // You can configure optional parameters by calling the respective setters at will, and
17227/// // execute the final call using `doit()`.
17228/// // Values shown here are possibly random and not representative !
17229/// let result = hub.projects().locations_datasets_consent_stores_query_accessible_data(req, "consentStore")
17230/// .doit().await;
17231/// # }
17232/// ```
17233pub struct ProjectLocationDatasetConsentStoreQueryAccessibleDataCall<'a, C>
17234where
17235 C: 'a,
17236{
17237 hub: &'a CloudHealthcare<C>,
17238 _request: QueryAccessibleDataRequest,
17239 _consent_store: String,
17240 _delegate: Option<&'a mut dyn common::Delegate>,
17241 _additional_params: HashMap<String, String>,
17242 _scopes: BTreeSet<String>,
17243}
17244
17245impl<'a, C> common::CallBuilder
17246 for ProjectLocationDatasetConsentStoreQueryAccessibleDataCall<'a, C>
17247{
17248}
17249
17250impl<'a, C> ProjectLocationDatasetConsentStoreQueryAccessibleDataCall<'a, C>
17251where
17252 C: common::Connector,
17253{
17254 /// Perform the operation you have build so far.
17255 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17256 use std::borrow::Cow;
17257 use std::io::{Read, Seek};
17258
17259 use common::{url::Params, ToParts};
17260 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17261
17262 let mut dd = common::DefaultDelegate;
17263 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17264 dlg.begin(common::MethodInfo {
17265 id: "healthcare.projects.locations.datasets.consentStores.queryAccessibleData",
17266 http_method: hyper::Method::POST,
17267 });
17268
17269 for &field in ["alt", "consentStore"].iter() {
17270 if self._additional_params.contains_key(field) {
17271 dlg.finished(false);
17272 return Err(common::Error::FieldClash(field));
17273 }
17274 }
17275
17276 let mut params = Params::with_capacity(4 + self._additional_params.len());
17277 params.push("consentStore", self._consent_store);
17278
17279 params.extend(self._additional_params.iter());
17280
17281 params.push("alt", "json");
17282 let mut url = self.hub._base_url.clone() + "v1/{+consentStore}:queryAccessibleData";
17283 if self._scopes.is_empty() {
17284 self._scopes
17285 .insert(Scope::CloudHealthcare.as_ref().to_string());
17286 }
17287
17288 #[allow(clippy::single_element_loop)]
17289 for &(find_this, param_name) in [("{+consentStore}", "consentStore")].iter() {
17290 url = params.uri_replacement(url, param_name, find_this, true);
17291 }
17292 {
17293 let to_remove = ["consentStore"];
17294 params.remove_params(&to_remove);
17295 }
17296
17297 let url = params.parse_with_url(&url);
17298
17299 let mut json_mime_type = mime::APPLICATION_JSON;
17300 let mut request_value_reader = {
17301 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17302 common::remove_json_null_values(&mut value);
17303 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17304 serde_json::to_writer(&mut dst, &value).unwrap();
17305 dst
17306 };
17307 let request_size = request_value_reader
17308 .seek(std::io::SeekFrom::End(0))
17309 .unwrap();
17310 request_value_reader
17311 .seek(std::io::SeekFrom::Start(0))
17312 .unwrap();
17313
17314 loop {
17315 let token = match self
17316 .hub
17317 .auth
17318 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17319 .await
17320 {
17321 Ok(token) => token,
17322 Err(e) => match dlg.token(e) {
17323 Ok(token) => token,
17324 Err(e) => {
17325 dlg.finished(false);
17326 return Err(common::Error::MissingToken(e));
17327 }
17328 },
17329 };
17330 request_value_reader
17331 .seek(std::io::SeekFrom::Start(0))
17332 .unwrap();
17333 let mut req_result = {
17334 let client = &self.hub.client;
17335 dlg.pre_request();
17336 let mut req_builder = hyper::Request::builder()
17337 .method(hyper::Method::POST)
17338 .uri(url.as_str())
17339 .header(USER_AGENT, self.hub._user_agent.clone());
17340
17341 if let Some(token) = token.as_ref() {
17342 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17343 }
17344
17345 let request = req_builder
17346 .header(CONTENT_TYPE, json_mime_type.to_string())
17347 .header(CONTENT_LENGTH, request_size as u64)
17348 .body(common::to_body(
17349 request_value_reader.get_ref().clone().into(),
17350 ));
17351
17352 client.request(request.unwrap()).await
17353 };
17354
17355 match req_result {
17356 Err(err) => {
17357 if let common::Retry::After(d) = dlg.http_error(&err) {
17358 sleep(d).await;
17359 continue;
17360 }
17361 dlg.finished(false);
17362 return Err(common::Error::HttpError(err));
17363 }
17364 Ok(res) => {
17365 let (mut parts, body) = res.into_parts();
17366 let mut body = common::Body::new(body);
17367 if !parts.status.is_success() {
17368 let bytes = common::to_bytes(body).await.unwrap_or_default();
17369 let error = serde_json::from_str(&common::to_string(&bytes));
17370 let response = common::to_response(parts, bytes.into());
17371
17372 if let common::Retry::After(d) =
17373 dlg.http_failure(&response, error.as_ref().ok())
17374 {
17375 sleep(d).await;
17376 continue;
17377 }
17378
17379 dlg.finished(false);
17380
17381 return Err(match error {
17382 Ok(value) => common::Error::BadRequest(value),
17383 _ => common::Error::Failure(response),
17384 });
17385 }
17386 let response = {
17387 let bytes = common::to_bytes(body).await.unwrap_or_default();
17388 let encoded = common::to_string(&bytes);
17389 match serde_json::from_str(&encoded) {
17390 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17391 Err(error) => {
17392 dlg.response_json_decode_error(&encoded, &error);
17393 return Err(common::Error::JsonDecodeError(
17394 encoded.to_string(),
17395 error,
17396 ));
17397 }
17398 }
17399 };
17400
17401 dlg.finished(true);
17402 return Ok(response);
17403 }
17404 }
17405 }
17406 }
17407
17408 ///
17409 /// Sets the *request* property to the given value.
17410 ///
17411 /// Even though the property as already been set when instantiating this call,
17412 /// we provide this method for API completeness.
17413 pub fn request(
17414 mut self,
17415 new_value: QueryAccessibleDataRequest,
17416 ) -> ProjectLocationDatasetConsentStoreQueryAccessibleDataCall<'a, C> {
17417 self._request = new_value;
17418 self
17419 }
17420 /// Required. Name of the consent store to retrieve User data mappings from.
17421 ///
17422 /// Sets the *consent store* path property to the given value.
17423 ///
17424 /// Even though the property as already been set when instantiating this call,
17425 /// we provide this method for API completeness.
17426 pub fn consent_store(
17427 mut self,
17428 new_value: &str,
17429 ) -> ProjectLocationDatasetConsentStoreQueryAccessibleDataCall<'a, C> {
17430 self._consent_store = new_value.to_string();
17431 self
17432 }
17433 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17434 /// while executing the actual API request.
17435 ///
17436 /// ````text
17437 /// It should be used to handle progress information, and to implement a certain level of resilience.
17438 /// ````
17439 ///
17440 /// Sets the *delegate* property to the given value.
17441 pub fn delegate(
17442 mut self,
17443 new_value: &'a mut dyn common::Delegate,
17444 ) -> ProjectLocationDatasetConsentStoreQueryAccessibleDataCall<'a, C> {
17445 self._delegate = Some(new_value);
17446 self
17447 }
17448
17449 /// Set any additional parameter of the query string used in the request.
17450 /// It should be used to set parameters which are not yet available through their own
17451 /// setters.
17452 ///
17453 /// Please note that this method must not be used to set any of the known parameters
17454 /// which have their own setter method. If done anyway, the request will fail.
17455 ///
17456 /// # Additional Parameters
17457 ///
17458 /// * *$.xgafv* (query-string) - V1 error format.
17459 /// * *access_token* (query-string) - OAuth access token.
17460 /// * *alt* (query-string) - Data format for response.
17461 /// * *callback* (query-string) - JSONP
17462 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17463 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17464 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17465 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17466 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17467 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17468 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17469 pub fn param<T>(
17470 mut self,
17471 name: T,
17472 value: T,
17473 ) -> ProjectLocationDatasetConsentStoreQueryAccessibleDataCall<'a, C>
17474 where
17475 T: AsRef<str>,
17476 {
17477 self._additional_params
17478 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17479 self
17480 }
17481
17482 /// Identifies the authorization scope for the method you are building.
17483 ///
17484 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17485 /// [`Scope::CloudHealthcare`].
17486 ///
17487 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17488 /// tokens for more than one scope.
17489 ///
17490 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17491 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17492 /// sufficient, a read-write scope will do as well.
17493 pub fn add_scope<St>(
17494 mut self,
17495 scope: St,
17496 ) -> ProjectLocationDatasetConsentStoreQueryAccessibleDataCall<'a, C>
17497 where
17498 St: AsRef<str>,
17499 {
17500 self._scopes.insert(String::from(scope.as_ref()));
17501 self
17502 }
17503 /// Identifies the authorization scope(s) for the method you are building.
17504 ///
17505 /// See [`Self::add_scope()`] for details.
17506 pub fn add_scopes<I, St>(
17507 mut self,
17508 scopes: I,
17509 ) -> ProjectLocationDatasetConsentStoreQueryAccessibleDataCall<'a, C>
17510 where
17511 I: IntoIterator<Item = St>,
17512 St: AsRef<str>,
17513 {
17514 self._scopes
17515 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17516 self
17517 }
17518
17519 /// Removes all scopes, and no default scope will be used either.
17520 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17521 /// for details).
17522 pub fn clear_scopes(
17523 mut self,
17524 ) -> ProjectLocationDatasetConsentStoreQueryAccessibleDataCall<'a, C> {
17525 self._scopes.clear();
17526 self
17527 }
17528}
17529
17530/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
17531///
17532/// A builder for the *locations.datasets.consentStores.setIamPolicy* method supported by a *project* resource.
17533/// It is not used directly, but through a [`ProjectMethods`] instance.
17534///
17535/// # Example
17536///
17537/// Instantiate a resource method builder
17538///
17539/// ```test_harness,no_run
17540/// # extern crate hyper;
17541/// # extern crate hyper_rustls;
17542/// # extern crate google_healthcare1 as healthcare1;
17543/// use healthcare1::api::SetIamPolicyRequest;
17544/// # async fn dox() {
17545/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17546///
17547/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17548/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17549/// # secret,
17550/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17551/// # ).build().await.unwrap();
17552///
17553/// # let client = hyper_util::client::legacy::Client::builder(
17554/// # hyper_util::rt::TokioExecutor::new()
17555/// # )
17556/// # .build(
17557/// # hyper_rustls::HttpsConnectorBuilder::new()
17558/// # .with_native_roots()
17559/// # .unwrap()
17560/// # .https_or_http()
17561/// # .enable_http1()
17562/// # .build()
17563/// # );
17564/// # let mut hub = CloudHealthcare::new(client, auth);
17565/// // As the method needs a request, you would usually fill it with the desired information
17566/// // into the respective structure. Some of the parts shown here might not be applicable !
17567/// // Values shown here are possibly random and not representative !
17568/// let mut req = SetIamPolicyRequest::default();
17569///
17570/// // You can configure optional parameters by calling the respective setters at will, and
17571/// // execute the final call using `doit()`.
17572/// // Values shown here are possibly random and not representative !
17573/// let result = hub.projects().locations_datasets_consent_stores_set_iam_policy(req, "resource")
17574/// .doit().await;
17575/// # }
17576/// ```
17577pub struct ProjectLocationDatasetConsentStoreSetIamPolicyCall<'a, C>
17578where
17579 C: 'a,
17580{
17581 hub: &'a CloudHealthcare<C>,
17582 _request: SetIamPolicyRequest,
17583 _resource: String,
17584 _delegate: Option<&'a mut dyn common::Delegate>,
17585 _additional_params: HashMap<String, String>,
17586 _scopes: BTreeSet<String>,
17587}
17588
17589impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreSetIamPolicyCall<'a, C> {}
17590
17591impl<'a, C> ProjectLocationDatasetConsentStoreSetIamPolicyCall<'a, C>
17592where
17593 C: common::Connector,
17594{
17595 /// Perform the operation you have build so far.
17596 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
17597 use std::borrow::Cow;
17598 use std::io::{Read, Seek};
17599
17600 use common::{url::Params, ToParts};
17601 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17602
17603 let mut dd = common::DefaultDelegate;
17604 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17605 dlg.begin(common::MethodInfo {
17606 id: "healthcare.projects.locations.datasets.consentStores.setIamPolicy",
17607 http_method: hyper::Method::POST,
17608 });
17609
17610 for &field in ["alt", "resource"].iter() {
17611 if self._additional_params.contains_key(field) {
17612 dlg.finished(false);
17613 return Err(common::Error::FieldClash(field));
17614 }
17615 }
17616
17617 let mut params = Params::with_capacity(4 + self._additional_params.len());
17618 params.push("resource", self._resource);
17619
17620 params.extend(self._additional_params.iter());
17621
17622 params.push("alt", "json");
17623 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
17624 if self._scopes.is_empty() {
17625 self._scopes
17626 .insert(Scope::CloudHealthcare.as_ref().to_string());
17627 }
17628
17629 #[allow(clippy::single_element_loop)]
17630 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
17631 url = params.uri_replacement(url, param_name, find_this, true);
17632 }
17633 {
17634 let to_remove = ["resource"];
17635 params.remove_params(&to_remove);
17636 }
17637
17638 let url = params.parse_with_url(&url);
17639
17640 let mut json_mime_type = mime::APPLICATION_JSON;
17641 let mut request_value_reader = {
17642 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17643 common::remove_json_null_values(&mut value);
17644 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17645 serde_json::to_writer(&mut dst, &value).unwrap();
17646 dst
17647 };
17648 let request_size = request_value_reader
17649 .seek(std::io::SeekFrom::End(0))
17650 .unwrap();
17651 request_value_reader
17652 .seek(std::io::SeekFrom::Start(0))
17653 .unwrap();
17654
17655 loop {
17656 let token = match self
17657 .hub
17658 .auth
17659 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17660 .await
17661 {
17662 Ok(token) => token,
17663 Err(e) => match dlg.token(e) {
17664 Ok(token) => token,
17665 Err(e) => {
17666 dlg.finished(false);
17667 return Err(common::Error::MissingToken(e));
17668 }
17669 },
17670 };
17671 request_value_reader
17672 .seek(std::io::SeekFrom::Start(0))
17673 .unwrap();
17674 let mut req_result = {
17675 let client = &self.hub.client;
17676 dlg.pre_request();
17677 let mut req_builder = hyper::Request::builder()
17678 .method(hyper::Method::POST)
17679 .uri(url.as_str())
17680 .header(USER_AGENT, self.hub._user_agent.clone());
17681
17682 if let Some(token) = token.as_ref() {
17683 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17684 }
17685
17686 let request = req_builder
17687 .header(CONTENT_TYPE, json_mime_type.to_string())
17688 .header(CONTENT_LENGTH, request_size as u64)
17689 .body(common::to_body(
17690 request_value_reader.get_ref().clone().into(),
17691 ));
17692
17693 client.request(request.unwrap()).await
17694 };
17695
17696 match req_result {
17697 Err(err) => {
17698 if let common::Retry::After(d) = dlg.http_error(&err) {
17699 sleep(d).await;
17700 continue;
17701 }
17702 dlg.finished(false);
17703 return Err(common::Error::HttpError(err));
17704 }
17705 Ok(res) => {
17706 let (mut parts, body) = res.into_parts();
17707 let mut body = common::Body::new(body);
17708 if !parts.status.is_success() {
17709 let bytes = common::to_bytes(body).await.unwrap_or_default();
17710 let error = serde_json::from_str(&common::to_string(&bytes));
17711 let response = common::to_response(parts, bytes.into());
17712
17713 if let common::Retry::After(d) =
17714 dlg.http_failure(&response, error.as_ref().ok())
17715 {
17716 sleep(d).await;
17717 continue;
17718 }
17719
17720 dlg.finished(false);
17721
17722 return Err(match error {
17723 Ok(value) => common::Error::BadRequest(value),
17724 _ => common::Error::Failure(response),
17725 });
17726 }
17727 let response = {
17728 let bytes = common::to_bytes(body).await.unwrap_or_default();
17729 let encoded = common::to_string(&bytes);
17730 match serde_json::from_str(&encoded) {
17731 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17732 Err(error) => {
17733 dlg.response_json_decode_error(&encoded, &error);
17734 return Err(common::Error::JsonDecodeError(
17735 encoded.to_string(),
17736 error,
17737 ));
17738 }
17739 }
17740 };
17741
17742 dlg.finished(true);
17743 return Ok(response);
17744 }
17745 }
17746 }
17747 }
17748
17749 ///
17750 /// Sets the *request* property to the given value.
17751 ///
17752 /// Even though the property as already been set when instantiating this call,
17753 /// we provide this method for API completeness.
17754 pub fn request(
17755 mut self,
17756 new_value: SetIamPolicyRequest,
17757 ) -> ProjectLocationDatasetConsentStoreSetIamPolicyCall<'a, C> {
17758 self._request = new_value;
17759 self
17760 }
17761 /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
17762 ///
17763 /// Sets the *resource* path property to the given value.
17764 ///
17765 /// Even though the property as already been set when instantiating this call,
17766 /// we provide this method for API completeness.
17767 pub fn resource(
17768 mut self,
17769 new_value: &str,
17770 ) -> ProjectLocationDatasetConsentStoreSetIamPolicyCall<'a, C> {
17771 self._resource = new_value.to_string();
17772 self
17773 }
17774 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17775 /// while executing the actual API request.
17776 ///
17777 /// ````text
17778 /// It should be used to handle progress information, and to implement a certain level of resilience.
17779 /// ````
17780 ///
17781 /// Sets the *delegate* property to the given value.
17782 pub fn delegate(
17783 mut self,
17784 new_value: &'a mut dyn common::Delegate,
17785 ) -> ProjectLocationDatasetConsentStoreSetIamPolicyCall<'a, C> {
17786 self._delegate = Some(new_value);
17787 self
17788 }
17789
17790 /// Set any additional parameter of the query string used in the request.
17791 /// It should be used to set parameters which are not yet available through their own
17792 /// setters.
17793 ///
17794 /// Please note that this method must not be used to set any of the known parameters
17795 /// which have their own setter method. If done anyway, the request will fail.
17796 ///
17797 /// # Additional Parameters
17798 ///
17799 /// * *$.xgafv* (query-string) - V1 error format.
17800 /// * *access_token* (query-string) - OAuth access token.
17801 /// * *alt* (query-string) - Data format for response.
17802 /// * *callback* (query-string) - JSONP
17803 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17804 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17805 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17806 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17807 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17808 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17809 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17810 pub fn param<T>(
17811 mut self,
17812 name: T,
17813 value: T,
17814 ) -> ProjectLocationDatasetConsentStoreSetIamPolicyCall<'a, C>
17815 where
17816 T: AsRef<str>,
17817 {
17818 self._additional_params
17819 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17820 self
17821 }
17822
17823 /// Identifies the authorization scope for the method you are building.
17824 ///
17825 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17826 /// [`Scope::CloudHealthcare`].
17827 ///
17828 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17829 /// tokens for more than one scope.
17830 ///
17831 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17832 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17833 /// sufficient, a read-write scope will do as well.
17834 pub fn add_scope<St>(
17835 mut self,
17836 scope: St,
17837 ) -> ProjectLocationDatasetConsentStoreSetIamPolicyCall<'a, C>
17838 where
17839 St: AsRef<str>,
17840 {
17841 self._scopes.insert(String::from(scope.as_ref()));
17842 self
17843 }
17844 /// Identifies the authorization scope(s) for the method you are building.
17845 ///
17846 /// See [`Self::add_scope()`] for details.
17847 pub fn add_scopes<I, St>(
17848 mut self,
17849 scopes: I,
17850 ) -> ProjectLocationDatasetConsentStoreSetIamPolicyCall<'a, C>
17851 where
17852 I: IntoIterator<Item = St>,
17853 St: AsRef<str>,
17854 {
17855 self._scopes
17856 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17857 self
17858 }
17859
17860 /// Removes all scopes, and no default scope will be used either.
17861 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17862 /// for details).
17863 pub fn clear_scopes(mut self) -> ProjectLocationDatasetConsentStoreSetIamPolicyCall<'a, C> {
17864 self._scopes.clear();
17865 self
17866 }
17867}
17868
17869/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
17870///
17871/// A builder for the *locations.datasets.consentStores.testIamPermissions* method supported by a *project* resource.
17872/// It is not used directly, but through a [`ProjectMethods`] instance.
17873///
17874/// # Example
17875///
17876/// Instantiate a resource method builder
17877///
17878/// ```test_harness,no_run
17879/// # extern crate hyper;
17880/// # extern crate hyper_rustls;
17881/// # extern crate google_healthcare1 as healthcare1;
17882/// use healthcare1::api::TestIamPermissionsRequest;
17883/// # async fn dox() {
17884/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17885///
17886/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17887/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17888/// # secret,
17889/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17890/// # ).build().await.unwrap();
17891///
17892/// # let client = hyper_util::client::legacy::Client::builder(
17893/// # hyper_util::rt::TokioExecutor::new()
17894/// # )
17895/// # .build(
17896/// # hyper_rustls::HttpsConnectorBuilder::new()
17897/// # .with_native_roots()
17898/// # .unwrap()
17899/// # .https_or_http()
17900/// # .enable_http1()
17901/// # .build()
17902/// # );
17903/// # let mut hub = CloudHealthcare::new(client, auth);
17904/// // As the method needs a request, you would usually fill it with the desired information
17905/// // into the respective structure. Some of the parts shown here might not be applicable !
17906/// // Values shown here are possibly random and not representative !
17907/// let mut req = TestIamPermissionsRequest::default();
17908///
17909/// // You can configure optional parameters by calling the respective setters at will, and
17910/// // execute the final call using `doit()`.
17911/// // Values shown here are possibly random and not representative !
17912/// let result = hub.projects().locations_datasets_consent_stores_test_iam_permissions(req, "resource")
17913/// .doit().await;
17914/// # }
17915/// ```
17916pub struct ProjectLocationDatasetConsentStoreTestIamPermissionCall<'a, C>
17917where
17918 C: 'a,
17919{
17920 hub: &'a CloudHealthcare<C>,
17921 _request: TestIamPermissionsRequest,
17922 _resource: String,
17923 _delegate: Option<&'a mut dyn common::Delegate>,
17924 _additional_params: HashMap<String, String>,
17925 _scopes: BTreeSet<String>,
17926}
17927
17928impl<'a, C> common::CallBuilder for ProjectLocationDatasetConsentStoreTestIamPermissionCall<'a, C> {}
17929
17930impl<'a, C> ProjectLocationDatasetConsentStoreTestIamPermissionCall<'a, C>
17931where
17932 C: common::Connector,
17933{
17934 /// Perform the operation you have build so far.
17935 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
17936 use std::borrow::Cow;
17937 use std::io::{Read, Seek};
17938
17939 use common::{url::Params, ToParts};
17940 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17941
17942 let mut dd = common::DefaultDelegate;
17943 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17944 dlg.begin(common::MethodInfo {
17945 id: "healthcare.projects.locations.datasets.consentStores.testIamPermissions",
17946 http_method: hyper::Method::POST,
17947 });
17948
17949 for &field in ["alt", "resource"].iter() {
17950 if self._additional_params.contains_key(field) {
17951 dlg.finished(false);
17952 return Err(common::Error::FieldClash(field));
17953 }
17954 }
17955
17956 let mut params = Params::with_capacity(4 + self._additional_params.len());
17957 params.push("resource", self._resource);
17958
17959 params.extend(self._additional_params.iter());
17960
17961 params.push("alt", "json");
17962 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
17963 if self._scopes.is_empty() {
17964 self._scopes
17965 .insert(Scope::CloudHealthcare.as_ref().to_string());
17966 }
17967
17968 #[allow(clippy::single_element_loop)]
17969 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
17970 url = params.uri_replacement(url, param_name, find_this, true);
17971 }
17972 {
17973 let to_remove = ["resource"];
17974 params.remove_params(&to_remove);
17975 }
17976
17977 let url = params.parse_with_url(&url);
17978
17979 let mut json_mime_type = mime::APPLICATION_JSON;
17980 let mut request_value_reader = {
17981 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17982 common::remove_json_null_values(&mut value);
17983 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17984 serde_json::to_writer(&mut dst, &value).unwrap();
17985 dst
17986 };
17987 let request_size = request_value_reader
17988 .seek(std::io::SeekFrom::End(0))
17989 .unwrap();
17990 request_value_reader
17991 .seek(std::io::SeekFrom::Start(0))
17992 .unwrap();
17993
17994 loop {
17995 let token = match self
17996 .hub
17997 .auth
17998 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17999 .await
18000 {
18001 Ok(token) => token,
18002 Err(e) => match dlg.token(e) {
18003 Ok(token) => token,
18004 Err(e) => {
18005 dlg.finished(false);
18006 return Err(common::Error::MissingToken(e));
18007 }
18008 },
18009 };
18010 request_value_reader
18011 .seek(std::io::SeekFrom::Start(0))
18012 .unwrap();
18013 let mut req_result = {
18014 let client = &self.hub.client;
18015 dlg.pre_request();
18016 let mut req_builder = hyper::Request::builder()
18017 .method(hyper::Method::POST)
18018 .uri(url.as_str())
18019 .header(USER_AGENT, self.hub._user_agent.clone());
18020
18021 if let Some(token) = token.as_ref() {
18022 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18023 }
18024
18025 let request = req_builder
18026 .header(CONTENT_TYPE, json_mime_type.to_string())
18027 .header(CONTENT_LENGTH, request_size as u64)
18028 .body(common::to_body(
18029 request_value_reader.get_ref().clone().into(),
18030 ));
18031
18032 client.request(request.unwrap()).await
18033 };
18034
18035 match req_result {
18036 Err(err) => {
18037 if let common::Retry::After(d) = dlg.http_error(&err) {
18038 sleep(d).await;
18039 continue;
18040 }
18041 dlg.finished(false);
18042 return Err(common::Error::HttpError(err));
18043 }
18044 Ok(res) => {
18045 let (mut parts, body) = res.into_parts();
18046 let mut body = common::Body::new(body);
18047 if !parts.status.is_success() {
18048 let bytes = common::to_bytes(body).await.unwrap_or_default();
18049 let error = serde_json::from_str(&common::to_string(&bytes));
18050 let response = common::to_response(parts, bytes.into());
18051
18052 if let common::Retry::After(d) =
18053 dlg.http_failure(&response, error.as_ref().ok())
18054 {
18055 sleep(d).await;
18056 continue;
18057 }
18058
18059 dlg.finished(false);
18060
18061 return Err(match error {
18062 Ok(value) => common::Error::BadRequest(value),
18063 _ => common::Error::Failure(response),
18064 });
18065 }
18066 let response = {
18067 let bytes = common::to_bytes(body).await.unwrap_or_default();
18068 let encoded = common::to_string(&bytes);
18069 match serde_json::from_str(&encoded) {
18070 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18071 Err(error) => {
18072 dlg.response_json_decode_error(&encoded, &error);
18073 return Err(common::Error::JsonDecodeError(
18074 encoded.to_string(),
18075 error,
18076 ));
18077 }
18078 }
18079 };
18080
18081 dlg.finished(true);
18082 return Ok(response);
18083 }
18084 }
18085 }
18086 }
18087
18088 ///
18089 /// Sets the *request* property to the given value.
18090 ///
18091 /// Even though the property as already been set when instantiating this call,
18092 /// we provide this method for API completeness.
18093 pub fn request(
18094 mut self,
18095 new_value: TestIamPermissionsRequest,
18096 ) -> ProjectLocationDatasetConsentStoreTestIamPermissionCall<'a, C> {
18097 self._request = new_value;
18098 self
18099 }
18100 /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
18101 ///
18102 /// Sets the *resource* path property to the given value.
18103 ///
18104 /// Even though the property as already been set when instantiating this call,
18105 /// we provide this method for API completeness.
18106 pub fn resource(
18107 mut self,
18108 new_value: &str,
18109 ) -> ProjectLocationDatasetConsentStoreTestIamPermissionCall<'a, C> {
18110 self._resource = new_value.to_string();
18111 self
18112 }
18113 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18114 /// while executing the actual API request.
18115 ///
18116 /// ````text
18117 /// It should be used to handle progress information, and to implement a certain level of resilience.
18118 /// ````
18119 ///
18120 /// Sets the *delegate* property to the given value.
18121 pub fn delegate(
18122 mut self,
18123 new_value: &'a mut dyn common::Delegate,
18124 ) -> ProjectLocationDatasetConsentStoreTestIamPermissionCall<'a, C> {
18125 self._delegate = Some(new_value);
18126 self
18127 }
18128
18129 /// Set any additional parameter of the query string used in the request.
18130 /// It should be used to set parameters which are not yet available through their own
18131 /// setters.
18132 ///
18133 /// Please note that this method must not be used to set any of the known parameters
18134 /// which have their own setter method. If done anyway, the request will fail.
18135 ///
18136 /// # Additional Parameters
18137 ///
18138 /// * *$.xgafv* (query-string) - V1 error format.
18139 /// * *access_token* (query-string) - OAuth access token.
18140 /// * *alt* (query-string) - Data format for response.
18141 /// * *callback* (query-string) - JSONP
18142 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18143 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18144 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18145 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18146 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18147 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18148 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18149 pub fn param<T>(
18150 mut self,
18151 name: T,
18152 value: T,
18153 ) -> ProjectLocationDatasetConsentStoreTestIamPermissionCall<'a, C>
18154 where
18155 T: AsRef<str>,
18156 {
18157 self._additional_params
18158 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18159 self
18160 }
18161
18162 /// Identifies the authorization scope for the method you are building.
18163 ///
18164 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18165 /// [`Scope::CloudHealthcare`].
18166 ///
18167 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18168 /// tokens for more than one scope.
18169 ///
18170 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18171 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18172 /// sufficient, a read-write scope will do as well.
18173 pub fn add_scope<St>(
18174 mut self,
18175 scope: St,
18176 ) -> ProjectLocationDatasetConsentStoreTestIamPermissionCall<'a, C>
18177 where
18178 St: AsRef<str>,
18179 {
18180 self._scopes.insert(String::from(scope.as_ref()));
18181 self
18182 }
18183 /// Identifies the authorization scope(s) for the method you are building.
18184 ///
18185 /// See [`Self::add_scope()`] for details.
18186 pub fn add_scopes<I, St>(
18187 mut self,
18188 scopes: I,
18189 ) -> ProjectLocationDatasetConsentStoreTestIamPermissionCall<'a, C>
18190 where
18191 I: IntoIterator<Item = St>,
18192 St: AsRef<str>,
18193 {
18194 self._scopes
18195 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18196 self
18197 }
18198
18199 /// Removes all scopes, and no default scope will be used either.
18200 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18201 /// for details).
18202 pub fn clear_scopes(
18203 mut self,
18204 ) -> ProjectLocationDatasetConsentStoreTestIamPermissionCall<'a, C> {
18205 self._scopes.clear();
18206 self
18207 }
18208}
18209
18210/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
18211///
18212/// A builder for the *locations.datasets.dataMapperWorkspaces.getIamPolicy* method supported by a *project* resource.
18213/// It is not used directly, but through a [`ProjectMethods`] instance.
18214///
18215/// # Example
18216///
18217/// Instantiate a resource method builder
18218///
18219/// ```test_harness,no_run
18220/// # extern crate hyper;
18221/// # extern crate hyper_rustls;
18222/// # extern crate google_healthcare1 as healthcare1;
18223/// # async fn dox() {
18224/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18225///
18226/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18227/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18228/// # secret,
18229/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18230/// # ).build().await.unwrap();
18231///
18232/// # let client = hyper_util::client::legacy::Client::builder(
18233/// # hyper_util::rt::TokioExecutor::new()
18234/// # )
18235/// # .build(
18236/// # hyper_rustls::HttpsConnectorBuilder::new()
18237/// # .with_native_roots()
18238/// # .unwrap()
18239/// # .https_or_http()
18240/// # .enable_http1()
18241/// # .build()
18242/// # );
18243/// # let mut hub = CloudHealthcare::new(client, auth);
18244/// // You can configure optional parameters by calling the respective setters at will, and
18245/// // execute the final call using `doit()`.
18246/// // Values shown here are possibly random and not representative !
18247/// let result = hub.projects().locations_datasets_data_mapper_workspaces_get_iam_policy("resource")
18248/// .options_requested_policy_version(-72)
18249/// .doit().await;
18250/// # }
18251/// ```
18252pub struct ProjectLocationDatasetDataMapperWorkspaceGetIamPolicyCall<'a, C>
18253where
18254 C: 'a,
18255{
18256 hub: &'a CloudHealthcare<C>,
18257 _resource: String,
18258 _options_requested_policy_version: Option<i32>,
18259 _delegate: Option<&'a mut dyn common::Delegate>,
18260 _additional_params: HashMap<String, String>,
18261 _scopes: BTreeSet<String>,
18262}
18263
18264impl<'a, C> common::CallBuilder
18265 for ProjectLocationDatasetDataMapperWorkspaceGetIamPolicyCall<'a, C>
18266{
18267}
18268
18269impl<'a, C> ProjectLocationDatasetDataMapperWorkspaceGetIamPolicyCall<'a, C>
18270where
18271 C: common::Connector,
18272{
18273 /// Perform the operation you have build so far.
18274 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
18275 use std::borrow::Cow;
18276 use std::io::{Read, Seek};
18277
18278 use common::{url::Params, ToParts};
18279 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18280
18281 let mut dd = common::DefaultDelegate;
18282 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18283 dlg.begin(common::MethodInfo {
18284 id: "healthcare.projects.locations.datasets.dataMapperWorkspaces.getIamPolicy",
18285 http_method: hyper::Method::GET,
18286 });
18287
18288 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
18289 if self._additional_params.contains_key(field) {
18290 dlg.finished(false);
18291 return Err(common::Error::FieldClash(field));
18292 }
18293 }
18294
18295 let mut params = Params::with_capacity(4 + self._additional_params.len());
18296 params.push("resource", self._resource);
18297 if let Some(value) = self._options_requested_policy_version.as_ref() {
18298 params.push("options.requestedPolicyVersion", value.to_string());
18299 }
18300
18301 params.extend(self._additional_params.iter());
18302
18303 params.push("alt", "json");
18304 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
18305 if self._scopes.is_empty() {
18306 self._scopes
18307 .insert(Scope::CloudHealthcare.as_ref().to_string());
18308 }
18309
18310 #[allow(clippy::single_element_loop)]
18311 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18312 url = params.uri_replacement(url, param_name, find_this, true);
18313 }
18314 {
18315 let to_remove = ["resource"];
18316 params.remove_params(&to_remove);
18317 }
18318
18319 let url = params.parse_with_url(&url);
18320
18321 loop {
18322 let token = match self
18323 .hub
18324 .auth
18325 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18326 .await
18327 {
18328 Ok(token) => token,
18329 Err(e) => match dlg.token(e) {
18330 Ok(token) => token,
18331 Err(e) => {
18332 dlg.finished(false);
18333 return Err(common::Error::MissingToken(e));
18334 }
18335 },
18336 };
18337 let mut req_result = {
18338 let client = &self.hub.client;
18339 dlg.pre_request();
18340 let mut req_builder = hyper::Request::builder()
18341 .method(hyper::Method::GET)
18342 .uri(url.as_str())
18343 .header(USER_AGENT, self.hub._user_agent.clone());
18344
18345 if let Some(token) = token.as_ref() {
18346 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18347 }
18348
18349 let request = req_builder
18350 .header(CONTENT_LENGTH, 0_u64)
18351 .body(common::to_body::<String>(None));
18352
18353 client.request(request.unwrap()).await
18354 };
18355
18356 match req_result {
18357 Err(err) => {
18358 if let common::Retry::After(d) = dlg.http_error(&err) {
18359 sleep(d).await;
18360 continue;
18361 }
18362 dlg.finished(false);
18363 return Err(common::Error::HttpError(err));
18364 }
18365 Ok(res) => {
18366 let (mut parts, body) = res.into_parts();
18367 let mut body = common::Body::new(body);
18368 if !parts.status.is_success() {
18369 let bytes = common::to_bytes(body).await.unwrap_or_default();
18370 let error = serde_json::from_str(&common::to_string(&bytes));
18371 let response = common::to_response(parts, bytes.into());
18372
18373 if let common::Retry::After(d) =
18374 dlg.http_failure(&response, error.as_ref().ok())
18375 {
18376 sleep(d).await;
18377 continue;
18378 }
18379
18380 dlg.finished(false);
18381
18382 return Err(match error {
18383 Ok(value) => common::Error::BadRequest(value),
18384 _ => common::Error::Failure(response),
18385 });
18386 }
18387 let response = {
18388 let bytes = common::to_bytes(body).await.unwrap_or_default();
18389 let encoded = common::to_string(&bytes);
18390 match serde_json::from_str(&encoded) {
18391 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18392 Err(error) => {
18393 dlg.response_json_decode_error(&encoded, &error);
18394 return Err(common::Error::JsonDecodeError(
18395 encoded.to_string(),
18396 error,
18397 ));
18398 }
18399 }
18400 };
18401
18402 dlg.finished(true);
18403 return Ok(response);
18404 }
18405 }
18406 }
18407 }
18408
18409 /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
18410 ///
18411 /// Sets the *resource* path property to the given value.
18412 ///
18413 /// Even though the property as already been set when instantiating this call,
18414 /// we provide this method for API completeness.
18415 pub fn resource(
18416 mut self,
18417 new_value: &str,
18418 ) -> ProjectLocationDatasetDataMapperWorkspaceGetIamPolicyCall<'a, C> {
18419 self._resource = new_value.to_string();
18420 self
18421 }
18422 /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
18423 ///
18424 /// Sets the *options.requested policy version* query property to the given value.
18425 pub fn options_requested_policy_version(
18426 mut self,
18427 new_value: i32,
18428 ) -> ProjectLocationDatasetDataMapperWorkspaceGetIamPolicyCall<'a, C> {
18429 self._options_requested_policy_version = Some(new_value);
18430 self
18431 }
18432 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18433 /// while executing the actual API request.
18434 ///
18435 /// ````text
18436 /// It should be used to handle progress information, and to implement a certain level of resilience.
18437 /// ````
18438 ///
18439 /// Sets the *delegate* property to the given value.
18440 pub fn delegate(
18441 mut self,
18442 new_value: &'a mut dyn common::Delegate,
18443 ) -> ProjectLocationDatasetDataMapperWorkspaceGetIamPolicyCall<'a, C> {
18444 self._delegate = Some(new_value);
18445 self
18446 }
18447
18448 /// Set any additional parameter of the query string used in the request.
18449 /// It should be used to set parameters which are not yet available through their own
18450 /// setters.
18451 ///
18452 /// Please note that this method must not be used to set any of the known parameters
18453 /// which have their own setter method. If done anyway, the request will fail.
18454 ///
18455 /// # Additional Parameters
18456 ///
18457 /// * *$.xgafv* (query-string) - V1 error format.
18458 /// * *access_token* (query-string) - OAuth access token.
18459 /// * *alt* (query-string) - Data format for response.
18460 /// * *callback* (query-string) - JSONP
18461 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18462 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18463 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18464 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18465 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18466 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18467 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18468 pub fn param<T>(
18469 mut self,
18470 name: T,
18471 value: T,
18472 ) -> ProjectLocationDatasetDataMapperWorkspaceGetIamPolicyCall<'a, C>
18473 where
18474 T: AsRef<str>,
18475 {
18476 self._additional_params
18477 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18478 self
18479 }
18480
18481 /// Identifies the authorization scope for the method you are building.
18482 ///
18483 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18484 /// [`Scope::CloudHealthcare`].
18485 ///
18486 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18487 /// tokens for more than one scope.
18488 ///
18489 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18490 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18491 /// sufficient, a read-write scope will do as well.
18492 pub fn add_scope<St>(
18493 mut self,
18494 scope: St,
18495 ) -> ProjectLocationDatasetDataMapperWorkspaceGetIamPolicyCall<'a, C>
18496 where
18497 St: AsRef<str>,
18498 {
18499 self._scopes.insert(String::from(scope.as_ref()));
18500 self
18501 }
18502 /// Identifies the authorization scope(s) for the method you are building.
18503 ///
18504 /// See [`Self::add_scope()`] for details.
18505 pub fn add_scopes<I, St>(
18506 mut self,
18507 scopes: I,
18508 ) -> ProjectLocationDatasetDataMapperWorkspaceGetIamPolicyCall<'a, C>
18509 where
18510 I: IntoIterator<Item = St>,
18511 St: AsRef<str>,
18512 {
18513 self._scopes
18514 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18515 self
18516 }
18517
18518 /// Removes all scopes, and no default scope will be used either.
18519 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18520 /// for details).
18521 pub fn clear_scopes(
18522 mut self,
18523 ) -> ProjectLocationDatasetDataMapperWorkspaceGetIamPolicyCall<'a, C> {
18524 self._scopes.clear();
18525 self
18526 }
18527}
18528
18529/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
18530///
18531/// A builder for the *locations.datasets.dataMapperWorkspaces.setIamPolicy* method supported by a *project* resource.
18532/// It is not used directly, but through a [`ProjectMethods`] instance.
18533///
18534/// # Example
18535///
18536/// Instantiate a resource method builder
18537///
18538/// ```test_harness,no_run
18539/// # extern crate hyper;
18540/// # extern crate hyper_rustls;
18541/// # extern crate google_healthcare1 as healthcare1;
18542/// use healthcare1::api::SetIamPolicyRequest;
18543/// # async fn dox() {
18544/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18545///
18546/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18547/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18548/// # secret,
18549/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18550/// # ).build().await.unwrap();
18551///
18552/// # let client = hyper_util::client::legacy::Client::builder(
18553/// # hyper_util::rt::TokioExecutor::new()
18554/// # )
18555/// # .build(
18556/// # hyper_rustls::HttpsConnectorBuilder::new()
18557/// # .with_native_roots()
18558/// # .unwrap()
18559/// # .https_or_http()
18560/// # .enable_http1()
18561/// # .build()
18562/// # );
18563/// # let mut hub = CloudHealthcare::new(client, auth);
18564/// // As the method needs a request, you would usually fill it with the desired information
18565/// // into the respective structure. Some of the parts shown here might not be applicable !
18566/// // Values shown here are possibly random and not representative !
18567/// let mut req = SetIamPolicyRequest::default();
18568///
18569/// // You can configure optional parameters by calling the respective setters at will, and
18570/// // execute the final call using `doit()`.
18571/// // Values shown here are possibly random and not representative !
18572/// let result = hub.projects().locations_datasets_data_mapper_workspaces_set_iam_policy(req, "resource")
18573/// .doit().await;
18574/// # }
18575/// ```
18576pub struct ProjectLocationDatasetDataMapperWorkspaceSetIamPolicyCall<'a, C>
18577where
18578 C: 'a,
18579{
18580 hub: &'a CloudHealthcare<C>,
18581 _request: SetIamPolicyRequest,
18582 _resource: String,
18583 _delegate: Option<&'a mut dyn common::Delegate>,
18584 _additional_params: HashMap<String, String>,
18585 _scopes: BTreeSet<String>,
18586}
18587
18588impl<'a, C> common::CallBuilder
18589 for ProjectLocationDatasetDataMapperWorkspaceSetIamPolicyCall<'a, C>
18590{
18591}
18592
18593impl<'a, C> ProjectLocationDatasetDataMapperWorkspaceSetIamPolicyCall<'a, C>
18594where
18595 C: common::Connector,
18596{
18597 /// Perform the operation you have build so far.
18598 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
18599 use std::borrow::Cow;
18600 use std::io::{Read, Seek};
18601
18602 use common::{url::Params, ToParts};
18603 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18604
18605 let mut dd = common::DefaultDelegate;
18606 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18607 dlg.begin(common::MethodInfo {
18608 id: "healthcare.projects.locations.datasets.dataMapperWorkspaces.setIamPolicy",
18609 http_method: hyper::Method::POST,
18610 });
18611
18612 for &field in ["alt", "resource"].iter() {
18613 if self._additional_params.contains_key(field) {
18614 dlg.finished(false);
18615 return Err(common::Error::FieldClash(field));
18616 }
18617 }
18618
18619 let mut params = Params::with_capacity(4 + self._additional_params.len());
18620 params.push("resource", self._resource);
18621
18622 params.extend(self._additional_params.iter());
18623
18624 params.push("alt", "json");
18625 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
18626 if self._scopes.is_empty() {
18627 self._scopes
18628 .insert(Scope::CloudHealthcare.as_ref().to_string());
18629 }
18630
18631 #[allow(clippy::single_element_loop)]
18632 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18633 url = params.uri_replacement(url, param_name, find_this, true);
18634 }
18635 {
18636 let to_remove = ["resource"];
18637 params.remove_params(&to_remove);
18638 }
18639
18640 let url = params.parse_with_url(&url);
18641
18642 let mut json_mime_type = mime::APPLICATION_JSON;
18643 let mut request_value_reader = {
18644 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18645 common::remove_json_null_values(&mut value);
18646 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18647 serde_json::to_writer(&mut dst, &value).unwrap();
18648 dst
18649 };
18650 let request_size = request_value_reader
18651 .seek(std::io::SeekFrom::End(0))
18652 .unwrap();
18653 request_value_reader
18654 .seek(std::io::SeekFrom::Start(0))
18655 .unwrap();
18656
18657 loop {
18658 let token = match self
18659 .hub
18660 .auth
18661 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18662 .await
18663 {
18664 Ok(token) => token,
18665 Err(e) => match dlg.token(e) {
18666 Ok(token) => token,
18667 Err(e) => {
18668 dlg.finished(false);
18669 return Err(common::Error::MissingToken(e));
18670 }
18671 },
18672 };
18673 request_value_reader
18674 .seek(std::io::SeekFrom::Start(0))
18675 .unwrap();
18676 let mut req_result = {
18677 let client = &self.hub.client;
18678 dlg.pre_request();
18679 let mut req_builder = hyper::Request::builder()
18680 .method(hyper::Method::POST)
18681 .uri(url.as_str())
18682 .header(USER_AGENT, self.hub._user_agent.clone());
18683
18684 if let Some(token) = token.as_ref() {
18685 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18686 }
18687
18688 let request = req_builder
18689 .header(CONTENT_TYPE, json_mime_type.to_string())
18690 .header(CONTENT_LENGTH, request_size as u64)
18691 .body(common::to_body(
18692 request_value_reader.get_ref().clone().into(),
18693 ));
18694
18695 client.request(request.unwrap()).await
18696 };
18697
18698 match req_result {
18699 Err(err) => {
18700 if let common::Retry::After(d) = dlg.http_error(&err) {
18701 sleep(d).await;
18702 continue;
18703 }
18704 dlg.finished(false);
18705 return Err(common::Error::HttpError(err));
18706 }
18707 Ok(res) => {
18708 let (mut parts, body) = res.into_parts();
18709 let mut body = common::Body::new(body);
18710 if !parts.status.is_success() {
18711 let bytes = common::to_bytes(body).await.unwrap_or_default();
18712 let error = serde_json::from_str(&common::to_string(&bytes));
18713 let response = common::to_response(parts, bytes.into());
18714
18715 if let common::Retry::After(d) =
18716 dlg.http_failure(&response, error.as_ref().ok())
18717 {
18718 sleep(d).await;
18719 continue;
18720 }
18721
18722 dlg.finished(false);
18723
18724 return Err(match error {
18725 Ok(value) => common::Error::BadRequest(value),
18726 _ => common::Error::Failure(response),
18727 });
18728 }
18729 let response = {
18730 let bytes = common::to_bytes(body).await.unwrap_or_default();
18731 let encoded = common::to_string(&bytes);
18732 match serde_json::from_str(&encoded) {
18733 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18734 Err(error) => {
18735 dlg.response_json_decode_error(&encoded, &error);
18736 return Err(common::Error::JsonDecodeError(
18737 encoded.to_string(),
18738 error,
18739 ));
18740 }
18741 }
18742 };
18743
18744 dlg.finished(true);
18745 return Ok(response);
18746 }
18747 }
18748 }
18749 }
18750
18751 ///
18752 /// Sets the *request* property to the given value.
18753 ///
18754 /// Even though the property as already been set when instantiating this call,
18755 /// we provide this method for API completeness.
18756 pub fn request(
18757 mut self,
18758 new_value: SetIamPolicyRequest,
18759 ) -> ProjectLocationDatasetDataMapperWorkspaceSetIamPolicyCall<'a, C> {
18760 self._request = new_value;
18761 self
18762 }
18763 /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
18764 ///
18765 /// Sets the *resource* path property to the given value.
18766 ///
18767 /// Even though the property as already been set when instantiating this call,
18768 /// we provide this method for API completeness.
18769 pub fn resource(
18770 mut self,
18771 new_value: &str,
18772 ) -> ProjectLocationDatasetDataMapperWorkspaceSetIamPolicyCall<'a, C> {
18773 self._resource = new_value.to_string();
18774 self
18775 }
18776 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18777 /// while executing the actual API request.
18778 ///
18779 /// ````text
18780 /// It should be used to handle progress information, and to implement a certain level of resilience.
18781 /// ````
18782 ///
18783 /// Sets the *delegate* property to the given value.
18784 pub fn delegate(
18785 mut self,
18786 new_value: &'a mut dyn common::Delegate,
18787 ) -> ProjectLocationDatasetDataMapperWorkspaceSetIamPolicyCall<'a, C> {
18788 self._delegate = Some(new_value);
18789 self
18790 }
18791
18792 /// Set any additional parameter of the query string used in the request.
18793 /// It should be used to set parameters which are not yet available through their own
18794 /// setters.
18795 ///
18796 /// Please note that this method must not be used to set any of the known parameters
18797 /// which have their own setter method. If done anyway, the request will fail.
18798 ///
18799 /// # Additional Parameters
18800 ///
18801 /// * *$.xgafv* (query-string) - V1 error format.
18802 /// * *access_token* (query-string) - OAuth access token.
18803 /// * *alt* (query-string) - Data format for response.
18804 /// * *callback* (query-string) - JSONP
18805 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18806 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18807 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18808 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18809 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18810 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18811 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18812 pub fn param<T>(
18813 mut self,
18814 name: T,
18815 value: T,
18816 ) -> ProjectLocationDatasetDataMapperWorkspaceSetIamPolicyCall<'a, C>
18817 where
18818 T: AsRef<str>,
18819 {
18820 self._additional_params
18821 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18822 self
18823 }
18824
18825 /// Identifies the authorization scope for the method you are building.
18826 ///
18827 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18828 /// [`Scope::CloudHealthcare`].
18829 ///
18830 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18831 /// tokens for more than one scope.
18832 ///
18833 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18834 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18835 /// sufficient, a read-write scope will do as well.
18836 pub fn add_scope<St>(
18837 mut self,
18838 scope: St,
18839 ) -> ProjectLocationDatasetDataMapperWorkspaceSetIamPolicyCall<'a, C>
18840 where
18841 St: AsRef<str>,
18842 {
18843 self._scopes.insert(String::from(scope.as_ref()));
18844 self
18845 }
18846 /// Identifies the authorization scope(s) for the method you are building.
18847 ///
18848 /// See [`Self::add_scope()`] for details.
18849 pub fn add_scopes<I, St>(
18850 mut self,
18851 scopes: I,
18852 ) -> ProjectLocationDatasetDataMapperWorkspaceSetIamPolicyCall<'a, C>
18853 where
18854 I: IntoIterator<Item = St>,
18855 St: AsRef<str>,
18856 {
18857 self._scopes
18858 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18859 self
18860 }
18861
18862 /// Removes all scopes, and no default scope will be used either.
18863 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18864 /// for details).
18865 pub fn clear_scopes(
18866 mut self,
18867 ) -> ProjectLocationDatasetDataMapperWorkspaceSetIamPolicyCall<'a, C> {
18868 self._scopes.clear();
18869 self
18870 }
18871}
18872
18873/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
18874///
18875/// A builder for the *locations.datasets.dataMapperWorkspaces.testIamPermissions* method supported by a *project* resource.
18876/// It is not used directly, but through a [`ProjectMethods`] instance.
18877///
18878/// # Example
18879///
18880/// Instantiate a resource method builder
18881///
18882/// ```test_harness,no_run
18883/// # extern crate hyper;
18884/// # extern crate hyper_rustls;
18885/// # extern crate google_healthcare1 as healthcare1;
18886/// use healthcare1::api::TestIamPermissionsRequest;
18887/// # async fn dox() {
18888/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18889///
18890/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18891/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18892/// # secret,
18893/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18894/// # ).build().await.unwrap();
18895///
18896/// # let client = hyper_util::client::legacy::Client::builder(
18897/// # hyper_util::rt::TokioExecutor::new()
18898/// # )
18899/// # .build(
18900/// # hyper_rustls::HttpsConnectorBuilder::new()
18901/// # .with_native_roots()
18902/// # .unwrap()
18903/// # .https_or_http()
18904/// # .enable_http1()
18905/// # .build()
18906/// # );
18907/// # let mut hub = CloudHealthcare::new(client, auth);
18908/// // As the method needs a request, you would usually fill it with the desired information
18909/// // into the respective structure. Some of the parts shown here might not be applicable !
18910/// // Values shown here are possibly random and not representative !
18911/// let mut req = TestIamPermissionsRequest::default();
18912///
18913/// // You can configure optional parameters by calling the respective setters at will, and
18914/// // execute the final call using `doit()`.
18915/// // Values shown here are possibly random and not representative !
18916/// let result = hub.projects().locations_datasets_data_mapper_workspaces_test_iam_permissions(req, "resource")
18917/// .doit().await;
18918/// # }
18919/// ```
18920pub struct ProjectLocationDatasetDataMapperWorkspaceTestIamPermissionCall<'a, C>
18921where
18922 C: 'a,
18923{
18924 hub: &'a CloudHealthcare<C>,
18925 _request: TestIamPermissionsRequest,
18926 _resource: String,
18927 _delegate: Option<&'a mut dyn common::Delegate>,
18928 _additional_params: HashMap<String, String>,
18929 _scopes: BTreeSet<String>,
18930}
18931
18932impl<'a, C> common::CallBuilder
18933 for ProjectLocationDatasetDataMapperWorkspaceTestIamPermissionCall<'a, C>
18934{
18935}
18936
18937impl<'a, C> ProjectLocationDatasetDataMapperWorkspaceTestIamPermissionCall<'a, C>
18938where
18939 C: common::Connector,
18940{
18941 /// Perform the operation you have build so far.
18942 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
18943 use std::borrow::Cow;
18944 use std::io::{Read, Seek};
18945
18946 use common::{url::Params, ToParts};
18947 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18948
18949 let mut dd = common::DefaultDelegate;
18950 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18951 dlg.begin(common::MethodInfo {
18952 id: "healthcare.projects.locations.datasets.dataMapperWorkspaces.testIamPermissions",
18953 http_method: hyper::Method::POST,
18954 });
18955
18956 for &field in ["alt", "resource"].iter() {
18957 if self._additional_params.contains_key(field) {
18958 dlg.finished(false);
18959 return Err(common::Error::FieldClash(field));
18960 }
18961 }
18962
18963 let mut params = Params::with_capacity(4 + self._additional_params.len());
18964 params.push("resource", self._resource);
18965
18966 params.extend(self._additional_params.iter());
18967
18968 params.push("alt", "json");
18969 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
18970 if self._scopes.is_empty() {
18971 self._scopes
18972 .insert(Scope::CloudHealthcare.as_ref().to_string());
18973 }
18974
18975 #[allow(clippy::single_element_loop)]
18976 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18977 url = params.uri_replacement(url, param_name, find_this, true);
18978 }
18979 {
18980 let to_remove = ["resource"];
18981 params.remove_params(&to_remove);
18982 }
18983
18984 let url = params.parse_with_url(&url);
18985
18986 let mut json_mime_type = mime::APPLICATION_JSON;
18987 let mut request_value_reader = {
18988 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18989 common::remove_json_null_values(&mut value);
18990 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18991 serde_json::to_writer(&mut dst, &value).unwrap();
18992 dst
18993 };
18994 let request_size = request_value_reader
18995 .seek(std::io::SeekFrom::End(0))
18996 .unwrap();
18997 request_value_reader
18998 .seek(std::io::SeekFrom::Start(0))
18999 .unwrap();
19000
19001 loop {
19002 let token = match self
19003 .hub
19004 .auth
19005 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19006 .await
19007 {
19008 Ok(token) => token,
19009 Err(e) => match dlg.token(e) {
19010 Ok(token) => token,
19011 Err(e) => {
19012 dlg.finished(false);
19013 return Err(common::Error::MissingToken(e));
19014 }
19015 },
19016 };
19017 request_value_reader
19018 .seek(std::io::SeekFrom::Start(0))
19019 .unwrap();
19020 let mut req_result = {
19021 let client = &self.hub.client;
19022 dlg.pre_request();
19023 let mut req_builder = hyper::Request::builder()
19024 .method(hyper::Method::POST)
19025 .uri(url.as_str())
19026 .header(USER_AGENT, self.hub._user_agent.clone());
19027
19028 if let Some(token) = token.as_ref() {
19029 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19030 }
19031
19032 let request = req_builder
19033 .header(CONTENT_TYPE, json_mime_type.to_string())
19034 .header(CONTENT_LENGTH, request_size as u64)
19035 .body(common::to_body(
19036 request_value_reader.get_ref().clone().into(),
19037 ));
19038
19039 client.request(request.unwrap()).await
19040 };
19041
19042 match req_result {
19043 Err(err) => {
19044 if let common::Retry::After(d) = dlg.http_error(&err) {
19045 sleep(d).await;
19046 continue;
19047 }
19048 dlg.finished(false);
19049 return Err(common::Error::HttpError(err));
19050 }
19051 Ok(res) => {
19052 let (mut parts, body) = res.into_parts();
19053 let mut body = common::Body::new(body);
19054 if !parts.status.is_success() {
19055 let bytes = common::to_bytes(body).await.unwrap_or_default();
19056 let error = serde_json::from_str(&common::to_string(&bytes));
19057 let response = common::to_response(parts, bytes.into());
19058
19059 if let common::Retry::After(d) =
19060 dlg.http_failure(&response, error.as_ref().ok())
19061 {
19062 sleep(d).await;
19063 continue;
19064 }
19065
19066 dlg.finished(false);
19067
19068 return Err(match error {
19069 Ok(value) => common::Error::BadRequest(value),
19070 _ => common::Error::Failure(response),
19071 });
19072 }
19073 let response = {
19074 let bytes = common::to_bytes(body).await.unwrap_or_default();
19075 let encoded = common::to_string(&bytes);
19076 match serde_json::from_str(&encoded) {
19077 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19078 Err(error) => {
19079 dlg.response_json_decode_error(&encoded, &error);
19080 return Err(common::Error::JsonDecodeError(
19081 encoded.to_string(),
19082 error,
19083 ));
19084 }
19085 }
19086 };
19087
19088 dlg.finished(true);
19089 return Ok(response);
19090 }
19091 }
19092 }
19093 }
19094
19095 ///
19096 /// Sets the *request* property to the given value.
19097 ///
19098 /// Even though the property as already been set when instantiating this call,
19099 /// we provide this method for API completeness.
19100 pub fn request(
19101 mut self,
19102 new_value: TestIamPermissionsRequest,
19103 ) -> ProjectLocationDatasetDataMapperWorkspaceTestIamPermissionCall<'a, C> {
19104 self._request = new_value;
19105 self
19106 }
19107 /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
19108 ///
19109 /// Sets the *resource* path property to the given value.
19110 ///
19111 /// Even though the property as already been set when instantiating this call,
19112 /// we provide this method for API completeness.
19113 pub fn resource(
19114 mut self,
19115 new_value: &str,
19116 ) -> ProjectLocationDatasetDataMapperWorkspaceTestIamPermissionCall<'a, C> {
19117 self._resource = new_value.to_string();
19118 self
19119 }
19120 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19121 /// while executing the actual API request.
19122 ///
19123 /// ````text
19124 /// It should be used to handle progress information, and to implement a certain level of resilience.
19125 /// ````
19126 ///
19127 /// Sets the *delegate* property to the given value.
19128 pub fn delegate(
19129 mut self,
19130 new_value: &'a mut dyn common::Delegate,
19131 ) -> ProjectLocationDatasetDataMapperWorkspaceTestIamPermissionCall<'a, C> {
19132 self._delegate = Some(new_value);
19133 self
19134 }
19135
19136 /// Set any additional parameter of the query string used in the request.
19137 /// It should be used to set parameters which are not yet available through their own
19138 /// setters.
19139 ///
19140 /// Please note that this method must not be used to set any of the known parameters
19141 /// which have their own setter method. If done anyway, the request will fail.
19142 ///
19143 /// # Additional Parameters
19144 ///
19145 /// * *$.xgafv* (query-string) - V1 error format.
19146 /// * *access_token* (query-string) - OAuth access token.
19147 /// * *alt* (query-string) - Data format for response.
19148 /// * *callback* (query-string) - JSONP
19149 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19150 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19151 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19152 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19153 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19154 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19155 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19156 pub fn param<T>(
19157 mut self,
19158 name: T,
19159 value: T,
19160 ) -> ProjectLocationDatasetDataMapperWorkspaceTestIamPermissionCall<'a, C>
19161 where
19162 T: AsRef<str>,
19163 {
19164 self._additional_params
19165 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19166 self
19167 }
19168
19169 /// Identifies the authorization scope for the method you are building.
19170 ///
19171 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19172 /// [`Scope::CloudHealthcare`].
19173 ///
19174 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19175 /// tokens for more than one scope.
19176 ///
19177 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19178 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19179 /// sufficient, a read-write scope will do as well.
19180 pub fn add_scope<St>(
19181 mut self,
19182 scope: St,
19183 ) -> ProjectLocationDatasetDataMapperWorkspaceTestIamPermissionCall<'a, C>
19184 where
19185 St: AsRef<str>,
19186 {
19187 self._scopes.insert(String::from(scope.as_ref()));
19188 self
19189 }
19190 /// Identifies the authorization scope(s) for the method you are building.
19191 ///
19192 /// See [`Self::add_scope()`] for details.
19193 pub fn add_scopes<I, St>(
19194 mut self,
19195 scopes: I,
19196 ) -> ProjectLocationDatasetDataMapperWorkspaceTestIamPermissionCall<'a, C>
19197 where
19198 I: IntoIterator<Item = St>,
19199 St: AsRef<str>,
19200 {
19201 self._scopes
19202 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19203 self
19204 }
19205
19206 /// Removes all scopes, and no default scope will be used either.
19207 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19208 /// for details).
19209 pub fn clear_scopes(
19210 mut self,
19211 ) -> ProjectLocationDatasetDataMapperWorkspaceTestIamPermissionCall<'a, C> {
19212 self._scopes.clear();
19213 self
19214 }
19215}
19216
19217/// GetSeriesMetrics returns metrics for a series.
19218///
19219/// A builder for the *locations.datasets.dicomStores.dicomWeb.studies.series.getSeriesMetrics* method supported by a *project* resource.
19220/// It is not used directly, but through a [`ProjectMethods`] instance.
19221///
19222/// # Example
19223///
19224/// Instantiate a resource method builder
19225///
19226/// ```test_harness,no_run
19227/// # extern crate hyper;
19228/// # extern crate hyper_rustls;
19229/// # extern crate google_healthcare1 as healthcare1;
19230/// # async fn dox() {
19231/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19232///
19233/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19234/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19235/// # secret,
19236/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19237/// # ).build().await.unwrap();
19238///
19239/// # let client = hyper_util::client::legacy::Client::builder(
19240/// # hyper_util::rt::TokioExecutor::new()
19241/// # )
19242/// # .build(
19243/// # hyper_rustls::HttpsConnectorBuilder::new()
19244/// # .with_native_roots()
19245/// # .unwrap()
19246/// # .https_or_http()
19247/// # .enable_http1()
19248/// # .build()
19249/// # );
19250/// # let mut hub = CloudHealthcare::new(client, auth);
19251/// // You can configure optional parameters by calling the respective setters at will, and
19252/// // execute the final call using `doit()`.
19253/// // Values shown here are possibly random and not representative !
19254/// let result = hub.projects().locations_datasets_dicom_stores_dicom_web_studies_series_get_series_metrics("series")
19255/// .doit().await;
19256/// # }
19257/// ```
19258pub struct ProjectLocationDatasetDicomStoreDicomWebStudySeriesGetSeriesMetricCall<'a, C>
19259where
19260 C: 'a,
19261{
19262 hub: &'a CloudHealthcare<C>,
19263 _series: String,
19264 _delegate: Option<&'a mut dyn common::Delegate>,
19265 _additional_params: HashMap<String, String>,
19266 _scopes: BTreeSet<String>,
19267}
19268
19269impl<'a, C> common::CallBuilder
19270 for ProjectLocationDatasetDicomStoreDicomWebStudySeriesGetSeriesMetricCall<'a, C>
19271{
19272}
19273
19274impl<'a, C> ProjectLocationDatasetDicomStoreDicomWebStudySeriesGetSeriesMetricCall<'a, C>
19275where
19276 C: common::Connector,
19277{
19278 /// Perform the operation you have build so far.
19279 pub async fn doit(mut self) -> common::Result<(common::Response, SeriesMetrics)> {
19280 use std::borrow::Cow;
19281 use std::io::{Read, Seek};
19282
19283 use common::{url::Params, ToParts};
19284 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19285
19286 let mut dd = common::DefaultDelegate;
19287 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19288 dlg.begin(common::MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.dicomWeb.studies.series.getSeriesMetrics",
19289 http_method: hyper::Method::GET });
19290
19291 for &field in ["alt", "series"].iter() {
19292 if self._additional_params.contains_key(field) {
19293 dlg.finished(false);
19294 return Err(common::Error::FieldClash(field));
19295 }
19296 }
19297
19298 let mut params = Params::with_capacity(3 + self._additional_params.len());
19299 params.push("series", self._series);
19300
19301 params.extend(self._additional_params.iter());
19302
19303 params.push("alt", "json");
19304 let mut url = self.hub._base_url.clone() + "v1/{+series}:getSeriesMetrics";
19305 if self._scopes.is_empty() {
19306 self._scopes
19307 .insert(Scope::CloudHealthcare.as_ref().to_string());
19308 }
19309
19310 #[allow(clippy::single_element_loop)]
19311 for &(find_this, param_name) in [("{+series}", "series")].iter() {
19312 url = params.uri_replacement(url, param_name, find_this, true);
19313 }
19314 {
19315 let to_remove = ["series"];
19316 params.remove_params(&to_remove);
19317 }
19318
19319 let url = params.parse_with_url(&url);
19320
19321 loop {
19322 let token = match self
19323 .hub
19324 .auth
19325 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19326 .await
19327 {
19328 Ok(token) => token,
19329 Err(e) => match dlg.token(e) {
19330 Ok(token) => token,
19331 Err(e) => {
19332 dlg.finished(false);
19333 return Err(common::Error::MissingToken(e));
19334 }
19335 },
19336 };
19337 let mut req_result = {
19338 let client = &self.hub.client;
19339 dlg.pre_request();
19340 let mut req_builder = hyper::Request::builder()
19341 .method(hyper::Method::GET)
19342 .uri(url.as_str())
19343 .header(USER_AGENT, self.hub._user_agent.clone());
19344
19345 if let Some(token) = token.as_ref() {
19346 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19347 }
19348
19349 let request = req_builder
19350 .header(CONTENT_LENGTH, 0_u64)
19351 .body(common::to_body::<String>(None));
19352
19353 client.request(request.unwrap()).await
19354 };
19355
19356 match req_result {
19357 Err(err) => {
19358 if let common::Retry::After(d) = dlg.http_error(&err) {
19359 sleep(d).await;
19360 continue;
19361 }
19362 dlg.finished(false);
19363 return Err(common::Error::HttpError(err));
19364 }
19365 Ok(res) => {
19366 let (mut parts, body) = res.into_parts();
19367 let mut body = common::Body::new(body);
19368 if !parts.status.is_success() {
19369 let bytes = common::to_bytes(body).await.unwrap_or_default();
19370 let error = serde_json::from_str(&common::to_string(&bytes));
19371 let response = common::to_response(parts, bytes.into());
19372
19373 if let common::Retry::After(d) =
19374 dlg.http_failure(&response, error.as_ref().ok())
19375 {
19376 sleep(d).await;
19377 continue;
19378 }
19379
19380 dlg.finished(false);
19381
19382 return Err(match error {
19383 Ok(value) => common::Error::BadRequest(value),
19384 _ => common::Error::Failure(response),
19385 });
19386 }
19387 let response = {
19388 let bytes = common::to_bytes(body).await.unwrap_or_default();
19389 let encoded = common::to_string(&bytes);
19390 match serde_json::from_str(&encoded) {
19391 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19392 Err(error) => {
19393 dlg.response_json_decode_error(&encoded, &error);
19394 return Err(common::Error::JsonDecodeError(
19395 encoded.to_string(),
19396 error,
19397 ));
19398 }
19399 }
19400 };
19401
19402 dlg.finished(true);
19403 return Ok(response);
19404 }
19405 }
19406 }
19407 }
19408
19409 /// Required. The series resource path. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}/dicomWeb/studies/{study_uid}/series/{series_uid}`.
19410 ///
19411 /// Sets the *series* path property to the given value.
19412 ///
19413 /// Even though the property as already been set when instantiating this call,
19414 /// we provide this method for API completeness.
19415 pub fn series(
19416 mut self,
19417 new_value: &str,
19418 ) -> ProjectLocationDatasetDicomStoreDicomWebStudySeriesGetSeriesMetricCall<'a, C> {
19419 self._series = new_value.to_string();
19420 self
19421 }
19422 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19423 /// while executing the actual API request.
19424 ///
19425 /// ````text
19426 /// It should be used to handle progress information, and to implement a certain level of resilience.
19427 /// ````
19428 ///
19429 /// Sets the *delegate* property to the given value.
19430 pub fn delegate(
19431 mut self,
19432 new_value: &'a mut dyn common::Delegate,
19433 ) -> ProjectLocationDatasetDicomStoreDicomWebStudySeriesGetSeriesMetricCall<'a, C> {
19434 self._delegate = Some(new_value);
19435 self
19436 }
19437
19438 /// Set any additional parameter of the query string used in the request.
19439 /// It should be used to set parameters which are not yet available through their own
19440 /// setters.
19441 ///
19442 /// Please note that this method must not be used to set any of the known parameters
19443 /// which have their own setter method. If done anyway, the request will fail.
19444 ///
19445 /// # Additional Parameters
19446 ///
19447 /// * *$.xgafv* (query-string) - V1 error format.
19448 /// * *access_token* (query-string) - OAuth access token.
19449 /// * *alt* (query-string) - Data format for response.
19450 /// * *callback* (query-string) - JSONP
19451 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19452 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19453 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19454 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19455 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19456 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19457 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19458 pub fn param<T>(
19459 mut self,
19460 name: T,
19461 value: T,
19462 ) -> ProjectLocationDatasetDicomStoreDicomWebStudySeriesGetSeriesMetricCall<'a, C>
19463 where
19464 T: AsRef<str>,
19465 {
19466 self._additional_params
19467 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19468 self
19469 }
19470
19471 /// Identifies the authorization scope for the method you are building.
19472 ///
19473 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19474 /// [`Scope::CloudHealthcare`].
19475 ///
19476 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19477 /// tokens for more than one scope.
19478 ///
19479 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19480 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19481 /// sufficient, a read-write scope will do as well.
19482 pub fn add_scope<St>(
19483 mut self,
19484 scope: St,
19485 ) -> ProjectLocationDatasetDicomStoreDicomWebStudySeriesGetSeriesMetricCall<'a, C>
19486 where
19487 St: AsRef<str>,
19488 {
19489 self._scopes.insert(String::from(scope.as_ref()));
19490 self
19491 }
19492 /// Identifies the authorization scope(s) for the method you are building.
19493 ///
19494 /// See [`Self::add_scope()`] for details.
19495 pub fn add_scopes<I, St>(
19496 mut self,
19497 scopes: I,
19498 ) -> ProjectLocationDatasetDicomStoreDicomWebStudySeriesGetSeriesMetricCall<'a, C>
19499 where
19500 I: IntoIterator<Item = St>,
19501 St: AsRef<str>,
19502 {
19503 self._scopes
19504 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19505 self
19506 }
19507
19508 /// Removes all scopes, and no default scope will be used either.
19509 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19510 /// for details).
19511 pub fn clear_scopes(
19512 mut self,
19513 ) -> ProjectLocationDatasetDicomStoreDicomWebStudySeriesGetSeriesMetricCall<'a, C> {
19514 self._scopes.clear();
19515 self
19516 }
19517}
19518
19519/// GetStudyMetrics returns metrics for a study.
19520///
19521/// A builder for the *locations.datasets.dicomStores.dicomWeb.studies.getStudyMetrics* method supported by a *project* resource.
19522/// It is not used directly, but through a [`ProjectMethods`] instance.
19523///
19524/// # Example
19525///
19526/// Instantiate a resource method builder
19527///
19528/// ```test_harness,no_run
19529/// # extern crate hyper;
19530/// # extern crate hyper_rustls;
19531/// # extern crate google_healthcare1 as healthcare1;
19532/// # async fn dox() {
19533/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19534///
19535/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19536/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19537/// # secret,
19538/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19539/// # ).build().await.unwrap();
19540///
19541/// # let client = hyper_util::client::legacy::Client::builder(
19542/// # hyper_util::rt::TokioExecutor::new()
19543/// # )
19544/// # .build(
19545/// # hyper_rustls::HttpsConnectorBuilder::new()
19546/// # .with_native_roots()
19547/// # .unwrap()
19548/// # .https_or_http()
19549/// # .enable_http1()
19550/// # .build()
19551/// # );
19552/// # let mut hub = CloudHealthcare::new(client, auth);
19553/// // You can configure optional parameters by calling the respective setters at will, and
19554/// // execute the final call using `doit()`.
19555/// // Values shown here are possibly random and not representative !
19556/// let result = hub.projects().locations_datasets_dicom_stores_dicom_web_studies_get_study_metrics("study")
19557/// .doit().await;
19558/// # }
19559/// ```
19560pub struct ProjectLocationDatasetDicomStoreDicomWebStudyGetStudyMetricCall<'a, C>
19561where
19562 C: 'a,
19563{
19564 hub: &'a CloudHealthcare<C>,
19565 _study: String,
19566 _delegate: Option<&'a mut dyn common::Delegate>,
19567 _additional_params: HashMap<String, String>,
19568 _scopes: BTreeSet<String>,
19569}
19570
19571impl<'a, C> common::CallBuilder
19572 for ProjectLocationDatasetDicomStoreDicomWebStudyGetStudyMetricCall<'a, C>
19573{
19574}
19575
19576impl<'a, C> ProjectLocationDatasetDicomStoreDicomWebStudyGetStudyMetricCall<'a, C>
19577where
19578 C: common::Connector,
19579{
19580 /// Perform the operation you have build so far.
19581 pub async fn doit(mut self) -> common::Result<(common::Response, StudyMetrics)> {
19582 use std::borrow::Cow;
19583 use std::io::{Read, Seek};
19584
19585 use common::{url::Params, ToParts};
19586 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19587
19588 let mut dd = common::DefaultDelegate;
19589 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19590 dlg.begin(common::MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.dicomWeb.studies.getStudyMetrics",
19591 http_method: hyper::Method::GET });
19592
19593 for &field in ["alt", "study"].iter() {
19594 if self._additional_params.contains_key(field) {
19595 dlg.finished(false);
19596 return Err(common::Error::FieldClash(field));
19597 }
19598 }
19599
19600 let mut params = Params::with_capacity(3 + self._additional_params.len());
19601 params.push("study", self._study);
19602
19603 params.extend(self._additional_params.iter());
19604
19605 params.push("alt", "json");
19606 let mut url = self.hub._base_url.clone() + "v1/{+study}:getStudyMetrics";
19607 if self._scopes.is_empty() {
19608 self._scopes
19609 .insert(Scope::CloudHealthcare.as_ref().to_string());
19610 }
19611
19612 #[allow(clippy::single_element_loop)]
19613 for &(find_this, param_name) in [("{+study}", "study")].iter() {
19614 url = params.uri_replacement(url, param_name, find_this, true);
19615 }
19616 {
19617 let to_remove = ["study"];
19618 params.remove_params(&to_remove);
19619 }
19620
19621 let url = params.parse_with_url(&url);
19622
19623 loop {
19624 let token = match self
19625 .hub
19626 .auth
19627 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19628 .await
19629 {
19630 Ok(token) => token,
19631 Err(e) => match dlg.token(e) {
19632 Ok(token) => token,
19633 Err(e) => {
19634 dlg.finished(false);
19635 return Err(common::Error::MissingToken(e));
19636 }
19637 },
19638 };
19639 let mut req_result = {
19640 let client = &self.hub.client;
19641 dlg.pre_request();
19642 let mut req_builder = hyper::Request::builder()
19643 .method(hyper::Method::GET)
19644 .uri(url.as_str())
19645 .header(USER_AGENT, self.hub._user_agent.clone());
19646
19647 if let Some(token) = token.as_ref() {
19648 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19649 }
19650
19651 let request = req_builder
19652 .header(CONTENT_LENGTH, 0_u64)
19653 .body(common::to_body::<String>(None));
19654
19655 client.request(request.unwrap()).await
19656 };
19657
19658 match req_result {
19659 Err(err) => {
19660 if let common::Retry::After(d) = dlg.http_error(&err) {
19661 sleep(d).await;
19662 continue;
19663 }
19664 dlg.finished(false);
19665 return Err(common::Error::HttpError(err));
19666 }
19667 Ok(res) => {
19668 let (mut parts, body) = res.into_parts();
19669 let mut body = common::Body::new(body);
19670 if !parts.status.is_success() {
19671 let bytes = common::to_bytes(body).await.unwrap_or_default();
19672 let error = serde_json::from_str(&common::to_string(&bytes));
19673 let response = common::to_response(parts, bytes.into());
19674
19675 if let common::Retry::After(d) =
19676 dlg.http_failure(&response, error.as_ref().ok())
19677 {
19678 sleep(d).await;
19679 continue;
19680 }
19681
19682 dlg.finished(false);
19683
19684 return Err(match error {
19685 Ok(value) => common::Error::BadRequest(value),
19686 _ => common::Error::Failure(response),
19687 });
19688 }
19689 let response = {
19690 let bytes = common::to_bytes(body).await.unwrap_or_default();
19691 let encoded = common::to_string(&bytes);
19692 match serde_json::from_str(&encoded) {
19693 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19694 Err(error) => {
19695 dlg.response_json_decode_error(&encoded, &error);
19696 return Err(common::Error::JsonDecodeError(
19697 encoded.to_string(),
19698 error,
19699 ));
19700 }
19701 }
19702 };
19703
19704 dlg.finished(true);
19705 return Ok(response);
19706 }
19707 }
19708 }
19709 }
19710
19711 /// Required. The study resource path. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}/dicomWeb/studies/{study_uid}`.
19712 ///
19713 /// Sets the *study* path property to the given value.
19714 ///
19715 /// Even though the property as already been set when instantiating this call,
19716 /// we provide this method for API completeness.
19717 pub fn study(
19718 mut self,
19719 new_value: &str,
19720 ) -> ProjectLocationDatasetDicomStoreDicomWebStudyGetStudyMetricCall<'a, C> {
19721 self._study = new_value.to_string();
19722 self
19723 }
19724 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19725 /// while executing the actual API request.
19726 ///
19727 /// ````text
19728 /// It should be used to handle progress information, and to implement a certain level of resilience.
19729 /// ````
19730 ///
19731 /// Sets the *delegate* property to the given value.
19732 pub fn delegate(
19733 mut self,
19734 new_value: &'a mut dyn common::Delegate,
19735 ) -> ProjectLocationDatasetDicomStoreDicomWebStudyGetStudyMetricCall<'a, C> {
19736 self._delegate = Some(new_value);
19737 self
19738 }
19739
19740 /// Set any additional parameter of the query string used in the request.
19741 /// It should be used to set parameters which are not yet available through their own
19742 /// setters.
19743 ///
19744 /// Please note that this method must not be used to set any of the known parameters
19745 /// which have their own setter method. If done anyway, the request will fail.
19746 ///
19747 /// # Additional Parameters
19748 ///
19749 /// * *$.xgafv* (query-string) - V1 error format.
19750 /// * *access_token* (query-string) - OAuth access token.
19751 /// * *alt* (query-string) - Data format for response.
19752 /// * *callback* (query-string) - JSONP
19753 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19754 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19755 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19756 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19757 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19758 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19759 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19760 pub fn param<T>(
19761 mut self,
19762 name: T,
19763 value: T,
19764 ) -> ProjectLocationDatasetDicomStoreDicomWebStudyGetStudyMetricCall<'a, C>
19765 where
19766 T: AsRef<str>,
19767 {
19768 self._additional_params
19769 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19770 self
19771 }
19772
19773 /// Identifies the authorization scope for the method you are building.
19774 ///
19775 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19776 /// [`Scope::CloudHealthcare`].
19777 ///
19778 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19779 /// tokens for more than one scope.
19780 ///
19781 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19782 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19783 /// sufficient, a read-write scope will do as well.
19784 pub fn add_scope<St>(
19785 mut self,
19786 scope: St,
19787 ) -> ProjectLocationDatasetDicomStoreDicomWebStudyGetStudyMetricCall<'a, C>
19788 where
19789 St: AsRef<str>,
19790 {
19791 self._scopes.insert(String::from(scope.as_ref()));
19792 self
19793 }
19794 /// Identifies the authorization scope(s) for the method you are building.
19795 ///
19796 /// See [`Self::add_scope()`] for details.
19797 pub fn add_scopes<I, St>(
19798 mut self,
19799 scopes: I,
19800 ) -> ProjectLocationDatasetDicomStoreDicomWebStudyGetStudyMetricCall<'a, C>
19801 where
19802 I: IntoIterator<Item = St>,
19803 St: AsRef<str>,
19804 {
19805 self._scopes
19806 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19807 self
19808 }
19809
19810 /// Removes all scopes, and no default scope will be used either.
19811 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19812 /// for details).
19813 pub fn clear_scopes(
19814 mut self,
19815 ) -> ProjectLocationDatasetDicomStoreDicomWebStudyGetStudyMetricCall<'a, C> {
19816 self._scopes.clear();
19817 self
19818 }
19819}
19820
19821/// RetrieveFrames returns instances associated with the given study, series, SOP Instance UID and frame numbers. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4}. For details on the implementation of RetrieveFrames, see [DICOM frames](https://cloud.google.com/healthcare/docs/dicom#dicom_frames) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveFrames, see [Retrieve DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-dicom).
19822///
19823/// A builder for the *locations.datasets.dicomStores.studies.series.instances.frames.retrieveFrames* method supported by a *project* resource.
19824/// It is not used directly, but through a [`ProjectMethods`] instance.
19825///
19826/// # Example
19827///
19828/// Instantiate a resource method builder
19829///
19830/// ```test_harness,no_run
19831/// # extern crate hyper;
19832/// # extern crate hyper_rustls;
19833/// # extern crate google_healthcare1 as healthcare1;
19834/// # async fn dox() {
19835/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19836///
19837/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19838/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19839/// # secret,
19840/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19841/// # ).build().await.unwrap();
19842///
19843/// # let client = hyper_util::client::legacy::Client::builder(
19844/// # hyper_util::rt::TokioExecutor::new()
19845/// # )
19846/// # .build(
19847/// # hyper_rustls::HttpsConnectorBuilder::new()
19848/// # .with_native_roots()
19849/// # .unwrap()
19850/// # .https_or_http()
19851/// # .enable_http1()
19852/// # .build()
19853/// # );
19854/// # let mut hub = CloudHealthcare::new(client, auth);
19855/// // You can configure optional parameters by calling the respective setters at will, and
19856/// // execute the final call using `doit()`.
19857/// // Values shown here are possibly random and not representative !
19858/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_frames("parent", "dicomWebPath")
19859/// .doit().await;
19860/// # }
19861/// ```
19862pub struct ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveFrameCall<'a, C>
19863where
19864 C: 'a,
19865{
19866 hub: &'a CloudHealthcare<C>,
19867 _parent: String,
19868 _dicom_web_path: String,
19869 _delegate: Option<&'a mut dyn common::Delegate>,
19870 _additional_params: HashMap<String, String>,
19871 _scopes: BTreeSet<String>,
19872}
19873
19874impl<'a, C> common::CallBuilder
19875 for ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveFrameCall<'a, C>
19876{
19877}
19878
19879impl<'a, C> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveFrameCall<'a, C>
19880where
19881 C: common::Connector,
19882{
19883 /// Perform the operation you have build so far.
19884 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
19885 use std::borrow::Cow;
19886 use std::io::{Read, Seek};
19887
19888 use common::{url::Params, ToParts};
19889 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19890
19891 let mut dd = common::DefaultDelegate;
19892 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19893 dlg.begin(common::MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.instances.frames.retrieveFrames",
19894 http_method: hyper::Method::GET });
19895
19896 for &field in ["alt", "parent", "dicomWebPath"].iter() {
19897 if self._additional_params.contains_key(field) {
19898 dlg.finished(false);
19899 return Err(common::Error::FieldClash(field));
19900 }
19901 }
19902
19903 let mut params = Params::with_capacity(4 + self._additional_params.len());
19904 params.push("parent", self._parent);
19905 params.push("dicomWebPath", self._dicom_web_path);
19906
19907 params.extend(self._additional_params.iter());
19908
19909 params.push("alt", "json");
19910 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
19911 if self._scopes.is_empty() {
19912 self._scopes
19913 .insert(Scope::CloudHealthcare.as_ref().to_string());
19914 }
19915
19916 #[allow(clippy::single_element_loop)]
19917 for &(find_this, param_name) in
19918 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
19919 {
19920 url = params.uri_replacement(url, param_name, find_this, true);
19921 }
19922 {
19923 let to_remove = ["dicomWebPath", "parent"];
19924 params.remove_params(&to_remove);
19925 }
19926
19927 let url = params.parse_with_url(&url);
19928
19929 loop {
19930 let token = match self
19931 .hub
19932 .auth
19933 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19934 .await
19935 {
19936 Ok(token) => token,
19937 Err(e) => match dlg.token(e) {
19938 Ok(token) => token,
19939 Err(e) => {
19940 dlg.finished(false);
19941 return Err(common::Error::MissingToken(e));
19942 }
19943 },
19944 };
19945 let mut req_result = {
19946 let client = &self.hub.client;
19947 dlg.pre_request();
19948 let mut req_builder = hyper::Request::builder()
19949 .method(hyper::Method::GET)
19950 .uri(url.as_str())
19951 .header(USER_AGENT, self.hub._user_agent.clone());
19952
19953 if let Some(token) = token.as_ref() {
19954 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19955 }
19956
19957 let request = req_builder
19958 .header(CONTENT_LENGTH, 0_u64)
19959 .body(common::to_body::<String>(None));
19960
19961 client.request(request.unwrap()).await
19962 };
19963
19964 match req_result {
19965 Err(err) => {
19966 if let common::Retry::After(d) = dlg.http_error(&err) {
19967 sleep(d).await;
19968 continue;
19969 }
19970 dlg.finished(false);
19971 return Err(common::Error::HttpError(err));
19972 }
19973 Ok(res) => {
19974 let (mut parts, body) = res.into_parts();
19975 let mut body = common::Body::new(body);
19976 if !parts.status.is_success() {
19977 let bytes = common::to_bytes(body).await.unwrap_or_default();
19978 let error = serde_json::from_str(&common::to_string(&bytes));
19979 let response = common::to_response(parts, bytes.into());
19980
19981 if let common::Retry::After(d) =
19982 dlg.http_failure(&response, error.as_ref().ok())
19983 {
19984 sleep(d).await;
19985 continue;
19986 }
19987
19988 dlg.finished(false);
19989
19990 return Err(match error {
19991 Ok(value) => common::Error::BadRequest(value),
19992 _ => common::Error::Failure(response),
19993 });
19994 }
19995 let response = {
19996 let bytes = common::to_bytes(body).await.unwrap_or_default();
19997 let encoded = common::to_string(&bytes);
19998 match serde_json::from_str(&encoded) {
19999 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20000 Err(error) => {
20001 dlg.response_json_decode_error(&encoded, &error);
20002 return Err(common::Error::JsonDecodeError(
20003 encoded.to_string(),
20004 error,
20005 ));
20006 }
20007 }
20008 };
20009
20010 dlg.finished(true);
20011 return Ok(response);
20012 }
20013 }
20014 }
20015 }
20016
20017 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
20018 ///
20019 /// Sets the *parent* path property to the given value.
20020 ///
20021 /// Even though the property as already been set when instantiating this call,
20022 /// we provide this method for API completeness.
20023 pub fn parent(
20024 mut self,
20025 new_value: &str,
20026 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveFrameCall<'a, C> {
20027 self._parent = new_value.to_string();
20028 self
20029 }
20030 /// Required. The path of the RetrieveFrames DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}/frames/{frame_list}`.
20031 ///
20032 /// Sets the *dicom web path* path property to the given value.
20033 ///
20034 /// Even though the property as already been set when instantiating this call,
20035 /// we provide this method for API completeness.
20036 pub fn dicom_web_path(
20037 mut self,
20038 new_value: &str,
20039 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveFrameCall<'a, C> {
20040 self._dicom_web_path = new_value.to_string();
20041 self
20042 }
20043 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20044 /// while executing the actual API request.
20045 ///
20046 /// ````text
20047 /// It should be used to handle progress information, and to implement a certain level of resilience.
20048 /// ````
20049 ///
20050 /// Sets the *delegate* property to the given value.
20051 pub fn delegate(
20052 mut self,
20053 new_value: &'a mut dyn common::Delegate,
20054 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveFrameCall<'a, C> {
20055 self._delegate = Some(new_value);
20056 self
20057 }
20058
20059 /// Set any additional parameter of the query string used in the request.
20060 /// It should be used to set parameters which are not yet available through their own
20061 /// setters.
20062 ///
20063 /// Please note that this method must not be used to set any of the known parameters
20064 /// which have their own setter method. If done anyway, the request will fail.
20065 ///
20066 /// # Additional Parameters
20067 ///
20068 /// * *$.xgafv* (query-string) - V1 error format.
20069 /// * *access_token* (query-string) - OAuth access token.
20070 /// * *alt* (query-string) - Data format for response.
20071 /// * *callback* (query-string) - JSONP
20072 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20073 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20074 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20075 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20076 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20077 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20078 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20079 pub fn param<T>(
20080 mut self,
20081 name: T,
20082 value: T,
20083 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveFrameCall<'a, C>
20084 where
20085 T: AsRef<str>,
20086 {
20087 self._additional_params
20088 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20089 self
20090 }
20091
20092 /// Identifies the authorization scope for the method you are building.
20093 ///
20094 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20095 /// [`Scope::CloudHealthcare`].
20096 ///
20097 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20098 /// tokens for more than one scope.
20099 ///
20100 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20101 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20102 /// sufficient, a read-write scope will do as well.
20103 pub fn add_scope<St>(
20104 mut self,
20105 scope: St,
20106 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveFrameCall<'a, C>
20107 where
20108 St: AsRef<str>,
20109 {
20110 self._scopes.insert(String::from(scope.as_ref()));
20111 self
20112 }
20113 /// Identifies the authorization scope(s) for the method you are building.
20114 ///
20115 /// See [`Self::add_scope()`] for details.
20116 pub fn add_scopes<I, St>(
20117 mut self,
20118 scopes: I,
20119 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveFrameCall<'a, C>
20120 where
20121 I: IntoIterator<Item = St>,
20122 St: AsRef<str>,
20123 {
20124 self._scopes
20125 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20126 self
20127 }
20128
20129 /// Removes all scopes, and no default scope will be used either.
20130 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20131 /// for details).
20132 pub fn clear_scopes(
20133 mut self,
20134 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveFrameCall<'a, C> {
20135 self._scopes.clear();
20136 self
20137 }
20138}
20139
20140/// RetrieveRenderedFrames returns instances associated with the given study, series, SOP Instance UID and frame numbers in an acceptable Rendered Media Type. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveRenderedFrames, see [Rendered resources](https://cloud.google.com/healthcare/docs/dicom#rendered_resources) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveRenderedFrames, see [Retrieve consumer image formats](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-consumer).
20141///
20142/// A builder for the *locations.datasets.dicomStores.studies.series.instances.frames.retrieveRendered* method supported by a *project* resource.
20143/// It is not used directly, but through a [`ProjectMethods`] instance.
20144///
20145/// # Example
20146///
20147/// Instantiate a resource method builder
20148///
20149/// ```test_harness,no_run
20150/// # extern crate hyper;
20151/// # extern crate hyper_rustls;
20152/// # extern crate google_healthcare1 as healthcare1;
20153/// # async fn dox() {
20154/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20155///
20156/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20157/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20158/// # secret,
20159/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20160/// # ).build().await.unwrap();
20161///
20162/// # let client = hyper_util::client::legacy::Client::builder(
20163/// # hyper_util::rt::TokioExecutor::new()
20164/// # )
20165/// # .build(
20166/// # hyper_rustls::HttpsConnectorBuilder::new()
20167/// # .with_native_roots()
20168/// # .unwrap()
20169/// # .https_or_http()
20170/// # .enable_http1()
20171/// # .build()
20172/// # );
20173/// # let mut hub = CloudHealthcare::new(client, auth);
20174/// // You can configure optional parameters by calling the respective setters at will, and
20175/// // execute the final call using `doit()`.
20176/// // Values shown here are possibly random and not representative !
20177/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_instances_frames_retrieve_rendered("parent", "dicomWebPath")
20178/// .doit().await;
20179/// # }
20180/// ```
20181pub struct ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveRenderedCall<'a, C>
20182where
20183 C: 'a,
20184{
20185 hub: &'a CloudHealthcare<C>,
20186 _parent: String,
20187 _dicom_web_path: String,
20188 _delegate: Option<&'a mut dyn common::Delegate>,
20189 _additional_params: HashMap<String, String>,
20190 _scopes: BTreeSet<String>,
20191}
20192
20193impl<'a, C> common::CallBuilder
20194 for ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveRenderedCall<'a, C>
20195{
20196}
20197
20198impl<'a, C> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveRenderedCall<'a, C>
20199where
20200 C: common::Connector,
20201{
20202 /// Perform the operation you have build so far.
20203 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
20204 use std::borrow::Cow;
20205 use std::io::{Read, Seek};
20206
20207 use common::{url::Params, ToParts};
20208 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20209
20210 let mut dd = common::DefaultDelegate;
20211 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20212 dlg.begin(common::MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.instances.frames.retrieveRendered",
20213 http_method: hyper::Method::GET });
20214
20215 for &field in ["alt", "parent", "dicomWebPath"].iter() {
20216 if self._additional_params.contains_key(field) {
20217 dlg.finished(false);
20218 return Err(common::Error::FieldClash(field));
20219 }
20220 }
20221
20222 let mut params = Params::with_capacity(4 + self._additional_params.len());
20223 params.push("parent", self._parent);
20224 params.push("dicomWebPath", self._dicom_web_path);
20225
20226 params.extend(self._additional_params.iter());
20227
20228 params.push("alt", "json");
20229 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
20230 if self._scopes.is_empty() {
20231 self._scopes
20232 .insert(Scope::CloudHealthcare.as_ref().to_string());
20233 }
20234
20235 #[allow(clippy::single_element_loop)]
20236 for &(find_this, param_name) in
20237 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
20238 {
20239 url = params.uri_replacement(url, param_name, find_this, true);
20240 }
20241 {
20242 let to_remove = ["dicomWebPath", "parent"];
20243 params.remove_params(&to_remove);
20244 }
20245
20246 let url = params.parse_with_url(&url);
20247
20248 loop {
20249 let token = match self
20250 .hub
20251 .auth
20252 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20253 .await
20254 {
20255 Ok(token) => token,
20256 Err(e) => match dlg.token(e) {
20257 Ok(token) => token,
20258 Err(e) => {
20259 dlg.finished(false);
20260 return Err(common::Error::MissingToken(e));
20261 }
20262 },
20263 };
20264 let mut req_result = {
20265 let client = &self.hub.client;
20266 dlg.pre_request();
20267 let mut req_builder = hyper::Request::builder()
20268 .method(hyper::Method::GET)
20269 .uri(url.as_str())
20270 .header(USER_AGENT, self.hub._user_agent.clone());
20271
20272 if let Some(token) = token.as_ref() {
20273 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20274 }
20275
20276 let request = req_builder
20277 .header(CONTENT_LENGTH, 0_u64)
20278 .body(common::to_body::<String>(None));
20279
20280 client.request(request.unwrap()).await
20281 };
20282
20283 match req_result {
20284 Err(err) => {
20285 if let common::Retry::After(d) = dlg.http_error(&err) {
20286 sleep(d).await;
20287 continue;
20288 }
20289 dlg.finished(false);
20290 return Err(common::Error::HttpError(err));
20291 }
20292 Ok(res) => {
20293 let (mut parts, body) = res.into_parts();
20294 let mut body = common::Body::new(body);
20295 if !parts.status.is_success() {
20296 let bytes = common::to_bytes(body).await.unwrap_or_default();
20297 let error = serde_json::from_str(&common::to_string(&bytes));
20298 let response = common::to_response(parts, bytes.into());
20299
20300 if let common::Retry::After(d) =
20301 dlg.http_failure(&response, error.as_ref().ok())
20302 {
20303 sleep(d).await;
20304 continue;
20305 }
20306
20307 dlg.finished(false);
20308
20309 return Err(match error {
20310 Ok(value) => common::Error::BadRequest(value),
20311 _ => common::Error::Failure(response),
20312 });
20313 }
20314 let response = {
20315 let bytes = common::to_bytes(body).await.unwrap_or_default();
20316 let encoded = common::to_string(&bytes);
20317 match serde_json::from_str(&encoded) {
20318 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20319 Err(error) => {
20320 dlg.response_json_decode_error(&encoded, &error);
20321 return Err(common::Error::JsonDecodeError(
20322 encoded.to_string(),
20323 error,
20324 ));
20325 }
20326 }
20327 };
20328
20329 dlg.finished(true);
20330 return Ok(response);
20331 }
20332 }
20333 }
20334 }
20335
20336 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
20337 ///
20338 /// Sets the *parent* path property to the given value.
20339 ///
20340 /// Even though the property as already been set when instantiating this call,
20341 /// we provide this method for API completeness.
20342 pub fn parent(
20343 mut self,
20344 new_value: &str,
20345 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveRenderedCall<'a, C> {
20346 self._parent = new_value.to_string();
20347 self
20348 }
20349 /// Required. The path of the RetrieveRenderedFrames DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}/frames/{frame_list}/rendered`.
20350 ///
20351 /// Sets the *dicom web path* path property to the given value.
20352 ///
20353 /// Even though the property as already been set when instantiating this call,
20354 /// we provide this method for API completeness.
20355 pub fn dicom_web_path(
20356 mut self,
20357 new_value: &str,
20358 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveRenderedCall<'a, C> {
20359 self._dicom_web_path = new_value.to_string();
20360 self
20361 }
20362 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20363 /// while executing the actual API request.
20364 ///
20365 /// ````text
20366 /// It should be used to handle progress information, and to implement a certain level of resilience.
20367 /// ````
20368 ///
20369 /// Sets the *delegate* property to the given value.
20370 pub fn delegate(
20371 mut self,
20372 new_value: &'a mut dyn common::Delegate,
20373 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveRenderedCall<'a, C> {
20374 self._delegate = Some(new_value);
20375 self
20376 }
20377
20378 /// Set any additional parameter of the query string used in the request.
20379 /// It should be used to set parameters which are not yet available through their own
20380 /// setters.
20381 ///
20382 /// Please note that this method must not be used to set any of the known parameters
20383 /// which have their own setter method. If done anyway, the request will fail.
20384 ///
20385 /// # Additional Parameters
20386 ///
20387 /// * *$.xgafv* (query-string) - V1 error format.
20388 /// * *access_token* (query-string) - OAuth access token.
20389 /// * *alt* (query-string) - Data format for response.
20390 /// * *callback* (query-string) - JSONP
20391 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20392 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20393 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20394 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20395 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20396 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20397 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20398 pub fn param<T>(
20399 mut self,
20400 name: T,
20401 value: T,
20402 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveRenderedCall<'a, C>
20403 where
20404 T: AsRef<str>,
20405 {
20406 self._additional_params
20407 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20408 self
20409 }
20410
20411 /// Identifies the authorization scope for the method you are building.
20412 ///
20413 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20414 /// [`Scope::CloudHealthcare`].
20415 ///
20416 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20417 /// tokens for more than one scope.
20418 ///
20419 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20420 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20421 /// sufficient, a read-write scope will do as well.
20422 pub fn add_scope<St>(
20423 mut self,
20424 scope: St,
20425 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveRenderedCall<'a, C>
20426 where
20427 St: AsRef<str>,
20428 {
20429 self._scopes.insert(String::from(scope.as_ref()));
20430 self
20431 }
20432 /// Identifies the authorization scope(s) for the method you are building.
20433 ///
20434 /// See [`Self::add_scope()`] for details.
20435 pub fn add_scopes<I, St>(
20436 mut self,
20437 scopes: I,
20438 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveRenderedCall<'a, C>
20439 where
20440 I: IntoIterator<Item = St>,
20441 St: AsRef<str>,
20442 {
20443 self._scopes
20444 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20445 self
20446 }
20447
20448 /// Removes all scopes, and no default scope will be used either.
20449 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20450 /// for details).
20451 pub fn clear_scopes(
20452 mut self,
20453 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceFrameRetrieveRenderedCall<'a, C> {
20454 self._scopes.clear();
20455 self
20456 }
20457}
20458
20459/// DeleteInstance deletes an instance associated with the given study, series, and SOP Instance UID. Delete requests are equivalent to the GET requests specified in the Retrieve transaction. Study and series search results can take a few seconds to be updated after an instance is deleted using DeleteInstance. For samples that show how to call DeleteInstance, see [Delete a study, series, or instance](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#delete-dicom).
20460///
20461/// A builder for the *locations.datasets.dicomStores.studies.series.instances.delete* method supported by a *project* resource.
20462/// It is not used directly, but through a [`ProjectMethods`] instance.
20463///
20464/// # Example
20465///
20466/// Instantiate a resource method builder
20467///
20468/// ```test_harness,no_run
20469/// # extern crate hyper;
20470/// # extern crate hyper_rustls;
20471/// # extern crate google_healthcare1 as healthcare1;
20472/// # async fn dox() {
20473/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20474///
20475/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20476/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20477/// # secret,
20478/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20479/// # ).build().await.unwrap();
20480///
20481/// # let client = hyper_util::client::legacy::Client::builder(
20482/// # hyper_util::rt::TokioExecutor::new()
20483/// # )
20484/// # .build(
20485/// # hyper_rustls::HttpsConnectorBuilder::new()
20486/// # .with_native_roots()
20487/// # .unwrap()
20488/// # .https_or_http()
20489/// # .enable_http1()
20490/// # .build()
20491/// # );
20492/// # let mut hub = CloudHealthcare::new(client, auth);
20493/// // You can configure optional parameters by calling the respective setters at will, and
20494/// // execute the final call using `doit()`.
20495/// // Values shown here are possibly random and not representative !
20496/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_instances_delete("parent", "dicomWebPath")
20497/// .doit().await;
20498/// # }
20499/// ```
20500pub struct ProjectLocationDatasetDicomStoreStudySeriesInstanceDeleteCall<'a, C>
20501where
20502 C: 'a,
20503{
20504 hub: &'a CloudHealthcare<C>,
20505 _parent: String,
20506 _dicom_web_path: String,
20507 _delegate: Option<&'a mut dyn common::Delegate>,
20508 _additional_params: HashMap<String, String>,
20509 _scopes: BTreeSet<String>,
20510}
20511
20512impl<'a, C> common::CallBuilder
20513 for ProjectLocationDatasetDicomStoreStudySeriesInstanceDeleteCall<'a, C>
20514{
20515}
20516
20517impl<'a, C> ProjectLocationDatasetDicomStoreStudySeriesInstanceDeleteCall<'a, C>
20518where
20519 C: common::Connector,
20520{
20521 /// Perform the operation you have build so far.
20522 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
20523 use std::borrow::Cow;
20524 use std::io::{Read, Seek};
20525
20526 use common::{url::Params, ToParts};
20527 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20528
20529 let mut dd = common::DefaultDelegate;
20530 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20531 dlg.begin(common::MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.instances.delete",
20532 http_method: hyper::Method::DELETE });
20533
20534 for &field in ["alt", "parent", "dicomWebPath"].iter() {
20535 if self._additional_params.contains_key(field) {
20536 dlg.finished(false);
20537 return Err(common::Error::FieldClash(field));
20538 }
20539 }
20540
20541 let mut params = Params::with_capacity(4 + self._additional_params.len());
20542 params.push("parent", self._parent);
20543 params.push("dicomWebPath", self._dicom_web_path);
20544
20545 params.extend(self._additional_params.iter());
20546
20547 params.push("alt", "json");
20548 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
20549 if self._scopes.is_empty() {
20550 self._scopes
20551 .insert(Scope::CloudHealthcare.as_ref().to_string());
20552 }
20553
20554 #[allow(clippy::single_element_loop)]
20555 for &(find_this, param_name) in
20556 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
20557 {
20558 url = params.uri_replacement(url, param_name, find_this, true);
20559 }
20560 {
20561 let to_remove = ["dicomWebPath", "parent"];
20562 params.remove_params(&to_remove);
20563 }
20564
20565 let url = params.parse_with_url(&url);
20566
20567 loop {
20568 let token = match self
20569 .hub
20570 .auth
20571 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20572 .await
20573 {
20574 Ok(token) => token,
20575 Err(e) => match dlg.token(e) {
20576 Ok(token) => token,
20577 Err(e) => {
20578 dlg.finished(false);
20579 return Err(common::Error::MissingToken(e));
20580 }
20581 },
20582 };
20583 let mut req_result = {
20584 let client = &self.hub.client;
20585 dlg.pre_request();
20586 let mut req_builder = hyper::Request::builder()
20587 .method(hyper::Method::DELETE)
20588 .uri(url.as_str())
20589 .header(USER_AGENT, self.hub._user_agent.clone());
20590
20591 if let Some(token) = token.as_ref() {
20592 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20593 }
20594
20595 let request = req_builder
20596 .header(CONTENT_LENGTH, 0_u64)
20597 .body(common::to_body::<String>(None));
20598
20599 client.request(request.unwrap()).await
20600 };
20601
20602 match req_result {
20603 Err(err) => {
20604 if let common::Retry::After(d) = dlg.http_error(&err) {
20605 sleep(d).await;
20606 continue;
20607 }
20608 dlg.finished(false);
20609 return Err(common::Error::HttpError(err));
20610 }
20611 Ok(res) => {
20612 let (mut parts, body) = res.into_parts();
20613 let mut body = common::Body::new(body);
20614 if !parts.status.is_success() {
20615 let bytes = common::to_bytes(body).await.unwrap_or_default();
20616 let error = serde_json::from_str(&common::to_string(&bytes));
20617 let response = common::to_response(parts, bytes.into());
20618
20619 if let common::Retry::After(d) =
20620 dlg.http_failure(&response, error.as_ref().ok())
20621 {
20622 sleep(d).await;
20623 continue;
20624 }
20625
20626 dlg.finished(false);
20627
20628 return Err(match error {
20629 Ok(value) => common::Error::BadRequest(value),
20630 _ => common::Error::Failure(response),
20631 });
20632 }
20633 let response = {
20634 let bytes = common::to_bytes(body).await.unwrap_or_default();
20635 let encoded = common::to_string(&bytes);
20636 match serde_json::from_str(&encoded) {
20637 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20638 Err(error) => {
20639 dlg.response_json_decode_error(&encoded, &error);
20640 return Err(common::Error::JsonDecodeError(
20641 encoded.to_string(),
20642 error,
20643 ));
20644 }
20645 }
20646 };
20647
20648 dlg.finished(true);
20649 return Ok(response);
20650 }
20651 }
20652 }
20653 }
20654
20655 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
20656 ///
20657 /// Sets the *parent* path property to the given value.
20658 ///
20659 /// Even though the property as already been set when instantiating this call,
20660 /// we provide this method for API completeness.
20661 pub fn parent(
20662 mut self,
20663 new_value: &str,
20664 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceDeleteCall<'a, C> {
20665 self._parent = new_value.to_string();
20666 self
20667 }
20668 /// Required. The path of the DeleteInstance request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}`.
20669 ///
20670 /// Sets the *dicom web path* path property to the given value.
20671 ///
20672 /// Even though the property as already been set when instantiating this call,
20673 /// we provide this method for API completeness.
20674 pub fn dicom_web_path(
20675 mut self,
20676 new_value: &str,
20677 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceDeleteCall<'a, C> {
20678 self._dicom_web_path = new_value.to_string();
20679 self
20680 }
20681 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20682 /// while executing the actual API request.
20683 ///
20684 /// ````text
20685 /// It should be used to handle progress information, and to implement a certain level of resilience.
20686 /// ````
20687 ///
20688 /// Sets the *delegate* property to the given value.
20689 pub fn delegate(
20690 mut self,
20691 new_value: &'a mut dyn common::Delegate,
20692 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceDeleteCall<'a, C> {
20693 self._delegate = Some(new_value);
20694 self
20695 }
20696
20697 /// Set any additional parameter of the query string used in the request.
20698 /// It should be used to set parameters which are not yet available through their own
20699 /// setters.
20700 ///
20701 /// Please note that this method must not be used to set any of the known parameters
20702 /// which have their own setter method. If done anyway, the request will fail.
20703 ///
20704 /// # Additional Parameters
20705 ///
20706 /// * *$.xgafv* (query-string) - V1 error format.
20707 /// * *access_token* (query-string) - OAuth access token.
20708 /// * *alt* (query-string) - Data format for response.
20709 /// * *callback* (query-string) - JSONP
20710 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20711 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20712 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20713 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20714 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20715 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20716 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20717 pub fn param<T>(
20718 mut self,
20719 name: T,
20720 value: T,
20721 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceDeleteCall<'a, C>
20722 where
20723 T: AsRef<str>,
20724 {
20725 self._additional_params
20726 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20727 self
20728 }
20729
20730 /// Identifies the authorization scope for the method you are building.
20731 ///
20732 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20733 /// [`Scope::CloudHealthcare`].
20734 ///
20735 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20736 /// tokens for more than one scope.
20737 ///
20738 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20739 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20740 /// sufficient, a read-write scope will do as well.
20741 pub fn add_scope<St>(
20742 mut self,
20743 scope: St,
20744 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceDeleteCall<'a, C>
20745 where
20746 St: AsRef<str>,
20747 {
20748 self._scopes.insert(String::from(scope.as_ref()));
20749 self
20750 }
20751 /// Identifies the authorization scope(s) for the method you are building.
20752 ///
20753 /// See [`Self::add_scope()`] for details.
20754 pub fn add_scopes<I, St>(
20755 mut self,
20756 scopes: I,
20757 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceDeleteCall<'a, C>
20758 where
20759 I: IntoIterator<Item = St>,
20760 St: AsRef<str>,
20761 {
20762 self._scopes
20763 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20764 self
20765 }
20766
20767 /// Removes all scopes, and no default scope will be used either.
20768 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20769 /// for details).
20770 pub fn clear_scopes(
20771 mut self,
20772 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceDeleteCall<'a, C> {
20773 self._scopes.clear();
20774 self
20775 }
20776}
20777
20778/// RetrieveInstance returns instance associated with the given study, series, and SOP Instance UID. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveInstance, see [DICOM study/series/instances](https://cloud.google.com/healthcare/docs/dicom#dicom_studyseriesinstances) and [DICOM instances](https://cloud.google.com/healthcare/docs/dicom#dicom_instances) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveInstance, see [Retrieve an instance](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-instance).
20779///
20780/// A builder for the *locations.datasets.dicomStores.studies.series.instances.retrieveInstance* method supported by a *project* resource.
20781/// It is not used directly, but through a [`ProjectMethods`] instance.
20782///
20783/// # Example
20784///
20785/// Instantiate a resource method builder
20786///
20787/// ```test_harness,no_run
20788/// # extern crate hyper;
20789/// # extern crate hyper_rustls;
20790/// # extern crate google_healthcare1 as healthcare1;
20791/// # async fn dox() {
20792/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20793///
20794/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20795/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20796/// # secret,
20797/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20798/// # ).build().await.unwrap();
20799///
20800/// # let client = hyper_util::client::legacy::Client::builder(
20801/// # hyper_util::rt::TokioExecutor::new()
20802/// # )
20803/// # .build(
20804/// # hyper_rustls::HttpsConnectorBuilder::new()
20805/// # .with_native_roots()
20806/// # .unwrap()
20807/// # .https_or_http()
20808/// # .enable_http1()
20809/// # .build()
20810/// # );
20811/// # let mut hub = CloudHealthcare::new(client, auth);
20812/// // You can configure optional parameters by calling the respective setters at will, and
20813/// // execute the final call using `doit()`.
20814/// // Values shown here are possibly random and not representative !
20815/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_instance("parent", "dicomWebPath")
20816/// .doit().await;
20817/// # }
20818/// ```
20819pub struct ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveInstanceCall<'a, C>
20820where
20821 C: 'a,
20822{
20823 hub: &'a CloudHealthcare<C>,
20824 _parent: String,
20825 _dicom_web_path: String,
20826 _delegate: Option<&'a mut dyn common::Delegate>,
20827 _additional_params: HashMap<String, String>,
20828 _scopes: BTreeSet<String>,
20829}
20830
20831impl<'a, C> common::CallBuilder
20832 for ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveInstanceCall<'a, C>
20833{
20834}
20835
20836impl<'a, C> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveInstanceCall<'a, C>
20837where
20838 C: common::Connector,
20839{
20840 /// Perform the operation you have build so far.
20841 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
20842 use std::borrow::Cow;
20843 use std::io::{Read, Seek};
20844
20845 use common::{url::Params, ToParts};
20846 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20847
20848 let mut dd = common::DefaultDelegate;
20849 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20850 dlg.begin(common::MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.instances.retrieveInstance",
20851 http_method: hyper::Method::GET });
20852
20853 for &field in ["alt", "parent", "dicomWebPath"].iter() {
20854 if self._additional_params.contains_key(field) {
20855 dlg.finished(false);
20856 return Err(common::Error::FieldClash(field));
20857 }
20858 }
20859
20860 let mut params = Params::with_capacity(4 + self._additional_params.len());
20861 params.push("parent", self._parent);
20862 params.push("dicomWebPath", self._dicom_web_path);
20863
20864 params.extend(self._additional_params.iter());
20865
20866 params.push("alt", "json");
20867 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
20868 if self._scopes.is_empty() {
20869 self._scopes
20870 .insert(Scope::CloudHealthcare.as_ref().to_string());
20871 }
20872
20873 #[allow(clippy::single_element_loop)]
20874 for &(find_this, param_name) in
20875 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
20876 {
20877 url = params.uri_replacement(url, param_name, find_this, true);
20878 }
20879 {
20880 let to_remove = ["dicomWebPath", "parent"];
20881 params.remove_params(&to_remove);
20882 }
20883
20884 let url = params.parse_with_url(&url);
20885
20886 loop {
20887 let token = match self
20888 .hub
20889 .auth
20890 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20891 .await
20892 {
20893 Ok(token) => token,
20894 Err(e) => match dlg.token(e) {
20895 Ok(token) => token,
20896 Err(e) => {
20897 dlg.finished(false);
20898 return Err(common::Error::MissingToken(e));
20899 }
20900 },
20901 };
20902 let mut req_result = {
20903 let client = &self.hub.client;
20904 dlg.pre_request();
20905 let mut req_builder = hyper::Request::builder()
20906 .method(hyper::Method::GET)
20907 .uri(url.as_str())
20908 .header(USER_AGENT, self.hub._user_agent.clone());
20909
20910 if let Some(token) = token.as_ref() {
20911 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20912 }
20913
20914 let request = req_builder
20915 .header(CONTENT_LENGTH, 0_u64)
20916 .body(common::to_body::<String>(None));
20917
20918 client.request(request.unwrap()).await
20919 };
20920
20921 match req_result {
20922 Err(err) => {
20923 if let common::Retry::After(d) = dlg.http_error(&err) {
20924 sleep(d).await;
20925 continue;
20926 }
20927 dlg.finished(false);
20928 return Err(common::Error::HttpError(err));
20929 }
20930 Ok(res) => {
20931 let (mut parts, body) = res.into_parts();
20932 let mut body = common::Body::new(body);
20933 if !parts.status.is_success() {
20934 let bytes = common::to_bytes(body).await.unwrap_or_default();
20935 let error = serde_json::from_str(&common::to_string(&bytes));
20936 let response = common::to_response(parts, bytes.into());
20937
20938 if let common::Retry::After(d) =
20939 dlg.http_failure(&response, error.as_ref().ok())
20940 {
20941 sleep(d).await;
20942 continue;
20943 }
20944
20945 dlg.finished(false);
20946
20947 return Err(match error {
20948 Ok(value) => common::Error::BadRequest(value),
20949 _ => common::Error::Failure(response),
20950 });
20951 }
20952 let response = {
20953 let bytes = common::to_bytes(body).await.unwrap_or_default();
20954 let encoded = common::to_string(&bytes);
20955 match serde_json::from_str(&encoded) {
20956 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20957 Err(error) => {
20958 dlg.response_json_decode_error(&encoded, &error);
20959 return Err(common::Error::JsonDecodeError(
20960 encoded.to_string(),
20961 error,
20962 ));
20963 }
20964 }
20965 };
20966
20967 dlg.finished(true);
20968 return Ok(response);
20969 }
20970 }
20971 }
20972 }
20973
20974 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
20975 ///
20976 /// Sets the *parent* path property to the given value.
20977 ///
20978 /// Even though the property as already been set when instantiating this call,
20979 /// we provide this method for API completeness.
20980 pub fn parent(
20981 mut self,
20982 new_value: &str,
20983 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveInstanceCall<'a, C> {
20984 self._parent = new_value.to_string();
20985 self
20986 }
20987 /// Required. The path of the RetrieveInstance DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}`.
20988 ///
20989 /// Sets the *dicom web path* path property to the given value.
20990 ///
20991 /// Even though the property as already been set when instantiating this call,
20992 /// we provide this method for API completeness.
20993 pub fn dicom_web_path(
20994 mut self,
20995 new_value: &str,
20996 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveInstanceCall<'a, C> {
20997 self._dicom_web_path = new_value.to_string();
20998 self
20999 }
21000 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21001 /// while executing the actual API request.
21002 ///
21003 /// ````text
21004 /// It should be used to handle progress information, and to implement a certain level of resilience.
21005 /// ````
21006 ///
21007 /// Sets the *delegate* property to the given value.
21008 pub fn delegate(
21009 mut self,
21010 new_value: &'a mut dyn common::Delegate,
21011 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveInstanceCall<'a, C> {
21012 self._delegate = Some(new_value);
21013 self
21014 }
21015
21016 /// Set any additional parameter of the query string used in the request.
21017 /// It should be used to set parameters which are not yet available through their own
21018 /// setters.
21019 ///
21020 /// Please note that this method must not be used to set any of the known parameters
21021 /// which have their own setter method. If done anyway, the request will fail.
21022 ///
21023 /// # Additional Parameters
21024 ///
21025 /// * *$.xgafv* (query-string) - V1 error format.
21026 /// * *access_token* (query-string) - OAuth access token.
21027 /// * *alt* (query-string) - Data format for response.
21028 /// * *callback* (query-string) - JSONP
21029 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21030 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21031 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21032 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21033 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21034 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21035 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21036 pub fn param<T>(
21037 mut self,
21038 name: T,
21039 value: T,
21040 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveInstanceCall<'a, C>
21041 where
21042 T: AsRef<str>,
21043 {
21044 self._additional_params
21045 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21046 self
21047 }
21048
21049 /// Identifies the authorization scope for the method you are building.
21050 ///
21051 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21052 /// [`Scope::CloudHealthcare`].
21053 ///
21054 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21055 /// tokens for more than one scope.
21056 ///
21057 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21058 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21059 /// sufficient, a read-write scope will do as well.
21060 pub fn add_scope<St>(
21061 mut self,
21062 scope: St,
21063 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveInstanceCall<'a, C>
21064 where
21065 St: AsRef<str>,
21066 {
21067 self._scopes.insert(String::from(scope.as_ref()));
21068 self
21069 }
21070 /// Identifies the authorization scope(s) for the method you are building.
21071 ///
21072 /// See [`Self::add_scope()`] for details.
21073 pub fn add_scopes<I, St>(
21074 mut self,
21075 scopes: I,
21076 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveInstanceCall<'a, C>
21077 where
21078 I: IntoIterator<Item = St>,
21079 St: AsRef<str>,
21080 {
21081 self._scopes
21082 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21083 self
21084 }
21085
21086 /// Removes all scopes, and no default scope will be used either.
21087 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21088 /// for details).
21089 pub fn clear_scopes(
21090 mut self,
21091 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveInstanceCall<'a, C> {
21092 self._scopes.clear();
21093 self
21094 }
21095}
21096
21097/// RetrieveInstanceMetadata returns instance associated with the given study, series, and SOP Instance UID presented as metadata with the bulk data removed. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveInstanceMetadata, see [Metadata resources](https://cloud.google.com/healthcare/docs/dicom#metadata_resources) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveInstanceMetadata, see [Retrieve metadata](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-metadata).
21098///
21099/// A builder for the *locations.datasets.dicomStores.studies.series.instances.retrieveMetadata* method supported by a *project* resource.
21100/// It is not used directly, but through a [`ProjectMethods`] instance.
21101///
21102/// # Example
21103///
21104/// Instantiate a resource method builder
21105///
21106/// ```test_harness,no_run
21107/// # extern crate hyper;
21108/// # extern crate hyper_rustls;
21109/// # extern crate google_healthcare1 as healthcare1;
21110/// # async fn dox() {
21111/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21112///
21113/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21114/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21115/// # secret,
21116/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21117/// # ).build().await.unwrap();
21118///
21119/// # let client = hyper_util::client::legacy::Client::builder(
21120/// # hyper_util::rt::TokioExecutor::new()
21121/// # )
21122/// # .build(
21123/// # hyper_rustls::HttpsConnectorBuilder::new()
21124/// # .with_native_roots()
21125/// # .unwrap()
21126/// # .https_or_http()
21127/// # .enable_http1()
21128/// # .build()
21129/// # );
21130/// # let mut hub = CloudHealthcare::new(client, auth);
21131/// // You can configure optional parameters by calling the respective setters at will, and
21132/// // execute the final call using `doit()`.
21133/// // Values shown here are possibly random and not representative !
21134/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_metadata("parent", "dicomWebPath")
21135/// .doit().await;
21136/// # }
21137/// ```
21138pub struct ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveMetadataCall<'a, C>
21139where
21140 C: 'a,
21141{
21142 hub: &'a CloudHealthcare<C>,
21143 _parent: String,
21144 _dicom_web_path: String,
21145 _delegate: Option<&'a mut dyn common::Delegate>,
21146 _additional_params: HashMap<String, String>,
21147 _scopes: BTreeSet<String>,
21148}
21149
21150impl<'a, C> common::CallBuilder
21151 for ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveMetadataCall<'a, C>
21152{
21153}
21154
21155impl<'a, C> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveMetadataCall<'a, C>
21156where
21157 C: common::Connector,
21158{
21159 /// Perform the operation you have build so far.
21160 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
21161 use std::borrow::Cow;
21162 use std::io::{Read, Seek};
21163
21164 use common::{url::Params, ToParts};
21165 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21166
21167 let mut dd = common::DefaultDelegate;
21168 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21169 dlg.begin(common::MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.instances.retrieveMetadata",
21170 http_method: hyper::Method::GET });
21171
21172 for &field in ["alt", "parent", "dicomWebPath"].iter() {
21173 if self._additional_params.contains_key(field) {
21174 dlg.finished(false);
21175 return Err(common::Error::FieldClash(field));
21176 }
21177 }
21178
21179 let mut params = Params::with_capacity(4 + self._additional_params.len());
21180 params.push("parent", self._parent);
21181 params.push("dicomWebPath", self._dicom_web_path);
21182
21183 params.extend(self._additional_params.iter());
21184
21185 params.push("alt", "json");
21186 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
21187 if self._scopes.is_empty() {
21188 self._scopes
21189 .insert(Scope::CloudHealthcare.as_ref().to_string());
21190 }
21191
21192 #[allow(clippy::single_element_loop)]
21193 for &(find_this, param_name) in
21194 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
21195 {
21196 url = params.uri_replacement(url, param_name, find_this, true);
21197 }
21198 {
21199 let to_remove = ["dicomWebPath", "parent"];
21200 params.remove_params(&to_remove);
21201 }
21202
21203 let url = params.parse_with_url(&url);
21204
21205 loop {
21206 let token = match self
21207 .hub
21208 .auth
21209 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21210 .await
21211 {
21212 Ok(token) => token,
21213 Err(e) => match dlg.token(e) {
21214 Ok(token) => token,
21215 Err(e) => {
21216 dlg.finished(false);
21217 return Err(common::Error::MissingToken(e));
21218 }
21219 },
21220 };
21221 let mut req_result = {
21222 let client = &self.hub.client;
21223 dlg.pre_request();
21224 let mut req_builder = hyper::Request::builder()
21225 .method(hyper::Method::GET)
21226 .uri(url.as_str())
21227 .header(USER_AGENT, self.hub._user_agent.clone());
21228
21229 if let Some(token) = token.as_ref() {
21230 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21231 }
21232
21233 let request = req_builder
21234 .header(CONTENT_LENGTH, 0_u64)
21235 .body(common::to_body::<String>(None));
21236
21237 client.request(request.unwrap()).await
21238 };
21239
21240 match req_result {
21241 Err(err) => {
21242 if let common::Retry::After(d) = dlg.http_error(&err) {
21243 sleep(d).await;
21244 continue;
21245 }
21246 dlg.finished(false);
21247 return Err(common::Error::HttpError(err));
21248 }
21249 Ok(res) => {
21250 let (mut parts, body) = res.into_parts();
21251 let mut body = common::Body::new(body);
21252 if !parts.status.is_success() {
21253 let bytes = common::to_bytes(body).await.unwrap_or_default();
21254 let error = serde_json::from_str(&common::to_string(&bytes));
21255 let response = common::to_response(parts, bytes.into());
21256
21257 if let common::Retry::After(d) =
21258 dlg.http_failure(&response, error.as_ref().ok())
21259 {
21260 sleep(d).await;
21261 continue;
21262 }
21263
21264 dlg.finished(false);
21265
21266 return Err(match error {
21267 Ok(value) => common::Error::BadRequest(value),
21268 _ => common::Error::Failure(response),
21269 });
21270 }
21271 let response = {
21272 let bytes = common::to_bytes(body).await.unwrap_or_default();
21273 let encoded = common::to_string(&bytes);
21274 match serde_json::from_str(&encoded) {
21275 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21276 Err(error) => {
21277 dlg.response_json_decode_error(&encoded, &error);
21278 return Err(common::Error::JsonDecodeError(
21279 encoded.to_string(),
21280 error,
21281 ));
21282 }
21283 }
21284 };
21285
21286 dlg.finished(true);
21287 return Ok(response);
21288 }
21289 }
21290 }
21291 }
21292
21293 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
21294 ///
21295 /// Sets the *parent* path property to the given value.
21296 ///
21297 /// Even though the property as already been set when instantiating this call,
21298 /// we provide this method for API completeness.
21299 pub fn parent(
21300 mut self,
21301 new_value: &str,
21302 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveMetadataCall<'a, C> {
21303 self._parent = new_value.to_string();
21304 self
21305 }
21306 /// Required. The path of the RetrieveInstanceMetadata DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}/metadata`.
21307 ///
21308 /// Sets the *dicom web path* path property to the given value.
21309 ///
21310 /// Even though the property as already been set when instantiating this call,
21311 /// we provide this method for API completeness.
21312 pub fn dicom_web_path(
21313 mut self,
21314 new_value: &str,
21315 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveMetadataCall<'a, C> {
21316 self._dicom_web_path = new_value.to_string();
21317 self
21318 }
21319 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21320 /// while executing the actual API request.
21321 ///
21322 /// ````text
21323 /// It should be used to handle progress information, and to implement a certain level of resilience.
21324 /// ````
21325 ///
21326 /// Sets the *delegate* property to the given value.
21327 pub fn delegate(
21328 mut self,
21329 new_value: &'a mut dyn common::Delegate,
21330 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveMetadataCall<'a, C> {
21331 self._delegate = Some(new_value);
21332 self
21333 }
21334
21335 /// Set any additional parameter of the query string used in the request.
21336 /// It should be used to set parameters which are not yet available through their own
21337 /// setters.
21338 ///
21339 /// Please note that this method must not be used to set any of the known parameters
21340 /// which have their own setter method. If done anyway, the request will fail.
21341 ///
21342 /// # Additional Parameters
21343 ///
21344 /// * *$.xgafv* (query-string) - V1 error format.
21345 /// * *access_token* (query-string) - OAuth access token.
21346 /// * *alt* (query-string) - Data format for response.
21347 /// * *callback* (query-string) - JSONP
21348 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21349 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21350 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21351 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21352 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21353 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21354 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21355 pub fn param<T>(
21356 mut self,
21357 name: T,
21358 value: T,
21359 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveMetadataCall<'a, C>
21360 where
21361 T: AsRef<str>,
21362 {
21363 self._additional_params
21364 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21365 self
21366 }
21367
21368 /// Identifies the authorization scope for the method you are building.
21369 ///
21370 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21371 /// [`Scope::CloudHealthcare`].
21372 ///
21373 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21374 /// tokens for more than one scope.
21375 ///
21376 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21377 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21378 /// sufficient, a read-write scope will do as well.
21379 pub fn add_scope<St>(
21380 mut self,
21381 scope: St,
21382 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveMetadataCall<'a, C>
21383 where
21384 St: AsRef<str>,
21385 {
21386 self._scopes.insert(String::from(scope.as_ref()));
21387 self
21388 }
21389 /// Identifies the authorization scope(s) for the method you are building.
21390 ///
21391 /// See [`Self::add_scope()`] for details.
21392 pub fn add_scopes<I, St>(
21393 mut self,
21394 scopes: I,
21395 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveMetadataCall<'a, C>
21396 where
21397 I: IntoIterator<Item = St>,
21398 St: AsRef<str>,
21399 {
21400 self._scopes
21401 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21402 self
21403 }
21404
21405 /// Removes all scopes, and no default scope will be used either.
21406 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21407 /// for details).
21408 pub fn clear_scopes(
21409 mut self,
21410 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveMetadataCall<'a, C> {
21411 self._scopes.clear();
21412 self
21413 }
21414}
21415
21416/// RetrieveRenderedInstance returns instance associated with the given study, series, and SOP Instance UID in an acceptable Rendered Media Type. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveRenderedInstance, see [Rendered resources](https://cloud.google.com/healthcare/docs/dicom#rendered_resources) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveRenderedInstance, see [Retrieve consumer image formats](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-consumer).
21417///
21418/// A builder for the *locations.datasets.dicomStores.studies.series.instances.retrieveRendered* method supported by a *project* resource.
21419/// It is not used directly, but through a [`ProjectMethods`] instance.
21420///
21421/// # Example
21422///
21423/// Instantiate a resource method builder
21424///
21425/// ```test_harness,no_run
21426/// # extern crate hyper;
21427/// # extern crate hyper_rustls;
21428/// # extern crate google_healthcare1 as healthcare1;
21429/// # async fn dox() {
21430/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21431///
21432/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21433/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21434/// # secret,
21435/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21436/// # ).build().await.unwrap();
21437///
21438/// # let client = hyper_util::client::legacy::Client::builder(
21439/// # hyper_util::rt::TokioExecutor::new()
21440/// # )
21441/// # .build(
21442/// # hyper_rustls::HttpsConnectorBuilder::new()
21443/// # .with_native_roots()
21444/// # .unwrap()
21445/// # .https_or_http()
21446/// # .enable_http1()
21447/// # .build()
21448/// # );
21449/// # let mut hub = CloudHealthcare::new(client, auth);
21450/// // You can configure optional parameters by calling the respective setters at will, and
21451/// // execute the final call using `doit()`.
21452/// // Values shown here are possibly random and not representative !
21453/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_instances_retrieve_rendered("parent", "dicomWebPath")
21454/// .doit().await;
21455/// # }
21456/// ```
21457pub struct ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveRenderedCall<'a, C>
21458where
21459 C: 'a,
21460{
21461 hub: &'a CloudHealthcare<C>,
21462 _parent: String,
21463 _dicom_web_path: String,
21464 _delegate: Option<&'a mut dyn common::Delegate>,
21465 _additional_params: HashMap<String, String>,
21466 _scopes: BTreeSet<String>,
21467}
21468
21469impl<'a, C> common::CallBuilder
21470 for ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveRenderedCall<'a, C>
21471{
21472}
21473
21474impl<'a, C> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveRenderedCall<'a, C>
21475where
21476 C: common::Connector,
21477{
21478 /// Perform the operation you have build so far.
21479 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
21480 use std::borrow::Cow;
21481 use std::io::{Read, Seek};
21482
21483 use common::{url::Params, ToParts};
21484 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21485
21486 let mut dd = common::DefaultDelegate;
21487 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21488 dlg.begin(common::MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.instances.retrieveRendered",
21489 http_method: hyper::Method::GET });
21490
21491 for &field in ["alt", "parent", "dicomWebPath"].iter() {
21492 if self._additional_params.contains_key(field) {
21493 dlg.finished(false);
21494 return Err(common::Error::FieldClash(field));
21495 }
21496 }
21497
21498 let mut params = Params::with_capacity(4 + self._additional_params.len());
21499 params.push("parent", self._parent);
21500 params.push("dicomWebPath", self._dicom_web_path);
21501
21502 params.extend(self._additional_params.iter());
21503
21504 params.push("alt", "json");
21505 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
21506 if self._scopes.is_empty() {
21507 self._scopes
21508 .insert(Scope::CloudHealthcare.as_ref().to_string());
21509 }
21510
21511 #[allow(clippy::single_element_loop)]
21512 for &(find_this, param_name) in
21513 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
21514 {
21515 url = params.uri_replacement(url, param_name, find_this, true);
21516 }
21517 {
21518 let to_remove = ["dicomWebPath", "parent"];
21519 params.remove_params(&to_remove);
21520 }
21521
21522 let url = params.parse_with_url(&url);
21523
21524 loop {
21525 let token = match self
21526 .hub
21527 .auth
21528 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21529 .await
21530 {
21531 Ok(token) => token,
21532 Err(e) => match dlg.token(e) {
21533 Ok(token) => token,
21534 Err(e) => {
21535 dlg.finished(false);
21536 return Err(common::Error::MissingToken(e));
21537 }
21538 },
21539 };
21540 let mut req_result = {
21541 let client = &self.hub.client;
21542 dlg.pre_request();
21543 let mut req_builder = hyper::Request::builder()
21544 .method(hyper::Method::GET)
21545 .uri(url.as_str())
21546 .header(USER_AGENT, self.hub._user_agent.clone());
21547
21548 if let Some(token) = token.as_ref() {
21549 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21550 }
21551
21552 let request = req_builder
21553 .header(CONTENT_LENGTH, 0_u64)
21554 .body(common::to_body::<String>(None));
21555
21556 client.request(request.unwrap()).await
21557 };
21558
21559 match req_result {
21560 Err(err) => {
21561 if let common::Retry::After(d) = dlg.http_error(&err) {
21562 sleep(d).await;
21563 continue;
21564 }
21565 dlg.finished(false);
21566 return Err(common::Error::HttpError(err));
21567 }
21568 Ok(res) => {
21569 let (mut parts, body) = res.into_parts();
21570 let mut body = common::Body::new(body);
21571 if !parts.status.is_success() {
21572 let bytes = common::to_bytes(body).await.unwrap_or_default();
21573 let error = serde_json::from_str(&common::to_string(&bytes));
21574 let response = common::to_response(parts, bytes.into());
21575
21576 if let common::Retry::After(d) =
21577 dlg.http_failure(&response, error.as_ref().ok())
21578 {
21579 sleep(d).await;
21580 continue;
21581 }
21582
21583 dlg.finished(false);
21584
21585 return Err(match error {
21586 Ok(value) => common::Error::BadRequest(value),
21587 _ => common::Error::Failure(response),
21588 });
21589 }
21590 let response = {
21591 let bytes = common::to_bytes(body).await.unwrap_or_default();
21592 let encoded = common::to_string(&bytes);
21593 match serde_json::from_str(&encoded) {
21594 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21595 Err(error) => {
21596 dlg.response_json_decode_error(&encoded, &error);
21597 return Err(common::Error::JsonDecodeError(
21598 encoded.to_string(),
21599 error,
21600 ));
21601 }
21602 }
21603 };
21604
21605 dlg.finished(true);
21606 return Ok(response);
21607 }
21608 }
21609 }
21610 }
21611
21612 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
21613 ///
21614 /// Sets the *parent* path property to the given value.
21615 ///
21616 /// Even though the property as already been set when instantiating this call,
21617 /// we provide this method for API completeness.
21618 pub fn parent(
21619 mut self,
21620 new_value: &str,
21621 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveRenderedCall<'a, C> {
21622 self._parent = new_value.to_string();
21623 self
21624 }
21625 /// Required. The path of the RetrieveRenderedInstance DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/instances/{instance_uid}/rendered`.
21626 ///
21627 /// Sets the *dicom web path* path property to the given value.
21628 ///
21629 /// Even though the property as already been set when instantiating this call,
21630 /// we provide this method for API completeness.
21631 pub fn dicom_web_path(
21632 mut self,
21633 new_value: &str,
21634 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveRenderedCall<'a, C> {
21635 self._dicom_web_path = new_value.to_string();
21636 self
21637 }
21638 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21639 /// while executing the actual API request.
21640 ///
21641 /// ````text
21642 /// It should be used to handle progress information, and to implement a certain level of resilience.
21643 /// ````
21644 ///
21645 /// Sets the *delegate* property to the given value.
21646 pub fn delegate(
21647 mut self,
21648 new_value: &'a mut dyn common::Delegate,
21649 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveRenderedCall<'a, C> {
21650 self._delegate = Some(new_value);
21651 self
21652 }
21653
21654 /// Set any additional parameter of the query string used in the request.
21655 /// It should be used to set parameters which are not yet available through their own
21656 /// setters.
21657 ///
21658 /// Please note that this method must not be used to set any of the known parameters
21659 /// which have their own setter method. If done anyway, the request will fail.
21660 ///
21661 /// # Additional Parameters
21662 ///
21663 /// * *$.xgafv* (query-string) - V1 error format.
21664 /// * *access_token* (query-string) - OAuth access token.
21665 /// * *alt* (query-string) - Data format for response.
21666 /// * *callback* (query-string) - JSONP
21667 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21668 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21669 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21670 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21671 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21672 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21673 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21674 pub fn param<T>(
21675 mut self,
21676 name: T,
21677 value: T,
21678 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveRenderedCall<'a, C>
21679 where
21680 T: AsRef<str>,
21681 {
21682 self._additional_params
21683 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21684 self
21685 }
21686
21687 /// Identifies the authorization scope for the method you are building.
21688 ///
21689 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21690 /// [`Scope::CloudHealthcare`].
21691 ///
21692 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21693 /// tokens for more than one scope.
21694 ///
21695 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21696 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21697 /// sufficient, a read-write scope will do as well.
21698 pub fn add_scope<St>(
21699 mut self,
21700 scope: St,
21701 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveRenderedCall<'a, C>
21702 where
21703 St: AsRef<str>,
21704 {
21705 self._scopes.insert(String::from(scope.as_ref()));
21706 self
21707 }
21708 /// Identifies the authorization scope(s) for the method you are building.
21709 ///
21710 /// See [`Self::add_scope()`] for details.
21711 pub fn add_scopes<I, St>(
21712 mut self,
21713 scopes: I,
21714 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveRenderedCall<'a, C>
21715 where
21716 I: IntoIterator<Item = St>,
21717 St: AsRef<str>,
21718 {
21719 self._scopes
21720 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21721 self
21722 }
21723
21724 /// Removes all scopes, and no default scope will be used either.
21725 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21726 /// for details).
21727 pub fn clear_scopes(
21728 mut self,
21729 ) -> ProjectLocationDatasetDicomStoreStudySeriesInstanceRetrieveRenderedCall<'a, C> {
21730 self._scopes.clear();
21731 self
21732 }
21733}
21734
21735/// DeleteSeries deletes all instances within the given study and series. Delete requests are equivalent to the GET requests specified in the Retrieve transaction. The method returns an Operation which will be marked successful when the deletion is complete. Warning: Instances cannot be inserted into a series that is being deleted by an operation until the operation completes. For samples that show how to call DeleteSeries, see [Delete a study, series, or instance](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#delete-dicom).
21736///
21737/// A builder for the *locations.datasets.dicomStores.studies.series.delete* method supported by a *project* resource.
21738/// It is not used directly, but through a [`ProjectMethods`] instance.
21739///
21740/// # Example
21741///
21742/// Instantiate a resource method builder
21743///
21744/// ```test_harness,no_run
21745/// # extern crate hyper;
21746/// # extern crate hyper_rustls;
21747/// # extern crate google_healthcare1 as healthcare1;
21748/// # async fn dox() {
21749/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21750///
21751/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21752/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21753/// # secret,
21754/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21755/// # ).build().await.unwrap();
21756///
21757/// # let client = hyper_util::client::legacy::Client::builder(
21758/// # hyper_util::rt::TokioExecutor::new()
21759/// # )
21760/// # .build(
21761/// # hyper_rustls::HttpsConnectorBuilder::new()
21762/// # .with_native_roots()
21763/// # .unwrap()
21764/// # .https_or_http()
21765/// # .enable_http1()
21766/// # .build()
21767/// # );
21768/// # let mut hub = CloudHealthcare::new(client, auth);
21769/// // You can configure optional parameters by calling the respective setters at will, and
21770/// // execute the final call using `doit()`.
21771/// // Values shown here are possibly random and not representative !
21772/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_delete("parent", "dicomWebPath")
21773/// .doit().await;
21774/// # }
21775/// ```
21776pub struct ProjectLocationDatasetDicomStoreStudySeriesDeleteCall<'a, C>
21777where
21778 C: 'a,
21779{
21780 hub: &'a CloudHealthcare<C>,
21781 _parent: String,
21782 _dicom_web_path: String,
21783 _delegate: Option<&'a mut dyn common::Delegate>,
21784 _additional_params: HashMap<String, String>,
21785 _scopes: BTreeSet<String>,
21786}
21787
21788impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreStudySeriesDeleteCall<'a, C> {}
21789
21790impl<'a, C> ProjectLocationDatasetDicomStoreStudySeriesDeleteCall<'a, C>
21791where
21792 C: common::Connector,
21793{
21794 /// Perform the operation you have build so far.
21795 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21796 use std::borrow::Cow;
21797 use std::io::{Read, Seek};
21798
21799 use common::{url::Params, ToParts};
21800 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21801
21802 let mut dd = common::DefaultDelegate;
21803 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21804 dlg.begin(common::MethodInfo {
21805 id: "healthcare.projects.locations.datasets.dicomStores.studies.series.delete",
21806 http_method: hyper::Method::DELETE,
21807 });
21808
21809 for &field in ["alt", "parent", "dicomWebPath"].iter() {
21810 if self._additional_params.contains_key(field) {
21811 dlg.finished(false);
21812 return Err(common::Error::FieldClash(field));
21813 }
21814 }
21815
21816 let mut params = Params::with_capacity(4 + self._additional_params.len());
21817 params.push("parent", self._parent);
21818 params.push("dicomWebPath", self._dicom_web_path);
21819
21820 params.extend(self._additional_params.iter());
21821
21822 params.push("alt", "json");
21823 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
21824 if self._scopes.is_empty() {
21825 self._scopes
21826 .insert(Scope::CloudHealthcare.as_ref().to_string());
21827 }
21828
21829 #[allow(clippy::single_element_loop)]
21830 for &(find_this, param_name) in
21831 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
21832 {
21833 url = params.uri_replacement(url, param_name, find_this, true);
21834 }
21835 {
21836 let to_remove = ["dicomWebPath", "parent"];
21837 params.remove_params(&to_remove);
21838 }
21839
21840 let url = params.parse_with_url(&url);
21841
21842 loop {
21843 let token = match self
21844 .hub
21845 .auth
21846 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21847 .await
21848 {
21849 Ok(token) => token,
21850 Err(e) => match dlg.token(e) {
21851 Ok(token) => token,
21852 Err(e) => {
21853 dlg.finished(false);
21854 return Err(common::Error::MissingToken(e));
21855 }
21856 },
21857 };
21858 let mut req_result = {
21859 let client = &self.hub.client;
21860 dlg.pre_request();
21861 let mut req_builder = hyper::Request::builder()
21862 .method(hyper::Method::DELETE)
21863 .uri(url.as_str())
21864 .header(USER_AGENT, self.hub._user_agent.clone());
21865
21866 if let Some(token) = token.as_ref() {
21867 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21868 }
21869
21870 let request = req_builder
21871 .header(CONTENT_LENGTH, 0_u64)
21872 .body(common::to_body::<String>(None));
21873
21874 client.request(request.unwrap()).await
21875 };
21876
21877 match req_result {
21878 Err(err) => {
21879 if let common::Retry::After(d) = dlg.http_error(&err) {
21880 sleep(d).await;
21881 continue;
21882 }
21883 dlg.finished(false);
21884 return Err(common::Error::HttpError(err));
21885 }
21886 Ok(res) => {
21887 let (mut parts, body) = res.into_parts();
21888 let mut body = common::Body::new(body);
21889 if !parts.status.is_success() {
21890 let bytes = common::to_bytes(body).await.unwrap_or_default();
21891 let error = serde_json::from_str(&common::to_string(&bytes));
21892 let response = common::to_response(parts, bytes.into());
21893
21894 if let common::Retry::After(d) =
21895 dlg.http_failure(&response, error.as_ref().ok())
21896 {
21897 sleep(d).await;
21898 continue;
21899 }
21900
21901 dlg.finished(false);
21902
21903 return Err(match error {
21904 Ok(value) => common::Error::BadRequest(value),
21905 _ => common::Error::Failure(response),
21906 });
21907 }
21908 let response = {
21909 let bytes = common::to_bytes(body).await.unwrap_or_default();
21910 let encoded = common::to_string(&bytes);
21911 match serde_json::from_str(&encoded) {
21912 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21913 Err(error) => {
21914 dlg.response_json_decode_error(&encoded, &error);
21915 return Err(common::Error::JsonDecodeError(
21916 encoded.to_string(),
21917 error,
21918 ));
21919 }
21920 }
21921 };
21922
21923 dlg.finished(true);
21924 return Ok(response);
21925 }
21926 }
21927 }
21928 }
21929
21930 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
21931 ///
21932 /// Sets the *parent* path property to the given value.
21933 ///
21934 /// Even though the property as already been set when instantiating this call,
21935 /// we provide this method for API completeness.
21936 pub fn parent(
21937 mut self,
21938 new_value: &str,
21939 ) -> ProjectLocationDatasetDicomStoreStudySeriesDeleteCall<'a, C> {
21940 self._parent = new_value.to_string();
21941 self
21942 }
21943 /// Required. The path of the DeleteSeries request. For example, `studies/{study_uid}/series/{series_uid}`.
21944 ///
21945 /// Sets the *dicom web path* path property to the given value.
21946 ///
21947 /// Even though the property as already been set when instantiating this call,
21948 /// we provide this method for API completeness.
21949 pub fn dicom_web_path(
21950 mut self,
21951 new_value: &str,
21952 ) -> ProjectLocationDatasetDicomStoreStudySeriesDeleteCall<'a, C> {
21953 self._dicom_web_path = new_value.to_string();
21954 self
21955 }
21956 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21957 /// while executing the actual API request.
21958 ///
21959 /// ````text
21960 /// It should be used to handle progress information, and to implement a certain level of resilience.
21961 /// ````
21962 ///
21963 /// Sets the *delegate* property to the given value.
21964 pub fn delegate(
21965 mut self,
21966 new_value: &'a mut dyn common::Delegate,
21967 ) -> ProjectLocationDatasetDicomStoreStudySeriesDeleteCall<'a, C> {
21968 self._delegate = Some(new_value);
21969 self
21970 }
21971
21972 /// Set any additional parameter of the query string used in the request.
21973 /// It should be used to set parameters which are not yet available through their own
21974 /// setters.
21975 ///
21976 /// Please note that this method must not be used to set any of the known parameters
21977 /// which have their own setter method. If done anyway, the request will fail.
21978 ///
21979 /// # Additional Parameters
21980 ///
21981 /// * *$.xgafv* (query-string) - V1 error format.
21982 /// * *access_token* (query-string) - OAuth access token.
21983 /// * *alt* (query-string) - Data format for response.
21984 /// * *callback* (query-string) - JSONP
21985 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21986 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21987 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21988 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21989 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21990 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21991 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21992 pub fn param<T>(
21993 mut self,
21994 name: T,
21995 value: T,
21996 ) -> ProjectLocationDatasetDicomStoreStudySeriesDeleteCall<'a, C>
21997 where
21998 T: AsRef<str>,
21999 {
22000 self._additional_params
22001 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22002 self
22003 }
22004
22005 /// Identifies the authorization scope for the method you are building.
22006 ///
22007 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22008 /// [`Scope::CloudHealthcare`].
22009 ///
22010 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22011 /// tokens for more than one scope.
22012 ///
22013 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22014 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22015 /// sufficient, a read-write scope will do as well.
22016 pub fn add_scope<St>(
22017 mut self,
22018 scope: St,
22019 ) -> ProjectLocationDatasetDicomStoreStudySeriesDeleteCall<'a, C>
22020 where
22021 St: AsRef<str>,
22022 {
22023 self._scopes.insert(String::from(scope.as_ref()));
22024 self
22025 }
22026 /// Identifies the authorization scope(s) for the method you are building.
22027 ///
22028 /// See [`Self::add_scope()`] for details.
22029 pub fn add_scopes<I, St>(
22030 mut self,
22031 scopes: I,
22032 ) -> ProjectLocationDatasetDicomStoreStudySeriesDeleteCall<'a, C>
22033 where
22034 I: IntoIterator<Item = St>,
22035 St: AsRef<str>,
22036 {
22037 self._scopes
22038 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22039 self
22040 }
22041
22042 /// Removes all scopes, and no default scope will be used either.
22043 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22044 /// for details).
22045 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreStudySeriesDeleteCall<'a, C> {
22046 self._scopes.clear();
22047 self
22048 }
22049}
22050
22051/// RetrieveSeriesMetadata returns instance associated with the given study and series, presented as metadata with the bulk data removed. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveSeriesMetadata, see [Metadata resources](https://cloud.google.com/healthcare/docs/dicom#metadata_resources) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveSeriesMetadata, see [Retrieve metadata](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-metadata).
22052///
22053/// A builder for the *locations.datasets.dicomStores.studies.series.retrieveMetadata* method supported by a *project* resource.
22054/// It is not used directly, but through a [`ProjectMethods`] instance.
22055///
22056/// # Example
22057///
22058/// Instantiate a resource method builder
22059///
22060/// ```test_harness,no_run
22061/// # extern crate hyper;
22062/// # extern crate hyper_rustls;
22063/// # extern crate google_healthcare1 as healthcare1;
22064/// # async fn dox() {
22065/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22066///
22067/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22068/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22069/// # secret,
22070/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22071/// # ).build().await.unwrap();
22072///
22073/// # let client = hyper_util::client::legacy::Client::builder(
22074/// # hyper_util::rt::TokioExecutor::new()
22075/// # )
22076/// # .build(
22077/// # hyper_rustls::HttpsConnectorBuilder::new()
22078/// # .with_native_roots()
22079/// # .unwrap()
22080/// # .https_or_http()
22081/// # .enable_http1()
22082/// # .build()
22083/// # );
22084/// # let mut hub = CloudHealthcare::new(client, auth);
22085/// // You can configure optional parameters by calling the respective setters at will, and
22086/// // execute the final call using `doit()`.
22087/// // Values shown here are possibly random and not representative !
22088/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_retrieve_metadata("parent", "dicomWebPath")
22089/// .doit().await;
22090/// # }
22091/// ```
22092pub struct ProjectLocationDatasetDicomStoreStudySeriesRetrieveMetadataCall<'a, C>
22093where
22094 C: 'a,
22095{
22096 hub: &'a CloudHealthcare<C>,
22097 _parent: String,
22098 _dicom_web_path: String,
22099 _delegate: Option<&'a mut dyn common::Delegate>,
22100 _additional_params: HashMap<String, String>,
22101 _scopes: BTreeSet<String>,
22102}
22103
22104impl<'a, C> common::CallBuilder
22105 for ProjectLocationDatasetDicomStoreStudySeriesRetrieveMetadataCall<'a, C>
22106{
22107}
22108
22109impl<'a, C> ProjectLocationDatasetDicomStoreStudySeriesRetrieveMetadataCall<'a, C>
22110where
22111 C: common::Connector,
22112{
22113 /// Perform the operation you have build so far.
22114 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
22115 use std::borrow::Cow;
22116 use std::io::{Read, Seek};
22117
22118 use common::{url::Params, ToParts};
22119 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22120
22121 let mut dd = common::DefaultDelegate;
22122 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22123 dlg.begin(common::MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.retrieveMetadata",
22124 http_method: hyper::Method::GET });
22125
22126 for &field in ["alt", "parent", "dicomWebPath"].iter() {
22127 if self._additional_params.contains_key(field) {
22128 dlg.finished(false);
22129 return Err(common::Error::FieldClash(field));
22130 }
22131 }
22132
22133 let mut params = Params::with_capacity(4 + self._additional_params.len());
22134 params.push("parent", self._parent);
22135 params.push("dicomWebPath", self._dicom_web_path);
22136
22137 params.extend(self._additional_params.iter());
22138
22139 params.push("alt", "json");
22140 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
22141 if self._scopes.is_empty() {
22142 self._scopes
22143 .insert(Scope::CloudHealthcare.as_ref().to_string());
22144 }
22145
22146 #[allow(clippy::single_element_loop)]
22147 for &(find_this, param_name) in
22148 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
22149 {
22150 url = params.uri_replacement(url, param_name, find_this, true);
22151 }
22152 {
22153 let to_remove = ["dicomWebPath", "parent"];
22154 params.remove_params(&to_remove);
22155 }
22156
22157 let url = params.parse_with_url(&url);
22158
22159 loop {
22160 let token = match self
22161 .hub
22162 .auth
22163 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22164 .await
22165 {
22166 Ok(token) => token,
22167 Err(e) => match dlg.token(e) {
22168 Ok(token) => token,
22169 Err(e) => {
22170 dlg.finished(false);
22171 return Err(common::Error::MissingToken(e));
22172 }
22173 },
22174 };
22175 let mut req_result = {
22176 let client = &self.hub.client;
22177 dlg.pre_request();
22178 let mut req_builder = hyper::Request::builder()
22179 .method(hyper::Method::GET)
22180 .uri(url.as_str())
22181 .header(USER_AGENT, self.hub._user_agent.clone());
22182
22183 if let Some(token) = token.as_ref() {
22184 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22185 }
22186
22187 let request = req_builder
22188 .header(CONTENT_LENGTH, 0_u64)
22189 .body(common::to_body::<String>(None));
22190
22191 client.request(request.unwrap()).await
22192 };
22193
22194 match req_result {
22195 Err(err) => {
22196 if let common::Retry::After(d) = dlg.http_error(&err) {
22197 sleep(d).await;
22198 continue;
22199 }
22200 dlg.finished(false);
22201 return Err(common::Error::HttpError(err));
22202 }
22203 Ok(res) => {
22204 let (mut parts, body) = res.into_parts();
22205 let mut body = common::Body::new(body);
22206 if !parts.status.is_success() {
22207 let bytes = common::to_bytes(body).await.unwrap_or_default();
22208 let error = serde_json::from_str(&common::to_string(&bytes));
22209 let response = common::to_response(parts, bytes.into());
22210
22211 if let common::Retry::After(d) =
22212 dlg.http_failure(&response, error.as_ref().ok())
22213 {
22214 sleep(d).await;
22215 continue;
22216 }
22217
22218 dlg.finished(false);
22219
22220 return Err(match error {
22221 Ok(value) => common::Error::BadRequest(value),
22222 _ => common::Error::Failure(response),
22223 });
22224 }
22225 let response = {
22226 let bytes = common::to_bytes(body).await.unwrap_or_default();
22227 let encoded = common::to_string(&bytes);
22228 match serde_json::from_str(&encoded) {
22229 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22230 Err(error) => {
22231 dlg.response_json_decode_error(&encoded, &error);
22232 return Err(common::Error::JsonDecodeError(
22233 encoded.to_string(),
22234 error,
22235 ));
22236 }
22237 }
22238 };
22239
22240 dlg.finished(true);
22241 return Ok(response);
22242 }
22243 }
22244 }
22245 }
22246
22247 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
22248 ///
22249 /// Sets the *parent* path property to the given value.
22250 ///
22251 /// Even though the property as already been set when instantiating this call,
22252 /// we provide this method for API completeness.
22253 pub fn parent(
22254 mut self,
22255 new_value: &str,
22256 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveMetadataCall<'a, C> {
22257 self._parent = new_value.to_string();
22258 self
22259 }
22260 /// Required. The path of the RetrieveSeriesMetadata DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}/metadata`.
22261 ///
22262 /// Sets the *dicom web path* path property to the given value.
22263 ///
22264 /// Even though the property as already been set when instantiating this call,
22265 /// we provide this method for API completeness.
22266 pub fn dicom_web_path(
22267 mut self,
22268 new_value: &str,
22269 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveMetadataCall<'a, C> {
22270 self._dicom_web_path = new_value.to_string();
22271 self
22272 }
22273 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22274 /// while executing the actual API request.
22275 ///
22276 /// ````text
22277 /// It should be used to handle progress information, and to implement a certain level of resilience.
22278 /// ````
22279 ///
22280 /// Sets the *delegate* property to the given value.
22281 pub fn delegate(
22282 mut self,
22283 new_value: &'a mut dyn common::Delegate,
22284 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveMetadataCall<'a, C> {
22285 self._delegate = Some(new_value);
22286 self
22287 }
22288
22289 /// Set any additional parameter of the query string used in the request.
22290 /// It should be used to set parameters which are not yet available through their own
22291 /// setters.
22292 ///
22293 /// Please note that this method must not be used to set any of the known parameters
22294 /// which have their own setter method. If done anyway, the request will fail.
22295 ///
22296 /// # Additional Parameters
22297 ///
22298 /// * *$.xgafv* (query-string) - V1 error format.
22299 /// * *access_token* (query-string) - OAuth access token.
22300 /// * *alt* (query-string) - Data format for response.
22301 /// * *callback* (query-string) - JSONP
22302 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22303 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22304 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22305 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22306 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22307 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22308 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22309 pub fn param<T>(
22310 mut self,
22311 name: T,
22312 value: T,
22313 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveMetadataCall<'a, C>
22314 where
22315 T: AsRef<str>,
22316 {
22317 self._additional_params
22318 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22319 self
22320 }
22321
22322 /// Identifies the authorization scope for the method you are building.
22323 ///
22324 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22325 /// [`Scope::CloudHealthcare`].
22326 ///
22327 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22328 /// tokens for more than one scope.
22329 ///
22330 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22331 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22332 /// sufficient, a read-write scope will do as well.
22333 pub fn add_scope<St>(
22334 mut self,
22335 scope: St,
22336 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveMetadataCall<'a, C>
22337 where
22338 St: AsRef<str>,
22339 {
22340 self._scopes.insert(String::from(scope.as_ref()));
22341 self
22342 }
22343 /// Identifies the authorization scope(s) for the method you are building.
22344 ///
22345 /// See [`Self::add_scope()`] for details.
22346 pub fn add_scopes<I, St>(
22347 mut self,
22348 scopes: I,
22349 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveMetadataCall<'a, C>
22350 where
22351 I: IntoIterator<Item = St>,
22352 St: AsRef<str>,
22353 {
22354 self._scopes
22355 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22356 self
22357 }
22358
22359 /// Removes all scopes, and no default scope will be used either.
22360 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22361 /// for details).
22362 pub fn clear_scopes(
22363 mut self,
22364 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveMetadataCall<'a, C> {
22365 self._scopes.clear();
22366 self
22367 }
22368}
22369
22370/// RetrieveSeries returns all instances within the given study and series. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveSeries, see [DICOM study/series/instances](https://cloud.google.com/healthcare/docs/dicom#dicom_studyseriesinstances) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveSeries, see [Retrieve DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-dicom).
22371///
22372/// A builder for the *locations.datasets.dicomStores.studies.series.retrieveSeries* method supported by a *project* resource.
22373/// It is not used directly, but through a [`ProjectMethods`] instance.
22374///
22375/// # Example
22376///
22377/// Instantiate a resource method builder
22378///
22379/// ```test_harness,no_run
22380/// # extern crate hyper;
22381/// # extern crate hyper_rustls;
22382/// # extern crate google_healthcare1 as healthcare1;
22383/// # async fn dox() {
22384/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22385///
22386/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22387/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22388/// # secret,
22389/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22390/// # ).build().await.unwrap();
22391///
22392/// # let client = hyper_util::client::legacy::Client::builder(
22393/// # hyper_util::rt::TokioExecutor::new()
22394/// # )
22395/// # .build(
22396/// # hyper_rustls::HttpsConnectorBuilder::new()
22397/// # .with_native_roots()
22398/// # .unwrap()
22399/// # .https_or_http()
22400/// # .enable_http1()
22401/// # .build()
22402/// # );
22403/// # let mut hub = CloudHealthcare::new(client, auth);
22404/// // You can configure optional parameters by calling the respective setters at will, and
22405/// // execute the final call using `doit()`.
22406/// // Values shown here are possibly random and not representative !
22407/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_retrieve_series("parent", "dicomWebPath")
22408/// .doit().await;
22409/// # }
22410/// ```
22411pub struct ProjectLocationDatasetDicomStoreStudySeriesRetrieveSeryCall<'a, C>
22412where
22413 C: 'a,
22414{
22415 hub: &'a CloudHealthcare<C>,
22416 _parent: String,
22417 _dicom_web_path: String,
22418 _delegate: Option<&'a mut dyn common::Delegate>,
22419 _additional_params: HashMap<String, String>,
22420 _scopes: BTreeSet<String>,
22421}
22422
22423impl<'a, C> common::CallBuilder
22424 for ProjectLocationDatasetDicomStoreStudySeriesRetrieveSeryCall<'a, C>
22425{
22426}
22427
22428impl<'a, C> ProjectLocationDatasetDicomStoreStudySeriesRetrieveSeryCall<'a, C>
22429where
22430 C: common::Connector,
22431{
22432 /// Perform the operation you have build so far.
22433 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
22434 use std::borrow::Cow;
22435 use std::io::{Read, Seek};
22436
22437 use common::{url::Params, ToParts};
22438 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22439
22440 let mut dd = common::DefaultDelegate;
22441 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22442 dlg.begin(common::MethodInfo {
22443 id: "healthcare.projects.locations.datasets.dicomStores.studies.series.retrieveSeries",
22444 http_method: hyper::Method::GET,
22445 });
22446
22447 for &field in ["alt", "parent", "dicomWebPath"].iter() {
22448 if self._additional_params.contains_key(field) {
22449 dlg.finished(false);
22450 return Err(common::Error::FieldClash(field));
22451 }
22452 }
22453
22454 let mut params = Params::with_capacity(4 + self._additional_params.len());
22455 params.push("parent", self._parent);
22456 params.push("dicomWebPath", self._dicom_web_path);
22457
22458 params.extend(self._additional_params.iter());
22459
22460 params.push("alt", "json");
22461 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
22462 if self._scopes.is_empty() {
22463 self._scopes
22464 .insert(Scope::CloudHealthcare.as_ref().to_string());
22465 }
22466
22467 #[allow(clippy::single_element_loop)]
22468 for &(find_this, param_name) in
22469 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
22470 {
22471 url = params.uri_replacement(url, param_name, find_this, true);
22472 }
22473 {
22474 let to_remove = ["dicomWebPath", "parent"];
22475 params.remove_params(&to_remove);
22476 }
22477
22478 let url = params.parse_with_url(&url);
22479
22480 loop {
22481 let token = match self
22482 .hub
22483 .auth
22484 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22485 .await
22486 {
22487 Ok(token) => token,
22488 Err(e) => match dlg.token(e) {
22489 Ok(token) => token,
22490 Err(e) => {
22491 dlg.finished(false);
22492 return Err(common::Error::MissingToken(e));
22493 }
22494 },
22495 };
22496 let mut req_result = {
22497 let client = &self.hub.client;
22498 dlg.pre_request();
22499 let mut req_builder = hyper::Request::builder()
22500 .method(hyper::Method::GET)
22501 .uri(url.as_str())
22502 .header(USER_AGENT, self.hub._user_agent.clone());
22503
22504 if let Some(token) = token.as_ref() {
22505 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22506 }
22507
22508 let request = req_builder
22509 .header(CONTENT_LENGTH, 0_u64)
22510 .body(common::to_body::<String>(None));
22511
22512 client.request(request.unwrap()).await
22513 };
22514
22515 match req_result {
22516 Err(err) => {
22517 if let common::Retry::After(d) = dlg.http_error(&err) {
22518 sleep(d).await;
22519 continue;
22520 }
22521 dlg.finished(false);
22522 return Err(common::Error::HttpError(err));
22523 }
22524 Ok(res) => {
22525 let (mut parts, body) = res.into_parts();
22526 let mut body = common::Body::new(body);
22527 if !parts.status.is_success() {
22528 let bytes = common::to_bytes(body).await.unwrap_or_default();
22529 let error = serde_json::from_str(&common::to_string(&bytes));
22530 let response = common::to_response(parts, bytes.into());
22531
22532 if let common::Retry::After(d) =
22533 dlg.http_failure(&response, error.as_ref().ok())
22534 {
22535 sleep(d).await;
22536 continue;
22537 }
22538
22539 dlg.finished(false);
22540
22541 return Err(match error {
22542 Ok(value) => common::Error::BadRequest(value),
22543 _ => common::Error::Failure(response),
22544 });
22545 }
22546 let response = {
22547 let bytes = common::to_bytes(body).await.unwrap_or_default();
22548 let encoded = common::to_string(&bytes);
22549 match serde_json::from_str(&encoded) {
22550 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22551 Err(error) => {
22552 dlg.response_json_decode_error(&encoded, &error);
22553 return Err(common::Error::JsonDecodeError(
22554 encoded.to_string(),
22555 error,
22556 ));
22557 }
22558 }
22559 };
22560
22561 dlg.finished(true);
22562 return Ok(response);
22563 }
22564 }
22565 }
22566 }
22567
22568 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
22569 ///
22570 /// Sets the *parent* path property to the given value.
22571 ///
22572 /// Even though the property as already been set when instantiating this call,
22573 /// we provide this method for API completeness.
22574 pub fn parent(
22575 mut self,
22576 new_value: &str,
22577 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveSeryCall<'a, C> {
22578 self._parent = new_value.to_string();
22579 self
22580 }
22581 /// Required. The path of the RetrieveSeries DICOMweb request. For example, `studies/{study_uid}/series/{series_uid}`.
22582 ///
22583 /// Sets the *dicom web path* path property to the given value.
22584 ///
22585 /// Even though the property as already been set when instantiating this call,
22586 /// we provide this method for API completeness.
22587 pub fn dicom_web_path(
22588 mut self,
22589 new_value: &str,
22590 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveSeryCall<'a, C> {
22591 self._dicom_web_path = new_value.to_string();
22592 self
22593 }
22594 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22595 /// while executing the actual API request.
22596 ///
22597 /// ````text
22598 /// It should be used to handle progress information, and to implement a certain level of resilience.
22599 /// ````
22600 ///
22601 /// Sets the *delegate* property to the given value.
22602 pub fn delegate(
22603 mut self,
22604 new_value: &'a mut dyn common::Delegate,
22605 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveSeryCall<'a, C> {
22606 self._delegate = Some(new_value);
22607 self
22608 }
22609
22610 /// Set any additional parameter of the query string used in the request.
22611 /// It should be used to set parameters which are not yet available through their own
22612 /// setters.
22613 ///
22614 /// Please note that this method must not be used to set any of the known parameters
22615 /// which have their own setter method. If done anyway, the request will fail.
22616 ///
22617 /// # Additional Parameters
22618 ///
22619 /// * *$.xgafv* (query-string) - V1 error format.
22620 /// * *access_token* (query-string) - OAuth access token.
22621 /// * *alt* (query-string) - Data format for response.
22622 /// * *callback* (query-string) - JSONP
22623 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22624 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22625 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22626 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22627 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22628 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22629 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22630 pub fn param<T>(
22631 mut self,
22632 name: T,
22633 value: T,
22634 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveSeryCall<'a, C>
22635 where
22636 T: AsRef<str>,
22637 {
22638 self._additional_params
22639 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22640 self
22641 }
22642
22643 /// Identifies the authorization scope for the method you are building.
22644 ///
22645 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22646 /// [`Scope::CloudHealthcare`].
22647 ///
22648 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22649 /// tokens for more than one scope.
22650 ///
22651 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22652 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22653 /// sufficient, a read-write scope will do as well.
22654 pub fn add_scope<St>(
22655 mut self,
22656 scope: St,
22657 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveSeryCall<'a, C>
22658 where
22659 St: AsRef<str>,
22660 {
22661 self._scopes.insert(String::from(scope.as_ref()));
22662 self
22663 }
22664 /// Identifies the authorization scope(s) for the method you are building.
22665 ///
22666 /// See [`Self::add_scope()`] for details.
22667 pub fn add_scopes<I, St>(
22668 mut self,
22669 scopes: I,
22670 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveSeryCall<'a, C>
22671 where
22672 I: IntoIterator<Item = St>,
22673 St: AsRef<str>,
22674 {
22675 self._scopes
22676 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22677 self
22678 }
22679
22680 /// Removes all scopes, and no default scope will be used either.
22681 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22682 /// for details).
22683 pub fn clear_scopes(
22684 mut self,
22685 ) -> ProjectLocationDatasetDicomStoreStudySeriesRetrieveSeryCall<'a, C> {
22686 self._scopes.clear();
22687 self
22688 }
22689}
22690
22691/// SearchForInstances returns a list of matching instances. See [Search Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6). For details on the implementation of SearchForInstances, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForInstances, see [Search for DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#search-dicom).
22692///
22693/// A builder for the *locations.datasets.dicomStores.studies.series.searchForInstances* method supported by a *project* resource.
22694/// It is not used directly, but through a [`ProjectMethods`] instance.
22695///
22696/// # Example
22697///
22698/// Instantiate a resource method builder
22699///
22700/// ```test_harness,no_run
22701/// # extern crate hyper;
22702/// # extern crate hyper_rustls;
22703/// # extern crate google_healthcare1 as healthcare1;
22704/// # async fn dox() {
22705/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22706///
22707/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22708/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22709/// # secret,
22710/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22711/// # ).build().await.unwrap();
22712///
22713/// # let client = hyper_util::client::legacy::Client::builder(
22714/// # hyper_util::rt::TokioExecutor::new()
22715/// # )
22716/// # .build(
22717/// # hyper_rustls::HttpsConnectorBuilder::new()
22718/// # .with_native_roots()
22719/// # .unwrap()
22720/// # .https_or_http()
22721/// # .enable_http1()
22722/// # .build()
22723/// # );
22724/// # let mut hub = CloudHealthcare::new(client, auth);
22725/// // You can configure optional parameters by calling the respective setters at will, and
22726/// // execute the final call using `doit()`.
22727/// // Values shown here are possibly random and not representative !
22728/// let result = hub.projects().locations_datasets_dicom_stores_studies_series_search_for_instances("parent", "dicomWebPath")
22729/// .doit().await;
22730/// # }
22731/// ```
22732pub struct ProjectLocationDatasetDicomStoreStudySeriesSearchForInstanceCall<'a, C>
22733where
22734 C: 'a,
22735{
22736 hub: &'a CloudHealthcare<C>,
22737 _parent: String,
22738 _dicom_web_path: String,
22739 _delegate: Option<&'a mut dyn common::Delegate>,
22740 _additional_params: HashMap<String, String>,
22741 _scopes: BTreeSet<String>,
22742}
22743
22744impl<'a, C> common::CallBuilder
22745 for ProjectLocationDatasetDicomStoreStudySeriesSearchForInstanceCall<'a, C>
22746{
22747}
22748
22749impl<'a, C> ProjectLocationDatasetDicomStoreStudySeriesSearchForInstanceCall<'a, C>
22750where
22751 C: common::Connector,
22752{
22753 /// Perform the operation you have build so far.
22754 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
22755 use std::borrow::Cow;
22756 use std::io::{Read, Seek};
22757
22758 use common::{url::Params, ToParts};
22759 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22760
22761 let mut dd = common::DefaultDelegate;
22762 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22763 dlg.begin(common::MethodInfo { id: "healthcare.projects.locations.datasets.dicomStores.studies.series.searchForInstances",
22764 http_method: hyper::Method::GET });
22765
22766 for &field in ["alt", "parent", "dicomWebPath"].iter() {
22767 if self._additional_params.contains_key(field) {
22768 dlg.finished(false);
22769 return Err(common::Error::FieldClash(field));
22770 }
22771 }
22772
22773 let mut params = Params::with_capacity(4 + self._additional_params.len());
22774 params.push("parent", self._parent);
22775 params.push("dicomWebPath", self._dicom_web_path);
22776
22777 params.extend(self._additional_params.iter());
22778
22779 params.push("alt", "json");
22780 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
22781 if self._scopes.is_empty() {
22782 self._scopes
22783 .insert(Scope::CloudHealthcare.as_ref().to_string());
22784 }
22785
22786 #[allow(clippy::single_element_loop)]
22787 for &(find_this, param_name) in
22788 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
22789 {
22790 url = params.uri_replacement(url, param_name, find_this, true);
22791 }
22792 {
22793 let to_remove = ["dicomWebPath", "parent"];
22794 params.remove_params(&to_remove);
22795 }
22796
22797 let url = params.parse_with_url(&url);
22798
22799 loop {
22800 let token = match self
22801 .hub
22802 .auth
22803 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22804 .await
22805 {
22806 Ok(token) => token,
22807 Err(e) => match dlg.token(e) {
22808 Ok(token) => token,
22809 Err(e) => {
22810 dlg.finished(false);
22811 return Err(common::Error::MissingToken(e));
22812 }
22813 },
22814 };
22815 let mut req_result = {
22816 let client = &self.hub.client;
22817 dlg.pre_request();
22818 let mut req_builder = hyper::Request::builder()
22819 .method(hyper::Method::GET)
22820 .uri(url.as_str())
22821 .header(USER_AGENT, self.hub._user_agent.clone());
22822
22823 if let Some(token) = token.as_ref() {
22824 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22825 }
22826
22827 let request = req_builder
22828 .header(CONTENT_LENGTH, 0_u64)
22829 .body(common::to_body::<String>(None));
22830
22831 client.request(request.unwrap()).await
22832 };
22833
22834 match req_result {
22835 Err(err) => {
22836 if let common::Retry::After(d) = dlg.http_error(&err) {
22837 sleep(d).await;
22838 continue;
22839 }
22840 dlg.finished(false);
22841 return Err(common::Error::HttpError(err));
22842 }
22843 Ok(res) => {
22844 let (mut parts, body) = res.into_parts();
22845 let mut body = common::Body::new(body);
22846 if !parts.status.is_success() {
22847 let bytes = common::to_bytes(body).await.unwrap_or_default();
22848 let error = serde_json::from_str(&common::to_string(&bytes));
22849 let response = common::to_response(parts, bytes.into());
22850
22851 if let common::Retry::After(d) =
22852 dlg.http_failure(&response, error.as_ref().ok())
22853 {
22854 sleep(d).await;
22855 continue;
22856 }
22857
22858 dlg.finished(false);
22859
22860 return Err(match error {
22861 Ok(value) => common::Error::BadRequest(value),
22862 _ => common::Error::Failure(response),
22863 });
22864 }
22865 let response = {
22866 let bytes = common::to_bytes(body).await.unwrap_or_default();
22867 let encoded = common::to_string(&bytes);
22868 match serde_json::from_str(&encoded) {
22869 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22870 Err(error) => {
22871 dlg.response_json_decode_error(&encoded, &error);
22872 return Err(common::Error::JsonDecodeError(
22873 encoded.to_string(),
22874 error,
22875 ));
22876 }
22877 }
22878 };
22879
22880 dlg.finished(true);
22881 return Ok(response);
22882 }
22883 }
22884 }
22885 }
22886
22887 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
22888 ///
22889 /// Sets the *parent* path property to the given value.
22890 ///
22891 /// Even though the property as already been set when instantiating this call,
22892 /// we provide this method for API completeness.
22893 pub fn parent(
22894 mut self,
22895 new_value: &str,
22896 ) -> ProjectLocationDatasetDicomStoreStudySeriesSearchForInstanceCall<'a, C> {
22897 self._parent = new_value.to_string();
22898 self
22899 }
22900 /// Required. The path of the SearchForInstancesRequest DICOMweb request. For example, `instances`, `series/{series_uid}/instances`, or `studies/{study_uid}/instances`.
22901 ///
22902 /// Sets the *dicom web path* path property to the given value.
22903 ///
22904 /// Even though the property as already been set when instantiating this call,
22905 /// we provide this method for API completeness.
22906 pub fn dicom_web_path(
22907 mut self,
22908 new_value: &str,
22909 ) -> ProjectLocationDatasetDicomStoreStudySeriesSearchForInstanceCall<'a, C> {
22910 self._dicom_web_path = new_value.to_string();
22911 self
22912 }
22913 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22914 /// while executing the actual API request.
22915 ///
22916 /// ````text
22917 /// It should be used to handle progress information, and to implement a certain level of resilience.
22918 /// ````
22919 ///
22920 /// Sets the *delegate* property to the given value.
22921 pub fn delegate(
22922 mut self,
22923 new_value: &'a mut dyn common::Delegate,
22924 ) -> ProjectLocationDatasetDicomStoreStudySeriesSearchForInstanceCall<'a, C> {
22925 self._delegate = Some(new_value);
22926 self
22927 }
22928
22929 /// Set any additional parameter of the query string used in the request.
22930 /// It should be used to set parameters which are not yet available through their own
22931 /// setters.
22932 ///
22933 /// Please note that this method must not be used to set any of the known parameters
22934 /// which have their own setter method. If done anyway, the request will fail.
22935 ///
22936 /// # Additional Parameters
22937 ///
22938 /// * *$.xgafv* (query-string) - V1 error format.
22939 /// * *access_token* (query-string) - OAuth access token.
22940 /// * *alt* (query-string) - Data format for response.
22941 /// * *callback* (query-string) - JSONP
22942 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22943 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22944 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22945 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22946 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22947 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22948 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22949 pub fn param<T>(
22950 mut self,
22951 name: T,
22952 value: T,
22953 ) -> ProjectLocationDatasetDicomStoreStudySeriesSearchForInstanceCall<'a, C>
22954 where
22955 T: AsRef<str>,
22956 {
22957 self._additional_params
22958 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22959 self
22960 }
22961
22962 /// Identifies the authorization scope for the method you are building.
22963 ///
22964 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22965 /// [`Scope::CloudHealthcare`].
22966 ///
22967 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22968 /// tokens for more than one scope.
22969 ///
22970 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22971 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22972 /// sufficient, a read-write scope will do as well.
22973 pub fn add_scope<St>(
22974 mut self,
22975 scope: St,
22976 ) -> ProjectLocationDatasetDicomStoreStudySeriesSearchForInstanceCall<'a, C>
22977 where
22978 St: AsRef<str>,
22979 {
22980 self._scopes.insert(String::from(scope.as_ref()));
22981 self
22982 }
22983 /// Identifies the authorization scope(s) for the method you are building.
22984 ///
22985 /// See [`Self::add_scope()`] for details.
22986 pub fn add_scopes<I, St>(
22987 mut self,
22988 scopes: I,
22989 ) -> ProjectLocationDatasetDicomStoreStudySeriesSearchForInstanceCall<'a, C>
22990 where
22991 I: IntoIterator<Item = St>,
22992 St: AsRef<str>,
22993 {
22994 self._scopes
22995 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22996 self
22997 }
22998
22999 /// Removes all scopes, and no default scope will be used either.
23000 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23001 /// for details).
23002 pub fn clear_scopes(
23003 mut self,
23004 ) -> ProjectLocationDatasetDicomStoreStudySeriesSearchForInstanceCall<'a, C> {
23005 self._scopes.clear();
23006 self
23007 }
23008}
23009
23010/// DeleteStudy deletes all instances within the given study. Delete requests are equivalent to the GET requests specified in the Retrieve transaction. The method returns an Operation which will be marked successful when the deletion is complete. Warning: Instances cannot be inserted into a study that is being deleted by an operation until the operation completes. For samples that show how to call DeleteStudy, see [Delete a study, series, or instance](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#delete-dicom).
23011///
23012/// A builder for the *locations.datasets.dicomStores.studies.delete* method supported by a *project* resource.
23013/// It is not used directly, but through a [`ProjectMethods`] instance.
23014///
23015/// # Example
23016///
23017/// Instantiate a resource method builder
23018///
23019/// ```test_harness,no_run
23020/// # extern crate hyper;
23021/// # extern crate hyper_rustls;
23022/// # extern crate google_healthcare1 as healthcare1;
23023/// # async fn dox() {
23024/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23025///
23026/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23027/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23028/// # secret,
23029/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23030/// # ).build().await.unwrap();
23031///
23032/// # let client = hyper_util::client::legacy::Client::builder(
23033/// # hyper_util::rt::TokioExecutor::new()
23034/// # )
23035/// # .build(
23036/// # hyper_rustls::HttpsConnectorBuilder::new()
23037/// # .with_native_roots()
23038/// # .unwrap()
23039/// # .https_or_http()
23040/// # .enable_http1()
23041/// # .build()
23042/// # );
23043/// # let mut hub = CloudHealthcare::new(client, auth);
23044/// // You can configure optional parameters by calling the respective setters at will, and
23045/// // execute the final call using `doit()`.
23046/// // Values shown here are possibly random and not representative !
23047/// let result = hub.projects().locations_datasets_dicom_stores_studies_delete("parent", "dicomWebPath")
23048/// .doit().await;
23049/// # }
23050/// ```
23051pub struct ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C>
23052where
23053 C: 'a,
23054{
23055 hub: &'a CloudHealthcare<C>,
23056 _parent: String,
23057 _dicom_web_path: String,
23058 _delegate: Option<&'a mut dyn common::Delegate>,
23059 _additional_params: HashMap<String, String>,
23060 _scopes: BTreeSet<String>,
23061}
23062
23063impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C> {}
23064
23065impl<'a, C> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C>
23066where
23067 C: common::Connector,
23068{
23069 /// Perform the operation you have build so far.
23070 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
23071 use std::borrow::Cow;
23072 use std::io::{Read, Seek};
23073
23074 use common::{url::Params, ToParts};
23075 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23076
23077 let mut dd = common::DefaultDelegate;
23078 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23079 dlg.begin(common::MethodInfo {
23080 id: "healthcare.projects.locations.datasets.dicomStores.studies.delete",
23081 http_method: hyper::Method::DELETE,
23082 });
23083
23084 for &field in ["alt", "parent", "dicomWebPath"].iter() {
23085 if self._additional_params.contains_key(field) {
23086 dlg.finished(false);
23087 return Err(common::Error::FieldClash(field));
23088 }
23089 }
23090
23091 let mut params = Params::with_capacity(4 + self._additional_params.len());
23092 params.push("parent", self._parent);
23093 params.push("dicomWebPath", self._dicom_web_path);
23094
23095 params.extend(self._additional_params.iter());
23096
23097 params.push("alt", "json");
23098 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
23099 if self._scopes.is_empty() {
23100 self._scopes
23101 .insert(Scope::CloudHealthcare.as_ref().to_string());
23102 }
23103
23104 #[allow(clippy::single_element_loop)]
23105 for &(find_this, param_name) in
23106 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
23107 {
23108 url = params.uri_replacement(url, param_name, find_this, true);
23109 }
23110 {
23111 let to_remove = ["dicomWebPath", "parent"];
23112 params.remove_params(&to_remove);
23113 }
23114
23115 let url = params.parse_with_url(&url);
23116
23117 loop {
23118 let token = match self
23119 .hub
23120 .auth
23121 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23122 .await
23123 {
23124 Ok(token) => token,
23125 Err(e) => match dlg.token(e) {
23126 Ok(token) => token,
23127 Err(e) => {
23128 dlg.finished(false);
23129 return Err(common::Error::MissingToken(e));
23130 }
23131 },
23132 };
23133 let mut req_result = {
23134 let client = &self.hub.client;
23135 dlg.pre_request();
23136 let mut req_builder = hyper::Request::builder()
23137 .method(hyper::Method::DELETE)
23138 .uri(url.as_str())
23139 .header(USER_AGENT, self.hub._user_agent.clone());
23140
23141 if let Some(token) = token.as_ref() {
23142 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23143 }
23144
23145 let request = req_builder
23146 .header(CONTENT_LENGTH, 0_u64)
23147 .body(common::to_body::<String>(None));
23148
23149 client.request(request.unwrap()).await
23150 };
23151
23152 match req_result {
23153 Err(err) => {
23154 if let common::Retry::After(d) = dlg.http_error(&err) {
23155 sleep(d).await;
23156 continue;
23157 }
23158 dlg.finished(false);
23159 return Err(common::Error::HttpError(err));
23160 }
23161 Ok(res) => {
23162 let (mut parts, body) = res.into_parts();
23163 let mut body = common::Body::new(body);
23164 if !parts.status.is_success() {
23165 let bytes = common::to_bytes(body).await.unwrap_or_default();
23166 let error = serde_json::from_str(&common::to_string(&bytes));
23167 let response = common::to_response(parts, bytes.into());
23168
23169 if let common::Retry::After(d) =
23170 dlg.http_failure(&response, error.as_ref().ok())
23171 {
23172 sleep(d).await;
23173 continue;
23174 }
23175
23176 dlg.finished(false);
23177
23178 return Err(match error {
23179 Ok(value) => common::Error::BadRequest(value),
23180 _ => common::Error::Failure(response),
23181 });
23182 }
23183 let response = {
23184 let bytes = common::to_bytes(body).await.unwrap_or_default();
23185 let encoded = common::to_string(&bytes);
23186 match serde_json::from_str(&encoded) {
23187 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23188 Err(error) => {
23189 dlg.response_json_decode_error(&encoded, &error);
23190 return Err(common::Error::JsonDecodeError(
23191 encoded.to_string(),
23192 error,
23193 ));
23194 }
23195 }
23196 };
23197
23198 dlg.finished(true);
23199 return Ok(response);
23200 }
23201 }
23202 }
23203 }
23204
23205 ///
23206 /// Sets the *parent* path property to the given value.
23207 ///
23208 /// Even though the property as already been set when instantiating this call,
23209 /// we provide this method for API completeness.
23210 pub fn parent(
23211 mut self,
23212 new_value: &str,
23213 ) -> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C> {
23214 self._parent = new_value.to_string();
23215 self
23216 }
23217 /// Required. The path of the DeleteStudy request. For example, `studies/{study_uid}`.
23218 ///
23219 /// Sets the *dicom web path* path property to the given value.
23220 ///
23221 /// Even though the property as already been set when instantiating this call,
23222 /// we provide this method for API completeness.
23223 pub fn dicom_web_path(
23224 mut self,
23225 new_value: &str,
23226 ) -> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C> {
23227 self._dicom_web_path = new_value.to_string();
23228 self
23229 }
23230 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23231 /// while executing the actual API request.
23232 ///
23233 /// ````text
23234 /// It should be used to handle progress information, and to implement a certain level of resilience.
23235 /// ````
23236 ///
23237 /// Sets the *delegate* property to the given value.
23238 pub fn delegate(
23239 mut self,
23240 new_value: &'a mut dyn common::Delegate,
23241 ) -> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C> {
23242 self._delegate = Some(new_value);
23243 self
23244 }
23245
23246 /// Set any additional parameter of the query string used in the request.
23247 /// It should be used to set parameters which are not yet available through their own
23248 /// setters.
23249 ///
23250 /// Please note that this method must not be used to set any of the known parameters
23251 /// which have their own setter method. If done anyway, the request will fail.
23252 ///
23253 /// # Additional Parameters
23254 ///
23255 /// * *$.xgafv* (query-string) - V1 error format.
23256 /// * *access_token* (query-string) - OAuth access token.
23257 /// * *alt* (query-string) - Data format for response.
23258 /// * *callback* (query-string) - JSONP
23259 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23260 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23261 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23262 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23263 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23264 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23265 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23266 pub fn param<T>(
23267 mut self,
23268 name: T,
23269 value: T,
23270 ) -> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C>
23271 where
23272 T: AsRef<str>,
23273 {
23274 self._additional_params
23275 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23276 self
23277 }
23278
23279 /// Identifies the authorization scope for the method you are building.
23280 ///
23281 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23282 /// [`Scope::CloudHealthcare`].
23283 ///
23284 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23285 /// tokens for more than one scope.
23286 ///
23287 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23288 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23289 /// sufficient, a read-write scope will do as well.
23290 pub fn add_scope<St>(
23291 mut self,
23292 scope: St,
23293 ) -> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C>
23294 where
23295 St: AsRef<str>,
23296 {
23297 self._scopes.insert(String::from(scope.as_ref()));
23298 self
23299 }
23300 /// Identifies the authorization scope(s) for the method you are building.
23301 ///
23302 /// See [`Self::add_scope()`] for details.
23303 pub fn add_scopes<I, St>(
23304 mut self,
23305 scopes: I,
23306 ) -> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C>
23307 where
23308 I: IntoIterator<Item = St>,
23309 St: AsRef<str>,
23310 {
23311 self._scopes
23312 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23313 self
23314 }
23315
23316 /// Removes all scopes, and no default scope will be used either.
23317 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23318 /// for details).
23319 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreStudyDeleteCall<'a, C> {
23320 self._scopes.clear();
23321 self
23322 }
23323}
23324
23325/// RetrieveStudyMetadata returns instance associated with the given study presented as metadata with the bulk data removed. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveStudyMetadata, see [Metadata resources](https://cloud.google.com/healthcare/docs/dicom#metadata_resources) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveStudyMetadata, see [Retrieve metadata](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-metadata).
23326///
23327/// A builder for the *locations.datasets.dicomStores.studies.retrieveMetadata* method supported by a *project* resource.
23328/// It is not used directly, but through a [`ProjectMethods`] instance.
23329///
23330/// # Example
23331///
23332/// Instantiate a resource method builder
23333///
23334/// ```test_harness,no_run
23335/// # extern crate hyper;
23336/// # extern crate hyper_rustls;
23337/// # extern crate google_healthcare1 as healthcare1;
23338/// # async fn dox() {
23339/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23340///
23341/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23342/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23343/// # secret,
23344/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23345/// # ).build().await.unwrap();
23346///
23347/// # let client = hyper_util::client::legacy::Client::builder(
23348/// # hyper_util::rt::TokioExecutor::new()
23349/// # )
23350/// # .build(
23351/// # hyper_rustls::HttpsConnectorBuilder::new()
23352/// # .with_native_roots()
23353/// # .unwrap()
23354/// # .https_or_http()
23355/// # .enable_http1()
23356/// # .build()
23357/// # );
23358/// # let mut hub = CloudHealthcare::new(client, auth);
23359/// // You can configure optional parameters by calling the respective setters at will, and
23360/// // execute the final call using `doit()`.
23361/// // Values shown here are possibly random and not representative !
23362/// let result = hub.projects().locations_datasets_dicom_stores_studies_retrieve_metadata("parent", "dicomWebPath")
23363/// .doit().await;
23364/// # }
23365/// ```
23366pub struct ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C>
23367where
23368 C: 'a,
23369{
23370 hub: &'a CloudHealthcare<C>,
23371 _parent: String,
23372 _dicom_web_path: String,
23373 _delegate: Option<&'a mut dyn common::Delegate>,
23374 _additional_params: HashMap<String, String>,
23375 _scopes: BTreeSet<String>,
23376}
23377
23378impl<'a, C> common::CallBuilder
23379 for ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C>
23380{
23381}
23382
23383impl<'a, C> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C>
23384where
23385 C: common::Connector,
23386{
23387 /// Perform the operation you have build so far.
23388 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
23389 use std::borrow::Cow;
23390 use std::io::{Read, Seek};
23391
23392 use common::{url::Params, ToParts};
23393 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23394
23395 let mut dd = common::DefaultDelegate;
23396 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23397 dlg.begin(common::MethodInfo {
23398 id: "healthcare.projects.locations.datasets.dicomStores.studies.retrieveMetadata",
23399 http_method: hyper::Method::GET,
23400 });
23401
23402 for &field in ["alt", "parent", "dicomWebPath"].iter() {
23403 if self._additional_params.contains_key(field) {
23404 dlg.finished(false);
23405 return Err(common::Error::FieldClash(field));
23406 }
23407 }
23408
23409 let mut params = Params::with_capacity(4 + self._additional_params.len());
23410 params.push("parent", self._parent);
23411 params.push("dicomWebPath", self._dicom_web_path);
23412
23413 params.extend(self._additional_params.iter());
23414
23415 params.push("alt", "json");
23416 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
23417 if self._scopes.is_empty() {
23418 self._scopes
23419 .insert(Scope::CloudHealthcare.as_ref().to_string());
23420 }
23421
23422 #[allow(clippy::single_element_loop)]
23423 for &(find_this, param_name) in
23424 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
23425 {
23426 url = params.uri_replacement(url, param_name, find_this, true);
23427 }
23428 {
23429 let to_remove = ["dicomWebPath", "parent"];
23430 params.remove_params(&to_remove);
23431 }
23432
23433 let url = params.parse_with_url(&url);
23434
23435 loop {
23436 let token = match self
23437 .hub
23438 .auth
23439 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23440 .await
23441 {
23442 Ok(token) => token,
23443 Err(e) => match dlg.token(e) {
23444 Ok(token) => token,
23445 Err(e) => {
23446 dlg.finished(false);
23447 return Err(common::Error::MissingToken(e));
23448 }
23449 },
23450 };
23451 let mut req_result = {
23452 let client = &self.hub.client;
23453 dlg.pre_request();
23454 let mut req_builder = hyper::Request::builder()
23455 .method(hyper::Method::GET)
23456 .uri(url.as_str())
23457 .header(USER_AGENT, self.hub._user_agent.clone());
23458
23459 if let Some(token) = token.as_ref() {
23460 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23461 }
23462
23463 let request = req_builder
23464 .header(CONTENT_LENGTH, 0_u64)
23465 .body(common::to_body::<String>(None));
23466
23467 client.request(request.unwrap()).await
23468 };
23469
23470 match req_result {
23471 Err(err) => {
23472 if let common::Retry::After(d) = dlg.http_error(&err) {
23473 sleep(d).await;
23474 continue;
23475 }
23476 dlg.finished(false);
23477 return Err(common::Error::HttpError(err));
23478 }
23479 Ok(res) => {
23480 let (mut parts, body) = res.into_parts();
23481 let mut body = common::Body::new(body);
23482 if !parts.status.is_success() {
23483 let bytes = common::to_bytes(body).await.unwrap_or_default();
23484 let error = serde_json::from_str(&common::to_string(&bytes));
23485 let response = common::to_response(parts, bytes.into());
23486
23487 if let common::Retry::After(d) =
23488 dlg.http_failure(&response, error.as_ref().ok())
23489 {
23490 sleep(d).await;
23491 continue;
23492 }
23493
23494 dlg.finished(false);
23495
23496 return Err(match error {
23497 Ok(value) => common::Error::BadRequest(value),
23498 _ => common::Error::Failure(response),
23499 });
23500 }
23501 let response = {
23502 let bytes = common::to_bytes(body).await.unwrap_or_default();
23503 let encoded = common::to_string(&bytes);
23504 match serde_json::from_str(&encoded) {
23505 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23506 Err(error) => {
23507 dlg.response_json_decode_error(&encoded, &error);
23508 return Err(common::Error::JsonDecodeError(
23509 encoded.to_string(),
23510 error,
23511 ));
23512 }
23513 }
23514 };
23515
23516 dlg.finished(true);
23517 return Ok(response);
23518 }
23519 }
23520 }
23521 }
23522
23523 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
23524 ///
23525 /// Sets the *parent* path property to the given value.
23526 ///
23527 /// Even though the property as already been set when instantiating this call,
23528 /// we provide this method for API completeness.
23529 pub fn parent(
23530 mut self,
23531 new_value: &str,
23532 ) -> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C> {
23533 self._parent = new_value.to_string();
23534 self
23535 }
23536 /// Required. The path of the RetrieveStudyMetadata DICOMweb request. For example, `studies/{study_uid}/metadata`.
23537 ///
23538 /// Sets the *dicom web path* path property to the given value.
23539 ///
23540 /// Even though the property as already been set when instantiating this call,
23541 /// we provide this method for API completeness.
23542 pub fn dicom_web_path(
23543 mut self,
23544 new_value: &str,
23545 ) -> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C> {
23546 self._dicom_web_path = new_value.to_string();
23547 self
23548 }
23549 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23550 /// while executing the actual API request.
23551 ///
23552 /// ````text
23553 /// It should be used to handle progress information, and to implement a certain level of resilience.
23554 /// ````
23555 ///
23556 /// Sets the *delegate* property to the given value.
23557 pub fn delegate(
23558 mut self,
23559 new_value: &'a mut dyn common::Delegate,
23560 ) -> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C> {
23561 self._delegate = Some(new_value);
23562 self
23563 }
23564
23565 /// Set any additional parameter of the query string used in the request.
23566 /// It should be used to set parameters which are not yet available through their own
23567 /// setters.
23568 ///
23569 /// Please note that this method must not be used to set any of the known parameters
23570 /// which have their own setter method. If done anyway, the request will fail.
23571 ///
23572 /// # Additional Parameters
23573 ///
23574 /// * *$.xgafv* (query-string) - V1 error format.
23575 /// * *access_token* (query-string) - OAuth access token.
23576 /// * *alt* (query-string) - Data format for response.
23577 /// * *callback* (query-string) - JSONP
23578 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23579 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23580 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23581 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23582 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23583 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23584 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23585 pub fn param<T>(
23586 mut self,
23587 name: T,
23588 value: T,
23589 ) -> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C>
23590 where
23591 T: AsRef<str>,
23592 {
23593 self._additional_params
23594 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23595 self
23596 }
23597
23598 /// Identifies the authorization scope for the method you are building.
23599 ///
23600 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23601 /// [`Scope::CloudHealthcare`].
23602 ///
23603 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23604 /// tokens for more than one scope.
23605 ///
23606 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23607 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23608 /// sufficient, a read-write scope will do as well.
23609 pub fn add_scope<St>(
23610 mut self,
23611 scope: St,
23612 ) -> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C>
23613 where
23614 St: AsRef<str>,
23615 {
23616 self._scopes.insert(String::from(scope.as_ref()));
23617 self
23618 }
23619 /// Identifies the authorization scope(s) for the method you are building.
23620 ///
23621 /// See [`Self::add_scope()`] for details.
23622 pub fn add_scopes<I, St>(
23623 mut self,
23624 scopes: I,
23625 ) -> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C>
23626 where
23627 I: IntoIterator<Item = St>,
23628 St: AsRef<str>,
23629 {
23630 self._scopes
23631 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23632 self
23633 }
23634
23635 /// Removes all scopes, and no default scope will be used either.
23636 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23637 /// for details).
23638 pub fn clear_scopes(
23639 mut self,
23640 ) -> ProjectLocationDatasetDicomStoreStudyRetrieveMetadataCall<'a, C> {
23641 self._scopes.clear();
23642 self
23643 }
23644}
23645
23646/// RetrieveStudy returns all instances within the given study. See [RetrieveTransaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.4). For details on the implementation of RetrieveStudy, see [DICOM study/series/instances](https://cloud.google.com/healthcare/docs/dicom#dicom_studyseriesinstances) in the Cloud Healthcare API conformance statement. For samples that show how to call RetrieveStudy, see [Retrieve DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#retrieve-dicom).
23647///
23648/// A builder for the *locations.datasets.dicomStores.studies.retrieveStudy* method supported by a *project* resource.
23649/// It is not used directly, but through a [`ProjectMethods`] instance.
23650///
23651/// # Example
23652///
23653/// Instantiate a resource method builder
23654///
23655/// ```test_harness,no_run
23656/// # extern crate hyper;
23657/// # extern crate hyper_rustls;
23658/// # extern crate google_healthcare1 as healthcare1;
23659/// # async fn dox() {
23660/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23661///
23662/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23663/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23664/// # secret,
23665/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23666/// # ).build().await.unwrap();
23667///
23668/// # let client = hyper_util::client::legacy::Client::builder(
23669/// # hyper_util::rt::TokioExecutor::new()
23670/// # )
23671/// # .build(
23672/// # hyper_rustls::HttpsConnectorBuilder::new()
23673/// # .with_native_roots()
23674/// # .unwrap()
23675/// # .https_or_http()
23676/// # .enable_http1()
23677/// # .build()
23678/// # );
23679/// # let mut hub = CloudHealthcare::new(client, auth);
23680/// // You can configure optional parameters by calling the respective setters at will, and
23681/// // execute the final call using `doit()`.
23682/// // Values shown here are possibly random and not representative !
23683/// let result = hub.projects().locations_datasets_dicom_stores_studies_retrieve_study("parent", "dicomWebPath")
23684/// .doit().await;
23685/// # }
23686/// ```
23687pub struct ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C>
23688where
23689 C: 'a,
23690{
23691 hub: &'a CloudHealthcare<C>,
23692 _parent: String,
23693 _dicom_web_path: String,
23694 _delegate: Option<&'a mut dyn common::Delegate>,
23695 _additional_params: HashMap<String, String>,
23696 _scopes: BTreeSet<String>,
23697}
23698
23699impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C> {}
23700
23701impl<'a, C> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C>
23702where
23703 C: common::Connector,
23704{
23705 /// Perform the operation you have build so far.
23706 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
23707 use std::borrow::Cow;
23708 use std::io::{Read, Seek};
23709
23710 use common::{url::Params, ToParts};
23711 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23712
23713 let mut dd = common::DefaultDelegate;
23714 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23715 dlg.begin(common::MethodInfo {
23716 id: "healthcare.projects.locations.datasets.dicomStores.studies.retrieveStudy",
23717 http_method: hyper::Method::GET,
23718 });
23719
23720 for &field in ["alt", "parent", "dicomWebPath"].iter() {
23721 if self._additional_params.contains_key(field) {
23722 dlg.finished(false);
23723 return Err(common::Error::FieldClash(field));
23724 }
23725 }
23726
23727 let mut params = Params::with_capacity(4 + self._additional_params.len());
23728 params.push("parent", self._parent);
23729 params.push("dicomWebPath", self._dicom_web_path);
23730
23731 params.extend(self._additional_params.iter());
23732
23733 params.push("alt", "json");
23734 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
23735 if self._scopes.is_empty() {
23736 self._scopes
23737 .insert(Scope::CloudHealthcare.as_ref().to_string());
23738 }
23739
23740 #[allow(clippy::single_element_loop)]
23741 for &(find_this, param_name) in
23742 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
23743 {
23744 url = params.uri_replacement(url, param_name, find_this, true);
23745 }
23746 {
23747 let to_remove = ["dicomWebPath", "parent"];
23748 params.remove_params(&to_remove);
23749 }
23750
23751 let url = params.parse_with_url(&url);
23752
23753 loop {
23754 let token = match self
23755 .hub
23756 .auth
23757 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23758 .await
23759 {
23760 Ok(token) => token,
23761 Err(e) => match dlg.token(e) {
23762 Ok(token) => token,
23763 Err(e) => {
23764 dlg.finished(false);
23765 return Err(common::Error::MissingToken(e));
23766 }
23767 },
23768 };
23769 let mut req_result = {
23770 let client = &self.hub.client;
23771 dlg.pre_request();
23772 let mut req_builder = hyper::Request::builder()
23773 .method(hyper::Method::GET)
23774 .uri(url.as_str())
23775 .header(USER_AGENT, self.hub._user_agent.clone());
23776
23777 if let Some(token) = token.as_ref() {
23778 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23779 }
23780
23781 let request = req_builder
23782 .header(CONTENT_LENGTH, 0_u64)
23783 .body(common::to_body::<String>(None));
23784
23785 client.request(request.unwrap()).await
23786 };
23787
23788 match req_result {
23789 Err(err) => {
23790 if let common::Retry::After(d) = dlg.http_error(&err) {
23791 sleep(d).await;
23792 continue;
23793 }
23794 dlg.finished(false);
23795 return Err(common::Error::HttpError(err));
23796 }
23797 Ok(res) => {
23798 let (mut parts, body) = res.into_parts();
23799 let mut body = common::Body::new(body);
23800 if !parts.status.is_success() {
23801 let bytes = common::to_bytes(body).await.unwrap_or_default();
23802 let error = serde_json::from_str(&common::to_string(&bytes));
23803 let response = common::to_response(parts, bytes.into());
23804
23805 if let common::Retry::After(d) =
23806 dlg.http_failure(&response, error.as_ref().ok())
23807 {
23808 sleep(d).await;
23809 continue;
23810 }
23811
23812 dlg.finished(false);
23813
23814 return Err(match error {
23815 Ok(value) => common::Error::BadRequest(value),
23816 _ => common::Error::Failure(response),
23817 });
23818 }
23819 let response = {
23820 let bytes = common::to_bytes(body).await.unwrap_or_default();
23821 let encoded = common::to_string(&bytes);
23822 match serde_json::from_str(&encoded) {
23823 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23824 Err(error) => {
23825 dlg.response_json_decode_error(&encoded, &error);
23826 return Err(common::Error::JsonDecodeError(
23827 encoded.to_string(),
23828 error,
23829 ));
23830 }
23831 }
23832 };
23833
23834 dlg.finished(true);
23835 return Ok(response);
23836 }
23837 }
23838 }
23839 }
23840
23841 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
23842 ///
23843 /// Sets the *parent* path property to the given value.
23844 ///
23845 /// Even though the property as already been set when instantiating this call,
23846 /// we provide this method for API completeness.
23847 pub fn parent(
23848 mut self,
23849 new_value: &str,
23850 ) -> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C> {
23851 self._parent = new_value.to_string();
23852 self
23853 }
23854 /// Required. The path of the RetrieveStudy DICOMweb request. For example, `studies/{study_uid}`.
23855 ///
23856 /// Sets the *dicom web path* path property to the given value.
23857 ///
23858 /// Even though the property as already been set when instantiating this call,
23859 /// we provide this method for API completeness.
23860 pub fn dicom_web_path(
23861 mut self,
23862 new_value: &str,
23863 ) -> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C> {
23864 self._dicom_web_path = new_value.to_string();
23865 self
23866 }
23867 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23868 /// while executing the actual API request.
23869 ///
23870 /// ````text
23871 /// It should be used to handle progress information, and to implement a certain level of resilience.
23872 /// ````
23873 ///
23874 /// Sets the *delegate* property to the given value.
23875 pub fn delegate(
23876 mut self,
23877 new_value: &'a mut dyn common::Delegate,
23878 ) -> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C> {
23879 self._delegate = Some(new_value);
23880 self
23881 }
23882
23883 /// Set any additional parameter of the query string used in the request.
23884 /// It should be used to set parameters which are not yet available through their own
23885 /// setters.
23886 ///
23887 /// Please note that this method must not be used to set any of the known parameters
23888 /// which have their own setter method. If done anyway, the request will fail.
23889 ///
23890 /// # Additional Parameters
23891 ///
23892 /// * *$.xgafv* (query-string) - V1 error format.
23893 /// * *access_token* (query-string) - OAuth access token.
23894 /// * *alt* (query-string) - Data format for response.
23895 /// * *callback* (query-string) - JSONP
23896 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23897 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
23898 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23899 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23900 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
23901 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23902 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23903 pub fn param<T>(
23904 mut self,
23905 name: T,
23906 value: T,
23907 ) -> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C>
23908 where
23909 T: AsRef<str>,
23910 {
23911 self._additional_params
23912 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23913 self
23914 }
23915
23916 /// Identifies the authorization scope for the method you are building.
23917 ///
23918 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23919 /// [`Scope::CloudHealthcare`].
23920 ///
23921 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23922 /// tokens for more than one scope.
23923 ///
23924 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23925 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23926 /// sufficient, a read-write scope will do as well.
23927 pub fn add_scope<St>(
23928 mut self,
23929 scope: St,
23930 ) -> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C>
23931 where
23932 St: AsRef<str>,
23933 {
23934 self._scopes.insert(String::from(scope.as_ref()));
23935 self
23936 }
23937 /// Identifies the authorization scope(s) for the method you are building.
23938 ///
23939 /// See [`Self::add_scope()`] for details.
23940 pub fn add_scopes<I, St>(
23941 mut self,
23942 scopes: I,
23943 ) -> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C>
23944 where
23945 I: IntoIterator<Item = St>,
23946 St: AsRef<str>,
23947 {
23948 self._scopes
23949 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23950 self
23951 }
23952
23953 /// Removes all scopes, and no default scope will be used either.
23954 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23955 /// for details).
23956 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreStudyRetrieveStudyCall<'a, C> {
23957 self._scopes.clear();
23958 self
23959 }
23960}
23961
23962/// SearchForInstances returns a list of matching instances. See [Search Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6). For details on the implementation of SearchForInstances, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForInstances, see [Search for DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#search-dicom).
23963///
23964/// A builder for the *locations.datasets.dicomStores.studies.searchForInstances* method supported by a *project* resource.
23965/// It is not used directly, but through a [`ProjectMethods`] instance.
23966///
23967/// # Example
23968///
23969/// Instantiate a resource method builder
23970///
23971/// ```test_harness,no_run
23972/// # extern crate hyper;
23973/// # extern crate hyper_rustls;
23974/// # extern crate google_healthcare1 as healthcare1;
23975/// # async fn dox() {
23976/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23977///
23978/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23979/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23980/// # secret,
23981/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23982/// # ).build().await.unwrap();
23983///
23984/// # let client = hyper_util::client::legacy::Client::builder(
23985/// # hyper_util::rt::TokioExecutor::new()
23986/// # )
23987/// # .build(
23988/// # hyper_rustls::HttpsConnectorBuilder::new()
23989/// # .with_native_roots()
23990/// # .unwrap()
23991/// # .https_or_http()
23992/// # .enable_http1()
23993/// # .build()
23994/// # );
23995/// # let mut hub = CloudHealthcare::new(client, auth);
23996/// // You can configure optional parameters by calling the respective setters at will, and
23997/// // execute the final call using `doit()`.
23998/// // Values shown here are possibly random and not representative !
23999/// let result = hub.projects().locations_datasets_dicom_stores_studies_search_for_instances("parent", "dicomWebPath")
24000/// .doit().await;
24001/// # }
24002/// ```
24003pub struct ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C>
24004where
24005 C: 'a,
24006{
24007 hub: &'a CloudHealthcare<C>,
24008 _parent: String,
24009 _dicom_web_path: String,
24010 _delegate: Option<&'a mut dyn common::Delegate>,
24011 _additional_params: HashMap<String, String>,
24012 _scopes: BTreeSet<String>,
24013}
24014
24015impl<'a, C> common::CallBuilder
24016 for ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C>
24017{
24018}
24019
24020impl<'a, C> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C>
24021where
24022 C: common::Connector,
24023{
24024 /// Perform the operation you have build so far.
24025 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
24026 use std::borrow::Cow;
24027 use std::io::{Read, Seek};
24028
24029 use common::{url::Params, ToParts};
24030 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24031
24032 let mut dd = common::DefaultDelegate;
24033 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24034 dlg.begin(common::MethodInfo {
24035 id: "healthcare.projects.locations.datasets.dicomStores.studies.searchForInstances",
24036 http_method: hyper::Method::GET,
24037 });
24038
24039 for &field in ["alt", "parent", "dicomWebPath"].iter() {
24040 if self._additional_params.contains_key(field) {
24041 dlg.finished(false);
24042 return Err(common::Error::FieldClash(field));
24043 }
24044 }
24045
24046 let mut params = Params::with_capacity(4 + self._additional_params.len());
24047 params.push("parent", self._parent);
24048 params.push("dicomWebPath", self._dicom_web_path);
24049
24050 params.extend(self._additional_params.iter());
24051
24052 params.push("alt", "json");
24053 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
24054 if self._scopes.is_empty() {
24055 self._scopes
24056 .insert(Scope::CloudHealthcare.as_ref().to_string());
24057 }
24058
24059 #[allow(clippy::single_element_loop)]
24060 for &(find_this, param_name) in
24061 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
24062 {
24063 url = params.uri_replacement(url, param_name, find_this, true);
24064 }
24065 {
24066 let to_remove = ["dicomWebPath", "parent"];
24067 params.remove_params(&to_remove);
24068 }
24069
24070 let url = params.parse_with_url(&url);
24071
24072 loop {
24073 let token = match self
24074 .hub
24075 .auth
24076 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24077 .await
24078 {
24079 Ok(token) => token,
24080 Err(e) => match dlg.token(e) {
24081 Ok(token) => token,
24082 Err(e) => {
24083 dlg.finished(false);
24084 return Err(common::Error::MissingToken(e));
24085 }
24086 },
24087 };
24088 let mut req_result = {
24089 let client = &self.hub.client;
24090 dlg.pre_request();
24091 let mut req_builder = hyper::Request::builder()
24092 .method(hyper::Method::GET)
24093 .uri(url.as_str())
24094 .header(USER_AGENT, self.hub._user_agent.clone());
24095
24096 if let Some(token) = token.as_ref() {
24097 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24098 }
24099
24100 let request = req_builder
24101 .header(CONTENT_LENGTH, 0_u64)
24102 .body(common::to_body::<String>(None));
24103
24104 client.request(request.unwrap()).await
24105 };
24106
24107 match req_result {
24108 Err(err) => {
24109 if let common::Retry::After(d) = dlg.http_error(&err) {
24110 sleep(d).await;
24111 continue;
24112 }
24113 dlg.finished(false);
24114 return Err(common::Error::HttpError(err));
24115 }
24116 Ok(res) => {
24117 let (mut parts, body) = res.into_parts();
24118 let mut body = common::Body::new(body);
24119 if !parts.status.is_success() {
24120 let bytes = common::to_bytes(body).await.unwrap_or_default();
24121 let error = serde_json::from_str(&common::to_string(&bytes));
24122 let response = common::to_response(parts, bytes.into());
24123
24124 if let common::Retry::After(d) =
24125 dlg.http_failure(&response, error.as_ref().ok())
24126 {
24127 sleep(d).await;
24128 continue;
24129 }
24130
24131 dlg.finished(false);
24132
24133 return Err(match error {
24134 Ok(value) => common::Error::BadRequest(value),
24135 _ => common::Error::Failure(response),
24136 });
24137 }
24138 let response = {
24139 let bytes = common::to_bytes(body).await.unwrap_or_default();
24140 let encoded = common::to_string(&bytes);
24141 match serde_json::from_str(&encoded) {
24142 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24143 Err(error) => {
24144 dlg.response_json_decode_error(&encoded, &error);
24145 return Err(common::Error::JsonDecodeError(
24146 encoded.to_string(),
24147 error,
24148 ));
24149 }
24150 }
24151 };
24152
24153 dlg.finished(true);
24154 return Ok(response);
24155 }
24156 }
24157 }
24158 }
24159
24160 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
24161 ///
24162 /// Sets the *parent* path property to the given value.
24163 ///
24164 /// Even though the property as already been set when instantiating this call,
24165 /// we provide this method for API completeness.
24166 pub fn parent(
24167 mut self,
24168 new_value: &str,
24169 ) -> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C> {
24170 self._parent = new_value.to_string();
24171 self
24172 }
24173 /// Required. The path of the SearchForInstancesRequest DICOMweb request. For example, `instances`, `series/{series_uid}/instances`, or `studies/{study_uid}/instances`.
24174 ///
24175 /// Sets the *dicom web path* path property to the given value.
24176 ///
24177 /// Even though the property as already been set when instantiating this call,
24178 /// we provide this method for API completeness.
24179 pub fn dicom_web_path(
24180 mut self,
24181 new_value: &str,
24182 ) -> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C> {
24183 self._dicom_web_path = new_value.to_string();
24184 self
24185 }
24186 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24187 /// while executing the actual API request.
24188 ///
24189 /// ````text
24190 /// It should be used to handle progress information, and to implement a certain level of resilience.
24191 /// ````
24192 ///
24193 /// Sets the *delegate* property to the given value.
24194 pub fn delegate(
24195 mut self,
24196 new_value: &'a mut dyn common::Delegate,
24197 ) -> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C> {
24198 self._delegate = Some(new_value);
24199 self
24200 }
24201
24202 /// Set any additional parameter of the query string used in the request.
24203 /// It should be used to set parameters which are not yet available through their own
24204 /// setters.
24205 ///
24206 /// Please note that this method must not be used to set any of the known parameters
24207 /// which have their own setter method. If done anyway, the request will fail.
24208 ///
24209 /// # Additional Parameters
24210 ///
24211 /// * *$.xgafv* (query-string) - V1 error format.
24212 /// * *access_token* (query-string) - OAuth access token.
24213 /// * *alt* (query-string) - Data format for response.
24214 /// * *callback* (query-string) - JSONP
24215 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24216 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24217 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24218 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24219 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24220 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24221 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24222 pub fn param<T>(
24223 mut self,
24224 name: T,
24225 value: T,
24226 ) -> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C>
24227 where
24228 T: AsRef<str>,
24229 {
24230 self._additional_params
24231 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24232 self
24233 }
24234
24235 /// Identifies the authorization scope for the method you are building.
24236 ///
24237 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24238 /// [`Scope::CloudHealthcare`].
24239 ///
24240 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24241 /// tokens for more than one scope.
24242 ///
24243 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24244 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24245 /// sufficient, a read-write scope will do as well.
24246 pub fn add_scope<St>(
24247 mut self,
24248 scope: St,
24249 ) -> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C>
24250 where
24251 St: AsRef<str>,
24252 {
24253 self._scopes.insert(String::from(scope.as_ref()));
24254 self
24255 }
24256 /// Identifies the authorization scope(s) for the method you are building.
24257 ///
24258 /// See [`Self::add_scope()`] for details.
24259 pub fn add_scopes<I, St>(
24260 mut self,
24261 scopes: I,
24262 ) -> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C>
24263 where
24264 I: IntoIterator<Item = St>,
24265 St: AsRef<str>,
24266 {
24267 self._scopes
24268 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24269 self
24270 }
24271
24272 /// Removes all scopes, and no default scope will be used either.
24273 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24274 /// for details).
24275 pub fn clear_scopes(
24276 mut self,
24277 ) -> ProjectLocationDatasetDicomStoreStudySearchForInstanceCall<'a, C> {
24278 self._scopes.clear();
24279 self
24280 }
24281}
24282
24283/// SearchForSeries returns a list of matching series. See [Search Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6). For details on the implementation of SearchForSeries, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForSeries, see [Search for DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#search-dicom).
24284///
24285/// A builder for the *locations.datasets.dicomStores.studies.searchForSeries* method supported by a *project* resource.
24286/// It is not used directly, but through a [`ProjectMethods`] instance.
24287///
24288/// # Example
24289///
24290/// Instantiate a resource method builder
24291///
24292/// ```test_harness,no_run
24293/// # extern crate hyper;
24294/// # extern crate hyper_rustls;
24295/// # extern crate google_healthcare1 as healthcare1;
24296/// # async fn dox() {
24297/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24298///
24299/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24300/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24301/// # secret,
24302/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24303/// # ).build().await.unwrap();
24304///
24305/// # let client = hyper_util::client::legacy::Client::builder(
24306/// # hyper_util::rt::TokioExecutor::new()
24307/// # )
24308/// # .build(
24309/// # hyper_rustls::HttpsConnectorBuilder::new()
24310/// # .with_native_roots()
24311/// # .unwrap()
24312/// # .https_or_http()
24313/// # .enable_http1()
24314/// # .build()
24315/// # );
24316/// # let mut hub = CloudHealthcare::new(client, auth);
24317/// // You can configure optional parameters by calling the respective setters at will, and
24318/// // execute the final call using `doit()`.
24319/// // Values shown here are possibly random and not representative !
24320/// let result = hub.projects().locations_datasets_dicom_stores_studies_search_for_series("parent", "dicomWebPath")
24321/// .doit().await;
24322/// # }
24323/// ```
24324pub struct ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C>
24325where
24326 C: 'a,
24327{
24328 hub: &'a CloudHealthcare<C>,
24329 _parent: String,
24330 _dicom_web_path: String,
24331 _delegate: Option<&'a mut dyn common::Delegate>,
24332 _additional_params: HashMap<String, String>,
24333 _scopes: BTreeSet<String>,
24334}
24335
24336impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C> {}
24337
24338impl<'a, C> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C>
24339where
24340 C: common::Connector,
24341{
24342 /// Perform the operation you have build so far.
24343 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
24344 use std::borrow::Cow;
24345 use std::io::{Read, Seek};
24346
24347 use common::{url::Params, ToParts};
24348 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24349
24350 let mut dd = common::DefaultDelegate;
24351 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24352 dlg.begin(common::MethodInfo {
24353 id: "healthcare.projects.locations.datasets.dicomStores.studies.searchForSeries",
24354 http_method: hyper::Method::GET,
24355 });
24356
24357 for &field in ["alt", "parent", "dicomWebPath"].iter() {
24358 if self._additional_params.contains_key(field) {
24359 dlg.finished(false);
24360 return Err(common::Error::FieldClash(field));
24361 }
24362 }
24363
24364 let mut params = Params::with_capacity(4 + self._additional_params.len());
24365 params.push("parent", self._parent);
24366 params.push("dicomWebPath", self._dicom_web_path);
24367
24368 params.extend(self._additional_params.iter());
24369
24370 params.push("alt", "json");
24371 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
24372 if self._scopes.is_empty() {
24373 self._scopes
24374 .insert(Scope::CloudHealthcare.as_ref().to_string());
24375 }
24376
24377 #[allow(clippy::single_element_loop)]
24378 for &(find_this, param_name) in
24379 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
24380 {
24381 url = params.uri_replacement(url, param_name, find_this, true);
24382 }
24383 {
24384 let to_remove = ["dicomWebPath", "parent"];
24385 params.remove_params(&to_remove);
24386 }
24387
24388 let url = params.parse_with_url(&url);
24389
24390 loop {
24391 let token = match self
24392 .hub
24393 .auth
24394 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24395 .await
24396 {
24397 Ok(token) => token,
24398 Err(e) => match dlg.token(e) {
24399 Ok(token) => token,
24400 Err(e) => {
24401 dlg.finished(false);
24402 return Err(common::Error::MissingToken(e));
24403 }
24404 },
24405 };
24406 let mut req_result = {
24407 let client = &self.hub.client;
24408 dlg.pre_request();
24409 let mut req_builder = hyper::Request::builder()
24410 .method(hyper::Method::GET)
24411 .uri(url.as_str())
24412 .header(USER_AGENT, self.hub._user_agent.clone());
24413
24414 if let Some(token) = token.as_ref() {
24415 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24416 }
24417
24418 let request = req_builder
24419 .header(CONTENT_LENGTH, 0_u64)
24420 .body(common::to_body::<String>(None));
24421
24422 client.request(request.unwrap()).await
24423 };
24424
24425 match req_result {
24426 Err(err) => {
24427 if let common::Retry::After(d) = dlg.http_error(&err) {
24428 sleep(d).await;
24429 continue;
24430 }
24431 dlg.finished(false);
24432 return Err(common::Error::HttpError(err));
24433 }
24434 Ok(res) => {
24435 let (mut parts, body) = res.into_parts();
24436 let mut body = common::Body::new(body);
24437 if !parts.status.is_success() {
24438 let bytes = common::to_bytes(body).await.unwrap_or_default();
24439 let error = serde_json::from_str(&common::to_string(&bytes));
24440 let response = common::to_response(parts, bytes.into());
24441
24442 if let common::Retry::After(d) =
24443 dlg.http_failure(&response, error.as_ref().ok())
24444 {
24445 sleep(d).await;
24446 continue;
24447 }
24448
24449 dlg.finished(false);
24450
24451 return Err(match error {
24452 Ok(value) => common::Error::BadRequest(value),
24453 _ => common::Error::Failure(response),
24454 });
24455 }
24456 let response = {
24457 let bytes = common::to_bytes(body).await.unwrap_or_default();
24458 let encoded = common::to_string(&bytes);
24459 match serde_json::from_str(&encoded) {
24460 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24461 Err(error) => {
24462 dlg.response_json_decode_error(&encoded, &error);
24463 return Err(common::Error::JsonDecodeError(
24464 encoded.to_string(),
24465 error,
24466 ));
24467 }
24468 }
24469 };
24470
24471 dlg.finished(true);
24472 return Ok(response);
24473 }
24474 }
24475 }
24476 }
24477
24478 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
24479 ///
24480 /// Sets the *parent* path property to the given value.
24481 ///
24482 /// Even though the property as already been set when instantiating this call,
24483 /// we provide this method for API completeness.
24484 pub fn parent(
24485 mut self,
24486 new_value: &str,
24487 ) -> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C> {
24488 self._parent = new_value.to_string();
24489 self
24490 }
24491 /// Required. The path of the SearchForSeries DICOMweb request. For example, `series` or `studies/{study_uid}/series`.
24492 ///
24493 /// Sets the *dicom web path* path property to the given value.
24494 ///
24495 /// Even though the property as already been set when instantiating this call,
24496 /// we provide this method for API completeness.
24497 pub fn dicom_web_path(
24498 mut self,
24499 new_value: &str,
24500 ) -> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C> {
24501 self._dicom_web_path = new_value.to_string();
24502 self
24503 }
24504 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24505 /// while executing the actual API request.
24506 ///
24507 /// ````text
24508 /// It should be used to handle progress information, and to implement a certain level of resilience.
24509 /// ````
24510 ///
24511 /// Sets the *delegate* property to the given value.
24512 pub fn delegate(
24513 mut self,
24514 new_value: &'a mut dyn common::Delegate,
24515 ) -> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C> {
24516 self._delegate = Some(new_value);
24517 self
24518 }
24519
24520 /// Set any additional parameter of the query string used in the request.
24521 /// It should be used to set parameters which are not yet available through their own
24522 /// setters.
24523 ///
24524 /// Please note that this method must not be used to set any of the known parameters
24525 /// which have their own setter method. If done anyway, the request will fail.
24526 ///
24527 /// # Additional Parameters
24528 ///
24529 /// * *$.xgafv* (query-string) - V1 error format.
24530 /// * *access_token* (query-string) - OAuth access token.
24531 /// * *alt* (query-string) - Data format for response.
24532 /// * *callback* (query-string) - JSONP
24533 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24534 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24535 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24536 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24537 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24538 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24539 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24540 pub fn param<T>(
24541 mut self,
24542 name: T,
24543 value: T,
24544 ) -> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C>
24545 where
24546 T: AsRef<str>,
24547 {
24548 self._additional_params
24549 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24550 self
24551 }
24552
24553 /// Identifies the authorization scope for the method you are building.
24554 ///
24555 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24556 /// [`Scope::CloudHealthcare`].
24557 ///
24558 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24559 /// tokens for more than one scope.
24560 ///
24561 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24562 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24563 /// sufficient, a read-write scope will do as well.
24564 pub fn add_scope<St>(
24565 mut self,
24566 scope: St,
24567 ) -> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C>
24568 where
24569 St: AsRef<str>,
24570 {
24571 self._scopes.insert(String::from(scope.as_ref()));
24572 self
24573 }
24574 /// Identifies the authorization scope(s) for the method you are building.
24575 ///
24576 /// See [`Self::add_scope()`] for details.
24577 pub fn add_scopes<I, St>(
24578 mut self,
24579 scopes: I,
24580 ) -> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C>
24581 where
24582 I: IntoIterator<Item = St>,
24583 St: AsRef<str>,
24584 {
24585 self._scopes
24586 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24587 self
24588 }
24589
24590 /// Removes all scopes, and no default scope will be used either.
24591 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24592 /// for details).
24593 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreStudySearchForSeryCall<'a, C> {
24594 self._scopes.clear();
24595 self
24596 }
24597}
24598
24599/// StoreInstances stores DICOM instances associated with study instance unique identifiers (SUID). See [Store Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.5). For details on the implementation of StoreInstances, see [Store transaction](https://cloud.google.com/healthcare/docs/dicom#store_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call StoreInstances, see [Store DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#store-dicom).
24600///
24601/// A builder for the *locations.datasets.dicomStores.studies.storeInstances* method supported by a *project* resource.
24602/// It is not used directly, but through a [`ProjectMethods`] instance.
24603///
24604/// # Example
24605///
24606/// Instantiate a resource method builder
24607///
24608/// ```test_harness,no_run
24609/// # extern crate hyper;
24610/// # extern crate hyper_rustls;
24611/// # extern crate google_healthcare1 as healthcare1;
24612/// use healthcare1::api::HttpBody;
24613/// # async fn dox() {
24614/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24615///
24616/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24617/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24618/// # secret,
24619/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24620/// # ).build().await.unwrap();
24621///
24622/// # let client = hyper_util::client::legacy::Client::builder(
24623/// # hyper_util::rt::TokioExecutor::new()
24624/// # )
24625/// # .build(
24626/// # hyper_rustls::HttpsConnectorBuilder::new()
24627/// # .with_native_roots()
24628/// # .unwrap()
24629/// # .https_or_http()
24630/// # .enable_http1()
24631/// # .build()
24632/// # );
24633/// # let mut hub = CloudHealthcare::new(client, auth);
24634/// // As the method needs a request, you would usually fill it with the desired information
24635/// // into the respective structure. Some of the parts shown here might not be applicable !
24636/// // Values shown here are possibly random and not representative !
24637/// let mut req = HttpBody::default();
24638///
24639/// // You can configure optional parameters by calling the respective setters at will, and
24640/// // execute the final call using `doit()`.
24641/// // Values shown here are possibly random and not representative !
24642/// let result = hub.projects().locations_datasets_dicom_stores_studies_store_instances(req, "parent", "dicomWebPath")
24643/// .doit().await;
24644/// # }
24645/// ```
24646pub struct ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C>
24647where
24648 C: 'a,
24649{
24650 hub: &'a CloudHealthcare<C>,
24651 _request: HttpBody,
24652 _parent: String,
24653 _dicom_web_path: String,
24654 _delegate: Option<&'a mut dyn common::Delegate>,
24655 _additional_params: HashMap<String, String>,
24656 _scopes: BTreeSet<String>,
24657}
24658
24659impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C> {}
24660
24661impl<'a, C> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C>
24662where
24663 C: common::Connector,
24664{
24665 /// Perform the operation you have build so far.
24666 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
24667 use std::borrow::Cow;
24668 use std::io::{Read, Seek};
24669
24670 use common::{url::Params, ToParts};
24671 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24672
24673 let mut dd = common::DefaultDelegate;
24674 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24675 dlg.begin(common::MethodInfo {
24676 id: "healthcare.projects.locations.datasets.dicomStores.studies.storeInstances",
24677 http_method: hyper::Method::POST,
24678 });
24679
24680 for &field in ["alt", "parent", "dicomWebPath"].iter() {
24681 if self._additional_params.contains_key(field) {
24682 dlg.finished(false);
24683 return Err(common::Error::FieldClash(field));
24684 }
24685 }
24686
24687 let mut params = Params::with_capacity(5 + self._additional_params.len());
24688 params.push("parent", self._parent);
24689 params.push("dicomWebPath", self._dicom_web_path);
24690
24691 params.extend(self._additional_params.iter());
24692
24693 params.push("alt", "json");
24694 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
24695 if self._scopes.is_empty() {
24696 self._scopes
24697 .insert(Scope::CloudHealthcare.as_ref().to_string());
24698 }
24699
24700 #[allow(clippy::single_element_loop)]
24701 for &(find_this, param_name) in
24702 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
24703 {
24704 url = params.uri_replacement(url, param_name, find_this, true);
24705 }
24706 {
24707 let to_remove = ["dicomWebPath", "parent"];
24708 params.remove_params(&to_remove);
24709 }
24710
24711 let url = params.parse_with_url(&url);
24712
24713 let mut json_mime_type = mime::APPLICATION_JSON;
24714 let mut request_value_reader = {
24715 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24716 common::remove_json_null_values(&mut value);
24717 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24718 serde_json::to_writer(&mut dst, &value).unwrap();
24719 dst
24720 };
24721 let request_size = request_value_reader
24722 .seek(std::io::SeekFrom::End(0))
24723 .unwrap();
24724 request_value_reader
24725 .seek(std::io::SeekFrom::Start(0))
24726 .unwrap();
24727
24728 loop {
24729 let token = match self
24730 .hub
24731 .auth
24732 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24733 .await
24734 {
24735 Ok(token) => token,
24736 Err(e) => match dlg.token(e) {
24737 Ok(token) => token,
24738 Err(e) => {
24739 dlg.finished(false);
24740 return Err(common::Error::MissingToken(e));
24741 }
24742 },
24743 };
24744 request_value_reader
24745 .seek(std::io::SeekFrom::Start(0))
24746 .unwrap();
24747 let mut req_result = {
24748 let client = &self.hub.client;
24749 dlg.pre_request();
24750 let mut req_builder = hyper::Request::builder()
24751 .method(hyper::Method::POST)
24752 .uri(url.as_str())
24753 .header(USER_AGENT, self.hub._user_agent.clone());
24754
24755 if let Some(token) = token.as_ref() {
24756 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24757 }
24758
24759 let request = req_builder
24760 .header(CONTENT_TYPE, json_mime_type.to_string())
24761 .header(CONTENT_LENGTH, request_size as u64)
24762 .body(common::to_body(
24763 request_value_reader.get_ref().clone().into(),
24764 ));
24765
24766 client.request(request.unwrap()).await
24767 };
24768
24769 match req_result {
24770 Err(err) => {
24771 if let common::Retry::After(d) = dlg.http_error(&err) {
24772 sleep(d).await;
24773 continue;
24774 }
24775 dlg.finished(false);
24776 return Err(common::Error::HttpError(err));
24777 }
24778 Ok(res) => {
24779 let (mut parts, body) = res.into_parts();
24780 let mut body = common::Body::new(body);
24781 if !parts.status.is_success() {
24782 let bytes = common::to_bytes(body).await.unwrap_or_default();
24783 let error = serde_json::from_str(&common::to_string(&bytes));
24784 let response = common::to_response(parts, bytes.into());
24785
24786 if let common::Retry::After(d) =
24787 dlg.http_failure(&response, error.as_ref().ok())
24788 {
24789 sleep(d).await;
24790 continue;
24791 }
24792
24793 dlg.finished(false);
24794
24795 return Err(match error {
24796 Ok(value) => common::Error::BadRequest(value),
24797 _ => common::Error::Failure(response),
24798 });
24799 }
24800 let response = {
24801 let bytes = common::to_bytes(body).await.unwrap_or_default();
24802 let encoded = common::to_string(&bytes);
24803 match serde_json::from_str(&encoded) {
24804 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24805 Err(error) => {
24806 dlg.response_json_decode_error(&encoded, &error);
24807 return Err(common::Error::JsonDecodeError(
24808 encoded.to_string(),
24809 error,
24810 ));
24811 }
24812 }
24813 };
24814
24815 dlg.finished(true);
24816 return Ok(response);
24817 }
24818 }
24819 }
24820 }
24821
24822 ///
24823 /// Sets the *request* property to the given value.
24824 ///
24825 /// Even though the property as already been set when instantiating this call,
24826 /// we provide this method for API completeness.
24827 pub fn request(
24828 mut self,
24829 new_value: HttpBody,
24830 ) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C> {
24831 self._request = new_value;
24832 self
24833 }
24834 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
24835 ///
24836 /// Sets the *parent* path property to the given value.
24837 ///
24838 /// Even though the property as already been set when instantiating this call,
24839 /// we provide this method for API completeness.
24840 pub fn parent(
24841 mut self,
24842 new_value: &str,
24843 ) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C> {
24844 self._parent = new_value.to_string();
24845 self
24846 }
24847 /// Required. The path of the StoreInstances DICOMweb request. For example, `studies/[{study_uid}]`. Note that the `study_uid` is optional.
24848 ///
24849 /// Sets the *dicom web path* path property to the given value.
24850 ///
24851 /// Even though the property as already been set when instantiating this call,
24852 /// we provide this method for API completeness.
24853 pub fn dicom_web_path(
24854 mut self,
24855 new_value: &str,
24856 ) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C> {
24857 self._dicom_web_path = new_value.to_string();
24858 self
24859 }
24860 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24861 /// while executing the actual API request.
24862 ///
24863 /// ````text
24864 /// It should be used to handle progress information, and to implement a certain level of resilience.
24865 /// ````
24866 ///
24867 /// Sets the *delegate* property to the given value.
24868 pub fn delegate(
24869 mut self,
24870 new_value: &'a mut dyn common::Delegate,
24871 ) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C> {
24872 self._delegate = Some(new_value);
24873 self
24874 }
24875
24876 /// Set any additional parameter of the query string used in the request.
24877 /// It should be used to set parameters which are not yet available through their own
24878 /// setters.
24879 ///
24880 /// Please note that this method must not be used to set any of the known parameters
24881 /// which have their own setter method. If done anyway, the request will fail.
24882 ///
24883 /// # Additional Parameters
24884 ///
24885 /// * *$.xgafv* (query-string) - V1 error format.
24886 /// * *access_token* (query-string) - OAuth access token.
24887 /// * *alt* (query-string) - Data format for response.
24888 /// * *callback* (query-string) - JSONP
24889 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24890 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
24891 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24892 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24893 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
24894 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24895 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24896 pub fn param<T>(
24897 mut self,
24898 name: T,
24899 value: T,
24900 ) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C>
24901 where
24902 T: AsRef<str>,
24903 {
24904 self._additional_params
24905 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24906 self
24907 }
24908
24909 /// Identifies the authorization scope for the method you are building.
24910 ///
24911 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24912 /// [`Scope::CloudHealthcare`].
24913 ///
24914 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24915 /// tokens for more than one scope.
24916 ///
24917 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24918 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24919 /// sufficient, a read-write scope will do as well.
24920 pub fn add_scope<St>(
24921 mut self,
24922 scope: St,
24923 ) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C>
24924 where
24925 St: AsRef<str>,
24926 {
24927 self._scopes.insert(String::from(scope.as_ref()));
24928 self
24929 }
24930 /// Identifies the authorization scope(s) for the method you are building.
24931 ///
24932 /// See [`Self::add_scope()`] for details.
24933 pub fn add_scopes<I, St>(
24934 mut self,
24935 scopes: I,
24936 ) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C>
24937 where
24938 I: IntoIterator<Item = St>,
24939 St: AsRef<str>,
24940 {
24941 self._scopes
24942 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24943 self
24944 }
24945
24946 /// Removes all scopes, and no default scope will be used either.
24947 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24948 /// for details).
24949 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreStudyStoreInstanceCall<'a, C> {
24950 self._scopes.clear();
24951 self
24952 }
24953}
24954
24955/// Creates a new DICOM store within the parent dataset.
24956///
24957/// A builder for the *locations.datasets.dicomStores.create* method supported by a *project* resource.
24958/// It is not used directly, but through a [`ProjectMethods`] instance.
24959///
24960/// # Example
24961///
24962/// Instantiate a resource method builder
24963///
24964/// ```test_harness,no_run
24965/// # extern crate hyper;
24966/// # extern crate hyper_rustls;
24967/// # extern crate google_healthcare1 as healthcare1;
24968/// use healthcare1::api::DicomStore;
24969/// # async fn dox() {
24970/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24971///
24972/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24973/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24974/// # secret,
24975/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24976/// # ).build().await.unwrap();
24977///
24978/// # let client = hyper_util::client::legacy::Client::builder(
24979/// # hyper_util::rt::TokioExecutor::new()
24980/// # )
24981/// # .build(
24982/// # hyper_rustls::HttpsConnectorBuilder::new()
24983/// # .with_native_roots()
24984/// # .unwrap()
24985/// # .https_or_http()
24986/// # .enable_http1()
24987/// # .build()
24988/// # );
24989/// # let mut hub = CloudHealthcare::new(client, auth);
24990/// // As the method needs a request, you would usually fill it with the desired information
24991/// // into the respective structure. Some of the parts shown here might not be applicable !
24992/// // Values shown here are possibly random and not representative !
24993/// let mut req = DicomStore::default();
24994///
24995/// // You can configure optional parameters by calling the respective setters at will, and
24996/// // execute the final call using `doit()`.
24997/// // Values shown here are possibly random and not representative !
24998/// let result = hub.projects().locations_datasets_dicom_stores_create(req, "parent")
24999/// .dicom_store_id("sed")
25000/// .doit().await;
25001/// # }
25002/// ```
25003pub struct ProjectLocationDatasetDicomStoreCreateCall<'a, C>
25004where
25005 C: 'a,
25006{
25007 hub: &'a CloudHealthcare<C>,
25008 _request: DicomStore,
25009 _parent: String,
25010 _dicom_store_id: Option<String>,
25011 _delegate: Option<&'a mut dyn common::Delegate>,
25012 _additional_params: HashMap<String, String>,
25013 _scopes: BTreeSet<String>,
25014}
25015
25016impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreCreateCall<'a, C> {}
25017
25018impl<'a, C> ProjectLocationDatasetDicomStoreCreateCall<'a, C>
25019where
25020 C: common::Connector,
25021{
25022 /// Perform the operation you have build so far.
25023 pub async fn doit(mut self) -> common::Result<(common::Response, DicomStore)> {
25024 use std::borrow::Cow;
25025 use std::io::{Read, Seek};
25026
25027 use common::{url::Params, ToParts};
25028 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25029
25030 let mut dd = common::DefaultDelegate;
25031 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25032 dlg.begin(common::MethodInfo {
25033 id: "healthcare.projects.locations.datasets.dicomStores.create",
25034 http_method: hyper::Method::POST,
25035 });
25036
25037 for &field in ["alt", "parent", "dicomStoreId"].iter() {
25038 if self._additional_params.contains_key(field) {
25039 dlg.finished(false);
25040 return Err(common::Error::FieldClash(field));
25041 }
25042 }
25043
25044 let mut params = Params::with_capacity(5 + self._additional_params.len());
25045 params.push("parent", self._parent);
25046 if let Some(value) = self._dicom_store_id.as_ref() {
25047 params.push("dicomStoreId", value);
25048 }
25049
25050 params.extend(self._additional_params.iter());
25051
25052 params.push("alt", "json");
25053 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomStores";
25054 if self._scopes.is_empty() {
25055 self._scopes
25056 .insert(Scope::CloudHealthcare.as_ref().to_string());
25057 }
25058
25059 #[allow(clippy::single_element_loop)]
25060 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
25061 url = params.uri_replacement(url, param_name, find_this, true);
25062 }
25063 {
25064 let to_remove = ["parent"];
25065 params.remove_params(&to_remove);
25066 }
25067
25068 let url = params.parse_with_url(&url);
25069
25070 let mut json_mime_type = mime::APPLICATION_JSON;
25071 let mut request_value_reader = {
25072 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25073 common::remove_json_null_values(&mut value);
25074 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25075 serde_json::to_writer(&mut dst, &value).unwrap();
25076 dst
25077 };
25078 let request_size = request_value_reader
25079 .seek(std::io::SeekFrom::End(0))
25080 .unwrap();
25081 request_value_reader
25082 .seek(std::io::SeekFrom::Start(0))
25083 .unwrap();
25084
25085 loop {
25086 let token = match self
25087 .hub
25088 .auth
25089 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25090 .await
25091 {
25092 Ok(token) => token,
25093 Err(e) => match dlg.token(e) {
25094 Ok(token) => token,
25095 Err(e) => {
25096 dlg.finished(false);
25097 return Err(common::Error::MissingToken(e));
25098 }
25099 },
25100 };
25101 request_value_reader
25102 .seek(std::io::SeekFrom::Start(0))
25103 .unwrap();
25104 let mut req_result = {
25105 let client = &self.hub.client;
25106 dlg.pre_request();
25107 let mut req_builder = hyper::Request::builder()
25108 .method(hyper::Method::POST)
25109 .uri(url.as_str())
25110 .header(USER_AGENT, self.hub._user_agent.clone());
25111
25112 if let Some(token) = token.as_ref() {
25113 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25114 }
25115
25116 let request = req_builder
25117 .header(CONTENT_TYPE, json_mime_type.to_string())
25118 .header(CONTENT_LENGTH, request_size as u64)
25119 .body(common::to_body(
25120 request_value_reader.get_ref().clone().into(),
25121 ));
25122
25123 client.request(request.unwrap()).await
25124 };
25125
25126 match req_result {
25127 Err(err) => {
25128 if let common::Retry::After(d) = dlg.http_error(&err) {
25129 sleep(d).await;
25130 continue;
25131 }
25132 dlg.finished(false);
25133 return Err(common::Error::HttpError(err));
25134 }
25135 Ok(res) => {
25136 let (mut parts, body) = res.into_parts();
25137 let mut body = common::Body::new(body);
25138 if !parts.status.is_success() {
25139 let bytes = common::to_bytes(body).await.unwrap_or_default();
25140 let error = serde_json::from_str(&common::to_string(&bytes));
25141 let response = common::to_response(parts, bytes.into());
25142
25143 if let common::Retry::After(d) =
25144 dlg.http_failure(&response, error.as_ref().ok())
25145 {
25146 sleep(d).await;
25147 continue;
25148 }
25149
25150 dlg.finished(false);
25151
25152 return Err(match error {
25153 Ok(value) => common::Error::BadRequest(value),
25154 _ => common::Error::Failure(response),
25155 });
25156 }
25157 let response = {
25158 let bytes = common::to_bytes(body).await.unwrap_or_default();
25159 let encoded = common::to_string(&bytes);
25160 match serde_json::from_str(&encoded) {
25161 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25162 Err(error) => {
25163 dlg.response_json_decode_error(&encoded, &error);
25164 return Err(common::Error::JsonDecodeError(
25165 encoded.to_string(),
25166 error,
25167 ));
25168 }
25169 }
25170 };
25171
25172 dlg.finished(true);
25173 return Ok(response);
25174 }
25175 }
25176 }
25177 }
25178
25179 ///
25180 /// Sets the *request* property to the given value.
25181 ///
25182 /// Even though the property as already been set when instantiating this call,
25183 /// we provide this method for API completeness.
25184 pub fn request(
25185 mut self,
25186 new_value: DicomStore,
25187 ) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C> {
25188 self._request = new_value;
25189 self
25190 }
25191 /// Required. The name of the dataset this DICOM store belongs to.
25192 ///
25193 /// Sets the *parent* path property to the given value.
25194 ///
25195 /// Even though the property as already been set when instantiating this call,
25196 /// we provide this method for API completeness.
25197 pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C> {
25198 self._parent = new_value.to_string();
25199 self
25200 }
25201 /// Required. The ID of the DICOM store that is being created. Any string value up to 256 characters in length.
25202 ///
25203 /// Sets the *dicom store id* query property to the given value.
25204 pub fn dicom_store_id(
25205 mut self,
25206 new_value: &str,
25207 ) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C> {
25208 self._dicom_store_id = Some(new_value.to_string());
25209 self
25210 }
25211 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25212 /// while executing the actual API request.
25213 ///
25214 /// ````text
25215 /// It should be used to handle progress information, and to implement a certain level of resilience.
25216 /// ````
25217 ///
25218 /// Sets the *delegate* property to the given value.
25219 pub fn delegate(
25220 mut self,
25221 new_value: &'a mut dyn common::Delegate,
25222 ) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C> {
25223 self._delegate = Some(new_value);
25224 self
25225 }
25226
25227 /// Set any additional parameter of the query string used in the request.
25228 /// It should be used to set parameters which are not yet available through their own
25229 /// setters.
25230 ///
25231 /// Please note that this method must not be used to set any of the known parameters
25232 /// which have their own setter method. If done anyway, the request will fail.
25233 ///
25234 /// # Additional Parameters
25235 ///
25236 /// * *$.xgafv* (query-string) - V1 error format.
25237 /// * *access_token* (query-string) - OAuth access token.
25238 /// * *alt* (query-string) - Data format for response.
25239 /// * *callback* (query-string) - JSONP
25240 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25241 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25242 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25243 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25244 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25245 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25246 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25247 pub fn param<T>(
25248 mut self,
25249 name: T,
25250 value: T,
25251 ) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C>
25252 where
25253 T: AsRef<str>,
25254 {
25255 self._additional_params
25256 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25257 self
25258 }
25259
25260 /// Identifies the authorization scope for the method you are building.
25261 ///
25262 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25263 /// [`Scope::CloudHealthcare`].
25264 ///
25265 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25266 /// tokens for more than one scope.
25267 ///
25268 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25269 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25270 /// sufficient, a read-write scope will do as well.
25271 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C>
25272 where
25273 St: AsRef<str>,
25274 {
25275 self._scopes.insert(String::from(scope.as_ref()));
25276 self
25277 }
25278 /// Identifies the authorization scope(s) for the method you are building.
25279 ///
25280 /// See [`Self::add_scope()`] for details.
25281 pub fn add_scopes<I, St>(
25282 mut self,
25283 scopes: I,
25284 ) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C>
25285 where
25286 I: IntoIterator<Item = St>,
25287 St: AsRef<str>,
25288 {
25289 self._scopes
25290 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25291 self
25292 }
25293
25294 /// Removes all scopes, and no default scope will be used either.
25295 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25296 /// for details).
25297 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreCreateCall<'a, C> {
25298 self._scopes.clear();
25299 self
25300 }
25301}
25302
25303/// De-identifies data from the source store and writes it to the destination store. The metadata field type is OperationMetadata. If the request is successful, the response field type is DeidentifyDicomStoreSummary. If errors occur, error is set. The LRO result may still be successful if de-identification fails for some DICOM instances. The output DICOM store will not contain these failed resources. Failed resource totals are tracked in Operation.metadata. Error details are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).
25304///
25305/// A builder for the *locations.datasets.dicomStores.deidentify* method supported by a *project* resource.
25306/// It is not used directly, but through a [`ProjectMethods`] instance.
25307///
25308/// # Example
25309///
25310/// Instantiate a resource method builder
25311///
25312/// ```test_harness,no_run
25313/// # extern crate hyper;
25314/// # extern crate hyper_rustls;
25315/// # extern crate google_healthcare1 as healthcare1;
25316/// use healthcare1::api::DeidentifyDicomStoreRequest;
25317/// # async fn dox() {
25318/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25319///
25320/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25321/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25322/// # secret,
25323/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25324/// # ).build().await.unwrap();
25325///
25326/// # let client = hyper_util::client::legacy::Client::builder(
25327/// # hyper_util::rt::TokioExecutor::new()
25328/// # )
25329/// # .build(
25330/// # hyper_rustls::HttpsConnectorBuilder::new()
25331/// # .with_native_roots()
25332/// # .unwrap()
25333/// # .https_or_http()
25334/// # .enable_http1()
25335/// # .build()
25336/// # );
25337/// # let mut hub = CloudHealthcare::new(client, auth);
25338/// // As the method needs a request, you would usually fill it with the desired information
25339/// // into the respective structure. Some of the parts shown here might not be applicable !
25340/// // Values shown here are possibly random and not representative !
25341/// let mut req = DeidentifyDicomStoreRequest::default();
25342///
25343/// // You can configure optional parameters by calling the respective setters at will, and
25344/// // execute the final call using `doit()`.
25345/// // Values shown here are possibly random and not representative !
25346/// let result = hub.projects().locations_datasets_dicom_stores_deidentify(req, "sourceStore")
25347/// .doit().await;
25348/// # }
25349/// ```
25350pub struct ProjectLocationDatasetDicomStoreDeidentifyCall<'a, C>
25351where
25352 C: 'a,
25353{
25354 hub: &'a CloudHealthcare<C>,
25355 _request: DeidentifyDicomStoreRequest,
25356 _source_store: String,
25357 _delegate: Option<&'a mut dyn common::Delegate>,
25358 _additional_params: HashMap<String, String>,
25359 _scopes: BTreeSet<String>,
25360}
25361
25362impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreDeidentifyCall<'a, C> {}
25363
25364impl<'a, C> ProjectLocationDatasetDicomStoreDeidentifyCall<'a, C>
25365where
25366 C: common::Connector,
25367{
25368 /// Perform the operation you have build so far.
25369 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
25370 use std::borrow::Cow;
25371 use std::io::{Read, Seek};
25372
25373 use common::{url::Params, ToParts};
25374 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25375
25376 let mut dd = common::DefaultDelegate;
25377 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25378 dlg.begin(common::MethodInfo {
25379 id: "healthcare.projects.locations.datasets.dicomStores.deidentify",
25380 http_method: hyper::Method::POST,
25381 });
25382
25383 for &field in ["alt", "sourceStore"].iter() {
25384 if self._additional_params.contains_key(field) {
25385 dlg.finished(false);
25386 return Err(common::Error::FieldClash(field));
25387 }
25388 }
25389
25390 let mut params = Params::with_capacity(4 + self._additional_params.len());
25391 params.push("sourceStore", self._source_store);
25392
25393 params.extend(self._additional_params.iter());
25394
25395 params.push("alt", "json");
25396 let mut url = self.hub._base_url.clone() + "v1/{+sourceStore}:deidentify";
25397 if self._scopes.is_empty() {
25398 self._scopes
25399 .insert(Scope::CloudHealthcare.as_ref().to_string());
25400 }
25401
25402 #[allow(clippy::single_element_loop)]
25403 for &(find_this, param_name) in [("{+sourceStore}", "sourceStore")].iter() {
25404 url = params.uri_replacement(url, param_name, find_this, true);
25405 }
25406 {
25407 let to_remove = ["sourceStore"];
25408 params.remove_params(&to_remove);
25409 }
25410
25411 let url = params.parse_with_url(&url);
25412
25413 let mut json_mime_type = mime::APPLICATION_JSON;
25414 let mut request_value_reader = {
25415 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25416 common::remove_json_null_values(&mut value);
25417 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25418 serde_json::to_writer(&mut dst, &value).unwrap();
25419 dst
25420 };
25421 let request_size = request_value_reader
25422 .seek(std::io::SeekFrom::End(0))
25423 .unwrap();
25424 request_value_reader
25425 .seek(std::io::SeekFrom::Start(0))
25426 .unwrap();
25427
25428 loop {
25429 let token = match self
25430 .hub
25431 .auth
25432 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25433 .await
25434 {
25435 Ok(token) => token,
25436 Err(e) => match dlg.token(e) {
25437 Ok(token) => token,
25438 Err(e) => {
25439 dlg.finished(false);
25440 return Err(common::Error::MissingToken(e));
25441 }
25442 },
25443 };
25444 request_value_reader
25445 .seek(std::io::SeekFrom::Start(0))
25446 .unwrap();
25447 let mut req_result = {
25448 let client = &self.hub.client;
25449 dlg.pre_request();
25450 let mut req_builder = hyper::Request::builder()
25451 .method(hyper::Method::POST)
25452 .uri(url.as_str())
25453 .header(USER_AGENT, self.hub._user_agent.clone());
25454
25455 if let Some(token) = token.as_ref() {
25456 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25457 }
25458
25459 let request = req_builder
25460 .header(CONTENT_TYPE, json_mime_type.to_string())
25461 .header(CONTENT_LENGTH, request_size as u64)
25462 .body(common::to_body(
25463 request_value_reader.get_ref().clone().into(),
25464 ));
25465
25466 client.request(request.unwrap()).await
25467 };
25468
25469 match req_result {
25470 Err(err) => {
25471 if let common::Retry::After(d) = dlg.http_error(&err) {
25472 sleep(d).await;
25473 continue;
25474 }
25475 dlg.finished(false);
25476 return Err(common::Error::HttpError(err));
25477 }
25478 Ok(res) => {
25479 let (mut parts, body) = res.into_parts();
25480 let mut body = common::Body::new(body);
25481 if !parts.status.is_success() {
25482 let bytes = common::to_bytes(body).await.unwrap_or_default();
25483 let error = serde_json::from_str(&common::to_string(&bytes));
25484 let response = common::to_response(parts, bytes.into());
25485
25486 if let common::Retry::After(d) =
25487 dlg.http_failure(&response, error.as_ref().ok())
25488 {
25489 sleep(d).await;
25490 continue;
25491 }
25492
25493 dlg.finished(false);
25494
25495 return Err(match error {
25496 Ok(value) => common::Error::BadRequest(value),
25497 _ => common::Error::Failure(response),
25498 });
25499 }
25500 let response = {
25501 let bytes = common::to_bytes(body).await.unwrap_or_default();
25502 let encoded = common::to_string(&bytes);
25503 match serde_json::from_str(&encoded) {
25504 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25505 Err(error) => {
25506 dlg.response_json_decode_error(&encoded, &error);
25507 return Err(common::Error::JsonDecodeError(
25508 encoded.to_string(),
25509 error,
25510 ));
25511 }
25512 }
25513 };
25514
25515 dlg.finished(true);
25516 return Ok(response);
25517 }
25518 }
25519 }
25520 }
25521
25522 ///
25523 /// Sets the *request* property to the given value.
25524 ///
25525 /// Even though the property as already been set when instantiating this call,
25526 /// we provide this method for API completeness.
25527 pub fn request(
25528 mut self,
25529 new_value: DeidentifyDicomStoreRequest,
25530 ) -> ProjectLocationDatasetDicomStoreDeidentifyCall<'a, C> {
25531 self._request = new_value;
25532 self
25533 }
25534 /// Required. Source DICOM store resource name. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
25535 ///
25536 /// Sets the *source store* path property to the given value.
25537 ///
25538 /// Even though the property as already been set when instantiating this call,
25539 /// we provide this method for API completeness.
25540 pub fn source_store(
25541 mut self,
25542 new_value: &str,
25543 ) -> ProjectLocationDatasetDicomStoreDeidentifyCall<'a, C> {
25544 self._source_store = new_value.to_string();
25545 self
25546 }
25547 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25548 /// while executing the actual API request.
25549 ///
25550 /// ````text
25551 /// It should be used to handle progress information, and to implement a certain level of resilience.
25552 /// ````
25553 ///
25554 /// Sets the *delegate* property to the given value.
25555 pub fn delegate(
25556 mut self,
25557 new_value: &'a mut dyn common::Delegate,
25558 ) -> ProjectLocationDatasetDicomStoreDeidentifyCall<'a, C> {
25559 self._delegate = Some(new_value);
25560 self
25561 }
25562
25563 /// Set any additional parameter of the query string used in the request.
25564 /// It should be used to set parameters which are not yet available through their own
25565 /// setters.
25566 ///
25567 /// Please note that this method must not be used to set any of the known parameters
25568 /// which have their own setter method. If done anyway, the request will fail.
25569 ///
25570 /// # Additional Parameters
25571 ///
25572 /// * *$.xgafv* (query-string) - V1 error format.
25573 /// * *access_token* (query-string) - OAuth access token.
25574 /// * *alt* (query-string) - Data format for response.
25575 /// * *callback* (query-string) - JSONP
25576 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25577 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25578 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25579 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25580 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25581 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25582 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25583 pub fn param<T>(
25584 mut self,
25585 name: T,
25586 value: T,
25587 ) -> ProjectLocationDatasetDicomStoreDeidentifyCall<'a, C>
25588 where
25589 T: AsRef<str>,
25590 {
25591 self._additional_params
25592 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25593 self
25594 }
25595
25596 /// Identifies the authorization scope for the method you are building.
25597 ///
25598 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25599 /// [`Scope::CloudHealthcare`].
25600 ///
25601 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25602 /// tokens for more than one scope.
25603 ///
25604 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25605 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25606 /// sufficient, a read-write scope will do as well.
25607 pub fn add_scope<St>(
25608 mut self,
25609 scope: St,
25610 ) -> ProjectLocationDatasetDicomStoreDeidentifyCall<'a, C>
25611 where
25612 St: AsRef<str>,
25613 {
25614 self._scopes.insert(String::from(scope.as_ref()));
25615 self
25616 }
25617 /// Identifies the authorization scope(s) for the method you are building.
25618 ///
25619 /// See [`Self::add_scope()`] for details.
25620 pub fn add_scopes<I, St>(
25621 mut self,
25622 scopes: I,
25623 ) -> ProjectLocationDatasetDicomStoreDeidentifyCall<'a, C>
25624 where
25625 I: IntoIterator<Item = St>,
25626 St: AsRef<str>,
25627 {
25628 self._scopes
25629 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25630 self
25631 }
25632
25633 /// Removes all scopes, and no default scope will be used either.
25634 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25635 /// for details).
25636 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreDeidentifyCall<'a, C> {
25637 self._scopes.clear();
25638 self
25639 }
25640}
25641
25642/// Deletes the specified DICOM store and removes all images that are contained within it.
25643///
25644/// A builder for the *locations.datasets.dicomStores.delete* method supported by a *project* resource.
25645/// It is not used directly, but through a [`ProjectMethods`] instance.
25646///
25647/// # Example
25648///
25649/// Instantiate a resource method builder
25650///
25651/// ```test_harness,no_run
25652/// # extern crate hyper;
25653/// # extern crate hyper_rustls;
25654/// # extern crate google_healthcare1 as healthcare1;
25655/// # async fn dox() {
25656/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25657///
25658/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25659/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25660/// # secret,
25661/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25662/// # ).build().await.unwrap();
25663///
25664/// # let client = hyper_util::client::legacy::Client::builder(
25665/// # hyper_util::rt::TokioExecutor::new()
25666/// # )
25667/// # .build(
25668/// # hyper_rustls::HttpsConnectorBuilder::new()
25669/// # .with_native_roots()
25670/// # .unwrap()
25671/// # .https_or_http()
25672/// # .enable_http1()
25673/// # .build()
25674/// # );
25675/// # let mut hub = CloudHealthcare::new(client, auth);
25676/// // You can configure optional parameters by calling the respective setters at will, and
25677/// // execute the final call using `doit()`.
25678/// // Values shown here are possibly random and not representative !
25679/// let result = hub.projects().locations_datasets_dicom_stores_delete("name")
25680/// .doit().await;
25681/// # }
25682/// ```
25683pub struct ProjectLocationDatasetDicomStoreDeleteCall<'a, C>
25684where
25685 C: 'a,
25686{
25687 hub: &'a CloudHealthcare<C>,
25688 _name: String,
25689 _delegate: Option<&'a mut dyn common::Delegate>,
25690 _additional_params: HashMap<String, String>,
25691 _scopes: BTreeSet<String>,
25692}
25693
25694impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreDeleteCall<'a, C> {}
25695
25696impl<'a, C> ProjectLocationDatasetDicomStoreDeleteCall<'a, C>
25697where
25698 C: common::Connector,
25699{
25700 /// Perform the operation you have build so far.
25701 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
25702 use std::borrow::Cow;
25703 use std::io::{Read, Seek};
25704
25705 use common::{url::Params, ToParts};
25706 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25707
25708 let mut dd = common::DefaultDelegate;
25709 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25710 dlg.begin(common::MethodInfo {
25711 id: "healthcare.projects.locations.datasets.dicomStores.delete",
25712 http_method: hyper::Method::DELETE,
25713 });
25714
25715 for &field in ["alt", "name"].iter() {
25716 if self._additional_params.contains_key(field) {
25717 dlg.finished(false);
25718 return Err(common::Error::FieldClash(field));
25719 }
25720 }
25721
25722 let mut params = Params::with_capacity(3 + self._additional_params.len());
25723 params.push("name", self._name);
25724
25725 params.extend(self._additional_params.iter());
25726
25727 params.push("alt", "json");
25728 let mut url = self.hub._base_url.clone() + "v1/{+name}";
25729 if self._scopes.is_empty() {
25730 self._scopes
25731 .insert(Scope::CloudHealthcare.as_ref().to_string());
25732 }
25733
25734 #[allow(clippy::single_element_loop)]
25735 for &(find_this, param_name) in [("{+name}", "name")].iter() {
25736 url = params.uri_replacement(url, param_name, find_this, true);
25737 }
25738 {
25739 let to_remove = ["name"];
25740 params.remove_params(&to_remove);
25741 }
25742
25743 let url = params.parse_with_url(&url);
25744
25745 loop {
25746 let token = match self
25747 .hub
25748 .auth
25749 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25750 .await
25751 {
25752 Ok(token) => token,
25753 Err(e) => match dlg.token(e) {
25754 Ok(token) => token,
25755 Err(e) => {
25756 dlg.finished(false);
25757 return Err(common::Error::MissingToken(e));
25758 }
25759 },
25760 };
25761 let mut req_result = {
25762 let client = &self.hub.client;
25763 dlg.pre_request();
25764 let mut req_builder = hyper::Request::builder()
25765 .method(hyper::Method::DELETE)
25766 .uri(url.as_str())
25767 .header(USER_AGENT, self.hub._user_agent.clone());
25768
25769 if let Some(token) = token.as_ref() {
25770 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25771 }
25772
25773 let request = req_builder
25774 .header(CONTENT_LENGTH, 0_u64)
25775 .body(common::to_body::<String>(None));
25776
25777 client.request(request.unwrap()).await
25778 };
25779
25780 match req_result {
25781 Err(err) => {
25782 if let common::Retry::After(d) = dlg.http_error(&err) {
25783 sleep(d).await;
25784 continue;
25785 }
25786 dlg.finished(false);
25787 return Err(common::Error::HttpError(err));
25788 }
25789 Ok(res) => {
25790 let (mut parts, body) = res.into_parts();
25791 let mut body = common::Body::new(body);
25792 if !parts.status.is_success() {
25793 let bytes = common::to_bytes(body).await.unwrap_or_default();
25794 let error = serde_json::from_str(&common::to_string(&bytes));
25795 let response = common::to_response(parts, bytes.into());
25796
25797 if let common::Retry::After(d) =
25798 dlg.http_failure(&response, error.as_ref().ok())
25799 {
25800 sleep(d).await;
25801 continue;
25802 }
25803
25804 dlg.finished(false);
25805
25806 return Err(match error {
25807 Ok(value) => common::Error::BadRequest(value),
25808 _ => common::Error::Failure(response),
25809 });
25810 }
25811 let response = {
25812 let bytes = common::to_bytes(body).await.unwrap_or_default();
25813 let encoded = common::to_string(&bytes);
25814 match serde_json::from_str(&encoded) {
25815 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25816 Err(error) => {
25817 dlg.response_json_decode_error(&encoded, &error);
25818 return Err(common::Error::JsonDecodeError(
25819 encoded.to_string(),
25820 error,
25821 ));
25822 }
25823 }
25824 };
25825
25826 dlg.finished(true);
25827 return Ok(response);
25828 }
25829 }
25830 }
25831 }
25832
25833 /// Required. The resource name of the DICOM store to delete.
25834 ///
25835 /// Sets the *name* path property to the given value.
25836 ///
25837 /// Even though the property as already been set when instantiating this call,
25838 /// we provide this method for API completeness.
25839 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreDeleteCall<'a, C> {
25840 self._name = new_value.to_string();
25841 self
25842 }
25843 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25844 /// while executing the actual API request.
25845 ///
25846 /// ````text
25847 /// It should be used to handle progress information, and to implement a certain level of resilience.
25848 /// ````
25849 ///
25850 /// Sets the *delegate* property to the given value.
25851 pub fn delegate(
25852 mut self,
25853 new_value: &'a mut dyn common::Delegate,
25854 ) -> ProjectLocationDatasetDicomStoreDeleteCall<'a, C> {
25855 self._delegate = Some(new_value);
25856 self
25857 }
25858
25859 /// Set any additional parameter of the query string used in the request.
25860 /// It should be used to set parameters which are not yet available through their own
25861 /// setters.
25862 ///
25863 /// Please note that this method must not be used to set any of the known parameters
25864 /// which have their own setter method. If done anyway, the request will fail.
25865 ///
25866 /// # Additional Parameters
25867 ///
25868 /// * *$.xgafv* (query-string) - V1 error format.
25869 /// * *access_token* (query-string) - OAuth access token.
25870 /// * *alt* (query-string) - Data format for response.
25871 /// * *callback* (query-string) - JSONP
25872 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25873 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
25874 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25875 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25876 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
25877 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25878 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25879 pub fn param<T>(
25880 mut self,
25881 name: T,
25882 value: T,
25883 ) -> ProjectLocationDatasetDicomStoreDeleteCall<'a, C>
25884 where
25885 T: AsRef<str>,
25886 {
25887 self._additional_params
25888 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25889 self
25890 }
25891
25892 /// Identifies the authorization scope for the method you are building.
25893 ///
25894 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25895 /// [`Scope::CloudHealthcare`].
25896 ///
25897 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25898 /// tokens for more than one scope.
25899 ///
25900 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25901 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25902 /// sufficient, a read-write scope will do as well.
25903 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetDicomStoreDeleteCall<'a, C>
25904 where
25905 St: AsRef<str>,
25906 {
25907 self._scopes.insert(String::from(scope.as_ref()));
25908 self
25909 }
25910 /// Identifies the authorization scope(s) for the method you are building.
25911 ///
25912 /// See [`Self::add_scope()`] for details.
25913 pub fn add_scopes<I, St>(
25914 mut self,
25915 scopes: I,
25916 ) -> ProjectLocationDatasetDicomStoreDeleteCall<'a, C>
25917 where
25918 I: IntoIterator<Item = St>,
25919 St: AsRef<str>,
25920 {
25921 self._scopes
25922 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25923 self
25924 }
25925
25926 /// Removes all scopes, and no default scope will be used either.
25927 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25928 /// for details).
25929 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreDeleteCall<'a, C> {
25930 self._scopes.clear();
25931 self
25932 }
25933}
25934
25935/// Exports data to the specified destination by copying it from the DICOM store. Errors are also logged to Cloud Logging. For more information, see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging). The metadata field type is OperationMetadata.
25936///
25937/// A builder for the *locations.datasets.dicomStores.export* method supported by a *project* resource.
25938/// It is not used directly, but through a [`ProjectMethods`] instance.
25939///
25940/// # Example
25941///
25942/// Instantiate a resource method builder
25943///
25944/// ```test_harness,no_run
25945/// # extern crate hyper;
25946/// # extern crate hyper_rustls;
25947/// # extern crate google_healthcare1 as healthcare1;
25948/// use healthcare1::api::ExportDicomDataRequest;
25949/// # async fn dox() {
25950/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25951///
25952/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25953/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25954/// # secret,
25955/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25956/// # ).build().await.unwrap();
25957///
25958/// # let client = hyper_util::client::legacy::Client::builder(
25959/// # hyper_util::rt::TokioExecutor::new()
25960/// # )
25961/// # .build(
25962/// # hyper_rustls::HttpsConnectorBuilder::new()
25963/// # .with_native_roots()
25964/// # .unwrap()
25965/// # .https_or_http()
25966/// # .enable_http1()
25967/// # .build()
25968/// # );
25969/// # let mut hub = CloudHealthcare::new(client, auth);
25970/// // As the method needs a request, you would usually fill it with the desired information
25971/// // into the respective structure. Some of the parts shown here might not be applicable !
25972/// // Values shown here are possibly random and not representative !
25973/// let mut req = ExportDicomDataRequest::default();
25974///
25975/// // You can configure optional parameters by calling the respective setters at will, and
25976/// // execute the final call using `doit()`.
25977/// // Values shown here are possibly random and not representative !
25978/// let result = hub.projects().locations_datasets_dicom_stores_export(req, "name")
25979/// .doit().await;
25980/// # }
25981/// ```
25982pub struct ProjectLocationDatasetDicomStoreExportCall<'a, C>
25983where
25984 C: 'a,
25985{
25986 hub: &'a CloudHealthcare<C>,
25987 _request: ExportDicomDataRequest,
25988 _name: String,
25989 _delegate: Option<&'a mut dyn common::Delegate>,
25990 _additional_params: HashMap<String, String>,
25991 _scopes: BTreeSet<String>,
25992}
25993
25994impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreExportCall<'a, C> {}
25995
25996impl<'a, C> ProjectLocationDatasetDicomStoreExportCall<'a, C>
25997where
25998 C: common::Connector,
25999{
26000 /// Perform the operation you have build so far.
26001 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
26002 use std::borrow::Cow;
26003 use std::io::{Read, Seek};
26004
26005 use common::{url::Params, ToParts};
26006 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26007
26008 let mut dd = common::DefaultDelegate;
26009 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26010 dlg.begin(common::MethodInfo {
26011 id: "healthcare.projects.locations.datasets.dicomStores.export",
26012 http_method: hyper::Method::POST,
26013 });
26014
26015 for &field in ["alt", "name"].iter() {
26016 if self._additional_params.contains_key(field) {
26017 dlg.finished(false);
26018 return Err(common::Error::FieldClash(field));
26019 }
26020 }
26021
26022 let mut params = Params::with_capacity(4 + self._additional_params.len());
26023 params.push("name", self._name);
26024
26025 params.extend(self._additional_params.iter());
26026
26027 params.push("alt", "json");
26028 let mut url = self.hub._base_url.clone() + "v1/{+name}:export";
26029 if self._scopes.is_empty() {
26030 self._scopes
26031 .insert(Scope::CloudHealthcare.as_ref().to_string());
26032 }
26033
26034 #[allow(clippy::single_element_loop)]
26035 for &(find_this, param_name) in [("{+name}", "name")].iter() {
26036 url = params.uri_replacement(url, param_name, find_this, true);
26037 }
26038 {
26039 let to_remove = ["name"];
26040 params.remove_params(&to_remove);
26041 }
26042
26043 let url = params.parse_with_url(&url);
26044
26045 let mut json_mime_type = mime::APPLICATION_JSON;
26046 let mut request_value_reader = {
26047 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26048 common::remove_json_null_values(&mut value);
26049 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26050 serde_json::to_writer(&mut dst, &value).unwrap();
26051 dst
26052 };
26053 let request_size = request_value_reader
26054 .seek(std::io::SeekFrom::End(0))
26055 .unwrap();
26056 request_value_reader
26057 .seek(std::io::SeekFrom::Start(0))
26058 .unwrap();
26059
26060 loop {
26061 let token = match self
26062 .hub
26063 .auth
26064 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26065 .await
26066 {
26067 Ok(token) => token,
26068 Err(e) => match dlg.token(e) {
26069 Ok(token) => token,
26070 Err(e) => {
26071 dlg.finished(false);
26072 return Err(common::Error::MissingToken(e));
26073 }
26074 },
26075 };
26076 request_value_reader
26077 .seek(std::io::SeekFrom::Start(0))
26078 .unwrap();
26079 let mut req_result = {
26080 let client = &self.hub.client;
26081 dlg.pre_request();
26082 let mut req_builder = hyper::Request::builder()
26083 .method(hyper::Method::POST)
26084 .uri(url.as_str())
26085 .header(USER_AGENT, self.hub._user_agent.clone());
26086
26087 if let Some(token) = token.as_ref() {
26088 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26089 }
26090
26091 let request = req_builder
26092 .header(CONTENT_TYPE, json_mime_type.to_string())
26093 .header(CONTENT_LENGTH, request_size as u64)
26094 .body(common::to_body(
26095 request_value_reader.get_ref().clone().into(),
26096 ));
26097
26098 client.request(request.unwrap()).await
26099 };
26100
26101 match req_result {
26102 Err(err) => {
26103 if let common::Retry::After(d) = dlg.http_error(&err) {
26104 sleep(d).await;
26105 continue;
26106 }
26107 dlg.finished(false);
26108 return Err(common::Error::HttpError(err));
26109 }
26110 Ok(res) => {
26111 let (mut parts, body) = res.into_parts();
26112 let mut body = common::Body::new(body);
26113 if !parts.status.is_success() {
26114 let bytes = common::to_bytes(body).await.unwrap_or_default();
26115 let error = serde_json::from_str(&common::to_string(&bytes));
26116 let response = common::to_response(parts, bytes.into());
26117
26118 if let common::Retry::After(d) =
26119 dlg.http_failure(&response, error.as_ref().ok())
26120 {
26121 sleep(d).await;
26122 continue;
26123 }
26124
26125 dlg.finished(false);
26126
26127 return Err(match error {
26128 Ok(value) => common::Error::BadRequest(value),
26129 _ => common::Error::Failure(response),
26130 });
26131 }
26132 let response = {
26133 let bytes = common::to_bytes(body).await.unwrap_or_default();
26134 let encoded = common::to_string(&bytes);
26135 match serde_json::from_str(&encoded) {
26136 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26137 Err(error) => {
26138 dlg.response_json_decode_error(&encoded, &error);
26139 return Err(common::Error::JsonDecodeError(
26140 encoded.to_string(),
26141 error,
26142 ));
26143 }
26144 }
26145 };
26146
26147 dlg.finished(true);
26148 return Ok(response);
26149 }
26150 }
26151 }
26152 }
26153
26154 ///
26155 /// Sets the *request* property to the given value.
26156 ///
26157 /// Even though the property as already been set when instantiating this call,
26158 /// we provide this method for API completeness.
26159 pub fn request(
26160 mut self,
26161 new_value: ExportDicomDataRequest,
26162 ) -> ProjectLocationDatasetDicomStoreExportCall<'a, C> {
26163 self._request = new_value;
26164 self
26165 }
26166 /// Required. The DICOM store resource name from which to export the data. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
26167 ///
26168 /// Sets the *name* path property to the given value.
26169 ///
26170 /// Even though the property as already been set when instantiating this call,
26171 /// we provide this method for API completeness.
26172 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreExportCall<'a, C> {
26173 self._name = new_value.to_string();
26174 self
26175 }
26176 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26177 /// while executing the actual API request.
26178 ///
26179 /// ````text
26180 /// It should be used to handle progress information, and to implement a certain level of resilience.
26181 /// ````
26182 ///
26183 /// Sets the *delegate* property to the given value.
26184 pub fn delegate(
26185 mut self,
26186 new_value: &'a mut dyn common::Delegate,
26187 ) -> ProjectLocationDatasetDicomStoreExportCall<'a, C> {
26188 self._delegate = Some(new_value);
26189 self
26190 }
26191
26192 /// Set any additional parameter of the query string used in the request.
26193 /// It should be used to set parameters which are not yet available through their own
26194 /// setters.
26195 ///
26196 /// Please note that this method must not be used to set any of the known parameters
26197 /// which have their own setter method. If done anyway, the request will fail.
26198 ///
26199 /// # Additional Parameters
26200 ///
26201 /// * *$.xgafv* (query-string) - V1 error format.
26202 /// * *access_token* (query-string) - OAuth access token.
26203 /// * *alt* (query-string) - Data format for response.
26204 /// * *callback* (query-string) - JSONP
26205 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26206 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26207 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26208 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26209 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26210 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26211 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26212 pub fn param<T>(
26213 mut self,
26214 name: T,
26215 value: T,
26216 ) -> ProjectLocationDatasetDicomStoreExportCall<'a, C>
26217 where
26218 T: AsRef<str>,
26219 {
26220 self._additional_params
26221 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26222 self
26223 }
26224
26225 /// Identifies the authorization scope for the method you are building.
26226 ///
26227 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26228 /// [`Scope::CloudHealthcare`].
26229 ///
26230 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26231 /// tokens for more than one scope.
26232 ///
26233 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26234 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26235 /// sufficient, a read-write scope will do as well.
26236 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetDicomStoreExportCall<'a, C>
26237 where
26238 St: AsRef<str>,
26239 {
26240 self._scopes.insert(String::from(scope.as_ref()));
26241 self
26242 }
26243 /// Identifies the authorization scope(s) for the method you are building.
26244 ///
26245 /// See [`Self::add_scope()`] for details.
26246 pub fn add_scopes<I, St>(
26247 mut self,
26248 scopes: I,
26249 ) -> ProjectLocationDatasetDicomStoreExportCall<'a, C>
26250 where
26251 I: IntoIterator<Item = St>,
26252 St: AsRef<str>,
26253 {
26254 self._scopes
26255 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26256 self
26257 }
26258
26259 /// Removes all scopes, and no default scope will be used either.
26260 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26261 /// for details).
26262 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreExportCall<'a, C> {
26263 self._scopes.clear();
26264 self
26265 }
26266}
26267
26268/// Gets the specified DICOM store.
26269///
26270/// A builder for the *locations.datasets.dicomStores.get* method supported by a *project* resource.
26271/// It is not used directly, but through a [`ProjectMethods`] instance.
26272///
26273/// # Example
26274///
26275/// Instantiate a resource method builder
26276///
26277/// ```test_harness,no_run
26278/// # extern crate hyper;
26279/// # extern crate hyper_rustls;
26280/// # extern crate google_healthcare1 as healthcare1;
26281/// # async fn dox() {
26282/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26283///
26284/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26285/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26286/// # secret,
26287/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26288/// # ).build().await.unwrap();
26289///
26290/// # let client = hyper_util::client::legacy::Client::builder(
26291/// # hyper_util::rt::TokioExecutor::new()
26292/// # )
26293/// # .build(
26294/// # hyper_rustls::HttpsConnectorBuilder::new()
26295/// # .with_native_roots()
26296/// # .unwrap()
26297/// # .https_or_http()
26298/// # .enable_http1()
26299/// # .build()
26300/// # );
26301/// # let mut hub = CloudHealthcare::new(client, auth);
26302/// // You can configure optional parameters by calling the respective setters at will, and
26303/// // execute the final call using `doit()`.
26304/// // Values shown here are possibly random and not representative !
26305/// let result = hub.projects().locations_datasets_dicom_stores_get("name")
26306/// .doit().await;
26307/// # }
26308/// ```
26309pub struct ProjectLocationDatasetDicomStoreGetCall<'a, C>
26310where
26311 C: 'a,
26312{
26313 hub: &'a CloudHealthcare<C>,
26314 _name: String,
26315 _delegate: Option<&'a mut dyn common::Delegate>,
26316 _additional_params: HashMap<String, String>,
26317 _scopes: BTreeSet<String>,
26318}
26319
26320impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreGetCall<'a, C> {}
26321
26322impl<'a, C> ProjectLocationDatasetDicomStoreGetCall<'a, C>
26323where
26324 C: common::Connector,
26325{
26326 /// Perform the operation you have build so far.
26327 pub async fn doit(mut self) -> common::Result<(common::Response, DicomStore)> {
26328 use std::borrow::Cow;
26329 use std::io::{Read, Seek};
26330
26331 use common::{url::Params, ToParts};
26332 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26333
26334 let mut dd = common::DefaultDelegate;
26335 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26336 dlg.begin(common::MethodInfo {
26337 id: "healthcare.projects.locations.datasets.dicomStores.get",
26338 http_method: hyper::Method::GET,
26339 });
26340
26341 for &field in ["alt", "name"].iter() {
26342 if self._additional_params.contains_key(field) {
26343 dlg.finished(false);
26344 return Err(common::Error::FieldClash(field));
26345 }
26346 }
26347
26348 let mut params = Params::with_capacity(3 + self._additional_params.len());
26349 params.push("name", self._name);
26350
26351 params.extend(self._additional_params.iter());
26352
26353 params.push("alt", "json");
26354 let mut url = self.hub._base_url.clone() + "v1/{+name}";
26355 if self._scopes.is_empty() {
26356 self._scopes
26357 .insert(Scope::CloudHealthcare.as_ref().to_string());
26358 }
26359
26360 #[allow(clippy::single_element_loop)]
26361 for &(find_this, param_name) in [("{+name}", "name")].iter() {
26362 url = params.uri_replacement(url, param_name, find_this, true);
26363 }
26364 {
26365 let to_remove = ["name"];
26366 params.remove_params(&to_remove);
26367 }
26368
26369 let url = params.parse_with_url(&url);
26370
26371 loop {
26372 let token = match self
26373 .hub
26374 .auth
26375 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26376 .await
26377 {
26378 Ok(token) => token,
26379 Err(e) => match dlg.token(e) {
26380 Ok(token) => token,
26381 Err(e) => {
26382 dlg.finished(false);
26383 return Err(common::Error::MissingToken(e));
26384 }
26385 },
26386 };
26387 let mut req_result = {
26388 let client = &self.hub.client;
26389 dlg.pre_request();
26390 let mut req_builder = hyper::Request::builder()
26391 .method(hyper::Method::GET)
26392 .uri(url.as_str())
26393 .header(USER_AGENT, self.hub._user_agent.clone());
26394
26395 if let Some(token) = token.as_ref() {
26396 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26397 }
26398
26399 let request = req_builder
26400 .header(CONTENT_LENGTH, 0_u64)
26401 .body(common::to_body::<String>(None));
26402
26403 client.request(request.unwrap()).await
26404 };
26405
26406 match req_result {
26407 Err(err) => {
26408 if let common::Retry::After(d) = dlg.http_error(&err) {
26409 sleep(d).await;
26410 continue;
26411 }
26412 dlg.finished(false);
26413 return Err(common::Error::HttpError(err));
26414 }
26415 Ok(res) => {
26416 let (mut parts, body) = res.into_parts();
26417 let mut body = common::Body::new(body);
26418 if !parts.status.is_success() {
26419 let bytes = common::to_bytes(body).await.unwrap_or_default();
26420 let error = serde_json::from_str(&common::to_string(&bytes));
26421 let response = common::to_response(parts, bytes.into());
26422
26423 if let common::Retry::After(d) =
26424 dlg.http_failure(&response, error.as_ref().ok())
26425 {
26426 sleep(d).await;
26427 continue;
26428 }
26429
26430 dlg.finished(false);
26431
26432 return Err(match error {
26433 Ok(value) => common::Error::BadRequest(value),
26434 _ => common::Error::Failure(response),
26435 });
26436 }
26437 let response = {
26438 let bytes = common::to_bytes(body).await.unwrap_or_default();
26439 let encoded = common::to_string(&bytes);
26440 match serde_json::from_str(&encoded) {
26441 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26442 Err(error) => {
26443 dlg.response_json_decode_error(&encoded, &error);
26444 return Err(common::Error::JsonDecodeError(
26445 encoded.to_string(),
26446 error,
26447 ));
26448 }
26449 }
26450 };
26451
26452 dlg.finished(true);
26453 return Ok(response);
26454 }
26455 }
26456 }
26457 }
26458
26459 /// Required. The resource name of the DICOM store to get.
26460 ///
26461 /// Sets the *name* path property to the given value.
26462 ///
26463 /// Even though the property as already been set when instantiating this call,
26464 /// we provide this method for API completeness.
26465 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreGetCall<'a, C> {
26466 self._name = new_value.to_string();
26467 self
26468 }
26469 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26470 /// while executing the actual API request.
26471 ///
26472 /// ````text
26473 /// It should be used to handle progress information, and to implement a certain level of resilience.
26474 /// ````
26475 ///
26476 /// Sets the *delegate* property to the given value.
26477 pub fn delegate(
26478 mut self,
26479 new_value: &'a mut dyn common::Delegate,
26480 ) -> ProjectLocationDatasetDicomStoreGetCall<'a, C> {
26481 self._delegate = Some(new_value);
26482 self
26483 }
26484
26485 /// Set any additional parameter of the query string used in the request.
26486 /// It should be used to set parameters which are not yet available through their own
26487 /// setters.
26488 ///
26489 /// Please note that this method must not be used to set any of the known parameters
26490 /// which have their own setter method. If done anyway, the request will fail.
26491 ///
26492 /// # Additional Parameters
26493 ///
26494 /// * *$.xgafv* (query-string) - V1 error format.
26495 /// * *access_token* (query-string) - OAuth access token.
26496 /// * *alt* (query-string) - Data format for response.
26497 /// * *callback* (query-string) - JSONP
26498 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26499 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26500 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26501 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26502 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26503 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26504 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26505 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreGetCall<'a, C>
26506 where
26507 T: AsRef<str>,
26508 {
26509 self._additional_params
26510 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26511 self
26512 }
26513
26514 /// Identifies the authorization scope for the method you are building.
26515 ///
26516 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26517 /// [`Scope::CloudHealthcare`].
26518 ///
26519 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26520 /// tokens for more than one scope.
26521 ///
26522 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26523 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26524 /// sufficient, a read-write scope will do as well.
26525 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetDicomStoreGetCall<'a, C>
26526 where
26527 St: AsRef<str>,
26528 {
26529 self._scopes.insert(String::from(scope.as_ref()));
26530 self
26531 }
26532 /// Identifies the authorization scope(s) for the method you are building.
26533 ///
26534 /// See [`Self::add_scope()`] for details.
26535 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetDicomStoreGetCall<'a, C>
26536 where
26537 I: IntoIterator<Item = St>,
26538 St: AsRef<str>,
26539 {
26540 self._scopes
26541 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26542 self
26543 }
26544
26545 /// Removes all scopes, and no default scope will be used either.
26546 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26547 /// for details).
26548 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreGetCall<'a, C> {
26549 self._scopes.clear();
26550 self
26551 }
26552}
26553
26554/// Gets metrics associated with the DICOM store.
26555///
26556/// A builder for the *locations.datasets.dicomStores.getDICOMStoreMetrics* method supported by a *project* resource.
26557/// It is not used directly, but through a [`ProjectMethods`] instance.
26558///
26559/// # Example
26560///
26561/// Instantiate a resource method builder
26562///
26563/// ```test_harness,no_run
26564/// # extern crate hyper;
26565/// # extern crate hyper_rustls;
26566/// # extern crate google_healthcare1 as healthcare1;
26567/// # async fn dox() {
26568/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26569///
26570/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26571/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26572/// # secret,
26573/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26574/// # ).build().await.unwrap();
26575///
26576/// # let client = hyper_util::client::legacy::Client::builder(
26577/// # hyper_util::rt::TokioExecutor::new()
26578/// # )
26579/// # .build(
26580/// # hyper_rustls::HttpsConnectorBuilder::new()
26581/// # .with_native_roots()
26582/// # .unwrap()
26583/// # .https_or_http()
26584/// # .enable_http1()
26585/// # .build()
26586/// # );
26587/// # let mut hub = CloudHealthcare::new(client, auth);
26588/// // You can configure optional parameters by calling the respective setters at will, and
26589/// // execute the final call using `doit()`.
26590/// // Values shown here are possibly random and not representative !
26591/// let result = hub.projects().locations_datasets_dicom_stores_get_dicom_store_metrics("name")
26592/// .doit().await;
26593/// # }
26594/// ```
26595pub struct ProjectLocationDatasetDicomStoreGetDICOMStoreMetricCall<'a, C>
26596where
26597 C: 'a,
26598{
26599 hub: &'a CloudHealthcare<C>,
26600 _name: String,
26601 _delegate: Option<&'a mut dyn common::Delegate>,
26602 _additional_params: HashMap<String, String>,
26603 _scopes: BTreeSet<String>,
26604}
26605
26606impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreGetDICOMStoreMetricCall<'a, C> {}
26607
26608impl<'a, C> ProjectLocationDatasetDicomStoreGetDICOMStoreMetricCall<'a, C>
26609where
26610 C: common::Connector,
26611{
26612 /// Perform the operation you have build so far.
26613 pub async fn doit(mut self) -> common::Result<(common::Response, DicomStoreMetrics)> {
26614 use std::borrow::Cow;
26615 use std::io::{Read, Seek};
26616
26617 use common::{url::Params, ToParts};
26618 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26619
26620 let mut dd = common::DefaultDelegate;
26621 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26622 dlg.begin(common::MethodInfo {
26623 id: "healthcare.projects.locations.datasets.dicomStores.getDICOMStoreMetrics",
26624 http_method: hyper::Method::GET,
26625 });
26626
26627 for &field in ["alt", "name"].iter() {
26628 if self._additional_params.contains_key(field) {
26629 dlg.finished(false);
26630 return Err(common::Error::FieldClash(field));
26631 }
26632 }
26633
26634 let mut params = Params::with_capacity(3 + self._additional_params.len());
26635 params.push("name", self._name);
26636
26637 params.extend(self._additional_params.iter());
26638
26639 params.push("alt", "json");
26640 let mut url = self.hub._base_url.clone() + "v1/{+name}:getDICOMStoreMetrics";
26641 if self._scopes.is_empty() {
26642 self._scopes
26643 .insert(Scope::CloudHealthcare.as_ref().to_string());
26644 }
26645
26646 #[allow(clippy::single_element_loop)]
26647 for &(find_this, param_name) in [("{+name}", "name")].iter() {
26648 url = params.uri_replacement(url, param_name, find_this, true);
26649 }
26650 {
26651 let to_remove = ["name"];
26652 params.remove_params(&to_remove);
26653 }
26654
26655 let url = params.parse_with_url(&url);
26656
26657 loop {
26658 let token = match self
26659 .hub
26660 .auth
26661 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26662 .await
26663 {
26664 Ok(token) => token,
26665 Err(e) => match dlg.token(e) {
26666 Ok(token) => token,
26667 Err(e) => {
26668 dlg.finished(false);
26669 return Err(common::Error::MissingToken(e));
26670 }
26671 },
26672 };
26673 let mut req_result = {
26674 let client = &self.hub.client;
26675 dlg.pre_request();
26676 let mut req_builder = hyper::Request::builder()
26677 .method(hyper::Method::GET)
26678 .uri(url.as_str())
26679 .header(USER_AGENT, self.hub._user_agent.clone());
26680
26681 if let Some(token) = token.as_ref() {
26682 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26683 }
26684
26685 let request = req_builder
26686 .header(CONTENT_LENGTH, 0_u64)
26687 .body(common::to_body::<String>(None));
26688
26689 client.request(request.unwrap()).await
26690 };
26691
26692 match req_result {
26693 Err(err) => {
26694 if let common::Retry::After(d) = dlg.http_error(&err) {
26695 sleep(d).await;
26696 continue;
26697 }
26698 dlg.finished(false);
26699 return Err(common::Error::HttpError(err));
26700 }
26701 Ok(res) => {
26702 let (mut parts, body) = res.into_parts();
26703 let mut body = common::Body::new(body);
26704 if !parts.status.is_success() {
26705 let bytes = common::to_bytes(body).await.unwrap_or_default();
26706 let error = serde_json::from_str(&common::to_string(&bytes));
26707 let response = common::to_response(parts, bytes.into());
26708
26709 if let common::Retry::After(d) =
26710 dlg.http_failure(&response, error.as_ref().ok())
26711 {
26712 sleep(d).await;
26713 continue;
26714 }
26715
26716 dlg.finished(false);
26717
26718 return Err(match error {
26719 Ok(value) => common::Error::BadRequest(value),
26720 _ => common::Error::Failure(response),
26721 });
26722 }
26723 let response = {
26724 let bytes = common::to_bytes(body).await.unwrap_or_default();
26725 let encoded = common::to_string(&bytes);
26726 match serde_json::from_str(&encoded) {
26727 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26728 Err(error) => {
26729 dlg.response_json_decode_error(&encoded, &error);
26730 return Err(common::Error::JsonDecodeError(
26731 encoded.to_string(),
26732 error,
26733 ));
26734 }
26735 }
26736 };
26737
26738 dlg.finished(true);
26739 return Ok(response);
26740 }
26741 }
26742 }
26743 }
26744
26745 /// Required. The resource name of the DICOM store to get metrics for.
26746 ///
26747 /// Sets the *name* path property to the given value.
26748 ///
26749 /// Even though the property as already been set when instantiating this call,
26750 /// we provide this method for API completeness.
26751 pub fn name(
26752 mut self,
26753 new_value: &str,
26754 ) -> ProjectLocationDatasetDicomStoreGetDICOMStoreMetricCall<'a, C> {
26755 self._name = new_value.to_string();
26756 self
26757 }
26758 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26759 /// while executing the actual API request.
26760 ///
26761 /// ````text
26762 /// It should be used to handle progress information, and to implement a certain level of resilience.
26763 /// ````
26764 ///
26765 /// Sets the *delegate* property to the given value.
26766 pub fn delegate(
26767 mut self,
26768 new_value: &'a mut dyn common::Delegate,
26769 ) -> ProjectLocationDatasetDicomStoreGetDICOMStoreMetricCall<'a, C> {
26770 self._delegate = Some(new_value);
26771 self
26772 }
26773
26774 /// Set any additional parameter of the query string used in the request.
26775 /// It should be used to set parameters which are not yet available through their own
26776 /// setters.
26777 ///
26778 /// Please note that this method must not be used to set any of the known parameters
26779 /// which have their own setter method. If done anyway, the request will fail.
26780 ///
26781 /// # Additional Parameters
26782 ///
26783 /// * *$.xgafv* (query-string) - V1 error format.
26784 /// * *access_token* (query-string) - OAuth access token.
26785 /// * *alt* (query-string) - Data format for response.
26786 /// * *callback* (query-string) - JSONP
26787 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26788 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
26789 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26790 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26791 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
26792 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26793 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26794 pub fn param<T>(
26795 mut self,
26796 name: T,
26797 value: T,
26798 ) -> ProjectLocationDatasetDicomStoreGetDICOMStoreMetricCall<'a, C>
26799 where
26800 T: AsRef<str>,
26801 {
26802 self._additional_params
26803 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26804 self
26805 }
26806
26807 /// Identifies the authorization scope for the method you are building.
26808 ///
26809 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26810 /// [`Scope::CloudHealthcare`].
26811 ///
26812 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26813 /// tokens for more than one scope.
26814 ///
26815 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26816 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26817 /// sufficient, a read-write scope will do as well.
26818 pub fn add_scope<St>(
26819 mut self,
26820 scope: St,
26821 ) -> ProjectLocationDatasetDicomStoreGetDICOMStoreMetricCall<'a, C>
26822 where
26823 St: AsRef<str>,
26824 {
26825 self._scopes.insert(String::from(scope.as_ref()));
26826 self
26827 }
26828 /// Identifies the authorization scope(s) for the method you are building.
26829 ///
26830 /// See [`Self::add_scope()`] for details.
26831 pub fn add_scopes<I, St>(
26832 mut self,
26833 scopes: I,
26834 ) -> ProjectLocationDatasetDicomStoreGetDICOMStoreMetricCall<'a, C>
26835 where
26836 I: IntoIterator<Item = St>,
26837 St: AsRef<str>,
26838 {
26839 self._scopes
26840 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26841 self
26842 }
26843
26844 /// Removes all scopes, and no default scope will be used either.
26845 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26846 /// for details).
26847 pub fn clear_scopes(
26848 mut self,
26849 ) -> ProjectLocationDatasetDicomStoreGetDICOMStoreMetricCall<'a, C> {
26850 self._scopes.clear();
26851 self
26852 }
26853}
26854
26855/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
26856///
26857/// A builder for the *locations.datasets.dicomStores.getIamPolicy* method supported by a *project* resource.
26858/// It is not used directly, but through a [`ProjectMethods`] instance.
26859///
26860/// # Example
26861///
26862/// Instantiate a resource method builder
26863///
26864/// ```test_harness,no_run
26865/// # extern crate hyper;
26866/// # extern crate hyper_rustls;
26867/// # extern crate google_healthcare1 as healthcare1;
26868/// # async fn dox() {
26869/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26870///
26871/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26872/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26873/// # secret,
26874/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26875/// # ).build().await.unwrap();
26876///
26877/// # let client = hyper_util::client::legacy::Client::builder(
26878/// # hyper_util::rt::TokioExecutor::new()
26879/// # )
26880/// # .build(
26881/// # hyper_rustls::HttpsConnectorBuilder::new()
26882/// # .with_native_roots()
26883/// # .unwrap()
26884/// # .https_or_http()
26885/// # .enable_http1()
26886/// # .build()
26887/// # );
26888/// # let mut hub = CloudHealthcare::new(client, auth);
26889/// // You can configure optional parameters by calling the respective setters at will, and
26890/// // execute the final call using `doit()`.
26891/// // Values shown here are possibly random and not representative !
26892/// let result = hub.projects().locations_datasets_dicom_stores_get_iam_policy("resource")
26893/// .options_requested_policy_version(-77)
26894/// .doit().await;
26895/// # }
26896/// ```
26897pub struct ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C>
26898where
26899 C: 'a,
26900{
26901 hub: &'a CloudHealthcare<C>,
26902 _resource: String,
26903 _options_requested_policy_version: Option<i32>,
26904 _delegate: Option<&'a mut dyn common::Delegate>,
26905 _additional_params: HashMap<String, String>,
26906 _scopes: BTreeSet<String>,
26907}
26908
26909impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C> {}
26910
26911impl<'a, C> ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C>
26912where
26913 C: common::Connector,
26914{
26915 /// Perform the operation you have build so far.
26916 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
26917 use std::borrow::Cow;
26918 use std::io::{Read, Seek};
26919
26920 use common::{url::Params, ToParts};
26921 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26922
26923 let mut dd = common::DefaultDelegate;
26924 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26925 dlg.begin(common::MethodInfo {
26926 id: "healthcare.projects.locations.datasets.dicomStores.getIamPolicy",
26927 http_method: hyper::Method::GET,
26928 });
26929
26930 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
26931 if self._additional_params.contains_key(field) {
26932 dlg.finished(false);
26933 return Err(common::Error::FieldClash(field));
26934 }
26935 }
26936
26937 let mut params = Params::with_capacity(4 + self._additional_params.len());
26938 params.push("resource", self._resource);
26939 if let Some(value) = self._options_requested_policy_version.as_ref() {
26940 params.push("options.requestedPolicyVersion", value.to_string());
26941 }
26942
26943 params.extend(self._additional_params.iter());
26944
26945 params.push("alt", "json");
26946 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
26947 if self._scopes.is_empty() {
26948 self._scopes
26949 .insert(Scope::CloudHealthcare.as_ref().to_string());
26950 }
26951
26952 #[allow(clippy::single_element_loop)]
26953 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
26954 url = params.uri_replacement(url, param_name, find_this, true);
26955 }
26956 {
26957 let to_remove = ["resource"];
26958 params.remove_params(&to_remove);
26959 }
26960
26961 let url = params.parse_with_url(&url);
26962
26963 loop {
26964 let token = match self
26965 .hub
26966 .auth
26967 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26968 .await
26969 {
26970 Ok(token) => token,
26971 Err(e) => match dlg.token(e) {
26972 Ok(token) => token,
26973 Err(e) => {
26974 dlg.finished(false);
26975 return Err(common::Error::MissingToken(e));
26976 }
26977 },
26978 };
26979 let mut req_result = {
26980 let client = &self.hub.client;
26981 dlg.pre_request();
26982 let mut req_builder = hyper::Request::builder()
26983 .method(hyper::Method::GET)
26984 .uri(url.as_str())
26985 .header(USER_AGENT, self.hub._user_agent.clone());
26986
26987 if let Some(token) = token.as_ref() {
26988 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26989 }
26990
26991 let request = req_builder
26992 .header(CONTENT_LENGTH, 0_u64)
26993 .body(common::to_body::<String>(None));
26994
26995 client.request(request.unwrap()).await
26996 };
26997
26998 match req_result {
26999 Err(err) => {
27000 if let common::Retry::After(d) = dlg.http_error(&err) {
27001 sleep(d).await;
27002 continue;
27003 }
27004 dlg.finished(false);
27005 return Err(common::Error::HttpError(err));
27006 }
27007 Ok(res) => {
27008 let (mut parts, body) = res.into_parts();
27009 let mut body = common::Body::new(body);
27010 if !parts.status.is_success() {
27011 let bytes = common::to_bytes(body).await.unwrap_or_default();
27012 let error = serde_json::from_str(&common::to_string(&bytes));
27013 let response = common::to_response(parts, bytes.into());
27014
27015 if let common::Retry::After(d) =
27016 dlg.http_failure(&response, error.as_ref().ok())
27017 {
27018 sleep(d).await;
27019 continue;
27020 }
27021
27022 dlg.finished(false);
27023
27024 return Err(match error {
27025 Ok(value) => common::Error::BadRequest(value),
27026 _ => common::Error::Failure(response),
27027 });
27028 }
27029 let response = {
27030 let bytes = common::to_bytes(body).await.unwrap_or_default();
27031 let encoded = common::to_string(&bytes);
27032 match serde_json::from_str(&encoded) {
27033 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27034 Err(error) => {
27035 dlg.response_json_decode_error(&encoded, &error);
27036 return Err(common::Error::JsonDecodeError(
27037 encoded.to_string(),
27038 error,
27039 ));
27040 }
27041 }
27042 };
27043
27044 dlg.finished(true);
27045 return Ok(response);
27046 }
27047 }
27048 }
27049 }
27050
27051 /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
27052 ///
27053 /// Sets the *resource* path property to the given value.
27054 ///
27055 /// Even though the property as already been set when instantiating this call,
27056 /// we provide this method for API completeness.
27057 pub fn resource(
27058 mut self,
27059 new_value: &str,
27060 ) -> ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C> {
27061 self._resource = new_value.to_string();
27062 self
27063 }
27064 /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
27065 ///
27066 /// Sets the *options.requested policy version* query property to the given value.
27067 pub fn options_requested_policy_version(
27068 mut self,
27069 new_value: i32,
27070 ) -> ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C> {
27071 self._options_requested_policy_version = Some(new_value);
27072 self
27073 }
27074 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27075 /// while executing the actual API request.
27076 ///
27077 /// ````text
27078 /// It should be used to handle progress information, and to implement a certain level of resilience.
27079 /// ````
27080 ///
27081 /// Sets the *delegate* property to the given value.
27082 pub fn delegate(
27083 mut self,
27084 new_value: &'a mut dyn common::Delegate,
27085 ) -> ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C> {
27086 self._delegate = Some(new_value);
27087 self
27088 }
27089
27090 /// Set any additional parameter of the query string used in the request.
27091 /// It should be used to set parameters which are not yet available through their own
27092 /// setters.
27093 ///
27094 /// Please note that this method must not be used to set any of the known parameters
27095 /// which have their own setter method. If done anyway, the request will fail.
27096 ///
27097 /// # Additional Parameters
27098 ///
27099 /// * *$.xgafv* (query-string) - V1 error format.
27100 /// * *access_token* (query-string) - OAuth access token.
27101 /// * *alt* (query-string) - Data format for response.
27102 /// * *callback* (query-string) - JSONP
27103 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27104 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27105 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27106 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27107 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27108 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27109 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27110 pub fn param<T>(
27111 mut self,
27112 name: T,
27113 value: T,
27114 ) -> ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C>
27115 where
27116 T: AsRef<str>,
27117 {
27118 self._additional_params
27119 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27120 self
27121 }
27122
27123 /// Identifies the authorization scope for the method you are building.
27124 ///
27125 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27126 /// [`Scope::CloudHealthcare`].
27127 ///
27128 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27129 /// tokens for more than one scope.
27130 ///
27131 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27132 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27133 /// sufficient, a read-write scope will do as well.
27134 pub fn add_scope<St>(
27135 mut self,
27136 scope: St,
27137 ) -> ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C>
27138 where
27139 St: AsRef<str>,
27140 {
27141 self._scopes.insert(String::from(scope.as_ref()));
27142 self
27143 }
27144 /// Identifies the authorization scope(s) for the method you are building.
27145 ///
27146 /// See [`Self::add_scope()`] for details.
27147 pub fn add_scopes<I, St>(
27148 mut self,
27149 scopes: I,
27150 ) -> ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C>
27151 where
27152 I: IntoIterator<Item = St>,
27153 St: AsRef<str>,
27154 {
27155 self._scopes
27156 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27157 self
27158 }
27159
27160 /// Removes all scopes, and no default scope will be used either.
27161 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27162 /// for details).
27163 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreGetIamPolicyCall<'a, C> {
27164 self._scopes.clear();
27165 self
27166 }
27167}
27168
27169/// Imports data into the DICOM store by copying it from the specified source. Errors are logged to Cloud Logging. For more information, see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging). The metadata field type is OperationMetadata.
27170///
27171/// A builder for the *locations.datasets.dicomStores.import* method supported by a *project* resource.
27172/// It is not used directly, but through a [`ProjectMethods`] instance.
27173///
27174/// # Example
27175///
27176/// Instantiate a resource method builder
27177///
27178/// ```test_harness,no_run
27179/// # extern crate hyper;
27180/// # extern crate hyper_rustls;
27181/// # extern crate google_healthcare1 as healthcare1;
27182/// use healthcare1::api::ImportDicomDataRequest;
27183/// # async fn dox() {
27184/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27185///
27186/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27187/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27188/// # secret,
27189/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27190/// # ).build().await.unwrap();
27191///
27192/// # let client = hyper_util::client::legacy::Client::builder(
27193/// # hyper_util::rt::TokioExecutor::new()
27194/// # )
27195/// # .build(
27196/// # hyper_rustls::HttpsConnectorBuilder::new()
27197/// # .with_native_roots()
27198/// # .unwrap()
27199/// # .https_or_http()
27200/// # .enable_http1()
27201/// # .build()
27202/// # );
27203/// # let mut hub = CloudHealthcare::new(client, auth);
27204/// // As the method needs a request, you would usually fill it with the desired information
27205/// // into the respective structure. Some of the parts shown here might not be applicable !
27206/// // Values shown here are possibly random and not representative !
27207/// let mut req = ImportDicomDataRequest::default();
27208///
27209/// // You can configure optional parameters by calling the respective setters at will, and
27210/// // execute the final call using `doit()`.
27211/// // Values shown here are possibly random and not representative !
27212/// let result = hub.projects().locations_datasets_dicom_stores_import(req, "name")
27213/// .doit().await;
27214/// # }
27215/// ```
27216pub struct ProjectLocationDatasetDicomStoreImportCall<'a, C>
27217where
27218 C: 'a,
27219{
27220 hub: &'a CloudHealthcare<C>,
27221 _request: ImportDicomDataRequest,
27222 _name: String,
27223 _delegate: Option<&'a mut dyn common::Delegate>,
27224 _additional_params: HashMap<String, String>,
27225 _scopes: BTreeSet<String>,
27226}
27227
27228impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreImportCall<'a, C> {}
27229
27230impl<'a, C> ProjectLocationDatasetDicomStoreImportCall<'a, C>
27231where
27232 C: common::Connector,
27233{
27234 /// Perform the operation you have build so far.
27235 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
27236 use std::borrow::Cow;
27237 use std::io::{Read, Seek};
27238
27239 use common::{url::Params, ToParts};
27240 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27241
27242 let mut dd = common::DefaultDelegate;
27243 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27244 dlg.begin(common::MethodInfo {
27245 id: "healthcare.projects.locations.datasets.dicomStores.import",
27246 http_method: hyper::Method::POST,
27247 });
27248
27249 for &field in ["alt", "name"].iter() {
27250 if self._additional_params.contains_key(field) {
27251 dlg.finished(false);
27252 return Err(common::Error::FieldClash(field));
27253 }
27254 }
27255
27256 let mut params = Params::with_capacity(4 + self._additional_params.len());
27257 params.push("name", self._name);
27258
27259 params.extend(self._additional_params.iter());
27260
27261 params.push("alt", "json");
27262 let mut url = self.hub._base_url.clone() + "v1/{+name}:import";
27263 if self._scopes.is_empty() {
27264 self._scopes
27265 .insert(Scope::CloudHealthcare.as_ref().to_string());
27266 }
27267
27268 #[allow(clippy::single_element_loop)]
27269 for &(find_this, param_name) in [("{+name}", "name")].iter() {
27270 url = params.uri_replacement(url, param_name, find_this, true);
27271 }
27272 {
27273 let to_remove = ["name"];
27274 params.remove_params(&to_remove);
27275 }
27276
27277 let url = params.parse_with_url(&url);
27278
27279 let mut json_mime_type = mime::APPLICATION_JSON;
27280 let mut request_value_reader = {
27281 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27282 common::remove_json_null_values(&mut value);
27283 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27284 serde_json::to_writer(&mut dst, &value).unwrap();
27285 dst
27286 };
27287 let request_size = request_value_reader
27288 .seek(std::io::SeekFrom::End(0))
27289 .unwrap();
27290 request_value_reader
27291 .seek(std::io::SeekFrom::Start(0))
27292 .unwrap();
27293
27294 loop {
27295 let token = match self
27296 .hub
27297 .auth
27298 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27299 .await
27300 {
27301 Ok(token) => token,
27302 Err(e) => match dlg.token(e) {
27303 Ok(token) => token,
27304 Err(e) => {
27305 dlg.finished(false);
27306 return Err(common::Error::MissingToken(e));
27307 }
27308 },
27309 };
27310 request_value_reader
27311 .seek(std::io::SeekFrom::Start(0))
27312 .unwrap();
27313 let mut req_result = {
27314 let client = &self.hub.client;
27315 dlg.pre_request();
27316 let mut req_builder = hyper::Request::builder()
27317 .method(hyper::Method::POST)
27318 .uri(url.as_str())
27319 .header(USER_AGENT, self.hub._user_agent.clone());
27320
27321 if let Some(token) = token.as_ref() {
27322 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27323 }
27324
27325 let request = req_builder
27326 .header(CONTENT_TYPE, json_mime_type.to_string())
27327 .header(CONTENT_LENGTH, request_size as u64)
27328 .body(common::to_body(
27329 request_value_reader.get_ref().clone().into(),
27330 ));
27331
27332 client.request(request.unwrap()).await
27333 };
27334
27335 match req_result {
27336 Err(err) => {
27337 if let common::Retry::After(d) = dlg.http_error(&err) {
27338 sleep(d).await;
27339 continue;
27340 }
27341 dlg.finished(false);
27342 return Err(common::Error::HttpError(err));
27343 }
27344 Ok(res) => {
27345 let (mut parts, body) = res.into_parts();
27346 let mut body = common::Body::new(body);
27347 if !parts.status.is_success() {
27348 let bytes = common::to_bytes(body).await.unwrap_or_default();
27349 let error = serde_json::from_str(&common::to_string(&bytes));
27350 let response = common::to_response(parts, bytes.into());
27351
27352 if let common::Retry::After(d) =
27353 dlg.http_failure(&response, error.as_ref().ok())
27354 {
27355 sleep(d).await;
27356 continue;
27357 }
27358
27359 dlg.finished(false);
27360
27361 return Err(match error {
27362 Ok(value) => common::Error::BadRequest(value),
27363 _ => common::Error::Failure(response),
27364 });
27365 }
27366 let response = {
27367 let bytes = common::to_bytes(body).await.unwrap_or_default();
27368 let encoded = common::to_string(&bytes);
27369 match serde_json::from_str(&encoded) {
27370 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27371 Err(error) => {
27372 dlg.response_json_decode_error(&encoded, &error);
27373 return Err(common::Error::JsonDecodeError(
27374 encoded.to_string(),
27375 error,
27376 ));
27377 }
27378 }
27379 };
27380
27381 dlg.finished(true);
27382 return Ok(response);
27383 }
27384 }
27385 }
27386 }
27387
27388 ///
27389 /// Sets the *request* property to the given value.
27390 ///
27391 /// Even though the property as already been set when instantiating this call,
27392 /// we provide this method for API completeness.
27393 pub fn request(
27394 mut self,
27395 new_value: ImportDicomDataRequest,
27396 ) -> ProjectLocationDatasetDicomStoreImportCall<'a, C> {
27397 self._request = new_value;
27398 self
27399 }
27400 /// Required. The name of the DICOM store resource into which the data is imported. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
27401 ///
27402 /// Sets the *name* path property to the given value.
27403 ///
27404 /// Even though the property as already been set when instantiating this call,
27405 /// we provide this method for API completeness.
27406 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreImportCall<'a, C> {
27407 self._name = new_value.to_string();
27408 self
27409 }
27410 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27411 /// while executing the actual API request.
27412 ///
27413 /// ````text
27414 /// It should be used to handle progress information, and to implement a certain level of resilience.
27415 /// ````
27416 ///
27417 /// Sets the *delegate* property to the given value.
27418 pub fn delegate(
27419 mut self,
27420 new_value: &'a mut dyn common::Delegate,
27421 ) -> ProjectLocationDatasetDicomStoreImportCall<'a, C> {
27422 self._delegate = Some(new_value);
27423 self
27424 }
27425
27426 /// Set any additional parameter of the query string used in the request.
27427 /// It should be used to set parameters which are not yet available through their own
27428 /// setters.
27429 ///
27430 /// Please note that this method must not be used to set any of the known parameters
27431 /// which have their own setter method. If done anyway, the request will fail.
27432 ///
27433 /// # Additional Parameters
27434 ///
27435 /// * *$.xgafv* (query-string) - V1 error format.
27436 /// * *access_token* (query-string) - OAuth access token.
27437 /// * *alt* (query-string) - Data format for response.
27438 /// * *callback* (query-string) - JSONP
27439 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27440 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27441 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27442 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27443 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27444 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27445 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27446 pub fn param<T>(
27447 mut self,
27448 name: T,
27449 value: T,
27450 ) -> ProjectLocationDatasetDicomStoreImportCall<'a, C>
27451 where
27452 T: AsRef<str>,
27453 {
27454 self._additional_params
27455 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27456 self
27457 }
27458
27459 /// Identifies the authorization scope for the method you are building.
27460 ///
27461 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27462 /// [`Scope::CloudHealthcare`].
27463 ///
27464 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27465 /// tokens for more than one scope.
27466 ///
27467 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27468 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27469 /// sufficient, a read-write scope will do as well.
27470 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetDicomStoreImportCall<'a, C>
27471 where
27472 St: AsRef<str>,
27473 {
27474 self._scopes.insert(String::from(scope.as_ref()));
27475 self
27476 }
27477 /// Identifies the authorization scope(s) for the method you are building.
27478 ///
27479 /// See [`Self::add_scope()`] for details.
27480 pub fn add_scopes<I, St>(
27481 mut self,
27482 scopes: I,
27483 ) -> ProjectLocationDatasetDicomStoreImportCall<'a, C>
27484 where
27485 I: IntoIterator<Item = St>,
27486 St: AsRef<str>,
27487 {
27488 self._scopes
27489 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27490 self
27491 }
27492
27493 /// Removes all scopes, and no default scope will be used either.
27494 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27495 /// for details).
27496 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreImportCall<'a, C> {
27497 self._scopes.clear();
27498 self
27499 }
27500}
27501
27502/// Lists the DICOM stores in the given dataset.
27503///
27504/// A builder for the *locations.datasets.dicomStores.list* method supported by a *project* resource.
27505/// It is not used directly, but through a [`ProjectMethods`] instance.
27506///
27507/// # Example
27508///
27509/// Instantiate a resource method builder
27510///
27511/// ```test_harness,no_run
27512/// # extern crate hyper;
27513/// # extern crate hyper_rustls;
27514/// # extern crate google_healthcare1 as healthcare1;
27515/// # async fn dox() {
27516/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27517///
27518/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27519/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27520/// # secret,
27521/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27522/// # ).build().await.unwrap();
27523///
27524/// # let client = hyper_util::client::legacy::Client::builder(
27525/// # hyper_util::rt::TokioExecutor::new()
27526/// # )
27527/// # .build(
27528/// # hyper_rustls::HttpsConnectorBuilder::new()
27529/// # .with_native_roots()
27530/// # .unwrap()
27531/// # .https_or_http()
27532/// # .enable_http1()
27533/// # .build()
27534/// # );
27535/// # let mut hub = CloudHealthcare::new(client, auth);
27536/// // You can configure optional parameters by calling the respective setters at will, and
27537/// // execute the final call using `doit()`.
27538/// // Values shown here are possibly random and not representative !
27539/// let result = hub.projects().locations_datasets_dicom_stores_list("parent")
27540/// .page_token("dolores")
27541/// .page_size(-95)
27542/// .filter("erat")
27543/// .doit().await;
27544/// # }
27545/// ```
27546pub struct ProjectLocationDatasetDicomStoreListCall<'a, C>
27547where
27548 C: 'a,
27549{
27550 hub: &'a CloudHealthcare<C>,
27551 _parent: String,
27552 _page_token: Option<String>,
27553 _page_size: Option<i32>,
27554 _filter: Option<String>,
27555 _delegate: Option<&'a mut dyn common::Delegate>,
27556 _additional_params: HashMap<String, String>,
27557 _scopes: BTreeSet<String>,
27558}
27559
27560impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreListCall<'a, C> {}
27561
27562impl<'a, C> ProjectLocationDatasetDicomStoreListCall<'a, C>
27563where
27564 C: common::Connector,
27565{
27566 /// Perform the operation you have build so far.
27567 pub async fn doit(mut self) -> common::Result<(common::Response, ListDicomStoresResponse)> {
27568 use std::borrow::Cow;
27569 use std::io::{Read, Seek};
27570
27571 use common::{url::Params, ToParts};
27572 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27573
27574 let mut dd = common::DefaultDelegate;
27575 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27576 dlg.begin(common::MethodInfo {
27577 id: "healthcare.projects.locations.datasets.dicomStores.list",
27578 http_method: hyper::Method::GET,
27579 });
27580
27581 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
27582 if self._additional_params.contains_key(field) {
27583 dlg.finished(false);
27584 return Err(common::Error::FieldClash(field));
27585 }
27586 }
27587
27588 let mut params = Params::with_capacity(6 + self._additional_params.len());
27589 params.push("parent", self._parent);
27590 if let Some(value) = self._page_token.as_ref() {
27591 params.push("pageToken", value);
27592 }
27593 if let Some(value) = self._page_size.as_ref() {
27594 params.push("pageSize", value.to_string());
27595 }
27596 if let Some(value) = self._filter.as_ref() {
27597 params.push("filter", value);
27598 }
27599
27600 params.extend(self._additional_params.iter());
27601
27602 params.push("alt", "json");
27603 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomStores";
27604 if self._scopes.is_empty() {
27605 self._scopes
27606 .insert(Scope::CloudHealthcare.as_ref().to_string());
27607 }
27608
27609 #[allow(clippy::single_element_loop)]
27610 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
27611 url = params.uri_replacement(url, param_name, find_this, true);
27612 }
27613 {
27614 let to_remove = ["parent"];
27615 params.remove_params(&to_remove);
27616 }
27617
27618 let url = params.parse_with_url(&url);
27619
27620 loop {
27621 let token = match self
27622 .hub
27623 .auth
27624 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27625 .await
27626 {
27627 Ok(token) => token,
27628 Err(e) => match dlg.token(e) {
27629 Ok(token) => token,
27630 Err(e) => {
27631 dlg.finished(false);
27632 return Err(common::Error::MissingToken(e));
27633 }
27634 },
27635 };
27636 let mut req_result = {
27637 let client = &self.hub.client;
27638 dlg.pre_request();
27639 let mut req_builder = hyper::Request::builder()
27640 .method(hyper::Method::GET)
27641 .uri(url.as_str())
27642 .header(USER_AGENT, self.hub._user_agent.clone());
27643
27644 if let Some(token) = token.as_ref() {
27645 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27646 }
27647
27648 let request = req_builder
27649 .header(CONTENT_LENGTH, 0_u64)
27650 .body(common::to_body::<String>(None));
27651
27652 client.request(request.unwrap()).await
27653 };
27654
27655 match req_result {
27656 Err(err) => {
27657 if let common::Retry::After(d) = dlg.http_error(&err) {
27658 sleep(d).await;
27659 continue;
27660 }
27661 dlg.finished(false);
27662 return Err(common::Error::HttpError(err));
27663 }
27664 Ok(res) => {
27665 let (mut parts, body) = res.into_parts();
27666 let mut body = common::Body::new(body);
27667 if !parts.status.is_success() {
27668 let bytes = common::to_bytes(body).await.unwrap_or_default();
27669 let error = serde_json::from_str(&common::to_string(&bytes));
27670 let response = common::to_response(parts, bytes.into());
27671
27672 if let common::Retry::After(d) =
27673 dlg.http_failure(&response, error.as_ref().ok())
27674 {
27675 sleep(d).await;
27676 continue;
27677 }
27678
27679 dlg.finished(false);
27680
27681 return Err(match error {
27682 Ok(value) => common::Error::BadRequest(value),
27683 _ => common::Error::Failure(response),
27684 });
27685 }
27686 let response = {
27687 let bytes = common::to_bytes(body).await.unwrap_or_default();
27688 let encoded = common::to_string(&bytes);
27689 match serde_json::from_str(&encoded) {
27690 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27691 Err(error) => {
27692 dlg.response_json_decode_error(&encoded, &error);
27693 return Err(common::Error::JsonDecodeError(
27694 encoded.to_string(),
27695 error,
27696 ));
27697 }
27698 }
27699 };
27700
27701 dlg.finished(true);
27702 return Ok(response);
27703 }
27704 }
27705 }
27706 }
27707
27708 /// Required. Name of the dataset.
27709 ///
27710 /// Sets the *parent* path property to the given value.
27711 ///
27712 /// Even though the property as already been set when instantiating this call,
27713 /// we provide this method for API completeness.
27714 pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreListCall<'a, C> {
27715 self._parent = new_value.to_string();
27716 self
27717 }
27718 /// The next_page_token value returned from the previous List request, if any.
27719 ///
27720 /// Sets the *page token* query property to the given value.
27721 pub fn page_token(
27722 mut self,
27723 new_value: &str,
27724 ) -> ProjectLocationDatasetDicomStoreListCall<'a, C> {
27725 self._page_token = Some(new_value.to_string());
27726 self
27727 }
27728 /// Limit on the number of DICOM stores to return in a single response. If not specified, 100 is used. May not be larger than 1000.
27729 ///
27730 /// Sets the *page size* query property to the given value.
27731 pub fn page_size(mut self, new_value: i32) -> ProjectLocationDatasetDicomStoreListCall<'a, C> {
27732 self._page_size = Some(new_value);
27733 self
27734 }
27735 /// Restricts stores returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. Only filtering on labels is supported. For example, `labels.key=value`.
27736 ///
27737 /// Sets the *filter* query property to the given value.
27738 pub fn filter(mut self, new_value: &str) -> ProjectLocationDatasetDicomStoreListCall<'a, C> {
27739 self._filter = Some(new_value.to_string());
27740 self
27741 }
27742 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27743 /// while executing the actual API request.
27744 ///
27745 /// ````text
27746 /// It should be used to handle progress information, and to implement a certain level of resilience.
27747 /// ````
27748 ///
27749 /// Sets the *delegate* property to the given value.
27750 pub fn delegate(
27751 mut self,
27752 new_value: &'a mut dyn common::Delegate,
27753 ) -> ProjectLocationDatasetDicomStoreListCall<'a, C> {
27754 self._delegate = Some(new_value);
27755 self
27756 }
27757
27758 /// Set any additional parameter of the query string used in the request.
27759 /// It should be used to set parameters which are not yet available through their own
27760 /// setters.
27761 ///
27762 /// Please note that this method must not be used to set any of the known parameters
27763 /// which have their own setter method. If done anyway, the request will fail.
27764 ///
27765 /// # Additional Parameters
27766 ///
27767 /// * *$.xgafv* (query-string) - V1 error format.
27768 /// * *access_token* (query-string) - OAuth access token.
27769 /// * *alt* (query-string) - Data format for response.
27770 /// * *callback* (query-string) - JSONP
27771 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27772 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
27773 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27774 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27775 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
27776 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27777 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27778 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStoreListCall<'a, C>
27779 where
27780 T: AsRef<str>,
27781 {
27782 self._additional_params
27783 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27784 self
27785 }
27786
27787 /// Identifies the authorization scope for the method you are building.
27788 ///
27789 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27790 /// [`Scope::CloudHealthcare`].
27791 ///
27792 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27793 /// tokens for more than one scope.
27794 ///
27795 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27796 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27797 /// sufficient, a read-write scope will do as well.
27798 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetDicomStoreListCall<'a, C>
27799 where
27800 St: AsRef<str>,
27801 {
27802 self._scopes.insert(String::from(scope.as_ref()));
27803 self
27804 }
27805 /// Identifies the authorization scope(s) for the method you are building.
27806 ///
27807 /// See [`Self::add_scope()`] for details.
27808 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetDicomStoreListCall<'a, C>
27809 where
27810 I: IntoIterator<Item = St>,
27811 St: AsRef<str>,
27812 {
27813 self._scopes
27814 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27815 self
27816 }
27817
27818 /// Removes all scopes, and no default scope will be used either.
27819 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27820 /// for details).
27821 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreListCall<'a, C> {
27822 self._scopes.clear();
27823 self
27824 }
27825}
27826
27827/// Updates the specified DICOM store.
27828///
27829/// A builder for the *locations.datasets.dicomStores.patch* method supported by a *project* resource.
27830/// It is not used directly, but through a [`ProjectMethods`] instance.
27831///
27832/// # Example
27833///
27834/// Instantiate a resource method builder
27835///
27836/// ```test_harness,no_run
27837/// # extern crate hyper;
27838/// # extern crate hyper_rustls;
27839/// # extern crate google_healthcare1 as healthcare1;
27840/// use healthcare1::api::DicomStore;
27841/// # async fn dox() {
27842/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27843///
27844/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27845/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27846/// # secret,
27847/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27848/// # ).build().await.unwrap();
27849///
27850/// # let client = hyper_util::client::legacy::Client::builder(
27851/// # hyper_util::rt::TokioExecutor::new()
27852/// # )
27853/// # .build(
27854/// # hyper_rustls::HttpsConnectorBuilder::new()
27855/// # .with_native_roots()
27856/// # .unwrap()
27857/// # .https_or_http()
27858/// # .enable_http1()
27859/// # .build()
27860/// # );
27861/// # let mut hub = CloudHealthcare::new(client, auth);
27862/// // As the method needs a request, you would usually fill it with the desired information
27863/// // into the respective structure. Some of the parts shown here might not be applicable !
27864/// // Values shown here are possibly random and not representative !
27865/// let mut req = DicomStore::default();
27866///
27867/// // You can configure optional parameters by calling the respective setters at will, and
27868/// // execute the final call using `doit()`.
27869/// // Values shown here are possibly random and not representative !
27870/// let result = hub.projects().locations_datasets_dicom_stores_patch(req, "name")
27871/// .update_mask(FieldMask::new::<&str>(&[]))
27872/// .doit().await;
27873/// # }
27874/// ```
27875pub struct ProjectLocationDatasetDicomStorePatchCall<'a, C>
27876where
27877 C: 'a,
27878{
27879 hub: &'a CloudHealthcare<C>,
27880 _request: DicomStore,
27881 _name: String,
27882 _update_mask: Option<common::FieldMask>,
27883 _delegate: Option<&'a mut dyn common::Delegate>,
27884 _additional_params: HashMap<String, String>,
27885 _scopes: BTreeSet<String>,
27886}
27887
27888impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStorePatchCall<'a, C> {}
27889
27890impl<'a, C> ProjectLocationDatasetDicomStorePatchCall<'a, C>
27891where
27892 C: common::Connector,
27893{
27894 /// Perform the operation you have build so far.
27895 pub async fn doit(mut self) -> common::Result<(common::Response, DicomStore)> {
27896 use std::borrow::Cow;
27897 use std::io::{Read, Seek};
27898
27899 use common::{url::Params, ToParts};
27900 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27901
27902 let mut dd = common::DefaultDelegate;
27903 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27904 dlg.begin(common::MethodInfo {
27905 id: "healthcare.projects.locations.datasets.dicomStores.patch",
27906 http_method: hyper::Method::PATCH,
27907 });
27908
27909 for &field in ["alt", "name", "updateMask"].iter() {
27910 if self._additional_params.contains_key(field) {
27911 dlg.finished(false);
27912 return Err(common::Error::FieldClash(field));
27913 }
27914 }
27915
27916 let mut params = Params::with_capacity(5 + self._additional_params.len());
27917 params.push("name", self._name);
27918 if let Some(value) = self._update_mask.as_ref() {
27919 params.push("updateMask", value.to_string());
27920 }
27921
27922 params.extend(self._additional_params.iter());
27923
27924 params.push("alt", "json");
27925 let mut url = self.hub._base_url.clone() + "v1/{+name}";
27926 if self._scopes.is_empty() {
27927 self._scopes
27928 .insert(Scope::CloudHealthcare.as_ref().to_string());
27929 }
27930
27931 #[allow(clippy::single_element_loop)]
27932 for &(find_this, param_name) in [("{+name}", "name")].iter() {
27933 url = params.uri_replacement(url, param_name, find_this, true);
27934 }
27935 {
27936 let to_remove = ["name"];
27937 params.remove_params(&to_remove);
27938 }
27939
27940 let url = params.parse_with_url(&url);
27941
27942 let mut json_mime_type = mime::APPLICATION_JSON;
27943 let mut request_value_reader = {
27944 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27945 common::remove_json_null_values(&mut value);
27946 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27947 serde_json::to_writer(&mut dst, &value).unwrap();
27948 dst
27949 };
27950 let request_size = request_value_reader
27951 .seek(std::io::SeekFrom::End(0))
27952 .unwrap();
27953 request_value_reader
27954 .seek(std::io::SeekFrom::Start(0))
27955 .unwrap();
27956
27957 loop {
27958 let token = match self
27959 .hub
27960 .auth
27961 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27962 .await
27963 {
27964 Ok(token) => token,
27965 Err(e) => match dlg.token(e) {
27966 Ok(token) => token,
27967 Err(e) => {
27968 dlg.finished(false);
27969 return Err(common::Error::MissingToken(e));
27970 }
27971 },
27972 };
27973 request_value_reader
27974 .seek(std::io::SeekFrom::Start(0))
27975 .unwrap();
27976 let mut req_result = {
27977 let client = &self.hub.client;
27978 dlg.pre_request();
27979 let mut req_builder = hyper::Request::builder()
27980 .method(hyper::Method::PATCH)
27981 .uri(url.as_str())
27982 .header(USER_AGENT, self.hub._user_agent.clone());
27983
27984 if let Some(token) = token.as_ref() {
27985 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27986 }
27987
27988 let request = req_builder
27989 .header(CONTENT_TYPE, json_mime_type.to_string())
27990 .header(CONTENT_LENGTH, request_size as u64)
27991 .body(common::to_body(
27992 request_value_reader.get_ref().clone().into(),
27993 ));
27994
27995 client.request(request.unwrap()).await
27996 };
27997
27998 match req_result {
27999 Err(err) => {
28000 if let common::Retry::After(d) = dlg.http_error(&err) {
28001 sleep(d).await;
28002 continue;
28003 }
28004 dlg.finished(false);
28005 return Err(common::Error::HttpError(err));
28006 }
28007 Ok(res) => {
28008 let (mut parts, body) = res.into_parts();
28009 let mut body = common::Body::new(body);
28010 if !parts.status.is_success() {
28011 let bytes = common::to_bytes(body).await.unwrap_or_default();
28012 let error = serde_json::from_str(&common::to_string(&bytes));
28013 let response = common::to_response(parts, bytes.into());
28014
28015 if let common::Retry::After(d) =
28016 dlg.http_failure(&response, error.as_ref().ok())
28017 {
28018 sleep(d).await;
28019 continue;
28020 }
28021
28022 dlg.finished(false);
28023
28024 return Err(match error {
28025 Ok(value) => common::Error::BadRequest(value),
28026 _ => common::Error::Failure(response),
28027 });
28028 }
28029 let response = {
28030 let bytes = common::to_bytes(body).await.unwrap_or_default();
28031 let encoded = common::to_string(&bytes);
28032 match serde_json::from_str(&encoded) {
28033 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28034 Err(error) => {
28035 dlg.response_json_decode_error(&encoded, &error);
28036 return Err(common::Error::JsonDecodeError(
28037 encoded.to_string(),
28038 error,
28039 ));
28040 }
28041 }
28042 };
28043
28044 dlg.finished(true);
28045 return Ok(response);
28046 }
28047 }
28048 }
28049 }
28050
28051 ///
28052 /// Sets the *request* property to the given value.
28053 ///
28054 /// Even though the property as already been set when instantiating this call,
28055 /// we provide this method for API completeness.
28056 pub fn request(
28057 mut self,
28058 new_value: DicomStore,
28059 ) -> ProjectLocationDatasetDicomStorePatchCall<'a, C> {
28060 self._request = new_value;
28061 self
28062 }
28063 /// Identifier. Resource name of the DICOM store, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
28064 ///
28065 /// Sets the *name* path property to the given value.
28066 ///
28067 /// Even though the property as already been set when instantiating this call,
28068 /// we provide this method for API completeness.
28069 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetDicomStorePatchCall<'a, C> {
28070 self._name = new_value.to_string();
28071 self
28072 }
28073 /// Required. The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
28074 ///
28075 /// Sets the *update mask* query property to the given value.
28076 pub fn update_mask(
28077 mut self,
28078 new_value: common::FieldMask,
28079 ) -> ProjectLocationDatasetDicomStorePatchCall<'a, C> {
28080 self._update_mask = Some(new_value);
28081 self
28082 }
28083 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28084 /// while executing the actual API request.
28085 ///
28086 /// ````text
28087 /// It should be used to handle progress information, and to implement a certain level of resilience.
28088 /// ````
28089 ///
28090 /// Sets the *delegate* property to the given value.
28091 pub fn delegate(
28092 mut self,
28093 new_value: &'a mut dyn common::Delegate,
28094 ) -> ProjectLocationDatasetDicomStorePatchCall<'a, C> {
28095 self._delegate = Some(new_value);
28096 self
28097 }
28098
28099 /// Set any additional parameter of the query string used in the request.
28100 /// It should be used to set parameters which are not yet available through their own
28101 /// setters.
28102 ///
28103 /// Please note that this method must not be used to set any of the known parameters
28104 /// which have their own setter method. If done anyway, the request will fail.
28105 ///
28106 /// # Additional Parameters
28107 ///
28108 /// * *$.xgafv* (query-string) - V1 error format.
28109 /// * *access_token* (query-string) - OAuth access token.
28110 /// * *alt* (query-string) - Data format for response.
28111 /// * *callback* (query-string) - JSONP
28112 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28113 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28114 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28115 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28116 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28117 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28118 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28119 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetDicomStorePatchCall<'a, C>
28120 where
28121 T: AsRef<str>,
28122 {
28123 self._additional_params
28124 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28125 self
28126 }
28127
28128 /// Identifies the authorization scope for the method you are building.
28129 ///
28130 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28131 /// [`Scope::CloudHealthcare`].
28132 ///
28133 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28134 /// tokens for more than one scope.
28135 ///
28136 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28137 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28138 /// sufficient, a read-write scope will do as well.
28139 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetDicomStorePatchCall<'a, C>
28140 where
28141 St: AsRef<str>,
28142 {
28143 self._scopes.insert(String::from(scope.as_ref()));
28144 self
28145 }
28146 /// Identifies the authorization scope(s) for the method you are building.
28147 ///
28148 /// See [`Self::add_scope()`] for details.
28149 pub fn add_scopes<I, St>(
28150 mut self,
28151 scopes: I,
28152 ) -> ProjectLocationDatasetDicomStorePatchCall<'a, C>
28153 where
28154 I: IntoIterator<Item = St>,
28155 St: AsRef<str>,
28156 {
28157 self._scopes
28158 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28159 self
28160 }
28161
28162 /// Removes all scopes, and no default scope will be used either.
28163 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28164 /// for details).
28165 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStorePatchCall<'a, C> {
28166 self._scopes.clear();
28167 self
28168 }
28169}
28170
28171/// SearchForInstances returns a list of matching instances. See [Search Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6). For details on the implementation of SearchForInstances, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForInstances, see [Search for DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#search-dicom).
28172///
28173/// A builder for the *locations.datasets.dicomStores.searchForInstances* method supported by a *project* resource.
28174/// It is not used directly, but through a [`ProjectMethods`] instance.
28175///
28176/// # Example
28177///
28178/// Instantiate a resource method builder
28179///
28180/// ```test_harness,no_run
28181/// # extern crate hyper;
28182/// # extern crate hyper_rustls;
28183/// # extern crate google_healthcare1 as healthcare1;
28184/// # async fn dox() {
28185/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28186///
28187/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28188/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28189/// # secret,
28190/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28191/// # ).build().await.unwrap();
28192///
28193/// # let client = hyper_util::client::legacy::Client::builder(
28194/// # hyper_util::rt::TokioExecutor::new()
28195/// # )
28196/// # .build(
28197/// # hyper_rustls::HttpsConnectorBuilder::new()
28198/// # .with_native_roots()
28199/// # .unwrap()
28200/// # .https_or_http()
28201/// # .enable_http1()
28202/// # .build()
28203/// # );
28204/// # let mut hub = CloudHealthcare::new(client, auth);
28205/// // You can configure optional parameters by calling the respective setters at will, and
28206/// // execute the final call using `doit()`.
28207/// // Values shown here are possibly random and not representative !
28208/// let result = hub.projects().locations_datasets_dicom_stores_search_for_instances("parent", "dicomWebPath")
28209/// .doit().await;
28210/// # }
28211/// ```
28212pub struct ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C>
28213where
28214 C: 'a,
28215{
28216 hub: &'a CloudHealthcare<C>,
28217 _parent: String,
28218 _dicom_web_path: String,
28219 _delegate: Option<&'a mut dyn common::Delegate>,
28220 _additional_params: HashMap<String, String>,
28221 _scopes: BTreeSet<String>,
28222}
28223
28224impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C> {}
28225
28226impl<'a, C> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C>
28227where
28228 C: common::Connector,
28229{
28230 /// Perform the operation you have build so far.
28231 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
28232 use std::borrow::Cow;
28233 use std::io::{Read, Seek};
28234
28235 use common::{url::Params, ToParts};
28236 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28237
28238 let mut dd = common::DefaultDelegate;
28239 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28240 dlg.begin(common::MethodInfo {
28241 id: "healthcare.projects.locations.datasets.dicomStores.searchForInstances",
28242 http_method: hyper::Method::GET,
28243 });
28244
28245 for &field in ["alt", "parent", "dicomWebPath"].iter() {
28246 if self._additional_params.contains_key(field) {
28247 dlg.finished(false);
28248 return Err(common::Error::FieldClash(field));
28249 }
28250 }
28251
28252 let mut params = Params::with_capacity(4 + self._additional_params.len());
28253 params.push("parent", self._parent);
28254 params.push("dicomWebPath", self._dicom_web_path);
28255
28256 params.extend(self._additional_params.iter());
28257
28258 params.push("alt", "json");
28259 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
28260 if self._scopes.is_empty() {
28261 self._scopes
28262 .insert(Scope::CloudHealthcare.as_ref().to_string());
28263 }
28264
28265 #[allow(clippy::single_element_loop)]
28266 for &(find_this, param_name) in
28267 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
28268 {
28269 url = params.uri_replacement(url, param_name, find_this, true);
28270 }
28271 {
28272 let to_remove = ["dicomWebPath", "parent"];
28273 params.remove_params(&to_remove);
28274 }
28275
28276 let url = params.parse_with_url(&url);
28277
28278 loop {
28279 let token = match self
28280 .hub
28281 .auth
28282 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28283 .await
28284 {
28285 Ok(token) => token,
28286 Err(e) => match dlg.token(e) {
28287 Ok(token) => token,
28288 Err(e) => {
28289 dlg.finished(false);
28290 return Err(common::Error::MissingToken(e));
28291 }
28292 },
28293 };
28294 let mut req_result = {
28295 let client = &self.hub.client;
28296 dlg.pre_request();
28297 let mut req_builder = hyper::Request::builder()
28298 .method(hyper::Method::GET)
28299 .uri(url.as_str())
28300 .header(USER_AGENT, self.hub._user_agent.clone());
28301
28302 if let Some(token) = token.as_ref() {
28303 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28304 }
28305
28306 let request = req_builder
28307 .header(CONTENT_LENGTH, 0_u64)
28308 .body(common::to_body::<String>(None));
28309
28310 client.request(request.unwrap()).await
28311 };
28312
28313 match req_result {
28314 Err(err) => {
28315 if let common::Retry::After(d) = dlg.http_error(&err) {
28316 sleep(d).await;
28317 continue;
28318 }
28319 dlg.finished(false);
28320 return Err(common::Error::HttpError(err));
28321 }
28322 Ok(res) => {
28323 let (mut parts, body) = res.into_parts();
28324 let mut body = common::Body::new(body);
28325 if !parts.status.is_success() {
28326 let bytes = common::to_bytes(body).await.unwrap_or_default();
28327 let error = serde_json::from_str(&common::to_string(&bytes));
28328 let response = common::to_response(parts, bytes.into());
28329
28330 if let common::Retry::After(d) =
28331 dlg.http_failure(&response, error.as_ref().ok())
28332 {
28333 sleep(d).await;
28334 continue;
28335 }
28336
28337 dlg.finished(false);
28338
28339 return Err(match error {
28340 Ok(value) => common::Error::BadRequest(value),
28341 _ => common::Error::Failure(response),
28342 });
28343 }
28344 let response = {
28345 let bytes = common::to_bytes(body).await.unwrap_or_default();
28346 let encoded = common::to_string(&bytes);
28347 match serde_json::from_str(&encoded) {
28348 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28349 Err(error) => {
28350 dlg.response_json_decode_error(&encoded, &error);
28351 return Err(common::Error::JsonDecodeError(
28352 encoded.to_string(),
28353 error,
28354 ));
28355 }
28356 }
28357 };
28358
28359 dlg.finished(true);
28360 return Ok(response);
28361 }
28362 }
28363 }
28364 }
28365
28366 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
28367 ///
28368 /// Sets the *parent* path property to the given value.
28369 ///
28370 /// Even though the property as already been set when instantiating this call,
28371 /// we provide this method for API completeness.
28372 pub fn parent(
28373 mut self,
28374 new_value: &str,
28375 ) -> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C> {
28376 self._parent = new_value.to_string();
28377 self
28378 }
28379 /// Required. The path of the SearchForInstancesRequest DICOMweb request. For example, `instances`, `series/{series_uid}/instances`, or `studies/{study_uid}/instances`.
28380 ///
28381 /// Sets the *dicom web path* path property to the given value.
28382 ///
28383 /// Even though the property as already been set when instantiating this call,
28384 /// we provide this method for API completeness.
28385 pub fn dicom_web_path(
28386 mut self,
28387 new_value: &str,
28388 ) -> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C> {
28389 self._dicom_web_path = new_value.to_string();
28390 self
28391 }
28392 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28393 /// while executing the actual API request.
28394 ///
28395 /// ````text
28396 /// It should be used to handle progress information, and to implement a certain level of resilience.
28397 /// ````
28398 ///
28399 /// Sets the *delegate* property to the given value.
28400 pub fn delegate(
28401 mut self,
28402 new_value: &'a mut dyn common::Delegate,
28403 ) -> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C> {
28404 self._delegate = Some(new_value);
28405 self
28406 }
28407
28408 /// Set any additional parameter of the query string used in the request.
28409 /// It should be used to set parameters which are not yet available through their own
28410 /// setters.
28411 ///
28412 /// Please note that this method must not be used to set any of the known parameters
28413 /// which have their own setter method. If done anyway, the request will fail.
28414 ///
28415 /// # Additional Parameters
28416 ///
28417 /// * *$.xgafv* (query-string) - V1 error format.
28418 /// * *access_token* (query-string) - OAuth access token.
28419 /// * *alt* (query-string) - Data format for response.
28420 /// * *callback* (query-string) - JSONP
28421 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28422 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28423 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28424 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28425 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28426 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28427 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28428 pub fn param<T>(
28429 mut self,
28430 name: T,
28431 value: T,
28432 ) -> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C>
28433 where
28434 T: AsRef<str>,
28435 {
28436 self._additional_params
28437 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28438 self
28439 }
28440
28441 /// Identifies the authorization scope for the method you are building.
28442 ///
28443 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28444 /// [`Scope::CloudHealthcare`].
28445 ///
28446 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28447 /// tokens for more than one scope.
28448 ///
28449 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28450 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28451 /// sufficient, a read-write scope will do as well.
28452 pub fn add_scope<St>(
28453 mut self,
28454 scope: St,
28455 ) -> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C>
28456 where
28457 St: AsRef<str>,
28458 {
28459 self._scopes.insert(String::from(scope.as_ref()));
28460 self
28461 }
28462 /// Identifies the authorization scope(s) for the method you are building.
28463 ///
28464 /// See [`Self::add_scope()`] for details.
28465 pub fn add_scopes<I, St>(
28466 mut self,
28467 scopes: I,
28468 ) -> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C>
28469 where
28470 I: IntoIterator<Item = St>,
28471 St: AsRef<str>,
28472 {
28473 self._scopes
28474 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28475 self
28476 }
28477
28478 /// Removes all scopes, and no default scope will be used either.
28479 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28480 /// for details).
28481 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreSearchForInstanceCall<'a, C> {
28482 self._scopes.clear();
28483 self
28484 }
28485}
28486
28487/// SearchForSeries returns a list of matching series. See [Search Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6). For details on the implementation of SearchForSeries, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForSeries, see [Search for DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#search-dicom).
28488///
28489/// A builder for the *locations.datasets.dicomStores.searchForSeries* method supported by a *project* resource.
28490/// It is not used directly, but through a [`ProjectMethods`] instance.
28491///
28492/// # Example
28493///
28494/// Instantiate a resource method builder
28495///
28496/// ```test_harness,no_run
28497/// # extern crate hyper;
28498/// # extern crate hyper_rustls;
28499/// # extern crate google_healthcare1 as healthcare1;
28500/// # async fn dox() {
28501/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28502///
28503/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28504/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28505/// # secret,
28506/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28507/// # ).build().await.unwrap();
28508///
28509/// # let client = hyper_util::client::legacy::Client::builder(
28510/// # hyper_util::rt::TokioExecutor::new()
28511/// # )
28512/// # .build(
28513/// # hyper_rustls::HttpsConnectorBuilder::new()
28514/// # .with_native_roots()
28515/// # .unwrap()
28516/// # .https_or_http()
28517/// # .enable_http1()
28518/// # .build()
28519/// # );
28520/// # let mut hub = CloudHealthcare::new(client, auth);
28521/// // You can configure optional parameters by calling the respective setters at will, and
28522/// // execute the final call using `doit()`.
28523/// // Values shown here are possibly random and not representative !
28524/// let result = hub.projects().locations_datasets_dicom_stores_search_for_series("parent", "dicomWebPath")
28525/// .doit().await;
28526/// # }
28527/// ```
28528pub struct ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C>
28529where
28530 C: 'a,
28531{
28532 hub: &'a CloudHealthcare<C>,
28533 _parent: String,
28534 _dicom_web_path: String,
28535 _delegate: Option<&'a mut dyn common::Delegate>,
28536 _additional_params: HashMap<String, String>,
28537 _scopes: BTreeSet<String>,
28538}
28539
28540impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C> {}
28541
28542impl<'a, C> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C>
28543where
28544 C: common::Connector,
28545{
28546 /// Perform the operation you have build so far.
28547 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
28548 use std::borrow::Cow;
28549 use std::io::{Read, Seek};
28550
28551 use common::{url::Params, ToParts};
28552 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28553
28554 let mut dd = common::DefaultDelegate;
28555 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28556 dlg.begin(common::MethodInfo {
28557 id: "healthcare.projects.locations.datasets.dicomStores.searchForSeries",
28558 http_method: hyper::Method::GET,
28559 });
28560
28561 for &field in ["alt", "parent", "dicomWebPath"].iter() {
28562 if self._additional_params.contains_key(field) {
28563 dlg.finished(false);
28564 return Err(common::Error::FieldClash(field));
28565 }
28566 }
28567
28568 let mut params = Params::with_capacity(4 + self._additional_params.len());
28569 params.push("parent", self._parent);
28570 params.push("dicomWebPath", self._dicom_web_path);
28571
28572 params.extend(self._additional_params.iter());
28573
28574 params.push("alt", "json");
28575 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
28576 if self._scopes.is_empty() {
28577 self._scopes
28578 .insert(Scope::CloudHealthcare.as_ref().to_string());
28579 }
28580
28581 #[allow(clippy::single_element_loop)]
28582 for &(find_this, param_name) in
28583 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
28584 {
28585 url = params.uri_replacement(url, param_name, find_this, true);
28586 }
28587 {
28588 let to_remove = ["dicomWebPath", "parent"];
28589 params.remove_params(&to_remove);
28590 }
28591
28592 let url = params.parse_with_url(&url);
28593
28594 loop {
28595 let token = match self
28596 .hub
28597 .auth
28598 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28599 .await
28600 {
28601 Ok(token) => token,
28602 Err(e) => match dlg.token(e) {
28603 Ok(token) => token,
28604 Err(e) => {
28605 dlg.finished(false);
28606 return Err(common::Error::MissingToken(e));
28607 }
28608 },
28609 };
28610 let mut req_result = {
28611 let client = &self.hub.client;
28612 dlg.pre_request();
28613 let mut req_builder = hyper::Request::builder()
28614 .method(hyper::Method::GET)
28615 .uri(url.as_str())
28616 .header(USER_AGENT, self.hub._user_agent.clone());
28617
28618 if let Some(token) = token.as_ref() {
28619 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28620 }
28621
28622 let request = req_builder
28623 .header(CONTENT_LENGTH, 0_u64)
28624 .body(common::to_body::<String>(None));
28625
28626 client.request(request.unwrap()).await
28627 };
28628
28629 match req_result {
28630 Err(err) => {
28631 if let common::Retry::After(d) = dlg.http_error(&err) {
28632 sleep(d).await;
28633 continue;
28634 }
28635 dlg.finished(false);
28636 return Err(common::Error::HttpError(err));
28637 }
28638 Ok(res) => {
28639 let (mut parts, body) = res.into_parts();
28640 let mut body = common::Body::new(body);
28641 if !parts.status.is_success() {
28642 let bytes = common::to_bytes(body).await.unwrap_or_default();
28643 let error = serde_json::from_str(&common::to_string(&bytes));
28644 let response = common::to_response(parts, bytes.into());
28645
28646 if let common::Retry::After(d) =
28647 dlg.http_failure(&response, error.as_ref().ok())
28648 {
28649 sleep(d).await;
28650 continue;
28651 }
28652
28653 dlg.finished(false);
28654
28655 return Err(match error {
28656 Ok(value) => common::Error::BadRequest(value),
28657 _ => common::Error::Failure(response),
28658 });
28659 }
28660 let response = {
28661 let bytes = common::to_bytes(body).await.unwrap_or_default();
28662 let encoded = common::to_string(&bytes);
28663 match serde_json::from_str(&encoded) {
28664 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28665 Err(error) => {
28666 dlg.response_json_decode_error(&encoded, &error);
28667 return Err(common::Error::JsonDecodeError(
28668 encoded.to_string(),
28669 error,
28670 ));
28671 }
28672 }
28673 };
28674
28675 dlg.finished(true);
28676 return Ok(response);
28677 }
28678 }
28679 }
28680 }
28681
28682 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
28683 ///
28684 /// Sets the *parent* path property to the given value.
28685 ///
28686 /// Even though the property as already been set when instantiating this call,
28687 /// we provide this method for API completeness.
28688 pub fn parent(
28689 mut self,
28690 new_value: &str,
28691 ) -> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C> {
28692 self._parent = new_value.to_string();
28693 self
28694 }
28695 /// Required. The path of the SearchForSeries DICOMweb request. For example, `series` or `studies/{study_uid}/series`.
28696 ///
28697 /// Sets the *dicom web path* path property to the given value.
28698 ///
28699 /// Even though the property as already been set when instantiating this call,
28700 /// we provide this method for API completeness.
28701 pub fn dicom_web_path(
28702 mut self,
28703 new_value: &str,
28704 ) -> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C> {
28705 self._dicom_web_path = new_value.to_string();
28706 self
28707 }
28708 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28709 /// while executing the actual API request.
28710 ///
28711 /// ````text
28712 /// It should be used to handle progress information, and to implement a certain level of resilience.
28713 /// ````
28714 ///
28715 /// Sets the *delegate* property to the given value.
28716 pub fn delegate(
28717 mut self,
28718 new_value: &'a mut dyn common::Delegate,
28719 ) -> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C> {
28720 self._delegate = Some(new_value);
28721 self
28722 }
28723
28724 /// Set any additional parameter of the query string used in the request.
28725 /// It should be used to set parameters which are not yet available through their own
28726 /// setters.
28727 ///
28728 /// Please note that this method must not be used to set any of the known parameters
28729 /// which have their own setter method. If done anyway, the request will fail.
28730 ///
28731 /// # Additional Parameters
28732 ///
28733 /// * *$.xgafv* (query-string) - V1 error format.
28734 /// * *access_token* (query-string) - OAuth access token.
28735 /// * *alt* (query-string) - Data format for response.
28736 /// * *callback* (query-string) - JSONP
28737 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28738 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
28739 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28740 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28741 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
28742 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28743 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28744 pub fn param<T>(
28745 mut self,
28746 name: T,
28747 value: T,
28748 ) -> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C>
28749 where
28750 T: AsRef<str>,
28751 {
28752 self._additional_params
28753 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28754 self
28755 }
28756
28757 /// Identifies the authorization scope for the method you are building.
28758 ///
28759 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28760 /// [`Scope::CloudHealthcare`].
28761 ///
28762 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28763 /// tokens for more than one scope.
28764 ///
28765 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28766 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28767 /// sufficient, a read-write scope will do as well.
28768 pub fn add_scope<St>(
28769 mut self,
28770 scope: St,
28771 ) -> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C>
28772 where
28773 St: AsRef<str>,
28774 {
28775 self._scopes.insert(String::from(scope.as_ref()));
28776 self
28777 }
28778 /// Identifies the authorization scope(s) for the method you are building.
28779 ///
28780 /// See [`Self::add_scope()`] for details.
28781 pub fn add_scopes<I, St>(
28782 mut self,
28783 scopes: I,
28784 ) -> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C>
28785 where
28786 I: IntoIterator<Item = St>,
28787 St: AsRef<str>,
28788 {
28789 self._scopes
28790 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28791 self
28792 }
28793
28794 /// Removes all scopes, and no default scope will be used either.
28795 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28796 /// for details).
28797 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreSearchForSeryCall<'a, C> {
28798 self._scopes.clear();
28799 self
28800 }
28801}
28802
28803/// SearchForStudies returns a list of matching studies. See [Search Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.6). For details on the implementation of SearchForStudies, see [Search transaction](https://cloud.google.com/healthcare/docs/dicom#search_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call SearchForStudies, see [Search for DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#search-dicom).
28804///
28805/// A builder for the *locations.datasets.dicomStores.searchForStudies* method supported by a *project* resource.
28806/// It is not used directly, but through a [`ProjectMethods`] instance.
28807///
28808/// # Example
28809///
28810/// Instantiate a resource method builder
28811///
28812/// ```test_harness,no_run
28813/// # extern crate hyper;
28814/// # extern crate hyper_rustls;
28815/// # extern crate google_healthcare1 as healthcare1;
28816/// # async fn dox() {
28817/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28818///
28819/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28820/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28821/// # secret,
28822/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28823/// # ).build().await.unwrap();
28824///
28825/// # let client = hyper_util::client::legacy::Client::builder(
28826/// # hyper_util::rt::TokioExecutor::new()
28827/// # )
28828/// # .build(
28829/// # hyper_rustls::HttpsConnectorBuilder::new()
28830/// # .with_native_roots()
28831/// # .unwrap()
28832/// # .https_or_http()
28833/// # .enable_http1()
28834/// # .build()
28835/// # );
28836/// # let mut hub = CloudHealthcare::new(client, auth);
28837/// // You can configure optional parameters by calling the respective setters at will, and
28838/// // execute the final call using `doit()`.
28839/// // Values shown here are possibly random and not representative !
28840/// let result = hub.projects().locations_datasets_dicom_stores_search_for_studies("parent", "dicomWebPath")
28841/// .doit().await;
28842/// # }
28843/// ```
28844pub struct ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C>
28845where
28846 C: 'a,
28847{
28848 hub: &'a CloudHealthcare<C>,
28849 _parent: String,
28850 _dicom_web_path: String,
28851 _delegate: Option<&'a mut dyn common::Delegate>,
28852 _additional_params: HashMap<String, String>,
28853 _scopes: BTreeSet<String>,
28854}
28855
28856impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C> {}
28857
28858impl<'a, C> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C>
28859where
28860 C: common::Connector,
28861{
28862 /// Perform the operation you have build so far.
28863 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
28864 use std::borrow::Cow;
28865 use std::io::{Read, Seek};
28866
28867 use common::{url::Params, ToParts};
28868 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28869
28870 let mut dd = common::DefaultDelegate;
28871 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28872 dlg.begin(common::MethodInfo {
28873 id: "healthcare.projects.locations.datasets.dicomStores.searchForStudies",
28874 http_method: hyper::Method::GET,
28875 });
28876
28877 for &field in ["alt", "parent", "dicomWebPath"].iter() {
28878 if self._additional_params.contains_key(field) {
28879 dlg.finished(false);
28880 return Err(common::Error::FieldClash(field));
28881 }
28882 }
28883
28884 let mut params = Params::with_capacity(4 + self._additional_params.len());
28885 params.push("parent", self._parent);
28886 params.push("dicomWebPath", self._dicom_web_path);
28887
28888 params.extend(self._additional_params.iter());
28889
28890 params.push("alt", "json");
28891 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
28892 if self._scopes.is_empty() {
28893 self._scopes
28894 .insert(Scope::CloudHealthcare.as_ref().to_string());
28895 }
28896
28897 #[allow(clippy::single_element_loop)]
28898 for &(find_this, param_name) in
28899 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
28900 {
28901 url = params.uri_replacement(url, param_name, find_this, true);
28902 }
28903 {
28904 let to_remove = ["dicomWebPath", "parent"];
28905 params.remove_params(&to_remove);
28906 }
28907
28908 let url = params.parse_with_url(&url);
28909
28910 loop {
28911 let token = match self
28912 .hub
28913 .auth
28914 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28915 .await
28916 {
28917 Ok(token) => token,
28918 Err(e) => match dlg.token(e) {
28919 Ok(token) => token,
28920 Err(e) => {
28921 dlg.finished(false);
28922 return Err(common::Error::MissingToken(e));
28923 }
28924 },
28925 };
28926 let mut req_result = {
28927 let client = &self.hub.client;
28928 dlg.pre_request();
28929 let mut req_builder = hyper::Request::builder()
28930 .method(hyper::Method::GET)
28931 .uri(url.as_str())
28932 .header(USER_AGENT, self.hub._user_agent.clone());
28933
28934 if let Some(token) = token.as_ref() {
28935 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28936 }
28937
28938 let request = req_builder
28939 .header(CONTENT_LENGTH, 0_u64)
28940 .body(common::to_body::<String>(None));
28941
28942 client.request(request.unwrap()).await
28943 };
28944
28945 match req_result {
28946 Err(err) => {
28947 if let common::Retry::After(d) = dlg.http_error(&err) {
28948 sleep(d).await;
28949 continue;
28950 }
28951 dlg.finished(false);
28952 return Err(common::Error::HttpError(err));
28953 }
28954 Ok(res) => {
28955 let (mut parts, body) = res.into_parts();
28956 let mut body = common::Body::new(body);
28957 if !parts.status.is_success() {
28958 let bytes = common::to_bytes(body).await.unwrap_or_default();
28959 let error = serde_json::from_str(&common::to_string(&bytes));
28960 let response = common::to_response(parts, bytes.into());
28961
28962 if let common::Retry::After(d) =
28963 dlg.http_failure(&response, error.as_ref().ok())
28964 {
28965 sleep(d).await;
28966 continue;
28967 }
28968
28969 dlg.finished(false);
28970
28971 return Err(match error {
28972 Ok(value) => common::Error::BadRequest(value),
28973 _ => common::Error::Failure(response),
28974 });
28975 }
28976 let response = {
28977 let bytes = common::to_bytes(body).await.unwrap_or_default();
28978 let encoded = common::to_string(&bytes);
28979 match serde_json::from_str(&encoded) {
28980 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28981 Err(error) => {
28982 dlg.response_json_decode_error(&encoded, &error);
28983 return Err(common::Error::JsonDecodeError(
28984 encoded.to_string(),
28985 error,
28986 ));
28987 }
28988 }
28989 };
28990
28991 dlg.finished(true);
28992 return Ok(response);
28993 }
28994 }
28995 }
28996 }
28997
28998 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
28999 ///
29000 /// Sets the *parent* path property to the given value.
29001 ///
29002 /// Even though the property as already been set when instantiating this call,
29003 /// we provide this method for API completeness.
29004 pub fn parent(
29005 mut self,
29006 new_value: &str,
29007 ) -> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C> {
29008 self._parent = new_value.to_string();
29009 self
29010 }
29011 /// Required. The path of the SearchForStudies DICOMweb request. For example, `studies`.
29012 ///
29013 /// Sets the *dicom web path* path property to the given value.
29014 ///
29015 /// Even though the property as already been set when instantiating this call,
29016 /// we provide this method for API completeness.
29017 pub fn dicom_web_path(
29018 mut self,
29019 new_value: &str,
29020 ) -> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C> {
29021 self._dicom_web_path = new_value.to_string();
29022 self
29023 }
29024 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29025 /// while executing the actual API request.
29026 ///
29027 /// ````text
29028 /// It should be used to handle progress information, and to implement a certain level of resilience.
29029 /// ````
29030 ///
29031 /// Sets the *delegate* property to the given value.
29032 pub fn delegate(
29033 mut self,
29034 new_value: &'a mut dyn common::Delegate,
29035 ) -> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C> {
29036 self._delegate = Some(new_value);
29037 self
29038 }
29039
29040 /// Set any additional parameter of the query string used in the request.
29041 /// It should be used to set parameters which are not yet available through their own
29042 /// setters.
29043 ///
29044 /// Please note that this method must not be used to set any of the known parameters
29045 /// which have their own setter method. If done anyway, the request will fail.
29046 ///
29047 /// # Additional Parameters
29048 ///
29049 /// * *$.xgafv* (query-string) - V1 error format.
29050 /// * *access_token* (query-string) - OAuth access token.
29051 /// * *alt* (query-string) - Data format for response.
29052 /// * *callback* (query-string) - JSONP
29053 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29054 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
29055 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29056 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29057 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
29058 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29059 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29060 pub fn param<T>(
29061 mut self,
29062 name: T,
29063 value: T,
29064 ) -> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C>
29065 where
29066 T: AsRef<str>,
29067 {
29068 self._additional_params
29069 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29070 self
29071 }
29072
29073 /// Identifies the authorization scope for the method you are building.
29074 ///
29075 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29076 /// [`Scope::CloudHealthcare`].
29077 ///
29078 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29079 /// tokens for more than one scope.
29080 ///
29081 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29082 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29083 /// sufficient, a read-write scope will do as well.
29084 pub fn add_scope<St>(
29085 mut self,
29086 scope: St,
29087 ) -> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C>
29088 where
29089 St: AsRef<str>,
29090 {
29091 self._scopes.insert(String::from(scope.as_ref()));
29092 self
29093 }
29094 /// Identifies the authorization scope(s) for the method you are building.
29095 ///
29096 /// See [`Self::add_scope()`] for details.
29097 pub fn add_scopes<I, St>(
29098 mut self,
29099 scopes: I,
29100 ) -> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C>
29101 where
29102 I: IntoIterator<Item = St>,
29103 St: AsRef<str>,
29104 {
29105 self._scopes
29106 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29107 self
29108 }
29109
29110 /// Removes all scopes, and no default scope will be used either.
29111 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29112 /// for details).
29113 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreSearchForStudyCall<'a, C> {
29114 self._scopes.clear();
29115 self
29116 }
29117}
29118
29119/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
29120///
29121/// A builder for the *locations.datasets.dicomStores.setIamPolicy* method supported by a *project* resource.
29122/// It is not used directly, but through a [`ProjectMethods`] instance.
29123///
29124/// # Example
29125///
29126/// Instantiate a resource method builder
29127///
29128/// ```test_harness,no_run
29129/// # extern crate hyper;
29130/// # extern crate hyper_rustls;
29131/// # extern crate google_healthcare1 as healthcare1;
29132/// use healthcare1::api::SetIamPolicyRequest;
29133/// # async fn dox() {
29134/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29135///
29136/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29137/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29138/// # secret,
29139/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29140/// # ).build().await.unwrap();
29141///
29142/// # let client = hyper_util::client::legacy::Client::builder(
29143/// # hyper_util::rt::TokioExecutor::new()
29144/// # )
29145/// # .build(
29146/// # hyper_rustls::HttpsConnectorBuilder::new()
29147/// # .with_native_roots()
29148/// # .unwrap()
29149/// # .https_or_http()
29150/// # .enable_http1()
29151/// # .build()
29152/// # );
29153/// # let mut hub = CloudHealthcare::new(client, auth);
29154/// // As the method needs a request, you would usually fill it with the desired information
29155/// // into the respective structure. Some of the parts shown here might not be applicable !
29156/// // Values shown here are possibly random and not representative !
29157/// let mut req = SetIamPolicyRequest::default();
29158///
29159/// // You can configure optional parameters by calling the respective setters at will, and
29160/// // execute the final call using `doit()`.
29161/// // Values shown here are possibly random and not representative !
29162/// let result = hub.projects().locations_datasets_dicom_stores_set_iam_policy(req, "resource")
29163/// .doit().await;
29164/// # }
29165/// ```
29166pub struct ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C>
29167where
29168 C: 'a,
29169{
29170 hub: &'a CloudHealthcare<C>,
29171 _request: SetIamPolicyRequest,
29172 _resource: String,
29173 _delegate: Option<&'a mut dyn common::Delegate>,
29174 _additional_params: HashMap<String, String>,
29175 _scopes: BTreeSet<String>,
29176}
29177
29178impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C> {}
29179
29180impl<'a, C> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C>
29181where
29182 C: common::Connector,
29183{
29184 /// Perform the operation you have build so far.
29185 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
29186 use std::borrow::Cow;
29187 use std::io::{Read, Seek};
29188
29189 use common::{url::Params, ToParts};
29190 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29191
29192 let mut dd = common::DefaultDelegate;
29193 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29194 dlg.begin(common::MethodInfo {
29195 id: "healthcare.projects.locations.datasets.dicomStores.setIamPolicy",
29196 http_method: hyper::Method::POST,
29197 });
29198
29199 for &field in ["alt", "resource"].iter() {
29200 if self._additional_params.contains_key(field) {
29201 dlg.finished(false);
29202 return Err(common::Error::FieldClash(field));
29203 }
29204 }
29205
29206 let mut params = Params::with_capacity(4 + self._additional_params.len());
29207 params.push("resource", self._resource);
29208
29209 params.extend(self._additional_params.iter());
29210
29211 params.push("alt", "json");
29212 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
29213 if self._scopes.is_empty() {
29214 self._scopes
29215 .insert(Scope::CloudHealthcare.as_ref().to_string());
29216 }
29217
29218 #[allow(clippy::single_element_loop)]
29219 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
29220 url = params.uri_replacement(url, param_name, find_this, true);
29221 }
29222 {
29223 let to_remove = ["resource"];
29224 params.remove_params(&to_remove);
29225 }
29226
29227 let url = params.parse_with_url(&url);
29228
29229 let mut json_mime_type = mime::APPLICATION_JSON;
29230 let mut request_value_reader = {
29231 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29232 common::remove_json_null_values(&mut value);
29233 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29234 serde_json::to_writer(&mut dst, &value).unwrap();
29235 dst
29236 };
29237 let request_size = request_value_reader
29238 .seek(std::io::SeekFrom::End(0))
29239 .unwrap();
29240 request_value_reader
29241 .seek(std::io::SeekFrom::Start(0))
29242 .unwrap();
29243
29244 loop {
29245 let token = match self
29246 .hub
29247 .auth
29248 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29249 .await
29250 {
29251 Ok(token) => token,
29252 Err(e) => match dlg.token(e) {
29253 Ok(token) => token,
29254 Err(e) => {
29255 dlg.finished(false);
29256 return Err(common::Error::MissingToken(e));
29257 }
29258 },
29259 };
29260 request_value_reader
29261 .seek(std::io::SeekFrom::Start(0))
29262 .unwrap();
29263 let mut req_result = {
29264 let client = &self.hub.client;
29265 dlg.pre_request();
29266 let mut req_builder = hyper::Request::builder()
29267 .method(hyper::Method::POST)
29268 .uri(url.as_str())
29269 .header(USER_AGENT, self.hub._user_agent.clone());
29270
29271 if let Some(token) = token.as_ref() {
29272 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29273 }
29274
29275 let request = req_builder
29276 .header(CONTENT_TYPE, json_mime_type.to_string())
29277 .header(CONTENT_LENGTH, request_size as u64)
29278 .body(common::to_body(
29279 request_value_reader.get_ref().clone().into(),
29280 ));
29281
29282 client.request(request.unwrap()).await
29283 };
29284
29285 match req_result {
29286 Err(err) => {
29287 if let common::Retry::After(d) = dlg.http_error(&err) {
29288 sleep(d).await;
29289 continue;
29290 }
29291 dlg.finished(false);
29292 return Err(common::Error::HttpError(err));
29293 }
29294 Ok(res) => {
29295 let (mut parts, body) = res.into_parts();
29296 let mut body = common::Body::new(body);
29297 if !parts.status.is_success() {
29298 let bytes = common::to_bytes(body).await.unwrap_or_default();
29299 let error = serde_json::from_str(&common::to_string(&bytes));
29300 let response = common::to_response(parts, bytes.into());
29301
29302 if let common::Retry::After(d) =
29303 dlg.http_failure(&response, error.as_ref().ok())
29304 {
29305 sleep(d).await;
29306 continue;
29307 }
29308
29309 dlg.finished(false);
29310
29311 return Err(match error {
29312 Ok(value) => common::Error::BadRequest(value),
29313 _ => common::Error::Failure(response),
29314 });
29315 }
29316 let response = {
29317 let bytes = common::to_bytes(body).await.unwrap_or_default();
29318 let encoded = common::to_string(&bytes);
29319 match serde_json::from_str(&encoded) {
29320 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29321 Err(error) => {
29322 dlg.response_json_decode_error(&encoded, &error);
29323 return Err(common::Error::JsonDecodeError(
29324 encoded.to_string(),
29325 error,
29326 ));
29327 }
29328 }
29329 };
29330
29331 dlg.finished(true);
29332 return Ok(response);
29333 }
29334 }
29335 }
29336 }
29337
29338 ///
29339 /// Sets the *request* property to the given value.
29340 ///
29341 /// Even though the property as already been set when instantiating this call,
29342 /// we provide this method for API completeness.
29343 pub fn request(
29344 mut self,
29345 new_value: SetIamPolicyRequest,
29346 ) -> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C> {
29347 self._request = new_value;
29348 self
29349 }
29350 /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
29351 ///
29352 /// Sets the *resource* path property to the given value.
29353 ///
29354 /// Even though the property as already been set when instantiating this call,
29355 /// we provide this method for API completeness.
29356 pub fn resource(
29357 mut self,
29358 new_value: &str,
29359 ) -> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C> {
29360 self._resource = new_value.to_string();
29361 self
29362 }
29363 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29364 /// while executing the actual API request.
29365 ///
29366 /// ````text
29367 /// It should be used to handle progress information, and to implement a certain level of resilience.
29368 /// ````
29369 ///
29370 /// Sets the *delegate* property to the given value.
29371 pub fn delegate(
29372 mut self,
29373 new_value: &'a mut dyn common::Delegate,
29374 ) -> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C> {
29375 self._delegate = Some(new_value);
29376 self
29377 }
29378
29379 /// Set any additional parameter of the query string used in the request.
29380 /// It should be used to set parameters which are not yet available through their own
29381 /// setters.
29382 ///
29383 /// Please note that this method must not be used to set any of the known parameters
29384 /// which have their own setter method. If done anyway, the request will fail.
29385 ///
29386 /// # Additional Parameters
29387 ///
29388 /// * *$.xgafv* (query-string) - V1 error format.
29389 /// * *access_token* (query-string) - OAuth access token.
29390 /// * *alt* (query-string) - Data format for response.
29391 /// * *callback* (query-string) - JSONP
29392 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29393 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
29394 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29395 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29396 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
29397 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29398 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29399 pub fn param<T>(
29400 mut self,
29401 name: T,
29402 value: T,
29403 ) -> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C>
29404 where
29405 T: AsRef<str>,
29406 {
29407 self._additional_params
29408 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29409 self
29410 }
29411
29412 /// Identifies the authorization scope for the method you are building.
29413 ///
29414 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29415 /// [`Scope::CloudHealthcare`].
29416 ///
29417 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29418 /// tokens for more than one scope.
29419 ///
29420 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29421 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29422 /// sufficient, a read-write scope will do as well.
29423 pub fn add_scope<St>(
29424 mut self,
29425 scope: St,
29426 ) -> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C>
29427 where
29428 St: AsRef<str>,
29429 {
29430 self._scopes.insert(String::from(scope.as_ref()));
29431 self
29432 }
29433 /// Identifies the authorization scope(s) for the method you are building.
29434 ///
29435 /// See [`Self::add_scope()`] for details.
29436 pub fn add_scopes<I, St>(
29437 mut self,
29438 scopes: I,
29439 ) -> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C>
29440 where
29441 I: IntoIterator<Item = St>,
29442 St: AsRef<str>,
29443 {
29444 self._scopes
29445 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29446 self
29447 }
29448
29449 /// Removes all scopes, and no default scope will be used either.
29450 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29451 /// for details).
29452 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreSetIamPolicyCall<'a, C> {
29453 self._scopes.clear();
29454 self
29455 }
29456}
29457
29458/// StoreInstances stores DICOM instances associated with study instance unique identifiers (SUID). See [Store Transaction] (http://dicom.nema.org/medical/dicom/current/output/html/part18.html#sect_10.5). For details on the implementation of StoreInstances, see [Store transaction](https://cloud.google.com/healthcare/docs/dicom#store_transaction) in the Cloud Healthcare API conformance statement. For samples that show how to call StoreInstances, see [Store DICOM data](https://cloud.google.com/healthcare/docs/how-tos/dicomweb#store-dicom).
29459///
29460/// A builder for the *locations.datasets.dicomStores.storeInstances* method supported by a *project* resource.
29461/// It is not used directly, but through a [`ProjectMethods`] instance.
29462///
29463/// # Example
29464///
29465/// Instantiate a resource method builder
29466///
29467/// ```test_harness,no_run
29468/// # extern crate hyper;
29469/// # extern crate hyper_rustls;
29470/// # extern crate google_healthcare1 as healthcare1;
29471/// use healthcare1::api::HttpBody;
29472/// # async fn dox() {
29473/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29474///
29475/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29476/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29477/// # secret,
29478/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29479/// # ).build().await.unwrap();
29480///
29481/// # let client = hyper_util::client::legacy::Client::builder(
29482/// # hyper_util::rt::TokioExecutor::new()
29483/// # )
29484/// # .build(
29485/// # hyper_rustls::HttpsConnectorBuilder::new()
29486/// # .with_native_roots()
29487/// # .unwrap()
29488/// # .https_or_http()
29489/// # .enable_http1()
29490/// # .build()
29491/// # );
29492/// # let mut hub = CloudHealthcare::new(client, auth);
29493/// // As the method needs a request, you would usually fill it with the desired information
29494/// // into the respective structure. Some of the parts shown here might not be applicable !
29495/// // Values shown here are possibly random and not representative !
29496/// let mut req = HttpBody::default();
29497///
29498/// // You can configure optional parameters by calling the respective setters at will, and
29499/// // execute the final call using `doit()`.
29500/// // Values shown here are possibly random and not representative !
29501/// let result = hub.projects().locations_datasets_dicom_stores_store_instances(req, "parent", "dicomWebPath")
29502/// .doit().await;
29503/// # }
29504/// ```
29505pub struct ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C>
29506where
29507 C: 'a,
29508{
29509 hub: &'a CloudHealthcare<C>,
29510 _request: HttpBody,
29511 _parent: String,
29512 _dicom_web_path: String,
29513 _delegate: Option<&'a mut dyn common::Delegate>,
29514 _additional_params: HashMap<String, String>,
29515 _scopes: BTreeSet<String>,
29516}
29517
29518impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C> {}
29519
29520impl<'a, C> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C>
29521where
29522 C: common::Connector,
29523{
29524 /// Perform the operation you have build so far.
29525 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
29526 use std::borrow::Cow;
29527 use std::io::{Read, Seek};
29528
29529 use common::{url::Params, ToParts};
29530 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29531
29532 let mut dd = common::DefaultDelegate;
29533 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29534 dlg.begin(common::MethodInfo {
29535 id: "healthcare.projects.locations.datasets.dicomStores.storeInstances",
29536 http_method: hyper::Method::POST,
29537 });
29538
29539 for &field in ["alt", "parent", "dicomWebPath"].iter() {
29540 if self._additional_params.contains_key(field) {
29541 dlg.finished(false);
29542 return Err(common::Error::FieldClash(field));
29543 }
29544 }
29545
29546 let mut params = Params::with_capacity(5 + self._additional_params.len());
29547 params.push("parent", self._parent);
29548 params.push("dicomWebPath", self._dicom_web_path);
29549
29550 params.extend(self._additional_params.iter());
29551
29552 params.push("alt", "json");
29553 let mut url = self.hub._base_url.clone() + "v1/{+parent}/dicomWeb/{+dicomWebPath}";
29554 if self._scopes.is_empty() {
29555 self._scopes
29556 .insert(Scope::CloudHealthcare.as_ref().to_string());
29557 }
29558
29559 #[allow(clippy::single_element_loop)]
29560 for &(find_this, param_name) in
29561 [("{+parent}", "parent"), ("{+dicomWebPath}", "dicomWebPath")].iter()
29562 {
29563 url = params.uri_replacement(url, param_name, find_this, true);
29564 }
29565 {
29566 let to_remove = ["dicomWebPath", "parent"];
29567 params.remove_params(&to_remove);
29568 }
29569
29570 let url = params.parse_with_url(&url);
29571
29572 let mut json_mime_type = mime::APPLICATION_JSON;
29573 let mut request_value_reader = {
29574 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29575 common::remove_json_null_values(&mut value);
29576 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29577 serde_json::to_writer(&mut dst, &value).unwrap();
29578 dst
29579 };
29580 let request_size = request_value_reader
29581 .seek(std::io::SeekFrom::End(0))
29582 .unwrap();
29583 request_value_reader
29584 .seek(std::io::SeekFrom::Start(0))
29585 .unwrap();
29586
29587 loop {
29588 let token = match self
29589 .hub
29590 .auth
29591 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29592 .await
29593 {
29594 Ok(token) => token,
29595 Err(e) => match dlg.token(e) {
29596 Ok(token) => token,
29597 Err(e) => {
29598 dlg.finished(false);
29599 return Err(common::Error::MissingToken(e));
29600 }
29601 },
29602 };
29603 request_value_reader
29604 .seek(std::io::SeekFrom::Start(0))
29605 .unwrap();
29606 let mut req_result = {
29607 let client = &self.hub.client;
29608 dlg.pre_request();
29609 let mut req_builder = hyper::Request::builder()
29610 .method(hyper::Method::POST)
29611 .uri(url.as_str())
29612 .header(USER_AGENT, self.hub._user_agent.clone());
29613
29614 if let Some(token) = token.as_ref() {
29615 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29616 }
29617
29618 let request = req_builder
29619 .header(CONTENT_TYPE, json_mime_type.to_string())
29620 .header(CONTENT_LENGTH, request_size as u64)
29621 .body(common::to_body(
29622 request_value_reader.get_ref().clone().into(),
29623 ));
29624
29625 client.request(request.unwrap()).await
29626 };
29627
29628 match req_result {
29629 Err(err) => {
29630 if let common::Retry::After(d) = dlg.http_error(&err) {
29631 sleep(d).await;
29632 continue;
29633 }
29634 dlg.finished(false);
29635 return Err(common::Error::HttpError(err));
29636 }
29637 Ok(res) => {
29638 let (mut parts, body) = res.into_parts();
29639 let mut body = common::Body::new(body);
29640 if !parts.status.is_success() {
29641 let bytes = common::to_bytes(body).await.unwrap_or_default();
29642 let error = serde_json::from_str(&common::to_string(&bytes));
29643 let response = common::to_response(parts, bytes.into());
29644
29645 if let common::Retry::After(d) =
29646 dlg.http_failure(&response, error.as_ref().ok())
29647 {
29648 sleep(d).await;
29649 continue;
29650 }
29651
29652 dlg.finished(false);
29653
29654 return Err(match error {
29655 Ok(value) => common::Error::BadRequest(value),
29656 _ => common::Error::Failure(response),
29657 });
29658 }
29659 let response = {
29660 let bytes = common::to_bytes(body).await.unwrap_or_default();
29661 let encoded = common::to_string(&bytes);
29662 match serde_json::from_str(&encoded) {
29663 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29664 Err(error) => {
29665 dlg.response_json_decode_error(&encoded, &error);
29666 return Err(common::Error::JsonDecodeError(
29667 encoded.to_string(),
29668 error,
29669 ));
29670 }
29671 }
29672 };
29673
29674 dlg.finished(true);
29675 return Ok(response);
29676 }
29677 }
29678 }
29679 }
29680
29681 ///
29682 /// Sets the *request* property to the given value.
29683 ///
29684 /// Even though the property as already been set when instantiating this call,
29685 /// we provide this method for API completeness.
29686 pub fn request(
29687 mut self,
29688 new_value: HttpBody,
29689 ) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C> {
29690 self._request = new_value;
29691 self
29692 }
29693 /// Required. The name of the DICOM store that is being accessed. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/dicomStores/{dicom_store_id}`.
29694 ///
29695 /// Sets the *parent* path property to the given value.
29696 ///
29697 /// Even though the property as already been set when instantiating this call,
29698 /// we provide this method for API completeness.
29699 pub fn parent(
29700 mut self,
29701 new_value: &str,
29702 ) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C> {
29703 self._parent = new_value.to_string();
29704 self
29705 }
29706 /// Required. The path of the StoreInstances DICOMweb request. For example, `studies/[{study_uid}]`. Note that the `study_uid` is optional.
29707 ///
29708 /// Sets the *dicom web path* path property to the given value.
29709 ///
29710 /// Even though the property as already been set when instantiating this call,
29711 /// we provide this method for API completeness.
29712 pub fn dicom_web_path(
29713 mut self,
29714 new_value: &str,
29715 ) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C> {
29716 self._dicom_web_path = new_value.to_string();
29717 self
29718 }
29719 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29720 /// while executing the actual API request.
29721 ///
29722 /// ````text
29723 /// It should be used to handle progress information, and to implement a certain level of resilience.
29724 /// ````
29725 ///
29726 /// Sets the *delegate* property to the given value.
29727 pub fn delegate(
29728 mut self,
29729 new_value: &'a mut dyn common::Delegate,
29730 ) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C> {
29731 self._delegate = Some(new_value);
29732 self
29733 }
29734
29735 /// Set any additional parameter of the query string used in the request.
29736 /// It should be used to set parameters which are not yet available through their own
29737 /// setters.
29738 ///
29739 /// Please note that this method must not be used to set any of the known parameters
29740 /// which have their own setter method. If done anyway, the request will fail.
29741 ///
29742 /// # Additional Parameters
29743 ///
29744 /// * *$.xgafv* (query-string) - V1 error format.
29745 /// * *access_token* (query-string) - OAuth access token.
29746 /// * *alt* (query-string) - Data format for response.
29747 /// * *callback* (query-string) - JSONP
29748 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29749 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
29750 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29751 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29752 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
29753 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29754 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29755 pub fn param<T>(
29756 mut self,
29757 name: T,
29758 value: T,
29759 ) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C>
29760 where
29761 T: AsRef<str>,
29762 {
29763 self._additional_params
29764 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29765 self
29766 }
29767
29768 /// Identifies the authorization scope for the method you are building.
29769 ///
29770 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29771 /// [`Scope::CloudHealthcare`].
29772 ///
29773 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29774 /// tokens for more than one scope.
29775 ///
29776 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29777 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29778 /// sufficient, a read-write scope will do as well.
29779 pub fn add_scope<St>(
29780 mut self,
29781 scope: St,
29782 ) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C>
29783 where
29784 St: AsRef<str>,
29785 {
29786 self._scopes.insert(String::from(scope.as_ref()));
29787 self
29788 }
29789 /// Identifies the authorization scope(s) for the method you are building.
29790 ///
29791 /// See [`Self::add_scope()`] for details.
29792 pub fn add_scopes<I, St>(
29793 mut self,
29794 scopes: I,
29795 ) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C>
29796 where
29797 I: IntoIterator<Item = St>,
29798 St: AsRef<str>,
29799 {
29800 self._scopes
29801 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29802 self
29803 }
29804
29805 /// Removes all scopes, and no default scope will be used either.
29806 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29807 /// for details).
29808 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreStoreInstanceCall<'a, C> {
29809 self._scopes.clear();
29810 self
29811 }
29812}
29813
29814/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
29815///
29816/// A builder for the *locations.datasets.dicomStores.testIamPermissions* method supported by a *project* resource.
29817/// It is not used directly, but through a [`ProjectMethods`] instance.
29818///
29819/// # Example
29820///
29821/// Instantiate a resource method builder
29822///
29823/// ```test_harness,no_run
29824/// # extern crate hyper;
29825/// # extern crate hyper_rustls;
29826/// # extern crate google_healthcare1 as healthcare1;
29827/// use healthcare1::api::TestIamPermissionsRequest;
29828/// # async fn dox() {
29829/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29830///
29831/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29832/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29833/// # secret,
29834/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29835/// # ).build().await.unwrap();
29836///
29837/// # let client = hyper_util::client::legacy::Client::builder(
29838/// # hyper_util::rt::TokioExecutor::new()
29839/// # )
29840/// # .build(
29841/// # hyper_rustls::HttpsConnectorBuilder::new()
29842/// # .with_native_roots()
29843/// # .unwrap()
29844/// # .https_or_http()
29845/// # .enable_http1()
29846/// # .build()
29847/// # );
29848/// # let mut hub = CloudHealthcare::new(client, auth);
29849/// // As the method needs a request, you would usually fill it with the desired information
29850/// // into the respective structure. Some of the parts shown here might not be applicable !
29851/// // Values shown here are possibly random and not representative !
29852/// let mut req = TestIamPermissionsRequest::default();
29853///
29854/// // You can configure optional parameters by calling the respective setters at will, and
29855/// // execute the final call using `doit()`.
29856/// // Values shown here are possibly random and not representative !
29857/// let result = hub.projects().locations_datasets_dicom_stores_test_iam_permissions(req, "resource")
29858/// .doit().await;
29859/// # }
29860/// ```
29861pub struct ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C>
29862where
29863 C: 'a,
29864{
29865 hub: &'a CloudHealthcare<C>,
29866 _request: TestIamPermissionsRequest,
29867 _resource: String,
29868 _delegate: Option<&'a mut dyn common::Delegate>,
29869 _additional_params: HashMap<String, String>,
29870 _scopes: BTreeSet<String>,
29871}
29872
29873impl<'a, C> common::CallBuilder for ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C> {}
29874
29875impl<'a, C> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C>
29876where
29877 C: common::Connector,
29878{
29879 /// Perform the operation you have build so far.
29880 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
29881 use std::borrow::Cow;
29882 use std::io::{Read, Seek};
29883
29884 use common::{url::Params, ToParts};
29885 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29886
29887 let mut dd = common::DefaultDelegate;
29888 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29889 dlg.begin(common::MethodInfo {
29890 id: "healthcare.projects.locations.datasets.dicomStores.testIamPermissions",
29891 http_method: hyper::Method::POST,
29892 });
29893
29894 for &field in ["alt", "resource"].iter() {
29895 if self._additional_params.contains_key(field) {
29896 dlg.finished(false);
29897 return Err(common::Error::FieldClash(field));
29898 }
29899 }
29900
29901 let mut params = Params::with_capacity(4 + self._additional_params.len());
29902 params.push("resource", self._resource);
29903
29904 params.extend(self._additional_params.iter());
29905
29906 params.push("alt", "json");
29907 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
29908 if self._scopes.is_empty() {
29909 self._scopes
29910 .insert(Scope::CloudHealthcare.as_ref().to_string());
29911 }
29912
29913 #[allow(clippy::single_element_loop)]
29914 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
29915 url = params.uri_replacement(url, param_name, find_this, true);
29916 }
29917 {
29918 let to_remove = ["resource"];
29919 params.remove_params(&to_remove);
29920 }
29921
29922 let url = params.parse_with_url(&url);
29923
29924 let mut json_mime_type = mime::APPLICATION_JSON;
29925 let mut request_value_reader = {
29926 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29927 common::remove_json_null_values(&mut value);
29928 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29929 serde_json::to_writer(&mut dst, &value).unwrap();
29930 dst
29931 };
29932 let request_size = request_value_reader
29933 .seek(std::io::SeekFrom::End(0))
29934 .unwrap();
29935 request_value_reader
29936 .seek(std::io::SeekFrom::Start(0))
29937 .unwrap();
29938
29939 loop {
29940 let token = match self
29941 .hub
29942 .auth
29943 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29944 .await
29945 {
29946 Ok(token) => token,
29947 Err(e) => match dlg.token(e) {
29948 Ok(token) => token,
29949 Err(e) => {
29950 dlg.finished(false);
29951 return Err(common::Error::MissingToken(e));
29952 }
29953 },
29954 };
29955 request_value_reader
29956 .seek(std::io::SeekFrom::Start(0))
29957 .unwrap();
29958 let mut req_result = {
29959 let client = &self.hub.client;
29960 dlg.pre_request();
29961 let mut req_builder = hyper::Request::builder()
29962 .method(hyper::Method::POST)
29963 .uri(url.as_str())
29964 .header(USER_AGENT, self.hub._user_agent.clone());
29965
29966 if let Some(token) = token.as_ref() {
29967 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29968 }
29969
29970 let request = req_builder
29971 .header(CONTENT_TYPE, json_mime_type.to_string())
29972 .header(CONTENT_LENGTH, request_size as u64)
29973 .body(common::to_body(
29974 request_value_reader.get_ref().clone().into(),
29975 ));
29976
29977 client.request(request.unwrap()).await
29978 };
29979
29980 match req_result {
29981 Err(err) => {
29982 if let common::Retry::After(d) = dlg.http_error(&err) {
29983 sleep(d).await;
29984 continue;
29985 }
29986 dlg.finished(false);
29987 return Err(common::Error::HttpError(err));
29988 }
29989 Ok(res) => {
29990 let (mut parts, body) = res.into_parts();
29991 let mut body = common::Body::new(body);
29992 if !parts.status.is_success() {
29993 let bytes = common::to_bytes(body).await.unwrap_or_default();
29994 let error = serde_json::from_str(&common::to_string(&bytes));
29995 let response = common::to_response(parts, bytes.into());
29996
29997 if let common::Retry::After(d) =
29998 dlg.http_failure(&response, error.as_ref().ok())
29999 {
30000 sleep(d).await;
30001 continue;
30002 }
30003
30004 dlg.finished(false);
30005
30006 return Err(match error {
30007 Ok(value) => common::Error::BadRequest(value),
30008 _ => common::Error::Failure(response),
30009 });
30010 }
30011 let response = {
30012 let bytes = common::to_bytes(body).await.unwrap_or_default();
30013 let encoded = common::to_string(&bytes);
30014 match serde_json::from_str(&encoded) {
30015 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30016 Err(error) => {
30017 dlg.response_json_decode_error(&encoded, &error);
30018 return Err(common::Error::JsonDecodeError(
30019 encoded.to_string(),
30020 error,
30021 ));
30022 }
30023 }
30024 };
30025
30026 dlg.finished(true);
30027 return Ok(response);
30028 }
30029 }
30030 }
30031 }
30032
30033 ///
30034 /// Sets the *request* property to the given value.
30035 ///
30036 /// Even though the property as already been set when instantiating this call,
30037 /// we provide this method for API completeness.
30038 pub fn request(
30039 mut self,
30040 new_value: TestIamPermissionsRequest,
30041 ) -> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C> {
30042 self._request = new_value;
30043 self
30044 }
30045 /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
30046 ///
30047 /// Sets the *resource* path property to the given value.
30048 ///
30049 /// Even though the property as already been set when instantiating this call,
30050 /// we provide this method for API completeness.
30051 pub fn resource(
30052 mut self,
30053 new_value: &str,
30054 ) -> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C> {
30055 self._resource = new_value.to_string();
30056 self
30057 }
30058 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30059 /// while executing the actual API request.
30060 ///
30061 /// ````text
30062 /// It should be used to handle progress information, and to implement a certain level of resilience.
30063 /// ````
30064 ///
30065 /// Sets the *delegate* property to the given value.
30066 pub fn delegate(
30067 mut self,
30068 new_value: &'a mut dyn common::Delegate,
30069 ) -> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C> {
30070 self._delegate = Some(new_value);
30071 self
30072 }
30073
30074 /// Set any additional parameter of the query string used in the request.
30075 /// It should be used to set parameters which are not yet available through their own
30076 /// setters.
30077 ///
30078 /// Please note that this method must not be used to set any of the known parameters
30079 /// which have their own setter method. If done anyway, the request will fail.
30080 ///
30081 /// # Additional Parameters
30082 ///
30083 /// * *$.xgafv* (query-string) - V1 error format.
30084 /// * *access_token* (query-string) - OAuth access token.
30085 /// * *alt* (query-string) - Data format for response.
30086 /// * *callback* (query-string) - JSONP
30087 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30088 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
30089 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30090 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30091 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
30092 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30093 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30094 pub fn param<T>(
30095 mut self,
30096 name: T,
30097 value: T,
30098 ) -> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C>
30099 where
30100 T: AsRef<str>,
30101 {
30102 self._additional_params
30103 .insert(name.as_ref().to_string(), value.as_ref().to_string());
30104 self
30105 }
30106
30107 /// Identifies the authorization scope for the method you are building.
30108 ///
30109 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30110 /// [`Scope::CloudHealthcare`].
30111 ///
30112 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30113 /// tokens for more than one scope.
30114 ///
30115 /// Usually there is more than one suitable scope to authorize an operation, some of which may
30116 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30117 /// sufficient, a read-write scope will do as well.
30118 pub fn add_scope<St>(
30119 mut self,
30120 scope: St,
30121 ) -> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C>
30122 where
30123 St: AsRef<str>,
30124 {
30125 self._scopes.insert(String::from(scope.as_ref()));
30126 self
30127 }
30128 /// Identifies the authorization scope(s) for the method you are building.
30129 ///
30130 /// See [`Self::add_scope()`] for details.
30131 pub fn add_scopes<I, St>(
30132 mut self,
30133 scopes: I,
30134 ) -> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C>
30135 where
30136 I: IntoIterator<Item = St>,
30137 St: AsRef<str>,
30138 {
30139 self._scopes
30140 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30141 self
30142 }
30143
30144 /// Removes all scopes, and no default scope will be used either.
30145 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30146 /// for details).
30147 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDicomStoreTestIamPermissionCall<'a, C> {
30148 self._scopes.clear();
30149 self
30150 }
30151}
30152
30153/// Retrieves a Patient resource and resources related to that patient. Implements the FHIR extended operation Patient-everything ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/patient-operations.html#everything), [STU3](http://hl7.org/implement/standards/fhir/STU3/patient-operations.html#everything), [R4](http://hl7.org/implement/standards/fhir/R4/patient-operations.html#everything)). On success, the response body contains a JSON-encoded representation of a `Bundle` resource of type `searchset`, containing the results of the operation. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. The resources in scope for the response are: * The patient resource itself. * All the resources directly referenced by the patient resource. * Resources directly referencing the patient resource that meet the inclusion criteria. The inclusion criteria are based on the membership rules in the patient compartment definition ([DSTU2](http://hl7.org/fhir/DSTU2/compartment-patient.html), [STU3](http://www.hl7.org/fhir/stu3/compartmentdefinition-patient.html), [R4](http://hl7.org/fhir/R4/compartmentdefinition-patient.html)), which details the eligible resource types and referencing search parameters. For samples that show how to call `Patient-everything`, see [Getting all patient compartment resources](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#getting_all_patient_compartment_resources).
30154///
30155/// A builder for the *locations.datasets.fhirStores.fhir.Patient-everything* method supported by a *project* resource.
30156/// It is not used directly, but through a [`ProjectMethods`] instance.
30157///
30158/// # Example
30159///
30160/// Instantiate a resource method builder
30161///
30162/// ```test_harness,no_run
30163/// # extern crate hyper;
30164/// # extern crate hyper_rustls;
30165/// # extern crate google_healthcare1 as healthcare1;
30166/// # async fn dox() {
30167/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30168///
30169/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30170/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30171/// # secret,
30172/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30173/// # ).build().await.unwrap();
30174///
30175/// # let client = hyper_util::client::legacy::Client::builder(
30176/// # hyper_util::rt::TokioExecutor::new()
30177/// # )
30178/// # .build(
30179/// # hyper_rustls::HttpsConnectorBuilder::new()
30180/// # .with_native_roots()
30181/// # .unwrap()
30182/// # .https_or_http()
30183/// # .enable_http1()
30184/// # .build()
30185/// # );
30186/// # let mut hub = CloudHealthcare::new(client, auth);
30187/// // You can configure optional parameters by calling the respective setters at will, and
30188/// // execute the final call using `doit()`.
30189/// // Values shown here are possibly random and not representative !
30190/// let result = hub.projects().locations_datasets_fhir_stores_fhir__patient_everything("name")
30191/// .start("diam")
30192/// .end("est")
30193/// ._type("sit")
30194/// ._since("sed")
30195/// ._page_token("eos")
30196/// ._count(-56)
30197/// .doit().await;
30198/// # }
30199/// ```
30200pub struct ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C>
30201where
30202 C: 'a,
30203{
30204 hub: &'a CloudHealthcare<C>,
30205 _name: String,
30206 _start: Option<String>,
30207 _end: Option<String>,
30208 __type: Option<String>,
30209 __since: Option<String>,
30210 __page_token: Option<String>,
30211 __count: Option<i32>,
30212 _delegate: Option<&'a mut dyn common::Delegate>,
30213 _additional_params: HashMap<String, String>,
30214 _scopes: BTreeSet<String>,
30215}
30216
30217impl<'a, C> common::CallBuilder
30218 for ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C>
30219{
30220}
30221
30222impl<'a, C> ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C>
30223where
30224 C: common::Connector,
30225{
30226 /// Perform the operation you have build so far.
30227 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
30228 use std::borrow::Cow;
30229 use std::io::{Read, Seek};
30230
30231 use common::{url::Params, ToParts};
30232 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30233
30234 let mut dd = common::DefaultDelegate;
30235 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30236 dlg.begin(common::MethodInfo {
30237 id: "healthcare.projects.locations.datasets.fhirStores.fhir.Patient-everything",
30238 http_method: hyper::Method::GET,
30239 });
30240
30241 for &field in [
30242 "alt",
30243 "name",
30244 "start",
30245 "end",
30246 "_type",
30247 "_since",
30248 "_page_token",
30249 "_count",
30250 ]
30251 .iter()
30252 {
30253 if self._additional_params.contains_key(field) {
30254 dlg.finished(false);
30255 return Err(common::Error::FieldClash(field));
30256 }
30257 }
30258
30259 let mut params = Params::with_capacity(9 + self._additional_params.len());
30260 params.push("name", self._name);
30261 if let Some(value) = self._start.as_ref() {
30262 params.push("start", value);
30263 }
30264 if let Some(value) = self._end.as_ref() {
30265 params.push("end", value);
30266 }
30267 if let Some(value) = self.__type.as_ref() {
30268 params.push("_type", value);
30269 }
30270 if let Some(value) = self.__since.as_ref() {
30271 params.push("_since", value);
30272 }
30273 if let Some(value) = self.__page_token.as_ref() {
30274 params.push("_page_token", value);
30275 }
30276 if let Some(value) = self.__count.as_ref() {
30277 params.push("_count", value.to_string());
30278 }
30279
30280 params.extend(self._additional_params.iter());
30281
30282 params.push("alt", "json");
30283 let mut url = self.hub._base_url.clone() + "v1/{+name}/$everything";
30284 if self._scopes.is_empty() {
30285 self._scopes
30286 .insert(Scope::CloudHealthcare.as_ref().to_string());
30287 }
30288
30289 #[allow(clippy::single_element_loop)]
30290 for &(find_this, param_name) in [("{+name}", "name")].iter() {
30291 url = params.uri_replacement(url, param_name, find_this, true);
30292 }
30293 {
30294 let to_remove = ["name"];
30295 params.remove_params(&to_remove);
30296 }
30297
30298 let url = params.parse_with_url(&url);
30299
30300 loop {
30301 let token = match self
30302 .hub
30303 .auth
30304 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30305 .await
30306 {
30307 Ok(token) => token,
30308 Err(e) => match dlg.token(e) {
30309 Ok(token) => token,
30310 Err(e) => {
30311 dlg.finished(false);
30312 return Err(common::Error::MissingToken(e));
30313 }
30314 },
30315 };
30316 let mut req_result = {
30317 let client = &self.hub.client;
30318 dlg.pre_request();
30319 let mut req_builder = hyper::Request::builder()
30320 .method(hyper::Method::GET)
30321 .uri(url.as_str())
30322 .header(USER_AGENT, self.hub._user_agent.clone());
30323
30324 if let Some(token) = token.as_ref() {
30325 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30326 }
30327
30328 let request = req_builder
30329 .header(CONTENT_LENGTH, 0_u64)
30330 .body(common::to_body::<String>(None));
30331
30332 client.request(request.unwrap()).await
30333 };
30334
30335 match req_result {
30336 Err(err) => {
30337 if let common::Retry::After(d) = dlg.http_error(&err) {
30338 sleep(d).await;
30339 continue;
30340 }
30341 dlg.finished(false);
30342 return Err(common::Error::HttpError(err));
30343 }
30344 Ok(res) => {
30345 let (mut parts, body) = res.into_parts();
30346 let mut body = common::Body::new(body);
30347 if !parts.status.is_success() {
30348 let bytes = common::to_bytes(body).await.unwrap_or_default();
30349 let error = serde_json::from_str(&common::to_string(&bytes));
30350 let response = common::to_response(parts, bytes.into());
30351
30352 if let common::Retry::After(d) =
30353 dlg.http_failure(&response, error.as_ref().ok())
30354 {
30355 sleep(d).await;
30356 continue;
30357 }
30358
30359 dlg.finished(false);
30360
30361 return Err(match error {
30362 Ok(value) => common::Error::BadRequest(value),
30363 _ => common::Error::Failure(response),
30364 });
30365 }
30366 let response = {
30367 let bytes = common::to_bytes(body).await.unwrap_or_default();
30368 let encoded = common::to_string(&bytes);
30369 match serde_json::from_str(&encoded) {
30370 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30371 Err(error) => {
30372 dlg.response_json_decode_error(&encoded, &error);
30373 return Err(common::Error::JsonDecodeError(
30374 encoded.to_string(),
30375 error,
30376 ));
30377 }
30378 }
30379 };
30380
30381 dlg.finished(true);
30382 return Ok(response);
30383 }
30384 }
30385 }
30386 }
30387
30388 /// Required. Name of the `Patient` resource for which the information is required.
30389 ///
30390 /// Sets the *name* path property to the given value.
30391 ///
30392 /// Even though the property as already been set when instantiating this call,
30393 /// we provide this method for API completeness.
30394 pub fn name(
30395 mut self,
30396 new_value: &str,
30397 ) -> ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C> {
30398 self._name = new_value.to_string();
30399 self
30400 }
30401 /// Optional. The response includes records subsequent to the start date. The date uses the format YYYY-MM-DD. If no start date is provided, all records prior to the end date are in scope.
30402 ///
30403 /// Sets the *start* query property to the given value.
30404 pub fn start(
30405 mut self,
30406 new_value: &str,
30407 ) -> ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C> {
30408 self._start = Some(new_value.to_string());
30409 self
30410 }
30411 /// Optional. The response includes records prior to the end date. The date uses the format YYYY-MM-DD. If no end date is provided, all records subsequent to the start date are in scope.
30412 ///
30413 /// Sets the *end* query property to the given value.
30414 pub fn end(
30415 mut self,
30416 new_value: &str,
30417 ) -> ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C> {
30418 self._end = Some(new_value.to_string());
30419 self
30420 }
30421 /// Optional. String of comma-delimited FHIR resource types. If provided, only resources of the specified resource type(s) are returned. Specifying multiple `_type` parameters isn't supported. For example, the result of `_type=Observation&_type=Encounter` is undefined. Use `_type=Observation,Encounter` instead.
30422 ///
30423 /// Sets the *_type* query property to the given value.
30424 pub fn _type(
30425 mut self,
30426 new_value: &str,
30427 ) -> ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C> {
30428 self.__type = Some(new_value.to_string());
30429 self
30430 }
30431 /// Optional. If provided, only resources updated after this time are returned. The time uses the format YYYY-MM-DDThh:mm:ss.sss+zz:zz. For example, `2015-02-07T13:28:17.239+02:00` or `2017-01-01T00:00:00Z`. The time must be specified to the second and include a time zone.
30432 ///
30433 /// Sets the *_since* query property to the given value.
30434 pub fn _since(
30435 mut self,
30436 new_value: &str,
30437 ) -> ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C> {
30438 self.__since = Some(new_value.to_string());
30439 self
30440 }
30441 /// Used to retrieve the next or previous page of results when using pagination. Set `_page_token` to the value of _page_token set in next or previous page links' url. Next and previous page are returned in the response bundle's links field, where `link.relation` is "previous" or "next". Omit `_page_token` if no previous request has been made.
30442 ///
30443 /// Sets the *_page_token* query property to the given value.
30444 pub fn _page_token(
30445 mut self,
30446 new_value: &str,
30447 ) -> ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C> {
30448 self.__page_token = Some(new_value.to_string());
30449 self
30450 }
30451 /// Optional. Maximum number of resources in a page. If not specified, 100 is used. May not be larger than 1000.
30452 ///
30453 /// Sets the *_count* query property to the given value.
30454 pub fn _count(
30455 mut self,
30456 new_value: i32,
30457 ) -> ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C> {
30458 self.__count = Some(new_value);
30459 self
30460 }
30461 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30462 /// while executing the actual API request.
30463 ///
30464 /// ````text
30465 /// It should be used to handle progress information, and to implement a certain level of resilience.
30466 /// ````
30467 ///
30468 /// Sets the *delegate* property to the given value.
30469 pub fn delegate(
30470 mut self,
30471 new_value: &'a mut dyn common::Delegate,
30472 ) -> ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C> {
30473 self._delegate = Some(new_value);
30474 self
30475 }
30476
30477 /// Set any additional parameter of the query string used in the request.
30478 /// It should be used to set parameters which are not yet available through their own
30479 /// setters.
30480 ///
30481 /// Please note that this method must not be used to set any of the known parameters
30482 /// which have their own setter method. If done anyway, the request will fail.
30483 ///
30484 /// # Additional Parameters
30485 ///
30486 /// * *$.xgafv* (query-string) - V1 error format.
30487 /// * *access_token* (query-string) - OAuth access token.
30488 /// * *alt* (query-string) - Data format for response.
30489 /// * *callback* (query-string) - JSONP
30490 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30491 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
30492 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30493 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30494 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
30495 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30496 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30497 pub fn param<T>(
30498 mut self,
30499 name: T,
30500 value: T,
30501 ) -> ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C>
30502 where
30503 T: AsRef<str>,
30504 {
30505 self._additional_params
30506 .insert(name.as_ref().to_string(), value.as_ref().to_string());
30507 self
30508 }
30509
30510 /// Identifies the authorization scope for the method you are building.
30511 ///
30512 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30513 /// [`Scope::CloudHealthcare`].
30514 ///
30515 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30516 /// tokens for more than one scope.
30517 ///
30518 /// Usually there is more than one suitable scope to authorize an operation, some of which may
30519 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30520 /// sufficient, a read-write scope will do as well.
30521 pub fn add_scope<St>(
30522 mut self,
30523 scope: St,
30524 ) -> ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C>
30525 where
30526 St: AsRef<str>,
30527 {
30528 self._scopes.insert(String::from(scope.as_ref()));
30529 self
30530 }
30531 /// Identifies the authorization scope(s) for the method you are building.
30532 ///
30533 /// See [`Self::add_scope()`] for details.
30534 pub fn add_scopes<I, St>(
30535 mut self,
30536 scopes: I,
30537 ) -> ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C>
30538 where
30539 I: IntoIterator<Item = St>,
30540 St: AsRef<str>,
30541 {
30542 self._scopes
30543 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30544 self
30545 }
30546
30547 /// Removes all scopes, and no default scope will be used either.
30548 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30549 /// for details).
30550 pub fn clear_scopes(
30551 mut self,
30552 ) -> ProjectLocationDatasetFhirStoreFhirPatientEverythingCall<'a, C> {
30553 self._scopes.clear();
30554 self
30555 }
30556}
30557
30558/// Deletes all the historical versions of a resource (excluding the current version) from the FHIR store. To remove all versions of a resource, first delete the current version and then call this method. This is not a FHIR standard operation. For samples that show how to call `Resource-purge`, see [Deleting historical versions of a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#deleting_historical_versions_of_a_fhir_resource).
30559///
30560/// A builder for the *locations.datasets.fhirStores.fhir.Resource-purge* method supported by a *project* resource.
30561/// It is not used directly, but through a [`ProjectMethods`] instance.
30562///
30563/// # Example
30564///
30565/// Instantiate a resource method builder
30566///
30567/// ```test_harness,no_run
30568/// # extern crate hyper;
30569/// # extern crate hyper_rustls;
30570/// # extern crate google_healthcare1 as healthcare1;
30571/// # async fn dox() {
30572/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30573///
30574/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30575/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30576/// # secret,
30577/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30578/// # ).build().await.unwrap();
30579///
30580/// # let client = hyper_util::client::legacy::Client::builder(
30581/// # hyper_util::rt::TokioExecutor::new()
30582/// # )
30583/// # .build(
30584/// # hyper_rustls::HttpsConnectorBuilder::new()
30585/// # .with_native_roots()
30586/// # .unwrap()
30587/// # .https_or_http()
30588/// # .enable_http1()
30589/// # .build()
30590/// # );
30591/// # let mut hub = CloudHealthcare::new(client, auth);
30592/// // You can configure optional parameters by calling the respective setters at will, and
30593/// // execute the final call using `doit()`.
30594/// // Values shown here are possibly random and not representative !
30595/// let result = hub.projects().locations_datasets_fhir_stores_fhir__resource_purge("name")
30596/// .doit().await;
30597/// # }
30598/// ```
30599pub struct ProjectLocationDatasetFhirStoreFhirResourcePurgeCall<'a, C>
30600where
30601 C: 'a,
30602{
30603 hub: &'a CloudHealthcare<C>,
30604 _name: String,
30605 _delegate: Option<&'a mut dyn common::Delegate>,
30606 _additional_params: HashMap<String, String>,
30607 _scopes: BTreeSet<String>,
30608}
30609
30610impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreFhirResourcePurgeCall<'a, C> {}
30611
30612impl<'a, C> ProjectLocationDatasetFhirStoreFhirResourcePurgeCall<'a, C>
30613where
30614 C: common::Connector,
30615{
30616 /// Perform the operation you have build so far.
30617 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
30618 use std::borrow::Cow;
30619 use std::io::{Read, Seek};
30620
30621 use common::{url::Params, ToParts};
30622 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30623
30624 let mut dd = common::DefaultDelegate;
30625 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30626 dlg.begin(common::MethodInfo {
30627 id: "healthcare.projects.locations.datasets.fhirStores.fhir.Resource-purge",
30628 http_method: hyper::Method::DELETE,
30629 });
30630
30631 for &field in ["alt", "name"].iter() {
30632 if self._additional_params.contains_key(field) {
30633 dlg.finished(false);
30634 return Err(common::Error::FieldClash(field));
30635 }
30636 }
30637
30638 let mut params = Params::with_capacity(3 + self._additional_params.len());
30639 params.push("name", self._name);
30640
30641 params.extend(self._additional_params.iter());
30642
30643 params.push("alt", "json");
30644 let mut url = self.hub._base_url.clone() + "v1/{+name}/$purge";
30645 if self._scopes.is_empty() {
30646 self._scopes
30647 .insert(Scope::CloudHealthcare.as_ref().to_string());
30648 }
30649
30650 #[allow(clippy::single_element_loop)]
30651 for &(find_this, param_name) in [("{+name}", "name")].iter() {
30652 url = params.uri_replacement(url, param_name, find_this, true);
30653 }
30654 {
30655 let to_remove = ["name"];
30656 params.remove_params(&to_remove);
30657 }
30658
30659 let url = params.parse_with_url(&url);
30660
30661 loop {
30662 let token = match self
30663 .hub
30664 .auth
30665 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30666 .await
30667 {
30668 Ok(token) => token,
30669 Err(e) => match dlg.token(e) {
30670 Ok(token) => token,
30671 Err(e) => {
30672 dlg.finished(false);
30673 return Err(common::Error::MissingToken(e));
30674 }
30675 },
30676 };
30677 let mut req_result = {
30678 let client = &self.hub.client;
30679 dlg.pre_request();
30680 let mut req_builder = hyper::Request::builder()
30681 .method(hyper::Method::DELETE)
30682 .uri(url.as_str())
30683 .header(USER_AGENT, self.hub._user_agent.clone());
30684
30685 if let Some(token) = token.as_ref() {
30686 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30687 }
30688
30689 let request = req_builder
30690 .header(CONTENT_LENGTH, 0_u64)
30691 .body(common::to_body::<String>(None));
30692
30693 client.request(request.unwrap()).await
30694 };
30695
30696 match req_result {
30697 Err(err) => {
30698 if let common::Retry::After(d) = dlg.http_error(&err) {
30699 sleep(d).await;
30700 continue;
30701 }
30702 dlg.finished(false);
30703 return Err(common::Error::HttpError(err));
30704 }
30705 Ok(res) => {
30706 let (mut parts, body) = res.into_parts();
30707 let mut body = common::Body::new(body);
30708 if !parts.status.is_success() {
30709 let bytes = common::to_bytes(body).await.unwrap_or_default();
30710 let error = serde_json::from_str(&common::to_string(&bytes));
30711 let response = common::to_response(parts, bytes.into());
30712
30713 if let common::Retry::After(d) =
30714 dlg.http_failure(&response, error.as_ref().ok())
30715 {
30716 sleep(d).await;
30717 continue;
30718 }
30719
30720 dlg.finished(false);
30721
30722 return Err(match error {
30723 Ok(value) => common::Error::BadRequest(value),
30724 _ => common::Error::Failure(response),
30725 });
30726 }
30727 let response = {
30728 let bytes = common::to_bytes(body).await.unwrap_or_default();
30729 let encoded = common::to_string(&bytes);
30730 match serde_json::from_str(&encoded) {
30731 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30732 Err(error) => {
30733 dlg.response_json_decode_error(&encoded, &error);
30734 return Err(common::Error::JsonDecodeError(
30735 encoded.to_string(),
30736 error,
30737 ));
30738 }
30739 }
30740 };
30741
30742 dlg.finished(true);
30743 return Ok(response);
30744 }
30745 }
30746 }
30747 }
30748
30749 /// Required. The name of the resource to purge.
30750 ///
30751 /// Sets the *name* path property to the given value.
30752 ///
30753 /// Even though the property as already been set when instantiating this call,
30754 /// we provide this method for API completeness.
30755 pub fn name(
30756 mut self,
30757 new_value: &str,
30758 ) -> ProjectLocationDatasetFhirStoreFhirResourcePurgeCall<'a, C> {
30759 self._name = new_value.to_string();
30760 self
30761 }
30762 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30763 /// while executing the actual API request.
30764 ///
30765 /// ````text
30766 /// It should be used to handle progress information, and to implement a certain level of resilience.
30767 /// ````
30768 ///
30769 /// Sets the *delegate* property to the given value.
30770 pub fn delegate(
30771 mut self,
30772 new_value: &'a mut dyn common::Delegate,
30773 ) -> ProjectLocationDatasetFhirStoreFhirResourcePurgeCall<'a, C> {
30774 self._delegate = Some(new_value);
30775 self
30776 }
30777
30778 /// Set any additional parameter of the query string used in the request.
30779 /// It should be used to set parameters which are not yet available through their own
30780 /// setters.
30781 ///
30782 /// Please note that this method must not be used to set any of the known parameters
30783 /// which have their own setter method. If done anyway, the request will fail.
30784 ///
30785 /// # Additional Parameters
30786 ///
30787 /// * *$.xgafv* (query-string) - V1 error format.
30788 /// * *access_token* (query-string) - OAuth access token.
30789 /// * *alt* (query-string) - Data format for response.
30790 /// * *callback* (query-string) - JSONP
30791 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30792 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
30793 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30794 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30795 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
30796 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30797 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30798 pub fn param<T>(
30799 mut self,
30800 name: T,
30801 value: T,
30802 ) -> ProjectLocationDatasetFhirStoreFhirResourcePurgeCall<'a, C>
30803 where
30804 T: AsRef<str>,
30805 {
30806 self._additional_params
30807 .insert(name.as_ref().to_string(), value.as_ref().to_string());
30808 self
30809 }
30810
30811 /// Identifies the authorization scope for the method you are building.
30812 ///
30813 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30814 /// [`Scope::CloudHealthcare`].
30815 ///
30816 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30817 /// tokens for more than one scope.
30818 ///
30819 /// Usually there is more than one suitable scope to authorize an operation, some of which may
30820 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30821 /// sufficient, a read-write scope will do as well.
30822 pub fn add_scope<St>(
30823 mut self,
30824 scope: St,
30825 ) -> ProjectLocationDatasetFhirStoreFhirResourcePurgeCall<'a, C>
30826 where
30827 St: AsRef<str>,
30828 {
30829 self._scopes.insert(String::from(scope.as_ref()));
30830 self
30831 }
30832 /// Identifies the authorization scope(s) for the method you are building.
30833 ///
30834 /// See [`Self::add_scope()`] for details.
30835 pub fn add_scopes<I, St>(
30836 mut self,
30837 scopes: I,
30838 ) -> ProjectLocationDatasetFhirStoreFhirResourcePurgeCall<'a, C>
30839 where
30840 I: IntoIterator<Item = St>,
30841 St: AsRef<str>,
30842 {
30843 self._scopes
30844 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30845 self
30846 }
30847
30848 /// Removes all scopes, and no default scope will be used either.
30849 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30850 /// for details).
30851 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreFhirResourcePurgeCall<'a, C> {
30852 self._scopes.clear();
30853 self
30854 }
30855}
30856
30857/// Validates an input FHIR resource's conformance to its profiles and the profiles configured on the FHIR store. Implements the FHIR extended operation $validate ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/resource-operations.html#validate), [STU3](http://hl7.org/implement/standards/fhir/STU3/resource-operations.html#validate), or [R4](http://hl7.org/implement/standards/fhir/R4/resource-operation-validate.html)). The request body must contain a JSON-encoded FHIR resource, and the request headers must contain `Content-Type: application/fhir+json`. The `Parameters` input syntax is not supported. The `profile` query parameter can be used to request that the resource only be validated against a specific profile. If a profile with the given URL cannot be found in the FHIR store then an error is returned. Errors generated by validation contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead.
30858///
30859/// A builder for the *locations.datasets.fhirStores.fhir.Resource-validate* method supported by a *project* resource.
30860/// It is not used directly, but through a [`ProjectMethods`] instance.
30861///
30862/// # Example
30863///
30864/// Instantiate a resource method builder
30865///
30866/// ```test_harness,no_run
30867/// # extern crate hyper;
30868/// # extern crate hyper_rustls;
30869/// # extern crate google_healthcare1 as healthcare1;
30870/// use healthcare1::api::HttpBody;
30871/// # async fn dox() {
30872/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30873///
30874/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30875/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30876/// # secret,
30877/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30878/// # ).build().await.unwrap();
30879///
30880/// # let client = hyper_util::client::legacy::Client::builder(
30881/// # hyper_util::rt::TokioExecutor::new()
30882/// # )
30883/// # .build(
30884/// # hyper_rustls::HttpsConnectorBuilder::new()
30885/// # .with_native_roots()
30886/// # .unwrap()
30887/// # .https_or_http()
30888/// # .enable_http1()
30889/// # .build()
30890/// # );
30891/// # let mut hub = CloudHealthcare::new(client, auth);
30892/// // As the method needs a request, you would usually fill it with the desired information
30893/// // into the respective structure. Some of the parts shown here might not be applicable !
30894/// // Values shown here are possibly random and not representative !
30895/// let mut req = HttpBody::default();
30896///
30897/// // You can configure optional parameters by calling the respective setters at will, and
30898/// // execute the final call using `doit()`.
30899/// // Values shown here are possibly random and not representative !
30900/// let result = hub.projects().locations_datasets_fhir_stores_fhir__resource_validate(req, "parent", "type")
30901/// .profile("eos")
30902/// .doit().await;
30903/// # }
30904/// ```
30905pub struct ProjectLocationDatasetFhirStoreFhirResourceValidateCall<'a, C>
30906where
30907 C: 'a,
30908{
30909 hub: &'a CloudHealthcare<C>,
30910 _request: HttpBody,
30911 _parent: String,
30912 _type_: String,
30913 _profile: Option<String>,
30914 _delegate: Option<&'a mut dyn common::Delegate>,
30915 _additional_params: HashMap<String, String>,
30916 _scopes: BTreeSet<String>,
30917}
30918
30919impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreFhirResourceValidateCall<'a, C> {}
30920
30921impl<'a, C> ProjectLocationDatasetFhirStoreFhirResourceValidateCall<'a, C>
30922where
30923 C: common::Connector,
30924{
30925 /// Perform the operation you have build so far.
30926 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
30927 use std::borrow::Cow;
30928 use std::io::{Read, Seek};
30929
30930 use common::{url::Params, ToParts};
30931 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30932
30933 let mut dd = common::DefaultDelegate;
30934 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30935 dlg.begin(common::MethodInfo {
30936 id: "healthcare.projects.locations.datasets.fhirStores.fhir.Resource-validate",
30937 http_method: hyper::Method::POST,
30938 });
30939
30940 for &field in ["alt", "parent", "type", "profile"].iter() {
30941 if self._additional_params.contains_key(field) {
30942 dlg.finished(false);
30943 return Err(common::Error::FieldClash(field));
30944 }
30945 }
30946
30947 let mut params = Params::with_capacity(6 + self._additional_params.len());
30948 params.push("parent", self._parent);
30949 params.push("type", self._type_);
30950 if let Some(value) = self._profile.as_ref() {
30951 params.push("profile", value);
30952 }
30953
30954 params.extend(self._additional_params.iter());
30955
30956 params.push("alt", "json");
30957 let mut url = self.hub._base_url.clone() + "v1/{+parent}/fhir/{+type}/$validate";
30958 if self._scopes.is_empty() {
30959 self._scopes
30960 .insert(Scope::CloudHealthcare.as_ref().to_string());
30961 }
30962
30963 #[allow(clippy::single_element_loop)]
30964 for &(find_this, param_name) in [("{+parent}", "parent"), ("{+type}", "type")].iter() {
30965 url = params.uri_replacement(url, param_name, find_this, true);
30966 }
30967 {
30968 let to_remove = ["type", "parent"];
30969 params.remove_params(&to_remove);
30970 }
30971
30972 let url = params.parse_with_url(&url);
30973
30974 let mut json_mime_type = mime::APPLICATION_JSON;
30975 let mut request_value_reader = {
30976 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30977 common::remove_json_null_values(&mut value);
30978 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30979 serde_json::to_writer(&mut dst, &value).unwrap();
30980 dst
30981 };
30982 let request_size = request_value_reader
30983 .seek(std::io::SeekFrom::End(0))
30984 .unwrap();
30985 request_value_reader
30986 .seek(std::io::SeekFrom::Start(0))
30987 .unwrap();
30988
30989 loop {
30990 let token = match self
30991 .hub
30992 .auth
30993 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30994 .await
30995 {
30996 Ok(token) => token,
30997 Err(e) => match dlg.token(e) {
30998 Ok(token) => token,
30999 Err(e) => {
31000 dlg.finished(false);
31001 return Err(common::Error::MissingToken(e));
31002 }
31003 },
31004 };
31005 request_value_reader
31006 .seek(std::io::SeekFrom::Start(0))
31007 .unwrap();
31008 let mut req_result = {
31009 let client = &self.hub.client;
31010 dlg.pre_request();
31011 let mut req_builder = hyper::Request::builder()
31012 .method(hyper::Method::POST)
31013 .uri(url.as_str())
31014 .header(USER_AGENT, self.hub._user_agent.clone());
31015
31016 if let Some(token) = token.as_ref() {
31017 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31018 }
31019
31020 let request = req_builder
31021 .header(CONTENT_TYPE, json_mime_type.to_string())
31022 .header(CONTENT_LENGTH, request_size as u64)
31023 .body(common::to_body(
31024 request_value_reader.get_ref().clone().into(),
31025 ));
31026
31027 client.request(request.unwrap()).await
31028 };
31029
31030 match req_result {
31031 Err(err) => {
31032 if let common::Retry::After(d) = dlg.http_error(&err) {
31033 sleep(d).await;
31034 continue;
31035 }
31036 dlg.finished(false);
31037 return Err(common::Error::HttpError(err));
31038 }
31039 Ok(res) => {
31040 let (mut parts, body) = res.into_parts();
31041 let mut body = common::Body::new(body);
31042 if !parts.status.is_success() {
31043 let bytes = common::to_bytes(body).await.unwrap_or_default();
31044 let error = serde_json::from_str(&common::to_string(&bytes));
31045 let response = common::to_response(parts, bytes.into());
31046
31047 if let common::Retry::After(d) =
31048 dlg.http_failure(&response, error.as_ref().ok())
31049 {
31050 sleep(d).await;
31051 continue;
31052 }
31053
31054 dlg.finished(false);
31055
31056 return Err(match error {
31057 Ok(value) => common::Error::BadRequest(value),
31058 _ => common::Error::Failure(response),
31059 });
31060 }
31061 let response = {
31062 let bytes = common::to_bytes(body).await.unwrap_or_default();
31063 let encoded = common::to_string(&bytes);
31064 match serde_json::from_str(&encoded) {
31065 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31066 Err(error) => {
31067 dlg.response_json_decode_error(&encoded, &error);
31068 return Err(common::Error::JsonDecodeError(
31069 encoded.to_string(),
31070 error,
31071 ));
31072 }
31073 }
31074 };
31075
31076 dlg.finished(true);
31077 return Ok(response);
31078 }
31079 }
31080 }
31081 }
31082
31083 ///
31084 /// Sets the *request* property to the given value.
31085 ///
31086 /// Even though the property as already been set when instantiating this call,
31087 /// we provide this method for API completeness.
31088 pub fn request(
31089 mut self,
31090 new_value: HttpBody,
31091 ) -> ProjectLocationDatasetFhirStoreFhirResourceValidateCall<'a, C> {
31092 self._request = new_value;
31093 self
31094 }
31095 /// Required. The name of the FHIR store that holds the profiles being used for validation.
31096 ///
31097 /// Sets the *parent* path property to the given value.
31098 ///
31099 /// Even though the property as already been set when instantiating this call,
31100 /// we provide this method for API completeness.
31101 pub fn parent(
31102 mut self,
31103 new_value: &str,
31104 ) -> ProjectLocationDatasetFhirStoreFhirResourceValidateCall<'a, C> {
31105 self._parent = new_value.to_string();
31106 self
31107 }
31108 /// Required. The FHIR resource type of the resource being validated. For a complete list, see the FHIR Resource Index ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](http://hl7.org/implement/standards/fhir/STU3/resourcelist.html), or [R4](http://hl7.org/implement/standards/fhir/R4/resourcelist.html)). Must match the resource type in the provided content.
31109 ///
31110 /// Sets the *type* path property to the given value.
31111 ///
31112 /// Even though the property as already been set when instantiating this call,
31113 /// we provide this method for API completeness.
31114 pub fn type_(
31115 mut self,
31116 new_value: &str,
31117 ) -> ProjectLocationDatasetFhirStoreFhirResourceValidateCall<'a, C> {
31118 self._type_ = new_value.to_string();
31119 self
31120 }
31121 /// Required. The canonical URL of a profile that this resource should be validated against. For example, to validate a Patient resource against the US Core Patient profile this parameter would be `http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient`. A StructureDefinition with this canonical URL must exist in the FHIR store.
31122 ///
31123 /// Sets the *profile* query property to the given value.
31124 pub fn profile(
31125 mut self,
31126 new_value: &str,
31127 ) -> ProjectLocationDatasetFhirStoreFhirResourceValidateCall<'a, C> {
31128 self._profile = Some(new_value.to_string());
31129 self
31130 }
31131 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31132 /// while executing the actual API request.
31133 ///
31134 /// ````text
31135 /// It should be used to handle progress information, and to implement a certain level of resilience.
31136 /// ````
31137 ///
31138 /// Sets the *delegate* property to the given value.
31139 pub fn delegate(
31140 mut self,
31141 new_value: &'a mut dyn common::Delegate,
31142 ) -> ProjectLocationDatasetFhirStoreFhirResourceValidateCall<'a, C> {
31143 self._delegate = Some(new_value);
31144 self
31145 }
31146
31147 /// Set any additional parameter of the query string used in the request.
31148 /// It should be used to set parameters which are not yet available through their own
31149 /// setters.
31150 ///
31151 /// Please note that this method must not be used to set any of the known parameters
31152 /// which have their own setter method. If done anyway, the request will fail.
31153 ///
31154 /// # Additional Parameters
31155 ///
31156 /// * *$.xgafv* (query-string) - V1 error format.
31157 /// * *access_token* (query-string) - OAuth access token.
31158 /// * *alt* (query-string) - Data format for response.
31159 /// * *callback* (query-string) - JSONP
31160 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31161 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
31162 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31163 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31164 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
31165 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31166 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31167 pub fn param<T>(
31168 mut self,
31169 name: T,
31170 value: T,
31171 ) -> ProjectLocationDatasetFhirStoreFhirResourceValidateCall<'a, C>
31172 where
31173 T: AsRef<str>,
31174 {
31175 self._additional_params
31176 .insert(name.as_ref().to_string(), value.as_ref().to_string());
31177 self
31178 }
31179
31180 /// Identifies the authorization scope for the method you are building.
31181 ///
31182 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31183 /// [`Scope::CloudHealthcare`].
31184 ///
31185 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31186 /// tokens for more than one scope.
31187 ///
31188 /// Usually there is more than one suitable scope to authorize an operation, some of which may
31189 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31190 /// sufficient, a read-write scope will do as well.
31191 pub fn add_scope<St>(
31192 mut self,
31193 scope: St,
31194 ) -> ProjectLocationDatasetFhirStoreFhirResourceValidateCall<'a, C>
31195 where
31196 St: AsRef<str>,
31197 {
31198 self._scopes.insert(String::from(scope.as_ref()));
31199 self
31200 }
31201 /// Identifies the authorization scope(s) for the method you are building.
31202 ///
31203 /// See [`Self::add_scope()`] for details.
31204 pub fn add_scopes<I, St>(
31205 mut self,
31206 scopes: I,
31207 ) -> ProjectLocationDatasetFhirStoreFhirResourceValidateCall<'a, C>
31208 where
31209 I: IntoIterator<Item = St>,
31210 St: AsRef<str>,
31211 {
31212 self._scopes
31213 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31214 self
31215 }
31216
31217 /// Removes all scopes, and no default scope will be used either.
31218 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31219 /// for details).
31220 pub fn clear_scopes(
31221 mut self,
31222 ) -> ProjectLocationDatasetFhirStoreFhirResourceValidateCall<'a, C> {
31223 self._scopes.clear();
31224 self
31225 }
31226}
31227
31228/// Gets the FHIR capability statement ([STU3](http://hl7.org/implement/standards/fhir/STU3/capabilitystatement.html), [R4](http://hl7.org/implement/standards/fhir/R4/capabilitystatement.html)), or the [conformance statement](http://hl7.org/implement/standards/fhir/DSTU2/conformance.html) in the DSTU2 case for the store, which contains a description of functionality supported by the server. Implements the FHIR standard capabilities interaction ([STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#capabilities), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#capabilities)), or the [conformance interaction](http://hl7.org/implement/standards/fhir/DSTU2/http.html#conformance) in the DSTU2 case. On success, the response body contains a JSON-encoded representation of a `CapabilityStatement` resource.
31229///
31230/// A builder for the *locations.datasets.fhirStores.fhir.capabilities* method supported by a *project* resource.
31231/// It is not used directly, but through a [`ProjectMethods`] instance.
31232///
31233/// # Example
31234///
31235/// Instantiate a resource method builder
31236///
31237/// ```test_harness,no_run
31238/// # extern crate hyper;
31239/// # extern crate hyper_rustls;
31240/// # extern crate google_healthcare1 as healthcare1;
31241/// # async fn dox() {
31242/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31243///
31244/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31245/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31246/// # secret,
31247/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31248/// # ).build().await.unwrap();
31249///
31250/// # let client = hyper_util::client::legacy::Client::builder(
31251/// # hyper_util::rt::TokioExecutor::new()
31252/// # )
31253/// # .build(
31254/// # hyper_rustls::HttpsConnectorBuilder::new()
31255/// # .with_native_roots()
31256/// # .unwrap()
31257/// # .https_or_http()
31258/// # .enable_http1()
31259/// # .build()
31260/// # );
31261/// # let mut hub = CloudHealthcare::new(client, auth);
31262/// // You can configure optional parameters by calling the respective setters at will, and
31263/// // execute the final call using `doit()`.
31264/// // Values shown here are possibly random and not representative !
31265/// let result = hub.projects().locations_datasets_fhir_stores_fhir_capabilities("name")
31266/// .doit().await;
31267/// # }
31268/// ```
31269pub struct ProjectLocationDatasetFhirStoreFhirCapabilityCall<'a, C>
31270where
31271 C: 'a,
31272{
31273 hub: &'a CloudHealthcare<C>,
31274 _name: String,
31275 _delegate: Option<&'a mut dyn common::Delegate>,
31276 _additional_params: HashMap<String, String>,
31277 _scopes: BTreeSet<String>,
31278}
31279
31280impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreFhirCapabilityCall<'a, C> {}
31281
31282impl<'a, C> ProjectLocationDatasetFhirStoreFhirCapabilityCall<'a, C>
31283where
31284 C: common::Connector,
31285{
31286 /// Perform the operation you have build so far.
31287 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
31288 use std::borrow::Cow;
31289 use std::io::{Read, Seek};
31290
31291 use common::{url::Params, ToParts};
31292 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31293
31294 let mut dd = common::DefaultDelegate;
31295 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31296 dlg.begin(common::MethodInfo {
31297 id: "healthcare.projects.locations.datasets.fhirStores.fhir.capabilities",
31298 http_method: hyper::Method::GET,
31299 });
31300
31301 for &field in ["alt", "name"].iter() {
31302 if self._additional_params.contains_key(field) {
31303 dlg.finished(false);
31304 return Err(common::Error::FieldClash(field));
31305 }
31306 }
31307
31308 let mut params = Params::with_capacity(3 + self._additional_params.len());
31309 params.push("name", self._name);
31310
31311 params.extend(self._additional_params.iter());
31312
31313 params.push("alt", "json");
31314 let mut url = self.hub._base_url.clone() + "v1/{+name}/fhir/metadata";
31315 if self._scopes.is_empty() {
31316 self._scopes
31317 .insert(Scope::CloudHealthcare.as_ref().to_string());
31318 }
31319
31320 #[allow(clippy::single_element_loop)]
31321 for &(find_this, param_name) in [("{+name}", "name")].iter() {
31322 url = params.uri_replacement(url, param_name, find_this, true);
31323 }
31324 {
31325 let to_remove = ["name"];
31326 params.remove_params(&to_remove);
31327 }
31328
31329 let url = params.parse_with_url(&url);
31330
31331 loop {
31332 let token = match self
31333 .hub
31334 .auth
31335 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31336 .await
31337 {
31338 Ok(token) => token,
31339 Err(e) => match dlg.token(e) {
31340 Ok(token) => token,
31341 Err(e) => {
31342 dlg.finished(false);
31343 return Err(common::Error::MissingToken(e));
31344 }
31345 },
31346 };
31347 let mut req_result = {
31348 let client = &self.hub.client;
31349 dlg.pre_request();
31350 let mut req_builder = hyper::Request::builder()
31351 .method(hyper::Method::GET)
31352 .uri(url.as_str())
31353 .header(USER_AGENT, self.hub._user_agent.clone());
31354
31355 if let Some(token) = token.as_ref() {
31356 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31357 }
31358
31359 let request = req_builder
31360 .header(CONTENT_LENGTH, 0_u64)
31361 .body(common::to_body::<String>(None));
31362
31363 client.request(request.unwrap()).await
31364 };
31365
31366 match req_result {
31367 Err(err) => {
31368 if let common::Retry::After(d) = dlg.http_error(&err) {
31369 sleep(d).await;
31370 continue;
31371 }
31372 dlg.finished(false);
31373 return Err(common::Error::HttpError(err));
31374 }
31375 Ok(res) => {
31376 let (mut parts, body) = res.into_parts();
31377 let mut body = common::Body::new(body);
31378 if !parts.status.is_success() {
31379 let bytes = common::to_bytes(body).await.unwrap_or_default();
31380 let error = serde_json::from_str(&common::to_string(&bytes));
31381 let response = common::to_response(parts, bytes.into());
31382
31383 if let common::Retry::After(d) =
31384 dlg.http_failure(&response, error.as_ref().ok())
31385 {
31386 sleep(d).await;
31387 continue;
31388 }
31389
31390 dlg.finished(false);
31391
31392 return Err(match error {
31393 Ok(value) => common::Error::BadRequest(value),
31394 _ => common::Error::Failure(response),
31395 });
31396 }
31397 let response = {
31398 let bytes = common::to_bytes(body).await.unwrap_or_default();
31399 let encoded = common::to_string(&bytes);
31400 match serde_json::from_str(&encoded) {
31401 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31402 Err(error) => {
31403 dlg.response_json_decode_error(&encoded, &error);
31404 return Err(common::Error::JsonDecodeError(
31405 encoded.to_string(),
31406 error,
31407 ));
31408 }
31409 }
31410 };
31411
31412 dlg.finished(true);
31413 return Ok(response);
31414 }
31415 }
31416 }
31417 }
31418
31419 /// Required. Name of the FHIR store to retrieve the capabilities for.
31420 ///
31421 /// Sets the *name* path property to the given value.
31422 ///
31423 /// Even though the property as already been set when instantiating this call,
31424 /// we provide this method for API completeness.
31425 pub fn name(
31426 mut self,
31427 new_value: &str,
31428 ) -> ProjectLocationDatasetFhirStoreFhirCapabilityCall<'a, C> {
31429 self._name = new_value.to_string();
31430 self
31431 }
31432 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31433 /// while executing the actual API request.
31434 ///
31435 /// ````text
31436 /// It should be used to handle progress information, and to implement a certain level of resilience.
31437 /// ````
31438 ///
31439 /// Sets the *delegate* property to the given value.
31440 pub fn delegate(
31441 mut self,
31442 new_value: &'a mut dyn common::Delegate,
31443 ) -> ProjectLocationDatasetFhirStoreFhirCapabilityCall<'a, C> {
31444 self._delegate = Some(new_value);
31445 self
31446 }
31447
31448 /// Set any additional parameter of the query string used in the request.
31449 /// It should be used to set parameters which are not yet available through their own
31450 /// setters.
31451 ///
31452 /// Please note that this method must not be used to set any of the known parameters
31453 /// which have their own setter method. If done anyway, the request will fail.
31454 ///
31455 /// # Additional Parameters
31456 ///
31457 /// * *$.xgafv* (query-string) - V1 error format.
31458 /// * *access_token* (query-string) - OAuth access token.
31459 /// * *alt* (query-string) - Data format for response.
31460 /// * *callback* (query-string) - JSONP
31461 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31462 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
31463 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31464 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31465 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
31466 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31467 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31468 pub fn param<T>(
31469 mut self,
31470 name: T,
31471 value: T,
31472 ) -> ProjectLocationDatasetFhirStoreFhirCapabilityCall<'a, C>
31473 where
31474 T: AsRef<str>,
31475 {
31476 self._additional_params
31477 .insert(name.as_ref().to_string(), value.as_ref().to_string());
31478 self
31479 }
31480
31481 /// Identifies the authorization scope for the method you are building.
31482 ///
31483 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31484 /// [`Scope::CloudHealthcare`].
31485 ///
31486 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31487 /// tokens for more than one scope.
31488 ///
31489 /// Usually there is more than one suitable scope to authorize an operation, some of which may
31490 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31491 /// sufficient, a read-write scope will do as well.
31492 pub fn add_scope<St>(
31493 mut self,
31494 scope: St,
31495 ) -> ProjectLocationDatasetFhirStoreFhirCapabilityCall<'a, C>
31496 where
31497 St: AsRef<str>,
31498 {
31499 self._scopes.insert(String::from(scope.as_ref()));
31500 self
31501 }
31502 /// Identifies the authorization scope(s) for the method you are building.
31503 ///
31504 /// See [`Self::add_scope()`] for details.
31505 pub fn add_scopes<I, St>(
31506 mut self,
31507 scopes: I,
31508 ) -> ProjectLocationDatasetFhirStoreFhirCapabilityCall<'a, C>
31509 where
31510 I: IntoIterator<Item = St>,
31511 St: AsRef<str>,
31512 {
31513 self._scopes
31514 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31515 self
31516 }
31517
31518 /// Removes all scopes, and no default scope will be used either.
31519 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31520 /// for details).
31521 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreFhirCapabilityCall<'a, C> {
31522 self._scopes.clear();
31523 self
31524 }
31525}
31526
31527/// Deletes a FHIR resource that match an identifier search query. Implements the FHIR standard conditional delete interaction, limited to searching by resource identifier. If multiple resources match, 412 Precondition Failed error will be returned. Search term for identifier should be in the pattern `identifier=system|value` or `identifier=value` - similar to the `search` method on resources with a specific identifier. Note: Unless resource versioning is disabled by setting the disable_resource_versioning flag on the FHIR store, the deleted resource is moved to a history repository that can still be retrieved through vread and related methods, unless they are removed by the purge method. For samples that show how to call `conditionalDelete`, see [Conditionally deleting a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#conditionally_deleting_a_fhir_resource).
31528///
31529/// A builder for the *locations.datasets.fhirStores.fhir.conditionalDelete* method supported by a *project* resource.
31530/// It is not used directly, but through a [`ProjectMethods`] instance.
31531///
31532/// # Example
31533///
31534/// Instantiate a resource method builder
31535///
31536/// ```test_harness,no_run
31537/// # extern crate hyper;
31538/// # extern crate hyper_rustls;
31539/// # extern crate google_healthcare1 as healthcare1;
31540/// # async fn dox() {
31541/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31542///
31543/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31544/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31545/// # secret,
31546/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31547/// # ).build().await.unwrap();
31548///
31549/// # let client = hyper_util::client::legacy::Client::builder(
31550/// # hyper_util::rt::TokioExecutor::new()
31551/// # )
31552/// # .build(
31553/// # hyper_rustls::HttpsConnectorBuilder::new()
31554/// # .with_native_roots()
31555/// # .unwrap()
31556/// # .https_or_http()
31557/// # .enable_http1()
31558/// # .build()
31559/// # );
31560/// # let mut hub = CloudHealthcare::new(client, auth);
31561/// // You can configure optional parameters by calling the respective setters at will, and
31562/// // execute the final call using `doit()`.
31563/// // Values shown here are possibly random and not representative !
31564/// let result = hub.projects().locations_datasets_fhir_stores_fhir_conditional_delete("parent", "type")
31565/// .doit().await;
31566/// # }
31567/// ```
31568pub struct ProjectLocationDatasetFhirStoreFhirConditionalDeleteCall<'a, C>
31569where
31570 C: 'a,
31571{
31572 hub: &'a CloudHealthcare<C>,
31573 _parent: String,
31574 _type_: String,
31575 _delegate: Option<&'a mut dyn common::Delegate>,
31576 _additional_params: HashMap<String, String>,
31577 _scopes: BTreeSet<String>,
31578}
31579
31580impl<'a, C> common::CallBuilder
31581 for ProjectLocationDatasetFhirStoreFhirConditionalDeleteCall<'a, C>
31582{
31583}
31584
31585impl<'a, C> ProjectLocationDatasetFhirStoreFhirConditionalDeleteCall<'a, C>
31586where
31587 C: common::Connector,
31588{
31589 /// Perform the operation you have build so far.
31590 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
31591 use std::borrow::Cow;
31592 use std::io::{Read, Seek};
31593
31594 use common::{url::Params, ToParts};
31595 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31596
31597 let mut dd = common::DefaultDelegate;
31598 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31599 dlg.begin(common::MethodInfo {
31600 id: "healthcare.projects.locations.datasets.fhirStores.fhir.conditionalDelete",
31601 http_method: hyper::Method::DELETE,
31602 });
31603
31604 for &field in ["alt", "parent", "type"].iter() {
31605 if self._additional_params.contains_key(field) {
31606 dlg.finished(false);
31607 return Err(common::Error::FieldClash(field));
31608 }
31609 }
31610
31611 let mut params = Params::with_capacity(4 + self._additional_params.len());
31612 params.push("parent", self._parent);
31613 params.push("type", self._type_);
31614
31615 params.extend(self._additional_params.iter());
31616
31617 params.push("alt", "json");
31618 let mut url = self.hub._base_url.clone() + "v1/{+parent}/fhir/{+type}";
31619 if self._scopes.is_empty() {
31620 self._scopes
31621 .insert(Scope::CloudHealthcare.as_ref().to_string());
31622 }
31623
31624 #[allow(clippy::single_element_loop)]
31625 for &(find_this, param_name) in [("{+parent}", "parent"), ("{+type}", "type")].iter() {
31626 url = params.uri_replacement(url, param_name, find_this, true);
31627 }
31628 {
31629 let to_remove = ["type", "parent"];
31630 params.remove_params(&to_remove);
31631 }
31632
31633 let url = params.parse_with_url(&url);
31634
31635 loop {
31636 let token = match self
31637 .hub
31638 .auth
31639 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31640 .await
31641 {
31642 Ok(token) => token,
31643 Err(e) => match dlg.token(e) {
31644 Ok(token) => token,
31645 Err(e) => {
31646 dlg.finished(false);
31647 return Err(common::Error::MissingToken(e));
31648 }
31649 },
31650 };
31651 let mut req_result = {
31652 let client = &self.hub.client;
31653 dlg.pre_request();
31654 let mut req_builder = hyper::Request::builder()
31655 .method(hyper::Method::DELETE)
31656 .uri(url.as_str())
31657 .header(USER_AGENT, self.hub._user_agent.clone());
31658
31659 if let Some(token) = token.as_ref() {
31660 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31661 }
31662
31663 let request = req_builder
31664 .header(CONTENT_LENGTH, 0_u64)
31665 .body(common::to_body::<String>(None));
31666
31667 client.request(request.unwrap()).await
31668 };
31669
31670 match req_result {
31671 Err(err) => {
31672 if let common::Retry::After(d) = dlg.http_error(&err) {
31673 sleep(d).await;
31674 continue;
31675 }
31676 dlg.finished(false);
31677 return Err(common::Error::HttpError(err));
31678 }
31679 Ok(res) => {
31680 let (mut parts, body) = res.into_parts();
31681 let mut body = common::Body::new(body);
31682 if !parts.status.is_success() {
31683 let bytes = common::to_bytes(body).await.unwrap_or_default();
31684 let error = serde_json::from_str(&common::to_string(&bytes));
31685 let response = common::to_response(parts, bytes.into());
31686
31687 if let common::Retry::After(d) =
31688 dlg.http_failure(&response, error.as_ref().ok())
31689 {
31690 sleep(d).await;
31691 continue;
31692 }
31693
31694 dlg.finished(false);
31695
31696 return Err(match error {
31697 Ok(value) => common::Error::BadRequest(value),
31698 _ => common::Error::Failure(response),
31699 });
31700 }
31701 let response = {
31702 let bytes = common::to_bytes(body).await.unwrap_or_default();
31703 let encoded = common::to_string(&bytes);
31704 match serde_json::from_str(&encoded) {
31705 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31706 Err(error) => {
31707 dlg.response_json_decode_error(&encoded, &error);
31708 return Err(common::Error::JsonDecodeError(
31709 encoded.to_string(),
31710 error,
31711 ));
31712 }
31713 }
31714 };
31715
31716 dlg.finished(true);
31717 return Ok(response);
31718 }
31719 }
31720 }
31721 }
31722
31723 /// Required. The name of the FHIR store this resource belongs to.
31724 ///
31725 /// Sets the *parent* path property to the given value.
31726 ///
31727 /// Even though the property as already been set when instantiating this call,
31728 /// we provide this method for API completeness.
31729 pub fn parent(
31730 mut self,
31731 new_value: &str,
31732 ) -> ProjectLocationDatasetFhirStoreFhirConditionalDeleteCall<'a, C> {
31733 self._parent = new_value.to_string();
31734 self
31735 }
31736 /// Required. The FHIR resource type to delete, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](https://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](https://hl7.org/implement/standards/fhir/R4/resourcelist.html)).
31737 ///
31738 /// Sets the *type* path property to the given value.
31739 ///
31740 /// Even though the property as already been set when instantiating this call,
31741 /// we provide this method for API completeness.
31742 pub fn type_(
31743 mut self,
31744 new_value: &str,
31745 ) -> ProjectLocationDatasetFhirStoreFhirConditionalDeleteCall<'a, C> {
31746 self._type_ = new_value.to_string();
31747 self
31748 }
31749 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31750 /// while executing the actual API request.
31751 ///
31752 /// ````text
31753 /// It should be used to handle progress information, and to implement a certain level of resilience.
31754 /// ````
31755 ///
31756 /// Sets the *delegate* property to the given value.
31757 pub fn delegate(
31758 mut self,
31759 new_value: &'a mut dyn common::Delegate,
31760 ) -> ProjectLocationDatasetFhirStoreFhirConditionalDeleteCall<'a, C> {
31761 self._delegate = Some(new_value);
31762 self
31763 }
31764
31765 /// Set any additional parameter of the query string used in the request.
31766 /// It should be used to set parameters which are not yet available through their own
31767 /// setters.
31768 ///
31769 /// Please note that this method must not be used to set any of the known parameters
31770 /// which have their own setter method. If done anyway, the request will fail.
31771 ///
31772 /// # Additional Parameters
31773 ///
31774 /// * *$.xgafv* (query-string) - V1 error format.
31775 /// * *access_token* (query-string) - OAuth access token.
31776 /// * *alt* (query-string) - Data format for response.
31777 /// * *callback* (query-string) - JSONP
31778 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31779 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
31780 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31781 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31782 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
31783 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31784 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31785 pub fn param<T>(
31786 mut self,
31787 name: T,
31788 value: T,
31789 ) -> ProjectLocationDatasetFhirStoreFhirConditionalDeleteCall<'a, C>
31790 where
31791 T: AsRef<str>,
31792 {
31793 self._additional_params
31794 .insert(name.as_ref().to_string(), value.as_ref().to_string());
31795 self
31796 }
31797
31798 /// Identifies the authorization scope for the method you are building.
31799 ///
31800 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31801 /// [`Scope::CloudHealthcare`].
31802 ///
31803 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31804 /// tokens for more than one scope.
31805 ///
31806 /// Usually there is more than one suitable scope to authorize an operation, some of which may
31807 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31808 /// sufficient, a read-write scope will do as well.
31809 pub fn add_scope<St>(
31810 mut self,
31811 scope: St,
31812 ) -> ProjectLocationDatasetFhirStoreFhirConditionalDeleteCall<'a, C>
31813 where
31814 St: AsRef<str>,
31815 {
31816 self._scopes.insert(String::from(scope.as_ref()));
31817 self
31818 }
31819 /// Identifies the authorization scope(s) for the method you are building.
31820 ///
31821 /// See [`Self::add_scope()`] for details.
31822 pub fn add_scopes<I, St>(
31823 mut self,
31824 scopes: I,
31825 ) -> ProjectLocationDatasetFhirStoreFhirConditionalDeleteCall<'a, C>
31826 where
31827 I: IntoIterator<Item = St>,
31828 St: AsRef<str>,
31829 {
31830 self._scopes
31831 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31832 self
31833 }
31834
31835 /// Removes all scopes, and no default scope will be used either.
31836 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31837 /// for details).
31838 pub fn clear_scopes(
31839 mut self,
31840 ) -> ProjectLocationDatasetFhirStoreFhirConditionalDeleteCall<'a, C> {
31841 self._scopes.clear();
31842 self
31843 }
31844}
31845
31846/// If a resource is found with the identifier specified in the query parameters, updates part of that resource by applying the operations specified in a [JSON Patch](http://jsonpatch.com/) document. Implements the FHIR standard conditional patch interaction, limited to searching by resource identifier. DSTU2 doesn't define a conditional patch method, but the server supports it in the same way it supports STU3. Search term for identifier should be in the pattern `identifier=system|value` or `identifier=value` - similar to the `search` method on resources with a specific identifier. If the search criteria identify more than one match, the request returns a `412 Precondition Failed` error. The request body must contain a JSON Patch document, and the request headers must contain `Content-Type: application/json-patch+json`. On success, the response body contains a JSON-encoded representation of the updated resource, including the server-assigned version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `conditionalPatch`, see [Conditionally patching a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#conditionally_patching_a_fhir_resource).
31847///
31848/// A builder for the *locations.datasets.fhirStores.fhir.conditionalPatch* method supported by a *project* resource.
31849/// It is not used directly, but through a [`ProjectMethods`] instance.
31850///
31851/// # Example
31852///
31853/// Instantiate a resource method builder
31854///
31855/// ```test_harness,no_run
31856/// # extern crate hyper;
31857/// # extern crate hyper_rustls;
31858/// # extern crate google_healthcare1 as healthcare1;
31859/// use healthcare1::api::HttpBody;
31860/// # async fn dox() {
31861/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31862///
31863/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31864/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31865/// # secret,
31866/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31867/// # ).build().await.unwrap();
31868///
31869/// # let client = hyper_util::client::legacy::Client::builder(
31870/// # hyper_util::rt::TokioExecutor::new()
31871/// # )
31872/// # .build(
31873/// # hyper_rustls::HttpsConnectorBuilder::new()
31874/// # .with_native_roots()
31875/// # .unwrap()
31876/// # .https_or_http()
31877/// # .enable_http1()
31878/// # .build()
31879/// # );
31880/// # let mut hub = CloudHealthcare::new(client, auth);
31881/// // As the method needs a request, you would usually fill it with the desired information
31882/// // into the respective structure. Some of the parts shown here might not be applicable !
31883/// // Values shown here are possibly random and not representative !
31884/// let mut req = HttpBody::default();
31885///
31886/// // You can configure optional parameters by calling the respective setters at will, and
31887/// // execute the final call using `doit()`.
31888/// // Values shown here are possibly random and not representative !
31889/// let result = hub.projects().locations_datasets_fhir_stores_fhir_conditional_patch(req, "parent", "type")
31890/// .doit().await;
31891/// # }
31892/// ```
31893pub struct ProjectLocationDatasetFhirStoreFhirConditionalPatchCall<'a, C>
31894where
31895 C: 'a,
31896{
31897 hub: &'a CloudHealthcare<C>,
31898 _request: HttpBody,
31899 _parent: String,
31900 _type_: String,
31901 _delegate: Option<&'a mut dyn common::Delegate>,
31902 _additional_params: HashMap<String, String>,
31903 _scopes: BTreeSet<String>,
31904}
31905
31906impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreFhirConditionalPatchCall<'a, C> {}
31907
31908impl<'a, C> ProjectLocationDatasetFhirStoreFhirConditionalPatchCall<'a, C>
31909where
31910 C: common::Connector,
31911{
31912 /// Perform the operation you have build so far.
31913 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
31914 use std::borrow::Cow;
31915 use std::io::{Read, Seek};
31916
31917 use common::{url::Params, ToParts};
31918 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31919
31920 let mut dd = common::DefaultDelegate;
31921 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31922 dlg.begin(common::MethodInfo {
31923 id: "healthcare.projects.locations.datasets.fhirStores.fhir.conditionalPatch",
31924 http_method: hyper::Method::PATCH,
31925 });
31926
31927 for &field in ["alt", "parent", "type"].iter() {
31928 if self._additional_params.contains_key(field) {
31929 dlg.finished(false);
31930 return Err(common::Error::FieldClash(field));
31931 }
31932 }
31933
31934 let mut params = Params::with_capacity(5 + self._additional_params.len());
31935 params.push("parent", self._parent);
31936 params.push("type", self._type_);
31937
31938 params.extend(self._additional_params.iter());
31939
31940 params.push("alt", "json");
31941 let mut url = self.hub._base_url.clone() + "v1/{+parent}/fhir/{+type}";
31942 if self._scopes.is_empty() {
31943 self._scopes
31944 .insert(Scope::CloudHealthcare.as_ref().to_string());
31945 }
31946
31947 #[allow(clippy::single_element_loop)]
31948 for &(find_this, param_name) in [("{+parent}", "parent"), ("{+type}", "type")].iter() {
31949 url = params.uri_replacement(url, param_name, find_this, true);
31950 }
31951 {
31952 let to_remove = ["type", "parent"];
31953 params.remove_params(&to_remove);
31954 }
31955
31956 let url = params.parse_with_url(&url);
31957
31958 let mut json_mime_type = mime::APPLICATION_JSON;
31959 let mut request_value_reader = {
31960 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31961 common::remove_json_null_values(&mut value);
31962 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31963 serde_json::to_writer(&mut dst, &value).unwrap();
31964 dst
31965 };
31966 let request_size = request_value_reader
31967 .seek(std::io::SeekFrom::End(0))
31968 .unwrap();
31969 request_value_reader
31970 .seek(std::io::SeekFrom::Start(0))
31971 .unwrap();
31972
31973 loop {
31974 let token = match self
31975 .hub
31976 .auth
31977 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31978 .await
31979 {
31980 Ok(token) => token,
31981 Err(e) => match dlg.token(e) {
31982 Ok(token) => token,
31983 Err(e) => {
31984 dlg.finished(false);
31985 return Err(common::Error::MissingToken(e));
31986 }
31987 },
31988 };
31989 request_value_reader
31990 .seek(std::io::SeekFrom::Start(0))
31991 .unwrap();
31992 let mut req_result = {
31993 let client = &self.hub.client;
31994 dlg.pre_request();
31995 let mut req_builder = hyper::Request::builder()
31996 .method(hyper::Method::PATCH)
31997 .uri(url.as_str())
31998 .header(USER_AGENT, self.hub._user_agent.clone());
31999
32000 if let Some(token) = token.as_ref() {
32001 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32002 }
32003
32004 let request = req_builder
32005 .header(CONTENT_TYPE, json_mime_type.to_string())
32006 .header(CONTENT_LENGTH, request_size as u64)
32007 .body(common::to_body(
32008 request_value_reader.get_ref().clone().into(),
32009 ));
32010
32011 client.request(request.unwrap()).await
32012 };
32013
32014 match req_result {
32015 Err(err) => {
32016 if let common::Retry::After(d) = dlg.http_error(&err) {
32017 sleep(d).await;
32018 continue;
32019 }
32020 dlg.finished(false);
32021 return Err(common::Error::HttpError(err));
32022 }
32023 Ok(res) => {
32024 let (mut parts, body) = res.into_parts();
32025 let mut body = common::Body::new(body);
32026 if !parts.status.is_success() {
32027 let bytes = common::to_bytes(body).await.unwrap_or_default();
32028 let error = serde_json::from_str(&common::to_string(&bytes));
32029 let response = common::to_response(parts, bytes.into());
32030
32031 if let common::Retry::After(d) =
32032 dlg.http_failure(&response, error.as_ref().ok())
32033 {
32034 sleep(d).await;
32035 continue;
32036 }
32037
32038 dlg.finished(false);
32039
32040 return Err(match error {
32041 Ok(value) => common::Error::BadRequest(value),
32042 _ => common::Error::Failure(response),
32043 });
32044 }
32045 let response = {
32046 let bytes = common::to_bytes(body).await.unwrap_or_default();
32047 let encoded = common::to_string(&bytes);
32048 match serde_json::from_str(&encoded) {
32049 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32050 Err(error) => {
32051 dlg.response_json_decode_error(&encoded, &error);
32052 return Err(common::Error::JsonDecodeError(
32053 encoded.to_string(),
32054 error,
32055 ));
32056 }
32057 }
32058 };
32059
32060 dlg.finished(true);
32061 return Ok(response);
32062 }
32063 }
32064 }
32065 }
32066
32067 ///
32068 /// Sets the *request* property to the given value.
32069 ///
32070 /// Even though the property as already been set when instantiating this call,
32071 /// we provide this method for API completeness.
32072 pub fn request(
32073 mut self,
32074 new_value: HttpBody,
32075 ) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchCall<'a, C> {
32076 self._request = new_value;
32077 self
32078 }
32079 /// Required. The name of the FHIR store this resource belongs to.
32080 ///
32081 /// Sets the *parent* path property to the given value.
32082 ///
32083 /// Even though the property as already been set when instantiating this call,
32084 /// we provide this method for API completeness.
32085 pub fn parent(
32086 mut self,
32087 new_value: &str,
32088 ) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchCall<'a, C> {
32089 self._parent = new_value.to_string();
32090 self
32091 }
32092 /// Required. The FHIR resource type to update, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](https://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](https://hl7.org/implement/standards/fhir/R4/resourcelist.html)).
32093 ///
32094 /// Sets the *type* path property to the given value.
32095 ///
32096 /// Even though the property as already been set when instantiating this call,
32097 /// we provide this method for API completeness.
32098 pub fn type_(
32099 mut self,
32100 new_value: &str,
32101 ) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchCall<'a, C> {
32102 self._type_ = new_value.to_string();
32103 self
32104 }
32105 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32106 /// while executing the actual API request.
32107 ///
32108 /// ````text
32109 /// It should be used to handle progress information, and to implement a certain level of resilience.
32110 /// ````
32111 ///
32112 /// Sets the *delegate* property to the given value.
32113 pub fn delegate(
32114 mut self,
32115 new_value: &'a mut dyn common::Delegate,
32116 ) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchCall<'a, C> {
32117 self._delegate = Some(new_value);
32118 self
32119 }
32120
32121 /// Set any additional parameter of the query string used in the request.
32122 /// It should be used to set parameters which are not yet available through their own
32123 /// setters.
32124 ///
32125 /// Please note that this method must not be used to set any of the known parameters
32126 /// which have their own setter method. If done anyway, the request will fail.
32127 ///
32128 /// # Additional Parameters
32129 ///
32130 /// * *$.xgafv* (query-string) - V1 error format.
32131 /// * *access_token* (query-string) - OAuth access token.
32132 /// * *alt* (query-string) - Data format for response.
32133 /// * *callback* (query-string) - JSONP
32134 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32135 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
32136 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32137 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32138 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
32139 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32140 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32141 pub fn param<T>(
32142 mut self,
32143 name: T,
32144 value: T,
32145 ) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchCall<'a, C>
32146 where
32147 T: AsRef<str>,
32148 {
32149 self._additional_params
32150 .insert(name.as_ref().to_string(), value.as_ref().to_string());
32151 self
32152 }
32153
32154 /// Identifies the authorization scope for the method you are building.
32155 ///
32156 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32157 /// [`Scope::CloudHealthcare`].
32158 ///
32159 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32160 /// tokens for more than one scope.
32161 ///
32162 /// Usually there is more than one suitable scope to authorize an operation, some of which may
32163 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32164 /// sufficient, a read-write scope will do as well.
32165 pub fn add_scope<St>(
32166 mut self,
32167 scope: St,
32168 ) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchCall<'a, C>
32169 where
32170 St: AsRef<str>,
32171 {
32172 self._scopes.insert(String::from(scope.as_ref()));
32173 self
32174 }
32175 /// Identifies the authorization scope(s) for the method you are building.
32176 ///
32177 /// See [`Self::add_scope()`] for details.
32178 pub fn add_scopes<I, St>(
32179 mut self,
32180 scopes: I,
32181 ) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchCall<'a, C>
32182 where
32183 I: IntoIterator<Item = St>,
32184 St: AsRef<str>,
32185 {
32186 self._scopes
32187 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32188 self
32189 }
32190
32191 /// Removes all scopes, and no default scope will be used either.
32192 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32193 /// for details).
32194 pub fn clear_scopes(
32195 mut self,
32196 ) -> ProjectLocationDatasetFhirStoreFhirConditionalPatchCall<'a, C> {
32197 self._scopes.clear();
32198 self
32199 }
32200}
32201
32202/// If a resource is found with the identifier specified in the query parameters, updates the entire contents of that resource. Implements the FHIR standard conditional update interaction, limited to searching by resource identifier. Search term for identifier should be in the pattern `identifier=system|value` or `identifier=value` - similar to the `search` method on resources with a specific identifier. If the search criteria identify more than one match, the request returns a `412 Precondition Failed` error. If the search criteria identify zero matches, and the supplied resource body contains an `id`, and the FHIR store has enable_update_create set, creates the resource with the client-specified ID. It is strongly advised not to include or encode any sensitive data such as patient identifiers in client-specified resource IDs. Those IDs are part of the FHIR resource path recorded in Cloud Audit Logs and Pub/Sub notifications. Those IDs can also be contained in reference fields within other resources. If the search criteria identify zero matches, and the supplied resource body does not contain an `id`, the resource is created with a server-assigned ID as per the create method. The request body must contain a JSON-encoded FHIR resource, and the request headers must contain `Content-Type: application/fhir+json`. On success, the response body contains a JSON-encoded representation of the updated resource, including the server-assigned version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `conditionalUpdate`, see [Conditionally updating a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#conditionally_updating_a_fhir_resource).
32203///
32204/// A builder for the *locations.datasets.fhirStores.fhir.conditionalUpdate* method supported by a *project* resource.
32205/// It is not used directly, but through a [`ProjectMethods`] instance.
32206///
32207/// # Example
32208///
32209/// Instantiate a resource method builder
32210///
32211/// ```test_harness,no_run
32212/// # extern crate hyper;
32213/// # extern crate hyper_rustls;
32214/// # extern crate google_healthcare1 as healthcare1;
32215/// use healthcare1::api::HttpBody;
32216/// # async fn dox() {
32217/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32218///
32219/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32220/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32221/// # secret,
32222/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32223/// # ).build().await.unwrap();
32224///
32225/// # let client = hyper_util::client::legacy::Client::builder(
32226/// # hyper_util::rt::TokioExecutor::new()
32227/// # )
32228/// # .build(
32229/// # hyper_rustls::HttpsConnectorBuilder::new()
32230/// # .with_native_roots()
32231/// # .unwrap()
32232/// # .https_or_http()
32233/// # .enable_http1()
32234/// # .build()
32235/// # );
32236/// # let mut hub = CloudHealthcare::new(client, auth);
32237/// // As the method needs a request, you would usually fill it with the desired information
32238/// // into the respective structure. Some of the parts shown here might not be applicable !
32239/// // Values shown here are possibly random and not representative !
32240/// let mut req = HttpBody::default();
32241///
32242/// // You can configure optional parameters by calling the respective setters at will, and
32243/// // execute the final call using `doit()`.
32244/// // Values shown here are possibly random and not representative !
32245/// let result = hub.projects().locations_datasets_fhir_stores_fhir_conditional_update(req, "parent", "type")
32246/// .doit().await;
32247/// # }
32248/// ```
32249pub struct ProjectLocationDatasetFhirStoreFhirConditionalUpdateCall<'a, C>
32250where
32251 C: 'a,
32252{
32253 hub: &'a CloudHealthcare<C>,
32254 _request: HttpBody,
32255 _parent: String,
32256 _type_: String,
32257 _delegate: Option<&'a mut dyn common::Delegate>,
32258 _additional_params: HashMap<String, String>,
32259 _scopes: BTreeSet<String>,
32260}
32261
32262impl<'a, C> common::CallBuilder
32263 for ProjectLocationDatasetFhirStoreFhirConditionalUpdateCall<'a, C>
32264{
32265}
32266
32267impl<'a, C> ProjectLocationDatasetFhirStoreFhirConditionalUpdateCall<'a, C>
32268where
32269 C: common::Connector,
32270{
32271 /// Perform the operation you have build so far.
32272 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
32273 use std::borrow::Cow;
32274 use std::io::{Read, Seek};
32275
32276 use common::{url::Params, ToParts};
32277 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32278
32279 let mut dd = common::DefaultDelegate;
32280 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32281 dlg.begin(common::MethodInfo {
32282 id: "healthcare.projects.locations.datasets.fhirStores.fhir.conditionalUpdate",
32283 http_method: hyper::Method::PUT,
32284 });
32285
32286 for &field in ["alt", "parent", "type"].iter() {
32287 if self._additional_params.contains_key(field) {
32288 dlg.finished(false);
32289 return Err(common::Error::FieldClash(field));
32290 }
32291 }
32292
32293 let mut params = Params::with_capacity(5 + self._additional_params.len());
32294 params.push("parent", self._parent);
32295 params.push("type", self._type_);
32296
32297 params.extend(self._additional_params.iter());
32298
32299 params.push("alt", "json");
32300 let mut url = self.hub._base_url.clone() + "v1/{+parent}/fhir/{+type}";
32301 if self._scopes.is_empty() {
32302 self._scopes
32303 .insert(Scope::CloudHealthcare.as_ref().to_string());
32304 }
32305
32306 #[allow(clippy::single_element_loop)]
32307 for &(find_this, param_name) in [("{+parent}", "parent"), ("{+type}", "type")].iter() {
32308 url = params.uri_replacement(url, param_name, find_this, true);
32309 }
32310 {
32311 let to_remove = ["type", "parent"];
32312 params.remove_params(&to_remove);
32313 }
32314
32315 let url = params.parse_with_url(&url);
32316
32317 let mut json_mime_type = mime::APPLICATION_JSON;
32318 let mut request_value_reader = {
32319 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32320 common::remove_json_null_values(&mut value);
32321 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32322 serde_json::to_writer(&mut dst, &value).unwrap();
32323 dst
32324 };
32325 let request_size = request_value_reader
32326 .seek(std::io::SeekFrom::End(0))
32327 .unwrap();
32328 request_value_reader
32329 .seek(std::io::SeekFrom::Start(0))
32330 .unwrap();
32331
32332 loop {
32333 let token = match self
32334 .hub
32335 .auth
32336 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32337 .await
32338 {
32339 Ok(token) => token,
32340 Err(e) => match dlg.token(e) {
32341 Ok(token) => token,
32342 Err(e) => {
32343 dlg.finished(false);
32344 return Err(common::Error::MissingToken(e));
32345 }
32346 },
32347 };
32348 request_value_reader
32349 .seek(std::io::SeekFrom::Start(0))
32350 .unwrap();
32351 let mut req_result = {
32352 let client = &self.hub.client;
32353 dlg.pre_request();
32354 let mut req_builder = hyper::Request::builder()
32355 .method(hyper::Method::PUT)
32356 .uri(url.as_str())
32357 .header(USER_AGENT, self.hub._user_agent.clone());
32358
32359 if let Some(token) = token.as_ref() {
32360 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32361 }
32362
32363 let request = req_builder
32364 .header(CONTENT_TYPE, json_mime_type.to_string())
32365 .header(CONTENT_LENGTH, request_size as u64)
32366 .body(common::to_body(
32367 request_value_reader.get_ref().clone().into(),
32368 ));
32369
32370 client.request(request.unwrap()).await
32371 };
32372
32373 match req_result {
32374 Err(err) => {
32375 if let common::Retry::After(d) = dlg.http_error(&err) {
32376 sleep(d).await;
32377 continue;
32378 }
32379 dlg.finished(false);
32380 return Err(common::Error::HttpError(err));
32381 }
32382 Ok(res) => {
32383 let (mut parts, body) = res.into_parts();
32384 let mut body = common::Body::new(body);
32385 if !parts.status.is_success() {
32386 let bytes = common::to_bytes(body).await.unwrap_or_default();
32387 let error = serde_json::from_str(&common::to_string(&bytes));
32388 let response = common::to_response(parts, bytes.into());
32389
32390 if let common::Retry::After(d) =
32391 dlg.http_failure(&response, error.as_ref().ok())
32392 {
32393 sleep(d).await;
32394 continue;
32395 }
32396
32397 dlg.finished(false);
32398
32399 return Err(match error {
32400 Ok(value) => common::Error::BadRequest(value),
32401 _ => common::Error::Failure(response),
32402 });
32403 }
32404 let response = {
32405 let bytes = common::to_bytes(body).await.unwrap_or_default();
32406 let encoded = common::to_string(&bytes);
32407 match serde_json::from_str(&encoded) {
32408 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32409 Err(error) => {
32410 dlg.response_json_decode_error(&encoded, &error);
32411 return Err(common::Error::JsonDecodeError(
32412 encoded.to_string(),
32413 error,
32414 ));
32415 }
32416 }
32417 };
32418
32419 dlg.finished(true);
32420 return Ok(response);
32421 }
32422 }
32423 }
32424 }
32425
32426 ///
32427 /// Sets the *request* property to the given value.
32428 ///
32429 /// Even though the property as already been set when instantiating this call,
32430 /// we provide this method for API completeness.
32431 pub fn request(
32432 mut self,
32433 new_value: HttpBody,
32434 ) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateCall<'a, C> {
32435 self._request = new_value;
32436 self
32437 }
32438 /// Required. The name of the FHIR store this resource belongs to.
32439 ///
32440 /// Sets the *parent* path property to the given value.
32441 ///
32442 /// Even though the property as already been set when instantiating this call,
32443 /// we provide this method for API completeness.
32444 pub fn parent(
32445 mut self,
32446 new_value: &str,
32447 ) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateCall<'a, C> {
32448 self._parent = new_value.to_string();
32449 self
32450 }
32451 /// Required. The FHIR resource type to update, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](https://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](https://hl7.org/implement/standards/fhir/R4/resourcelist.html)). Must match the resource type in the provided content.
32452 ///
32453 /// Sets the *type* path property to the given value.
32454 ///
32455 /// Even though the property as already been set when instantiating this call,
32456 /// we provide this method for API completeness.
32457 pub fn type_(
32458 mut self,
32459 new_value: &str,
32460 ) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateCall<'a, C> {
32461 self._type_ = new_value.to_string();
32462 self
32463 }
32464 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32465 /// while executing the actual API request.
32466 ///
32467 /// ````text
32468 /// It should be used to handle progress information, and to implement a certain level of resilience.
32469 /// ````
32470 ///
32471 /// Sets the *delegate* property to the given value.
32472 pub fn delegate(
32473 mut self,
32474 new_value: &'a mut dyn common::Delegate,
32475 ) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateCall<'a, C> {
32476 self._delegate = Some(new_value);
32477 self
32478 }
32479
32480 /// Set any additional parameter of the query string used in the request.
32481 /// It should be used to set parameters which are not yet available through their own
32482 /// setters.
32483 ///
32484 /// Please note that this method must not be used to set any of the known parameters
32485 /// which have their own setter method. If done anyway, the request will fail.
32486 ///
32487 /// # Additional Parameters
32488 ///
32489 /// * *$.xgafv* (query-string) - V1 error format.
32490 /// * *access_token* (query-string) - OAuth access token.
32491 /// * *alt* (query-string) - Data format for response.
32492 /// * *callback* (query-string) - JSONP
32493 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32494 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
32495 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32496 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32497 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
32498 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32499 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32500 pub fn param<T>(
32501 mut self,
32502 name: T,
32503 value: T,
32504 ) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateCall<'a, C>
32505 where
32506 T: AsRef<str>,
32507 {
32508 self._additional_params
32509 .insert(name.as_ref().to_string(), value.as_ref().to_string());
32510 self
32511 }
32512
32513 /// Identifies the authorization scope for the method you are building.
32514 ///
32515 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32516 /// [`Scope::CloudHealthcare`].
32517 ///
32518 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32519 /// tokens for more than one scope.
32520 ///
32521 /// Usually there is more than one suitable scope to authorize an operation, some of which may
32522 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32523 /// sufficient, a read-write scope will do as well.
32524 pub fn add_scope<St>(
32525 mut self,
32526 scope: St,
32527 ) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateCall<'a, C>
32528 where
32529 St: AsRef<str>,
32530 {
32531 self._scopes.insert(String::from(scope.as_ref()));
32532 self
32533 }
32534 /// Identifies the authorization scope(s) for the method you are building.
32535 ///
32536 /// See [`Self::add_scope()`] for details.
32537 pub fn add_scopes<I, St>(
32538 mut self,
32539 scopes: I,
32540 ) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateCall<'a, C>
32541 where
32542 I: IntoIterator<Item = St>,
32543 St: AsRef<str>,
32544 {
32545 self._scopes
32546 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32547 self
32548 }
32549
32550 /// Removes all scopes, and no default scope will be used either.
32551 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32552 /// for details).
32553 pub fn clear_scopes(
32554 mut self,
32555 ) -> ProjectLocationDatasetFhirStoreFhirConditionalUpdateCall<'a, C> {
32556 self._scopes.clear();
32557 self
32558 }
32559}
32560
32561/// Creates a FHIR resource. Implements the FHIR standard create interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#create), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#create), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#create)), which creates a new resource with a server-assigned resource ID. Also supports the FHIR standard conditional create interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#ccreate), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#ccreate), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#ccreate)), specified by supplying an `If-None-Exist` header containing a FHIR search query, limited to searching by resource identifier. If no resources match this search query, the server processes the create operation as normal. When using conditional create, the search term for identifier should be in the pattern `identifier=system|value` or `identifier=value` - similar to the `search` method on resources with a specific identifier. The request body must contain a JSON-encoded FHIR resource, and the request headers must contain `Content-Type: application/fhir+json`. On success, the response body contains a JSON-encoded representation of the resource as it was created on the server, including the server-assigned resource ID and version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `create`, see [Creating a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#creating_a_fhir_resource).
32562///
32563/// A builder for the *locations.datasets.fhirStores.fhir.create* method supported by a *project* resource.
32564/// It is not used directly, but through a [`ProjectMethods`] instance.
32565///
32566/// # Example
32567///
32568/// Instantiate a resource method builder
32569///
32570/// ```test_harness,no_run
32571/// # extern crate hyper;
32572/// # extern crate hyper_rustls;
32573/// # extern crate google_healthcare1 as healthcare1;
32574/// use healthcare1::api::HttpBody;
32575/// # async fn dox() {
32576/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32577///
32578/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32579/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32580/// # secret,
32581/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32582/// # ).build().await.unwrap();
32583///
32584/// # let client = hyper_util::client::legacy::Client::builder(
32585/// # hyper_util::rt::TokioExecutor::new()
32586/// # )
32587/// # .build(
32588/// # hyper_rustls::HttpsConnectorBuilder::new()
32589/// # .with_native_roots()
32590/// # .unwrap()
32591/// # .https_or_http()
32592/// # .enable_http1()
32593/// # .build()
32594/// # );
32595/// # let mut hub = CloudHealthcare::new(client, auth);
32596/// // As the method needs a request, you would usually fill it with the desired information
32597/// // into the respective structure. Some of the parts shown here might not be applicable !
32598/// // Values shown here are possibly random and not representative !
32599/// let mut req = HttpBody::default();
32600///
32601/// // You can configure optional parameters by calling the respective setters at will, and
32602/// // execute the final call using `doit()`.
32603/// // Values shown here are possibly random and not representative !
32604/// let result = hub.projects().locations_datasets_fhir_stores_fhir_create(req, "parent", "type")
32605/// .doit().await;
32606/// # }
32607/// ```
32608pub struct ProjectLocationDatasetFhirStoreFhirCreateCall<'a, C>
32609where
32610 C: 'a,
32611{
32612 hub: &'a CloudHealthcare<C>,
32613 _request: HttpBody,
32614 _parent: String,
32615 _type_: String,
32616 _delegate: Option<&'a mut dyn common::Delegate>,
32617 _additional_params: HashMap<String, String>,
32618 _scopes: BTreeSet<String>,
32619}
32620
32621impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreFhirCreateCall<'a, C> {}
32622
32623impl<'a, C> ProjectLocationDatasetFhirStoreFhirCreateCall<'a, C>
32624where
32625 C: common::Connector,
32626{
32627 /// Perform the operation you have build so far.
32628 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
32629 use std::borrow::Cow;
32630 use std::io::{Read, Seek};
32631
32632 use common::{url::Params, ToParts};
32633 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32634
32635 let mut dd = common::DefaultDelegate;
32636 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32637 dlg.begin(common::MethodInfo {
32638 id: "healthcare.projects.locations.datasets.fhirStores.fhir.create",
32639 http_method: hyper::Method::POST,
32640 });
32641
32642 for &field in ["alt", "parent", "type"].iter() {
32643 if self._additional_params.contains_key(field) {
32644 dlg.finished(false);
32645 return Err(common::Error::FieldClash(field));
32646 }
32647 }
32648
32649 let mut params = Params::with_capacity(5 + self._additional_params.len());
32650 params.push("parent", self._parent);
32651 params.push("type", self._type_);
32652
32653 params.extend(self._additional_params.iter());
32654
32655 params.push("alt", "json");
32656 let mut url = self.hub._base_url.clone() + "v1/{+parent}/fhir/{+type}";
32657 if self._scopes.is_empty() {
32658 self._scopes
32659 .insert(Scope::CloudHealthcare.as_ref().to_string());
32660 }
32661
32662 #[allow(clippy::single_element_loop)]
32663 for &(find_this, param_name) in [("{+parent}", "parent"), ("{+type}", "type")].iter() {
32664 url = params.uri_replacement(url, param_name, find_this, true);
32665 }
32666 {
32667 let to_remove = ["type", "parent"];
32668 params.remove_params(&to_remove);
32669 }
32670
32671 let url = params.parse_with_url(&url);
32672
32673 let mut json_mime_type = mime::APPLICATION_JSON;
32674 let mut request_value_reader = {
32675 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32676 common::remove_json_null_values(&mut value);
32677 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32678 serde_json::to_writer(&mut dst, &value).unwrap();
32679 dst
32680 };
32681 let request_size = request_value_reader
32682 .seek(std::io::SeekFrom::End(0))
32683 .unwrap();
32684 request_value_reader
32685 .seek(std::io::SeekFrom::Start(0))
32686 .unwrap();
32687
32688 loop {
32689 let token = match self
32690 .hub
32691 .auth
32692 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32693 .await
32694 {
32695 Ok(token) => token,
32696 Err(e) => match dlg.token(e) {
32697 Ok(token) => token,
32698 Err(e) => {
32699 dlg.finished(false);
32700 return Err(common::Error::MissingToken(e));
32701 }
32702 },
32703 };
32704 request_value_reader
32705 .seek(std::io::SeekFrom::Start(0))
32706 .unwrap();
32707 let mut req_result = {
32708 let client = &self.hub.client;
32709 dlg.pre_request();
32710 let mut req_builder = hyper::Request::builder()
32711 .method(hyper::Method::POST)
32712 .uri(url.as_str())
32713 .header(USER_AGENT, self.hub._user_agent.clone());
32714
32715 if let Some(token) = token.as_ref() {
32716 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32717 }
32718
32719 let request = req_builder
32720 .header(CONTENT_TYPE, json_mime_type.to_string())
32721 .header(CONTENT_LENGTH, request_size as u64)
32722 .body(common::to_body(
32723 request_value_reader.get_ref().clone().into(),
32724 ));
32725
32726 client.request(request.unwrap()).await
32727 };
32728
32729 match req_result {
32730 Err(err) => {
32731 if let common::Retry::After(d) = dlg.http_error(&err) {
32732 sleep(d).await;
32733 continue;
32734 }
32735 dlg.finished(false);
32736 return Err(common::Error::HttpError(err));
32737 }
32738 Ok(res) => {
32739 let (mut parts, body) = res.into_parts();
32740 let mut body = common::Body::new(body);
32741 if !parts.status.is_success() {
32742 let bytes = common::to_bytes(body).await.unwrap_or_default();
32743 let error = serde_json::from_str(&common::to_string(&bytes));
32744 let response = common::to_response(parts, bytes.into());
32745
32746 if let common::Retry::After(d) =
32747 dlg.http_failure(&response, error.as_ref().ok())
32748 {
32749 sleep(d).await;
32750 continue;
32751 }
32752
32753 dlg.finished(false);
32754
32755 return Err(match error {
32756 Ok(value) => common::Error::BadRequest(value),
32757 _ => common::Error::Failure(response),
32758 });
32759 }
32760 let response = {
32761 let bytes = common::to_bytes(body).await.unwrap_or_default();
32762 let encoded = common::to_string(&bytes);
32763 match serde_json::from_str(&encoded) {
32764 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32765 Err(error) => {
32766 dlg.response_json_decode_error(&encoded, &error);
32767 return Err(common::Error::JsonDecodeError(
32768 encoded.to_string(),
32769 error,
32770 ));
32771 }
32772 }
32773 };
32774
32775 dlg.finished(true);
32776 return Ok(response);
32777 }
32778 }
32779 }
32780 }
32781
32782 ///
32783 /// Sets the *request* property to the given value.
32784 ///
32785 /// Even though the property as already been set when instantiating this call,
32786 /// we provide this method for API completeness.
32787 pub fn request(
32788 mut self,
32789 new_value: HttpBody,
32790 ) -> ProjectLocationDatasetFhirStoreFhirCreateCall<'a, C> {
32791 self._request = new_value;
32792 self
32793 }
32794 /// Required. The name of the FHIR store this resource belongs to.
32795 ///
32796 /// Sets the *parent* path property to the given value.
32797 ///
32798 /// Even though the property as already been set when instantiating this call,
32799 /// we provide this method for API completeness.
32800 pub fn parent(
32801 mut self,
32802 new_value: &str,
32803 ) -> ProjectLocationDatasetFhirStoreFhirCreateCall<'a, C> {
32804 self._parent = new_value.to_string();
32805 self
32806 }
32807 /// Required. The FHIR resource type to create, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](http://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](http://hl7.org/implement/standards/fhir/R4/resourcelist.html)). Must match the resource type in the provided content.
32808 ///
32809 /// Sets the *type* path property to the given value.
32810 ///
32811 /// Even though the property as already been set when instantiating this call,
32812 /// we provide this method for API completeness.
32813 pub fn type_(
32814 mut self,
32815 new_value: &str,
32816 ) -> ProjectLocationDatasetFhirStoreFhirCreateCall<'a, C> {
32817 self._type_ = new_value.to_string();
32818 self
32819 }
32820 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32821 /// while executing the actual API request.
32822 ///
32823 /// ````text
32824 /// It should be used to handle progress information, and to implement a certain level of resilience.
32825 /// ````
32826 ///
32827 /// Sets the *delegate* property to the given value.
32828 pub fn delegate(
32829 mut self,
32830 new_value: &'a mut dyn common::Delegate,
32831 ) -> ProjectLocationDatasetFhirStoreFhirCreateCall<'a, C> {
32832 self._delegate = Some(new_value);
32833 self
32834 }
32835
32836 /// Set any additional parameter of the query string used in the request.
32837 /// It should be used to set parameters which are not yet available through their own
32838 /// setters.
32839 ///
32840 /// Please note that this method must not be used to set any of the known parameters
32841 /// which have their own setter method. If done anyway, the request will fail.
32842 ///
32843 /// # Additional Parameters
32844 ///
32845 /// * *$.xgafv* (query-string) - V1 error format.
32846 /// * *access_token* (query-string) - OAuth access token.
32847 /// * *alt* (query-string) - Data format for response.
32848 /// * *callback* (query-string) - JSONP
32849 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32850 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
32851 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32852 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32853 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
32854 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32855 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32856 pub fn param<T>(
32857 mut self,
32858 name: T,
32859 value: T,
32860 ) -> ProjectLocationDatasetFhirStoreFhirCreateCall<'a, C>
32861 where
32862 T: AsRef<str>,
32863 {
32864 self._additional_params
32865 .insert(name.as_ref().to_string(), value.as_ref().to_string());
32866 self
32867 }
32868
32869 /// Identifies the authorization scope for the method you are building.
32870 ///
32871 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32872 /// [`Scope::CloudHealthcare`].
32873 ///
32874 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32875 /// tokens for more than one scope.
32876 ///
32877 /// Usually there is more than one suitable scope to authorize an operation, some of which may
32878 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32879 /// sufficient, a read-write scope will do as well.
32880 pub fn add_scope<St>(
32881 mut self,
32882 scope: St,
32883 ) -> ProjectLocationDatasetFhirStoreFhirCreateCall<'a, C>
32884 where
32885 St: AsRef<str>,
32886 {
32887 self._scopes.insert(String::from(scope.as_ref()));
32888 self
32889 }
32890 /// Identifies the authorization scope(s) for the method you are building.
32891 ///
32892 /// See [`Self::add_scope()`] for details.
32893 pub fn add_scopes<I, St>(
32894 mut self,
32895 scopes: I,
32896 ) -> ProjectLocationDatasetFhirStoreFhirCreateCall<'a, C>
32897 where
32898 I: IntoIterator<Item = St>,
32899 St: AsRef<str>,
32900 {
32901 self._scopes
32902 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32903 self
32904 }
32905
32906 /// Removes all scopes, and no default scope will be used either.
32907 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32908 /// for details).
32909 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreFhirCreateCall<'a, C> {
32910 self._scopes.clear();
32911 self
32912 }
32913}
32914
32915/// Deletes a FHIR resource. Implements the FHIR standard delete interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#delete), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#delete), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#delete)). Note: Unless resource versioning is disabled by setting the disable_resource_versioning flag on the FHIR store, the deleted resources will be moved to a history repository that can still be retrieved through vread and related methods, unless they are removed by the purge method. For samples that show how to call `delete`, see [Deleting a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#deleting_a_fhir_resource).
32916///
32917/// A builder for the *locations.datasets.fhirStores.fhir.delete* method supported by a *project* resource.
32918/// It is not used directly, but through a [`ProjectMethods`] instance.
32919///
32920/// # Example
32921///
32922/// Instantiate a resource method builder
32923///
32924/// ```test_harness,no_run
32925/// # extern crate hyper;
32926/// # extern crate hyper_rustls;
32927/// # extern crate google_healthcare1 as healthcare1;
32928/// # async fn dox() {
32929/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32930///
32931/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32932/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32933/// # secret,
32934/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32935/// # ).build().await.unwrap();
32936///
32937/// # let client = hyper_util::client::legacy::Client::builder(
32938/// # hyper_util::rt::TokioExecutor::new()
32939/// # )
32940/// # .build(
32941/// # hyper_rustls::HttpsConnectorBuilder::new()
32942/// # .with_native_roots()
32943/// # .unwrap()
32944/// # .https_or_http()
32945/// # .enable_http1()
32946/// # .build()
32947/// # );
32948/// # let mut hub = CloudHealthcare::new(client, auth);
32949/// // You can configure optional parameters by calling the respective setters at will, and
32950/// // execute the final call using `doit()`.
32951/// // Values shown here are possibly random and not representative !
32952/// let result = hub.projects().locations_datasets_fhir_stores_fhir_delete("name")
32953/// .doit().await;
32954/// # }
32955/// ```
32956pub struct ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C>
32957where
32958 C: 'a,
32959{
32960 hub: &'a CloudHealthcare<C>,
32961 _name: String,
32962 _delegate: Option<&'a mut dyn common::Delegate>,
32963 _additional_params: HashMap<String, String>,
32964 _scopes: BTreeSet<String>,
32965}
32966
32967impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C> {}
32968
32969impl<'a, C> ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C>
32970where
32971 C: common::Connector,
32972{
32973 /// Perform the operation you have build so far.
32974 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
32975 use std::borrow::Cow;
32976 use std::io::{Read, Seek};
32977
32978 use common::{url::Params, ToParts};
32979 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32980
32981 let mut dd = common::DefaultDelegate;
32982 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32983 dlg.begin(common::MethodInfo {
32984 id: "healthcare.projects.locations.datasets.fhirStores.fhir.delete",
32985 http_method: hyper::Method::DELETE,
32986 });
32987
32988 for &field in ["alt", "name"].iter() {
32989 if self._additional_params.contains_key(field) {
32990 dlg.finished(false);
32991 return Err(common::Error::FieldClash(field));
32992 }
32993 }
32994
32995 let mut params = Params::with_capacity(3 + self._additional_params.len());
32996 params.push("name", self._name);
32997
32998 params.extend(self._additional_params.iter());
32999
33000 params.push("alt", "json");
33001 let mut url = self.hub._base_url.clone() + "v1/{+name}";
33002 if self._scopes.is_empty() {
33003 self._scopes
33004 .insert(Scope::CloudHealthcare.as_ref().to_string());
33005 }
33006
33007 #[allow(clippy::single_element_loop)]
33008 for &(find_this, param_name) in [("{+name}", "name")].iter() {
33009 url = params.uri_replacement(url, param_name, find_this, true);
33010 }
33011 {
33012 let to_remove = ["name"];
33013 params.remove_params(&to_remove);
33014 }
33015
33016 let url = params.parse_with_url(&url);
33017
33018 loop {
33019 let token = match self
33020 .hub
33021 .auth
33022 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33023 .await
33024 {
33025 Ok(token) => token,
33026 Err(e) => match dlg.token(e) {
33027 Ok(token) => token,
33028 Err(e) => {
33029 dlg.finished(false);
33030 return Err(common::Error::MissingToken(e));
33031 }
33032 },
33033 };
33034 let mut req_result = {
33035 let client = &self.hub.client;
33036 dlg.pre_request();
33037 let mut req_builder = hyper::Request::builder()
33038 .method(hyper::Method::DELETE)
33039 .uri(url.as_str())
33040 .header(USER_AGENT, self.hub._user_agent.clone());
33041
33042 if let Some(token) = token.as_ref() {
33043 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33044 }
33045
33046 let request = req_builder
33047 .header(CONTENT_LENGTH, 0_u64)
33048 .body(common::to_body::<String>(None));
33049
33050 client.request(request.unwrap()).await
33051 };
33052
33053 match req_result {
33054 Err(err) => {
33055 if let common::Retry::After(d) = dlg.http_error(&err) {
33056 sleep(d).await;
33057 continue;
33058 }
33059 dlg.finished(false);
33060 return Err(common::Error::HttpError(err));
33061 }
33062 Ok(res) => {
33063 let (mut parts, body) = res.into_parts();
33064 let mut body = common::Body::new(body);
33065 if !parts.status.is_success() {
33066 let bytes = common::to_bytes(body).await.unwrap_or_default();
33067 let error = serde_json::from_str(&common::to_string(&bytes));
33068 let response = common::to_response(parts, bytes.into());
33069
33070 if let common::Retry::After(d) =
33071 dlg.http_failure(&response, error.as_ref().ok())
33072 {
33073 sleep(d).await;
33074 continue;
33075 }
33076
33077 dlg.finished(false);
33078
33079 return Err(match error {
33080 Ok(value) => common::Error::BadRequest(value),
33081 _ => common::Error::Failure(response),
33082 });
33083 }
33084 let response = {
33085 let bytes = common::to_bytes(body).await.unwrap_or_default();
33086 let encoded = common::to_string(&bytes);
33087 match serde_json::from_str(&encoded) {
33088 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33089 Err(error) => {
33090 dlg.response_json_decode_error(&encoded, &error);
33091 return Err(common::Error::JsonDecodeError(
33092 encoded.to_string(),
33093 error,
33094 ));
33095 }
33096 }
33097 };
33098
33099 dlg.finished(true);
33100 return Ok(response);
33101 }
33102 }
33103 }
33104 }
33105
33106 /// Required. The name of the resource to delete.
33107 ///
33108 /// Sets the *name* path property to the given value.
33109 ///
33110 /// Even though the property as already been set when instantiating this call,
33111 /// we provide this method for API completeness.
33112 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C> {
33113 self._name = new_value.to_string();
33114 self
33115 }
33116 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33117 /// while executing the actual API request.
33118 ///
33119 /// ````text
33120 /// It should be used to handle progress information, and to implement a certain level of resilience.
33121 /// ````
33122 ///
33123 /// Sets the *delegate* property to the given value.
33124 pub fn delegate(
33125 mut self,
33126 new_value: &'a mut dyn common::Delegate,
33127 ) -> ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C> {
33128 self._delegate = Some(new_value);
33129 self
33130 }
33131
33132 /// Set any additional parameter of the query string used in the request.
33133 /// It should be used to set parameters which are not yet available through their own
33134 /// setters.
33135 ///
33136 /// Please note that this method must not be used to set any of the known parameters
33137 /// which have their own setter method. If done anyway, the request will fail.
33138 ///
33139 /// # Additional Parameters
33140 ///
33141 /// * *$.xgafv* (query-string) - V1 error format.
33142 /// * *access_token* (query-string) - OAuth access token.
33143 /// * *alt* (query-string) - Data format for response.
33144 /// * *callback* (query-string) - JSONP
33145 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33146 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
33147 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33148 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33149 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
33150 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33151 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33152 pub fn param<T>(
33153 mut self,
33154 name: T,
33155 value: T,
33156 ) -> ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C>
33157 where
33158 T: AsRef<str>,
33159 {
33160 self._additional_params
33161 .insert(name.as_ref().to_string(), value.as_ref().to_string());
33162 self
33163 }
33164
33165 /// Identifies the authorization scope for the method you are building.
33166 ///
33167 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33168 /// [`Scope::CloudHealthcare`].
33169 ///
33170 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33171 /// tokens for more than one scope.
33172 ///
33173 /// Usually there is more than one suitable scope to authorize an operation, some of which may
33174 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33175 /// sufficient, a read-write scope will do as well.
33176 pub fn add_scope<St>(
33177 mut self,
33178 scope: St,
33179 ) -> ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C>
33180 where
33181 St: AsRef<str>,
33182 {
33183 self._scopes.insert(String::from(scope.as_ref()));
33184 self
33185 }
33186 /// Identifies the authorization scope(s) for the method you are building.
33187 ///
33188 /// See [`Self::add_scope()`] for details.
33189 pub fn add_scopes<I, St>(
33190 mut self,
33191 scopes: I,
33192 ) -> ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C>
33193 where
33194 I: IntoIterator<Item = St>,
33195 St: AsRef<str>,
33196 {
33197 self._scopes
33198 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33199 self
33200 }
33201
33202 /// Removes all scopes, and no default scope will be used either.
33203 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33204 /// for details).
33205 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreFhirDeleteCall<'a, C> {
33206 self._scopes.clear();
33207 self
33208 }
33209}
33210
33211/// Executes all the requests in the given Bundle. Implements the FHIR standard batch/transaction interaction ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#transaction), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#transaction), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#transaction)). Supports all interactions within a bundle, except search. This method accepts Bundles of type `batch` and `transaction`, processing them according to the batch processing rules ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#2.1.0.16.1), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#2.21.0.17.1), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#brules)) and transaction processing rules ([DSTU2](https://hl7.org/implement/standards/fhir/DSTU2/http.html#2.1.0.16.2), [STU3](https://hl7.org/implement/standards/fhir/STU3/http.html#2.21.0.17.2), [R4](https://hl7.org/implement/standards/fhir/R4/http.html#trules)). The request body must contain a JSON-encoded FHIR `Bundle` resource, and the request headers must contain `Content-Type: application/fhir+json`. For a batch bundle or a successful transaction, the response body contains a JSON-encoded representation of a `Bundle` resource of type `batch-response` or `transaction-response` containing one entry for each entry in the request, with the outcome of processing the entry. In the case of an error for a transaction bundle, the response body contains a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. This method checks permissions for each request in the bundle. The `executeBundle` permission is required to call this method, but you must also grant sufficient permissions to execute the individual requests in the bundle. For example, if the bundle contains a request to create a FHIR resource, the caller must also have been granted the `healthcare.fhirResources.create` permission. You can use audit logs to view the permissions for `executeBundle` and each request in the bundle. For more information, see [Viewing Cloud Audit logs](https://cloud.google.com/healthcare-api/docs/how-tos/audit-logging). For samples that show how to call `executeBundle`, see [Managing FHIR resources using FHIR bundles](https://cloud.google.com/healthcare/docs/how-tos/fhir-bundles).
33212///
33213/// A builder for the *locations.datasets.fhirStores.fhir.executeBundle* method supported by a *project* resource.
33214/// It is not used directly, but through a [`ProjectMethods`] instance.
33215///
33216/// # Example
33217///
33218/// Instantiate a resource method builder
33219///
33220/// ```test_harness,no_run
33221/// # extern crate hyper;
33222/// # extern crate hyper_rustls;
33223/// # extern crate google_healthcare1 as healthcare1;
33224/// use healthcare1::api::HttpBody;
33225/// # async fn dox() {
33226/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33227///
33228/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33229/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33230/// # secret,
33231/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33232/// # ).build().await.unwrap();
33233///
33234/// # let client = hyper_util::client::legacy::Client::builder(
33235/// # hyper_util::rt::TokioExecutor::new()
33236/// # )
33237/// # .build(
33238/// # hyper_rustls::HttpsConnectorBuilder::new()
33239/// # .with_native_roots()
33240/// # .unwrap()
33241/// # .https_or_http()
33242/// # .enable_http1()
33243/// # .build()
33244/// # );
33245/// # let mut hub = CloudHealthcare::new(client, auth);
33246/// // As the method needs a request, you would usually fill it with the desired information
33247/// // into the respective structure. Some of the parts shown here might not be applicable !
33248/// // Values shown here are possibly random and not representative !
33249/// let mut req = HttpBody::default();
33250///
33251/// // You can configure optional parameters by calling the respective setters at will, and
33252/// // execute the final call using `doit()`.
33253/// // Values shown here are possibly random and not representative !
33254/// let result = hub.projects().locations_datasets_fhir_stores_fhir_execute_bundle(req, "parent")
33255/// .doit().await;
33256/// # }
33257/// ```
33258pub struct ProjectLocationDatasetFhirStoreFhirExecuteBundleCall<'a, C>
33259where
33260 C: 'a,
33261{
33262 hub: &'a CloudHealthcare<C>,
33263 _request: HttpBody,
33264 _parent: String,
33265 _delegate: Option<&'a mut dyn common::Delegate>,
33266 _additional_params: HashMap<String, String>,
33267 _scopes: BTreeSet<String>,
33268}
33269
33270impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreFhirExecuteBundleCall<'a, C> {}
33271
33272impl<'a, C> ProjectLocationDatasetFhirStoreFhirExecuteBundleCall<'a, C>
33273where
33274 C: common::Connector,
33275{
33276 /// Perform the operation you have build so far.
33277 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
33278 use std::borrow::Cow;
33279 use std::io::{Read, Seek};
33280
33281 use common::{url::Params, ToParts};
33282 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33283
33284 let mut dd = common::DefaultDelegate;
33285 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33286 dlg.begin(common::MethodInfo {
33287 id: "healthcare.projects.locations.datasets.fhirStores.fhir.executeBundle",
33288 http_method: hyper::Method::POST,
33289 });
33290
33291 for &field in ["alt", "parent"].iter() {
33292 if self._additional_params.contains_key(field) {
33293 dlg.finished(false);
33294 return Err(common::Error::FieldClash(field));
33295 }
33296 }
33297
33298 let mut params = Params::with_capacity(4 + self._additional_params.len());
33299 params.push("parent", self._parent);
33300
33301 params.extend(self._additional_params.iter());
33302
33303 params.push("alt", "json");
33304 let mut url = self.hub._base_url.clone() + "v1/{+parent}/fhir";
33305 if self._scopes.is_empty() {
33306 self._scopes
33307 .insert(Scope::CloudHealthcare.as_ref().to_string());
33308 }
33309
33310 #[allow(clippy::single_element_loop)]
33311 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
33312 url = params.uri_replacement(url, param_name, find_this, true);
33313 }
33314 {
33315 let to_remove = ["parent"];
33316 params.remove_params(&to_remove);
33317 }
33318
33319 let url = params.parse_with_url(&url);
33320
33321 let mut json_mime_type = mime::APPLICATION_JSON;
33322 let mut request_value_reader = {
33323 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33324 common::remove_json_null_values(&mut value);
33325 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33326 serde_json::to_writer(&mut dst, &value).unwrap();
33327 dst
33328 };
33329 let request_size = request_value_reader
33330 .seek(std::io::SeekFrom::End(0))
33331 .unwrap();
33332 request_value_reader
33333 .seek(std::io::SeekFrom::Start(0))
33334 .unwrap();
33335
33336 loop {
33337 let token = match self
33338 .hub
33339 .auth
33340 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33341 .await
33342 {
33343 Ok(token) => token,
33344 Err(e) => match dlg.token(e) {
33345 Ok(token) => token,
33346 Err(e) => {
33347 dlg.finished(false);
33348 return Err(common::Error::MissingToken(e));
33349 }
33350 },
33351 };
33352 request_value_reader
33353 .seek(std::io::SeekFrom::Start(0))
33354 .unwrap();
33355 let mut req_result = {
33356 let client = &self.hub.client;
33357 dlg.pre_request();
33358 let mut req_builder = hyper::Request::builder()
33359 .method(hyper::Method::POST)
33360 .uri(url.as_str())
33361 .header(USER_AGENT, self.hub._user_agent.clone());
33362
33363 if let Some(token) = token.as_ref() {
33364 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33365 }
33366
33367 let request = req_builder
33368 .header(CONTENT_TYPE, json_mime_type.to_string())
33369 .header(CONTENT_LENGTH, request_size as u64)
33370 .body(common::to_body(
33371 request_value_reader.get_ref().clone().into(),
33372 ));
33373
33374 client.request(request.unwrap()).await
33375 };
33376
33377 match req_result {
33378 Err(err) => {
33379 if let common::Retry::After(d) = dlg.http_error(&err) {
33380 sleep(d).await;
33381 continue;
33382 }
33383 dlg.finished(false);
33384 return Err(common::Error::HttpError(err));
33385 }
33386 Ok(res) => {
33387 let (mut parts, body) = res.into_parts();
33388 let mut body = common::Body::new(body);
33389 if !parts.status.is_success() {
33390 let bytes = common::to_bytes(body).await.unwrap_or_default();
33391 let error = serde_json::from_str(&common::to_string(&bytes));
33392 let response = common::to_response(parts, bytes.into());
33393
33394 if let common::Retry::After(d) =
33395 dlg.http_failure(&response, error.as_ref().ok())
33396 {
33397 sleep(d).await;
33398 continue;
33399 }
33400
33401 dlg.finished(false);
33402
33403 return Err(match error {
33404 Ok(value) => common::Error::BadRequest(value),
33405 _ => common::Error::Failure(response),
33406 });
33407 }
33408 let response = {
33409 let bytes = common::to_bytes(body).await.unwrap_or_default();
33410 let encoded = common::to_string(&bytes);
33411 match serde_json::from_str(&encoded) {
33412 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33413 Err(error) => {
33414 dlg.response_json_decode_error(&encoded, &error);
33415 return Err(common::Error::JsonDecodeError(
33416 encoded.to_string(),
33417 error,
33418 ));
33419 }
33420 }
33421 };
33422
33423 dlg.finished(true);
33424 return Ok(response);
33425 }
33426 }
33427 }
33428 }
33429
33430 ///
33431 /// Sets the *request* property to the given value.
33432 ///
33433 /// Even though the property as already been set when instantiating this call,
33434 /// we provide this method for API completeness.
33435 pub fn request(
33436 mut self,
33437 new_value: HttpBody,
33438 ) -> ProjectLocationDatasetFhirStoreFhirExecuteBundleCall<'a, C> {
33439 self._request = new_value;
33440 self
33441 }
33442 /// Required. Name of the FHIR store in which this bundle will be executed.
33443 ///
33444 /// Sets the *parent* path property to the given value.
33445 ///
33446 /// Even though the property as already been set when instantiating this call,
33447 /// we provide this method for API completeness.
33448 pub fn parent(
33449 mut self,
33450 new_value: &str,
33451 ) -> ProjectLocationDatasetFhirStoreFhirExecuteBundleCall<'a, C> {
33452 self._parent = new_value.to_string();
33453 self
33454 }
33455 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33456 /// while executing the actual API request.
33457 ///
33458 /// ````text
33459 /// It should be used to handle progress information, and to implement a certain level of resilience.
33460 /// ````
33461 ///
33462 /// Sets the *delegate* property to the given value.
33463 pub fn delegate(
33464 mut self,
33465 new_value: &'a mut dyn common::Delegate,
33466 ) -> ProjectLocationDatasetFhirStoreFhirExecuteBundleCall<'a, C> {
33467 self._delegate = Some(new_value);
33468 self
33469 }
33470
33471 /// Set any additional parameter of the query string used in the request.
33472 /// It should be used to set parameters which are not yet available through their own
33473 /// setters.
33474 ///
33475 /// Please note that this method must not be used to set any of the known parameters
33476 /// which have their own setter method. If done anyway, the request will fail.
33477 ///
33478 /// # Additional Parameters
33479 ///
33480 /// * *$.xgafv* (query-string) - V1 error format.
33481 /// * *access_token* (query-string) - OAuth access token.
33482 /// * *alt* (query-string) - Data format for response.
33483 /// * *callback* (query-string) - JSONP
33484 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33485 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
33486 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33487 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33488 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
33489 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33490 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33491 pub fn param<T>(
33492 mut self,
33493 name: T,
33494 value: T,
33495 ) -> ProjectLocationDatasetFhirStoreFhirExecuteBundleCall<'a, C>
33496 where
33497 T: AsRef<str>,
33498 {
33499 self._additional_params
33500 .insert(name.as_ref().to_string(), value.as_ref().to_string());
33501 self
33502 }
33503
33504 /// Identifies the authorization scope for the method you are building.
33505 ///
33506 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33507 /// [`Scope::CloudHealthcare`].
33508 ///
33509 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33510 /// tokens for more than one scope.
33511 ///
33512 /// Usually there is more than one suitable scope to authorize an operation, some of which may
33513 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33514 /// sufficient, a read-write scope will do as well.
33515 pub fn add_scope<St>(
33516 mut self,
33517 scope: St,
33518 ) -> ProjectLocationDatasetFhirStoreFhirExecuteBundleCall<'a, C>
33519 where
33520 St: AsRef<str>,
33521 {
33522 self._scopes.insert(String::from(scope.as_ref()));
33523 self
33524 }
33525 /// Identifies the authorization scope(s) for the method you are building.
33526 ///
33527 /// See [`Self::add_scope()`] for details.
33528 pub fn add_scopes<I, St>(
33529 mut self,
33530 scopes: I,
33531 ) -> ProjectLocationDatasetFhirStoreFhirExecuteBundleCall<'a, C>
33532 where
33533 I: IntoIterator<Item = St>,
33534 St: AsRef<str>,
33535 {
33536 self._scopes
33537 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33538 self
33539 }
33540
33541 /// Removes all scopes, and no default scope will be used either.
33542 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33543 /// for details).
33544 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreFhirExecuteBundleCall<'a, C> {
33545 self._scopes.clear();
33546 self
33547 }
33548}
33549
33550/// Lists all the versions of a resource (including the current version and deleted versions) from the FHIR store. Implements the per-resource form of the FHIR standard history interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#history), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#history), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#history)). On success, the response body contains a JSON-encoded representation of a `Bundle` resource of type `history`, containing the version history sorted from most recent to oldest versions. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `history`, see [Listing FHIR resource versions](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#listing_fhir_resource_versions).
33551///
33552/// A builder for the *locations.datasets.fhirStores.fhir.history* method supported by a *project* resource.
33553/// It is not used directly, but through a [`ProjectMethods`] instance.
33554///
33555/// # Example
33556///
33557/// Instantiate a resource method builder
33558///
33559/// ```test_harness,no_run
33560/// # extern crate hyper;
33561/// # extern crate hyper_rustls;
33562/// # extern crate google_healthcare1 as healthcare1;
33563/// # async fn dox() {
33564/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33565///
33566/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33567/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33568/// # secret,
33569/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33570/// # ).build().await.unwrap();
33571///
33572/// # let client = hyper_util::client::legacy::Client::builder(
33573/// # hyper_util::rt::TokioExecutor::new()
33574/// # )
33575/// # .build(
33576/// # hyper_rustls::HttpsConnectorBuilder::new()
33577/// # .with_native_roots()
33578/// # .unwrap()
33579/// # .https_or_http()
33580/// # .enable_http1()
33581/// # .build()
33582/// # );
33583/// # let mut hub = CloudHealthcare::new(client, auth);
33584/// // You can configure optional parameters by calling the respective setters at will, and
33585/// // execute the final call using `doit()`.
33586/// // Values shown here are possibly random and not representative !
33587/// let result = hub.projects().locations_datasets_fhir_stores_fhir_history("name")
33588/// ._since("accusam")
33589/// ._page_token("sea")
33590/// ._count(-59)
33591/// ._at("Lorem")
33592/// .doit().await;
33593/// # }
33594/// ```
33595pub struct ProjectLocationDatasetFhirStoreFhirHistoryCall<'a, C>
33596where
33597 C: 'a,
33598{
33599 hub: &'a CloudHealthcare<C>,
33600 _name: String,
33601 __since: Option<String>,
33602 __page_token: Option<String>,
33603 __count: Option<i32>,
33604 __at: Option<String>,
33605 _delegate: Option<&'a mut dyn common::Delegate>,
33606 _additional_params: HashMap<String, String>,
33607 _scopes: BTreeSet<String>,
33608}
33609
33610impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreFhirHistoryCall<'a, C> {}
33611
33612impl<'a, C> ProjectLocationDatasetFhirStoreFhirHistoryCall<'a, C>
33613where
33614 C: common::Connector,
33615{
33616 /// Perform the operation you have build so far.
33617 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
33618 use std::borrow::Cow;
33619 use std::io::{Read, Seek};
33620
33621 use common::{url::Params, ToParts};
33622 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33623
33624 let mut dd = common::DefaultDelegate;
33625 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33626 dlg.begin(common::MethodInfo {
33627 id: "healthcare.projects.locations.datasets.fhirStores.fhir.history",
33628 http_method: hyper::Method::GET,
33629 });
33630
33631 for &field in ["alt", "name", "_since", "_page_token", "_count", "_at"].iter() {
33632 if self._additional_params.contains_key(field) {
33633 dlg.finished(false);
33634 return Err(common::Error::FieldClash(field));
33635 }
33636 }
33637
33638 let mut params = Params::with_capacity(7 + self._additional_params.len());
33639 params.push("name", self._name);
33640 if let Some(value) = self.__since.as_ref() {
33641 params.push("_since", value);
33642 }
33643 if let Some(value) = self.__page_token.as_ref() {
33644 params.push("_page_token", value);
33645 }
33646 if let Some(value) = self.__count.as_ref() {
33647 params.push("_count", value.to_string());
33648 }
33649 if let Some(value) = self.__at.as_ref() {
33650 params.push("_at", value);
33651 }
33652
33653 params.extend(self._additional_params.iter());
33654
33655 params.push("alt", "json");
33656 let mut url = self.hub._base_url.clone() + "v1/{+name}/_history";
33657 if self._scopes.is_empty() {
33658 self._scopes
33659 .insert(Scope::CloudHealthcare.as_ref().to_string());
33660 }
33661
33662 #[allow(clippy::single_element_loop)]
33663 for &(find_this, param_name) in [("{+name}", "name")].iter() {
33664 url = params.uri_replacement(url, param_name, find_this, true);
33665 }
33666 {
33667 let to_remove = ["name"];
33668 params.remove_params(&to_remove);
33669 }
33670
33671 let url = params.parse_with_url(&url);
33672
33673 loop {
33674 let token = match self
33675 .hub
33676 .auth
33677 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33678 .await
33679 {
33680 Ok(token) => token,
33681 Err(e) => match dlg.token(e) {
33682 Ok(token) => token,
33683 Err(e) => {
33684 dlg.finished(false);
33685 return Err(common::Error::MissingToken(e));
33686 }
33687 },
33688 };
33689 let mut req_result = {
33690 let client = &self.hub.client;
33691 dlg.pre_request();
33692 let mut req_builder = hyper::Request::builder()
33693 .method(hyper::Method::GET)
33694 .uri(url.as_str())
33695 .header(USER_AGENT, self.hub._user_agent.clone());
33696
33697 if let Some(token) = token.as_ref() {
33698 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33699 }
33700
33701 let request = req_builder
33702 .header(CONTENT_LENGTH, 0_u64)
33703 .body(common::to_body::<String>(None));
33704
33705 client.request(request.unwrap()).await
33706 };
33707
33708 match req_result {
33709 Err(err) => {
33710 if let common::Retry::After(d) = dlg.http_error(&err) {
33711 sleep(d).await;
33712 continue;
33713 }
33714 dlg.finished(false);
33715 return Err(common::Error::HttpError(err));
33716 }
33717 Ok(res) => {
33718 let (mut parts, body) = res.into_parts();
33719 let mut body = common::Body::new(body);
33720 if !parts.status.is_success() {
33721 let bytes = common::to_bytes(body).await.unwrap_or_default();
33722 let error = serde_json::from_str(&common::to_string(&bytes));
33723 let response = common::to_response(parts, bytes.into());
33724
33725 if let common::Retry::After(d) =
33726 dlg.http_failure(&response, error.as_ref().ok())
33727 {
33728 sleep(d).await;
33729 continue;
33730 }
33731
33732 dlg.finished(false);
33733
33734 return Err(match error {
33735 Ok(value) => common::Error::BadRequest(value),
33736 _ => common::Error::Failure(response),
33737 });
33738 }
33739 let response = {
33740 let bytes = common::to_bytes(body).await.unwrap_or_default();
33741 let encoded = common::to_string(&bytes);
33742 match serde_json::from_str(&encoded) {
33743 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33744 Err(error) => {
33745 dlg.response_json_decode_error(&encoded, &error);
33746 return Err(common::Error::JsonDecodeError(
33747 encoded.to_string(),
33748 error,
33749 ));
33750 }
33751 }
33752 };
33753
33754 dlg.finished(true);
33755 return Ok(response);
33756 }
33757 }
33758 }
33759 }
33760
33761 /// Required. The name of the resource to retrieve.
33762 ///
33763 /// Sets the *name* path property to the given value.
33764 ///
33765 /// Even though the property as already been set when instantiating this call,
33766 /// we provide this method for API completeness.
33767 pub fn name(
33768 mut self,
33769 new_value: &str,
33770 ) -> ProjectLocationDatasetFhirStoreFhirHistoryCall<'a, C> {
33771 self._name = new_value.to_string();
33772 self
33773 }
33774 /// Only include resource versions that were created at or after the given instant in time. The instant in time uses the format YYYY-MM-DDThh:mm:ss.sss+zz:zz (for example 2015-02-07T13:28:17.239+02:00 or 2017-01-01T00:00:00Z). The time must be specified to the second and include a time zone.
33775 ///
33776 /// Sets the *_since* query property to the given value.
33777 pub fn _since(
33778 mut self,
33779 new_value: &str,
33780 ) -> ProjectLocationDatasetFhirStoreFhirHistoryCall<'a, C> {
33781 self.__since = Some(new_value.to_string());
33782 self
33783 }
33784 /// Used to retrieve the first, previous, next, or last page of resource versions when using pagination. Value should be set to the value of `_page_token` set in next or previous page links' URLs. Next and previous page are returned in the response bundle's links field, where `link.relation` is "previous" or "next". Omit `_page_token` if no previous request has been made.
33785 ///
33786 /// Sets the *_page_token* query property to the given value.
33787 pub fn _page_token(
33788 mut self,
33789 new_value: &str,
33790 ) -> ProjectLocationDatasetFhirStoreFhirHistoryCall<'a, C> {
33791 self.__page_token = Some(new_value.to_string());
33792 self
33793 }
33794 /// The maximum number of search results on a page. If not specified, 100 is used. May not be larger than 1000.
33795 ///
33796 /// Sets the *_count* query property to the given value.
33797 pub fn _count(
33798 mut self,
33799 new_value: i32,
33800 ) -> ProjectLocationDatasetFhirStoreFhirHistoryCall<'a, C> {
33801 self.__count = Some(new_value);
33802 self
33803 }
33804 /// Only include resource versions that were current at some point during the time period specified in the date time value. The date parameter format is yyyy-mm-ddThh:mm:ss[Z|(+|-)hh:mm] Clients may specify any of the following: * An entire year: `_at=2019` * An entire month: `_at=2019-01` * A specific day: `_at=2019-01-20` * A specific second: `_at=2018-12-31T23:59:58Z`
33805 ///
33806 /// Sets the *_at* query property to the given value.
33807 pub fn _at(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirHistoryCall<'a, C> {
33808 self.__at = Some(new_value.to_string());
33809 self
33810 }
33811 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33812 /// while executing the actual API request.
33813 ///
33814 /// ````text
33815 /// It should be used to handle progress information, and to implement a certain level of resilience.
33816 /// ````
33817 ///
33818 /// Sets the *delegate* property to the given value.
33819 pub fn delegate(
33820 mut self,
33821 new_value: &'a mut dyn common::Delegate,
33822 ) -> ProjectLocationDatasetFhirStoreFhirHistoryCall<'a, C> {
33823 self._delegate = Some(new_value);
33824 self
33825 }
33826
33827 /// Set any additional parameter of the query string used in the request.
33828 /// It should be used to set parameters which are not yet available through their own
33829 /// setters.
33830 ///
33831 /// Please note that this method must not be used to set any of the known parameters
33832 /// which have their own setter method. If done anyway, the request will fail.
33833 ///
33834 /// # Additional Parameters
33835 ///
33836 /// * *$.xgafv* (query-string) - V1 error format.
33837 /// * *access_token* (query-string) - OAuth access token.
33838 /// * *alt* (query-string) - Data format for response.
33839 /// * *callback* (query-string) - JSONP
33840 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33841 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
33842 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33843 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33844 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
33845 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33846 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33847 pub fn param<T>(
33848 mut self,
33849 name: T,
33850 value: T,
33851 ) -> ProjectLocationDatasetFhirStoreFhirHistoryCall<'a, C>
33852 where
33853 T: AsRef<str>,
33854 {
33855 self._additional_params
33856 .insert(name.as_ref().to_string(), value.as_ref().to_string());
33857 self
33858 }
33859
33860 /// Identifies the authorization scope for the method you are building.
33861 ///
33862 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33863 /// [`Scope::CloudHealthcare`].
33864 ///
33865 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33866 /// tokens for more than one scope.
33867 ///
33868 /// Usually there is more than one suitable scope to authorize an operation, some of which may
33869 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33870 /// sufficient, a read-write scope will do as well.
33871 pub fn add_scope<St>(
33872 mut self,
33873 scope: St,
33874 ) -> ProjectLocationDatasetFhirStoreFhirHistoryCall<'a, C>
33875 where
33876 St: AsRef<str>,
33877 {
33878 self._scopes.insert(String::from(scope.as_ref()));
33879 self
33880 }
33881 /// Identifies the authorization scope(s) for the method you are building.
33882 ///
33883 /// See [`Self::add_scope()`] for details.
33884 pub fn add_scopes<I, St>(
33885 mut self,
33886 scopes: I,
33887 ) -> ProjectLocationDatasetFhirStoreFhirHistoryCall<'a, C>
33888 where
33889 I: IntoIterator<Item = St>,
33890 St: AsRef<str>,
33891 {
33892 self._scopes
33893 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33894 self
33895 }
33896
33897 /// Removes all scopes, and no default scope will be used either.
33898 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33899 /// for details).
33900 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreFhirHistoryCall<'a, C> {
33901 self._scopes.clear();
33902 self
33903 }
33904}
33905
33906/// Updates part of an existing resource by applying the operations specified in a [JSON Patch](http://jsonpatch.com/) document. Implements the FHIR standard patch interaction ([STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#patch), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#patch)). DSTU2 doesn't define a patch method, but the server supports it in the same way it supports STU3. The request body must contain a JSON Patch document, and the request headers must contain `Content-Type: application/json-patch+json`. On success, the response body contains a JSON-encoded representation of the updated resource, including the server-assigned version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `patch`, see [Patching a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#patching_a_fhir_resource).
33907///
33908/// A builder for the *locations.datasets.fhirStores.fhir.patch* method supported by a *project* resource.
33909/// It is not used directly, but through a [`ProjectMethods`] instance.
33910///
33911/// # Example
33912///
33913/// Instantiate a resource method builder
33914///
33915/// ```test_harness,no_run
33916/// # extern crate hyper;
33917/// # extern crate hyper_rustls;
33918/// # extern crate google_healthcare1 as healthcare1;
33919/// use healthcare1::api::HttpBody;
33920/// # async fn dox() {
33921/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33922///
33923/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33924/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33925/// # secret,
33926/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33927/// # ).build().await.unwrap();
33928///
33929/// # let client = hyper_util::client::legacy::Client::builder(
33930/// # hyper_util::rt::TokioExecutor::new()
33931/// # )
33932/// # .build(
33933/// # hyper_rustls::HttpsConnectorBuilder::new()
33934/// # .with_native_roots()
33935/// # .unwrap()
33936/// # .https_or_http()
33937/// # .enable_http1()
33938/// # .build()
33939/// # );
33940/// # let mut hub = CloudHealthcare::new(client, auth);
33941/// // As the method needs a request, you would usually fill it with the desired information
33942/// // into the respective structure. Some of the parts shown here might not be applicable !
33943/// // Values shown here are possibly random and not representative !
33944/// let mut req = HttpBody::default();
33945///
33946/// // You can configure optional parameters by calling the respective setters at will, and
33947/// // execute the final call using `doit()`.
33948/// // Values shown here are possibly random and not representative !
33949/// let result = hub.projects().locations_datasets_fhir_stores_fhir_patch(req, "name")
33950/// .doit().await;
33951/// # }
33952/// ```
33953pub struct ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C>
33954where
33955 C: 'a,
33956{
33957 hub: &'a CloudHealthcare<C>,
33958 _request: HttpBody,
33959 _name: String,
33960 _delegate: Option<&'a mut dyn common::Delegate>,
33961 _additional_params: HashMap<String, String>,
33962 _scopes: BTreeSet<String>,
33963}
33964
33965impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C> {}
33966
33967impl<'a, C> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C>
33968where
33969 C: common::Connector,
33970{
33971 /// Perform the operation you have build so far.
33972 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
33973 use std::borrow::Cow;
33974 use std::io::{Read, Seek};
33975
33976 use common::{url::Params, ToParts};
33977 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33978
33979 let mut dd = common::DefaultDelegate;
33980 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33981 dlg.begin(common::MethodInfo {
33982 id: "healthcare.projects.locations.datasets.fhirStores.fhir.patch",
33983 http_method: hyper::Method::PATCH,
33984 });
33985
33986 for &field in ["alt", "name"].iter() {
33987 if self._additional_params.contains_key(field) {
33988 dlg.finished(false);
33989 return Err(common::Error::FieldClash(field));
33990 }
33991 }
33992
33993 let mut params = Params::with_capacity(4 + self._additional_params.len());
33994 params.push("name", self._name);
33995
33996 params.extend(self._additional_params.iter());
33997
33998 params.push("alt", "json");
33999 let mut url = self.hub._base_url.clone() + "v1/{+name}";
34000 if self._scopes.is_empty() {
34001 self._scopes
34002 .insert(Scope::CloudHealthcare.as_ref().to_string());
34003 }
34004
34005 #[allow(clippy::single_element_loop)]
34006 for &(find_this, param_name) in [("{+name}", "name")].iter() {
34007 url = params.uri_replacement(url, param_name, find_this, true);
34008 }
34009 {
34010 let to_remove = ["name"];
34011 params.remove_params(&to_remove);
34012 }
34013
34014 let url = params.parse_with_url(&url);
34015
34016 let mut json_mime_type = mime::APPLICATION_JSON;
34017 let mut request_value_reader = {
34018 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
34019 common::remove_json_null_values(&mut value);
34020 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
34021 serde_json::to_writer(&mut dst, &value).unwrap();
34022 dst
34023 };
34024 let request_size = request_value_reader
34025 .seek(std::io::SeekFrom::End(0))
34026 .unwrap();
34027 request_value_reader
34028 .seek(std::io::SeekFrom::Start(0))
34029 .unwrap();
34030
34031 loop {
34032 let token = match self
34033 .hub
34034 .auth
34035 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34036 .await
34037 {
34038 Ok(token) => token,
34039 Err(e) => match dlg.token(e) {
34040 Ok(token) => token,
34041 Err(e) => {
34042 dlg.finished(false);
34043 return Err(common::Error::MissingToken(e));
34044 }
34045 },
34046 };
34047 request_value_reader
34048 .seek(std::io::SeekFrom::Start(0))
34049 .unwrap();
34050 let mut req_result = {
34051 let client = &self.hub.client;
34052 dlg.pre_request();
34053 let mut req_builder = hyper::Request::builder()
34054 .method(hyper::Method::PATCH)
34055 .uri(url.as_str())
34056 .header(USER_AGENT, self.hub._user_agent.clone());
34057
34058 if let Some(token) = token.as_ref() {
34059 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34060 }
34061
34062 let request = req_builder
34063 .header(CONTENT_TYPE, json_mime_type.to_string())
34064 .header(CONTENT_LENGTH, request_size as u64)
34065 .body(common::to_body(
34066 request_value_reader.get_ref().clone().into(),
34067 ));
34068
34069 client.request(request.unwrap()).await
34070 };
34071
34072 match req_result {
34073 Err(err) => {
34074 if let common::Retry::After(d) = dlg.http_error(&err) {
34075 sleep(d).await;
34076 continue;
34077 }
34078 dlg.finished(false);
34079 return Err(common::Error::HttpError(err));
34080 }
34081 Ok(res) => {
34082 let (mut parts, body) = res.into_parts();
34083 let mut body = common::Body::new(body);
34084 if !parts.status.is_success() {
34085 let bytes = common::to_bytes(body).await.unwrap_or_default();
34086 let error = serde_json::from_str(&common::to_string(&bytes));
34087 let response = common::to_response(parts, bytes.into());
34088
34089 if let common::Retry::After(d) =
34090 dlg.http_failure(&response, error.as_ref().ok())
34091 {
34092 sleep(d).await;
34093 continue;
34094 }
34095
34096 dlg.finished(false);
34097
34098 return Err(match error {
34099 Ok(value) => common::Error::BadRequest(value),
34100 _ => common::Error::Failure(response),
34101 });
34102 }
34103 let response = {
34104 let bytes = common::to_bytes(body).await.unwrap_or_default();
34105 let encoded = common::to_string(&bytes);
34106 match serde_json::from_str(&encoded) {
34107 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34108 Err(error) => {
34109 dlg.response_json_decode_error(&encoded, &error);
34110 return Err(common::Error::JsonDecodeError(
34111 encoded.to_string(),
34112 error,
34113 ));
34114 }
34115 }
34116 };
34117
34118 dlg.finished(true);
34119 return Ok(response);
34120 }
34121 }
34122 }
34123 }
34124
34125 ///
34126 /// Sets the *request* property to the given value.
34127 ///
34128 /// Even though the property as already been set when instantiating this call,
34129 /// we provide this method for API completeness.
34130 pub fn request(
34131 mut self,
34132 new_value: HttpBody,
34133 ) -> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C> {
34134 self._request = new_value;
34135 self
34136 }
34137 /// Required. The name of the resource to update.
34138 ///
34139 /// Sets the *name* path property to the given value.
34140 ///
34141 /// Even though the property as already been set when instantiating this call,
34142 /// we provide this method for API completeness.
34143 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C> {
34144 self._name = new_value.to_string();
34145 self
34146 }
34147 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34148 /// while executing the actual API request.
34149 ///
34150 /// ````text
34151 /// It should be used to handle progress information, and to implement a certain level of resilience.
34152 /// ````
34153 ///
34154 /// Sets the *delegate* property to the given value.
34155 pub fn delegate(
34156 mut self,
34157 new_value: &'a mut dyn common::Delegate,
34158 ) -> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C> {
34159 self._delegate = Some(new_value);
34160 self
34161 }
34162
34163 /// Set any additional parameter of the query string used in the request.
34164 /// It should be used to set parameters which are not yet available through their own
34165 /// setters.
34166 ///
34167 /// Please note that this method must not be used to set any of the known parameters
34168 /// which have their own setter method. If done anyway, the request will fail.
34169 ///
34170 /// # Additional Parameters
34171 ///
34172 /// * *$.xgafv* (query-string) - V1 error format.
34173 /// * *access_token* (query-string) - OAuth access token.
34174 /// * *alt* (query-string) - Data format for response.
34175 /// * *callback* (query-string) - JSONP
34176 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34177 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
34178 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34179 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34180 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
34181 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34182 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34183 pub fn param<T>(
34184 mut self,
34185 name: T,
34186 value: T,
34187 ) -> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C>
34188 where
34189 T: AsRef<str>,
34190 {
34191 self._additional_params
34192 .insert(name.as_ref().to_string(), value.as_ref().to_string());
34193 self
34194 }
34195
34196 /// Identifies the authorization scope for the method you are building.
34197 ///
34198 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34199 /// [`Scope::CloudHealthcare`].
34200 ///
34201 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34202 /// tokens for more than one scope.
34203 ///
34204 /// Usually there is more than one suitable scope to authorize an operation, some of which may
34205 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34206 /// sufficient, a read-write scope will do as well.
34207 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C>
34208 where
34209 St: AsRef<str>,
34210 {
34211 self._scopes.insert(String::from(scope.as_ref()));
34212 self
34213 }
34214 /// Identifies the authorization scope(s) for the method you are building.
34215 ///
34216 /// See [`Self::add_scope()`] for details.
34217 pub fn add_scopes<I, St>(
34218 mut self,
34219 scopes: I,
34220 ) -> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C>
34221 where
34222 I: IntoIterator<Item = St>,
34223 St: AsRef<str>,
34224 {
34225 self._scopes
34226 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34227 self
34228 }
34229
34230 /// Removes all scopes, and no default scope will be used either.
34231 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34232 /// for details).
34233 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreFhirPatchCall<'a, C> {
34234 self._scopes.clear();
34235 self
34236 }
34237}
34238
34239/// Gets the contents of a FHIR resource. Implements the FHIR standard read interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#read), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#read), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#read)). Also supports the FHIR standard conditional read interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#cread), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#cread), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#cread)) specified by supplying an `If-Modified-Since` header with a date/time value or an `If-None-Match` header with an ETag value. On success, the response body contains a JSON-encoded representation of the resource. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `read`, see [Getting a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#getting_a_fhir_resource).
34240///
34241/// A builder for the *locations.datasets.fhirStores.fhir.read* method supported by a *project* resource.
34242/// It is not used directly, but through a [`ProjectMethods`] instance.
34243///
34244/// # Example
34245///
34246/// Instantiate a resource method builder
34247///
34248/// ```test_harness,no_run
34249/// # extern crate hyper;
34250/// # extern crate hyper_rustls;
34251/// # extern crate google_healthcare1 as healthcare1;
34252/// # async fn dox() {
34253/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34254///
34255/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34256/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34257/// # secret,
34258/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34259/// # ).build().await.unwrap();
34260///
34261/// # let client = hyper_util::client::legacy::Client::builder(
34262/// # hyper_util::rt::TokioExecutor::new()
34263/// # )
34264/// # .build(
34265/// # hyper_rustls::HttpsConnectorBuilder::new()
34266/// # .with_native_roots()
34267/// # .unwrap()
34268/// # .https_or_http()
34269/// # .enable_http1()
34270/// # .build()
34271/// # );
34272/// # let mut hub = CloudHealthcare::new(client, auth);
34273/// // You can configure optional parameters by calling the respective setters at will, and
34274/// // execute the final call using `doit()`.
34275/// // Values shown here are possibly random and not representative !
34276/// let result = hub.projects().locations_datasets_fhir_stores_fhir_read("name")
34277/// .doit().await;
34278/// # }
34279/// ```
34280pub struct ProjectLocationDatasetFhirStoreFhirReadCall<'a, C>
34281where
34282 C: 'a,
34283{
34284 hub: &'a CloudHealthcare<C>,
34285 _name: String,
34286 _delegate: Option<&'a mut dyn common::Delegate>,
34287 _additional_params: HashMap<String, String>,
34288 _scopes: BTreeSet<String>,
34289}
34290
34291impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreFhirReadCall<'a, C> {}
34292
34293impl<'a, C> ProjectLocationDatasetFhirStoreFhirReadCall<'a, C>
34294where
34295 C: common::Connector,
34296{
34297 /// Perform the operation you have build so far.
34298 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
34299 use std::borrow::Cow;
34300 use std::io::{Read, Seek};
34301
34302 use common::{url::Params, ToParts};
34303 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34304
34305 let mut dd = common::DefaultDelegate;
34306 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34307 dlg.begin(common::MethodInfo {
34308 id: "healthcare.projects.locations.datasets.fhirStores.fhir.read",
34309 http_method: hyper::Method::GET,
34310 });
34311
34312 for &field in ["alt", "name"].iter() {
34313 if self._additional_params.contains_key(field) {
34314 dlg.finished(false);
34315 return Err(common::Error::FieldClash(field));
34316 }
34317 }
34318
34319 let mut params = Params::with_capacity(3 + self._additional_params.len());
34320 params.push("name", self._name);
34321
34322 params.extend(self._additional_params.iter());
34323
34324 params.push("alt", "json");
34325 let mut url = self.hub._base_url.clone() + "v1/{+name}";
34326 if self._scopes.is_empty() {
34327 self._scopes
34328 .insert(Scope::CloudHealthcare.as_ref().to_string());
34329 }
34330
34331 #[allow(clippy::single_element_loop)]
34332 for &(find_this, param_name) in [("{+name}", "name")].iter() {
34333 url = params.uri_replacement(url, param_name, find_this, true);
34334 }
34335 {
34336 let to_remove = ["name"];
34337 params.remove_params(&to_remove);
34338 }
34339
34340 let url = params.parse_with_url(&url);
34341
34342 loop {
34343 let token = match self
34344 .hub
34345 .auth
34346 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34347 .await
34348 {
34349 Ok(token) => token,
34350 Err(e) => match dlg.token(e) {
34351 Ok(token) => token,
34352 Err(e) => {
34353 dlg.finished(false);
34354 return Err(common::Error::MissingToken(e));
34355 }
34356 },
34357 };
34358 let mut req_result = {
34359 let client = &self.hub.client;
34360 dlg.pre_request();
34361 let mut req_builder = hyper::Request::builder()
34362 .method(hyper::Method::GET)
34363 .uri(url.as_str())
34364 .header(USER_AGENT, self.hub._user_agent.clone());
34365
34366 if let Some(token) = token.as_ref() {
34367 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34368 }
34369
34370 let request = req_builder
34371 .header(CONTENT_LENGTH, 0_u64)
34372 .body(common::to_body::<String>(None));
34373
34374 client.request(request.unwrap()).await
34375 };
34376
34377 match req_result {
34378 Err(err) => {
34379 if let common::Retry::After(d) = dlg.http_error(&err) {
34380 sleep(d).await;
34381 continue;
34382 }
34383 dlg.finished(false);
34384 return Err(common::Error::HttpError(err));
34385 }
34386 Ok(res) => {
34387 let (mut parts, body) = res.into_parts();
34388 let mut body = common::Body::new(body);
34389 if !parts.status.is_success() {
34390 let bytes = common::to_bytes(body).await.unwrap_or_default();
34391 let error = serde_json::from_str(&common::to_string(&bytes));
34392 let response = common::to_response(parts, bytes.into());
34393
34394 if let common::Retry::After(d) =
34395 dlg.http_failure(&response, error.as_ref().ok())
34396 {
34397 sleep(d).await;
34398 continue;
34399 }
34400
34401 dlg.finished(false);
34402
34403 return Err(match error {
34404 Ok(value) => common::Error::BadRequest(value),
34405 _ => common::Error::Failure(response),
34406 });
34407 }
34408 let response = {
34409 let bytes = common::to_bytes(body).await.unwrap_or_default();
34410 let encoded = common::to_string(&bytes);
34411 match serde_json::from_str(&encoded) {
34412 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34413 Err(error) => {
34414 dlg.response_json_decode_error(&encoded, &error);
34415 return Err(common::Error::JsonDecodeError(
34416 encoded.to_string(),
34417 error,
34418 ));
34419 }
34420 }
34421 };
34422
34423 dlg.finished(true);
34424 return Ok(response);
34425 }
34426 }
34427 }
34428 }
34429
34430 /// Required. The name of the resource to retrieve.
34431 ///
34432 /// Sets the *name* path property to the given value.
34433 ///
34434 /// Even though the property as already been set when instantiating this call,
34435 /// we provide this method for API completeness.
34436 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirReadCall<'a, C> {
34437 self._name = new_value.to_string();
34438 self
34439 }
34440 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34441 /// while executing the actual API request.
34442 ///
34443 /// ````text
34444 /// It should be used to handle progress information, and to implement a certain level of resilience.
34445 /// ````
34446 ///
34447 /// Sets the *delegate* property to the given value.
34448 pub fn delegate(
34449 mut self,
34450 new_value: &'a mut dyn common::Delegate,
34451 ) -> ProjectLocationDatasetFhirStoreFhirReadCall<'a, C> {
34452 self._delegate = Some(new_value);
34453 self
34454 }
34455
34456 /// Set any additional parameter of the query string used in the request.
34457 /// It should be used to set parameters which are not yet available through their own
34458 /// setters.
34459 ///
34460 /// Please note that this method must not be used to set any of the known parameters
34461 /// which have their own setter method. If done anyway, the request will fail.
34462 ///
34463 /// # Additional Parameters
34464 ///
34465 /// * *$.xgafv* (query-string) - V1 error format.
34466 /// * *access_token* (query-string) - OAuth access token.
34467 /// * *alt* (query-string) - Data format for response.
34468 /// * *callback* (query-string) - JSONP
34469 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34470 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
34471 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34472 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34473 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
34474 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34475 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34476 pub fn param<T>(
34477 mut self,
34478 name: T,
34479 value: T,
34480 ) -> ProjectLocationDatasetFhirStoreFhirReadCall<'a, C>
34481 where
34482 T: AsRef<str>,
34483 {
34484 self._additional_params
34485 .insert(name.as_ref().to_string(), value.as_ref().to_string());
34486 self
34487 }
34488
34489 /// Identifies the authorization scope for the method you are building.
34490 ///
34491 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34492 /// [`Scope::CloudHealthcare`].
34493 ///
34494 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34495 /// tokens for more than one scope.
34496 ///
34497 /// Usually there is more than one suitable scope to authorize an operation, some of which may
34498 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34499 /// sufficient, a read-write scope will do as well.
34500 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetFhirStoreFhirReadCall<'a, C>
34501 where
34502 St: AsRef<str>,
34503 {
34504 self._scopes.insert(String::from(scope.as_ref()));
34505 self
34506 }
34507 /// Identifies the authorization scope(s) for the method you are building.
34508 ///
34509 /// See [`Self::add_scope()`] for details.
34510 pub fn add_scopes<I, St>(
34511 mut self,
34512 scopes: I,
34513 ) -> ProjectLocationDatasetFhirStoreFhirReadCall<'a, C>
34514 where
34515 I: IntoIterator<Item = St>,
34516 St: AsRef<str>,
34517 {
34518 self._scopes
34519 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34520 self
34521 }
34522
34523 /// Removes all scopes, and no default scope will be used either.
34524 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34525 /// for details).
34526 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreFhirReadCall<'a, C> {
34527 self._scopes.clear();
34528 self
34529 }
34530}
34531
34532/// Searches for resources in the given FHIR store according to criteria specified as query parameters. Implements the FHIR standard search interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#search), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#search), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#search)) using the search semantics described in the FHIR Search specification ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/search.html), [STU3](http://hl7.org/implement/standards/fhir/STU3/search.html), [R4](http://hl7.org/implement/standards/fhir/R4/search.html)). Supports four methods of search defined by the specification: * `GET [base]?[parameters]` to search across all resources. * `GET [base]/[type]?[parameters]` to search resources of a specified type. * `POST [base]/_search?[parameters]` as an alternate form having the same semantics as the `GET` method across all resources. * `POST [base]/[type]/_search?[parameters]` as an alternate form having the same semantics as the `GET` method for the specified type. The `GET` and `POST` methods do not support compartment searches. The `POST` method does not support `application/x-www-form-urlencoded` search parameters. On success, the response body contains a JSON-encoded representation of a `Bundle` resource of type `searchset`, containing the results of the search. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. The server's capability statement, retrieved through capabilities, indicates what search parameters are supported on each FHIR resource. A list of all search parameters defined by the specification can be found in the FHIR Search Parameter Registry ([STU3](http://hl7.org/implement/standards/fhir/STU3/searchparameter-registry.html), [R4](http://hl7.org/implement/standards/fhir/R4/searchparameter-registry.html)). FHIR search parameters for DSTU2 can be found on each resource's definition page. Supported search modifiers: `:missing`, `:exact`, `:contains`, `:text`, `:in`, `:not-in`, `:above`, `:below`, `:[type]`, `:not`, and `recurse` (DSTU2 and STU3) or `:iterate` (R4). Supported search result parameters: `_sort`, `_count`, `_include`, `_revinclude`, `_summary=text`, `_summary=data`, and `_elements`. The maximum number of search results returned defaults to 100, which can be overridden by the `_count` parameter up to a maximum limit of 1000. The server might return fewer resources than requested to prevent excessively large responses. If there are additional results, the returned `Bundle` contains a link of `relation` "next", which has a `_page_token` parameter for an opaque pagination token that can be used to retrieve the next page. Resources with a total size larger than 5MB or a field count larger than 50,000 might not be fully searchable as the server might trim its generated search index in those cases. Note: FHIR resources are indexed asynchronously, so there might be a slight delay between the time a resource is created or changed, and the time when the change reflects in search results. The only exception is resource identifier data, which is indexed synchronously as a special index. As a result, searching using resource identifier is not subject to indexing delay. To use the special synchronous index, the search term for identifier should be in the pattern `identifier=[system]|[value]` or `identifier=[value]`, and any of the following search result parameters can be used: * `_count` * `_include` * `_revinclude` * `_summary` * `_elements` If your query contains any other search parameters, the standard asynchronous index will be used instead. Note that searching against the special index is optimized for resolving a small number of matches. The search isn't optimized if your identifier search criteria matches a large number (i.e. more than 2,000) of resources. For a search query that will match a large number of resources, you can avoiding using the special synchronous index by including an additional `_sort` parameter in your query. Use `_sort=-_lastUpdated` if you want to keep the default sorting order. Note: The special synchronous identifier index are currently disabled for DocumentReference and DocumentManifest searches. For samples and detailed information, see [Searching for FHIR resources](https://cloud.google.com/healthcare/docs/how-tos/fhir-search) and [Advanced FHIR search features](https://cloud.google.com/healthcare/docs/how-tos/fhir-advanced-search).
34533///
34534/// A builder for the *locations.datasets.fhirStores.fhir.search* method supported by a *project* resource.
34535/// It is not used directly, but through a [`ProjectMethods`] instance.
34536///
34537/// # Example
34538///
34539/// Instantiate a resource method builder
34540///
34541/// ```test_harness,no_run
34542/// # extern crate hyper;
34543/// # extern crate hyper_rustls;
34544/// # extern crate google_healthcare1 as healthcare1;
34545/// use healthcare1::api::SearchResourcesRequest;
34546/// # async fn dox() {
34547/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34548///
34549/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34550/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34551/// # secret,
34552/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34553/// # ).build().await.unwrap();
34554///
34555/// # let client = hyper_util::client::legacy::Client::builder(
34556/// # hyper_util::rt::TokioExecutor::new()
34557/// # )
34558/// # .build(
34559/// # hyper_rustls::HttpsConnectorBuilder::new()
34560/// # .with_native_roots()
34561/// # .unwrap()
34562/// # .https_or_http()
34563/// # .enable_http1()
34564/// # .build()
34565/// # );
34566/// # let mut hub = CloudHealthcare::new(client, auth);
34567/// // As the method needs a request, you would usually fill it with the desired information
34568/// // into the respective structure. Some of the parts shown here might not be applicable !
34569/// // Values shown here are possibly random and not representative !
34570/// let mut req = SearchResourcesRequest::default();
34571///
34572/// // You can configure optional parameters by calling the respective setters at will, and
34573/// // execute the final call using `doit()`.
34574/// // Values shown here are possibly random and not representative !
34575/// let result = hub.projects().locations_datasets_fhir_stores_fhir_search(req, "parent")
34576/// .doit().await;
34577/// # }
34578/// ```
34579pub struct ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C>
34580where
34581 C: 'a,
34582{
34583 hub: &'a CloudHealthcare<C>,
34584 _request: SearchResourcesRequest,
34585 _parent: String,
34586 _delegate: Option<&'a mut dyn common::Delegate>,
34587 _additional_params: HashMap<String, String>,
34588 _scopes: BTreeSet<String>,
34589}
34590
34591impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C> {}
34592
34593impl<'a, C> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C>
34594where
34595 C: common::Connector,
34596{
34597 /// Perform the operation you have build so far.
34598 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
34599 use std::borrow::Cow;
34600 use std::io::{Read, Seek};
34601
34602 use common::{url::Params, ToParts};
34603 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34604
34605 let mut dd = common::DefaultDelegate;
34606 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34607 dlg.begin(common::MethodInfo {
34608 id: "healthcare.projects.locations.datasets.fhirStores.fhir.search",
34609 http_method: hyper::Method::POST,
34610 });
34611
34612 for &field in ["alt", "parent"].iter() {
34613 if self._additional_params.contains_key(field) {
34614 dlg.finished(false);
34615 return Err(common::Error::FieldClash(field));
34616 }
34617 }
34618
34619 let mut params = Params::with_capacity(4 + self._additional_params.len());
34620 params.push("parent", self._parent);
34621
34622 params.extend(self._additional_params.iter());
34623
34624 params.push("alt", "json");
34625 let mut url = self.hub._base_url.clone() + "v1/{+parent}/fhir/_search";
34626 if self._scopes.is_empty() {
34627 self._scopes
34628 .insert(Scope::CloudHealthcare.as_ref().to_string());
34629 }
34630
34631 #[allow(clippy::single_element_loop)]
34632 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
34633 url = params.uri_replacement(url, param_name, find_this, true);
34634 }
34635 {
34636 let to_remove = ["parent"];
34637 params.remove_params(&to_remove);
34638 }
34639
34640 let url = params.parse_with_url(&url);
34641
34642 let mut json_mime_type = mime::APPLICATION_JSON;
34643 let mut request_value_reader = {
34644 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
34645 common::remove_json_null_values(&mut value);
34646 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
34647 serde_json::to_writer(&mut dst, &value).unwrap();
34648 dst
34649 };
34650 let request_size = request_value_reader
34651 .seek(std::io::SeekFrom::End(0))
34652 .unwrap();
34653 request_value_reader
34654 .seek(std::io::SeekFrom::Start(0))
34655 .unwrap();
34656
34657 loop {
34658 let token = match self
34659 .hub
34660 .auth
34661 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34662 .await
34663 {
34664 Ok(token) => token,
34665 Err(e) => match dlg.token(e) {
34666 Ok(token) => token,
34667 Err(e) => {
34668 dlg.finished(false);
34669 return Err(common::Error::MissingToken(e));
34670 }
34671 },
34672 };
34673 request_value_reader
34674 .seek(std::io::SeekFrom::Start(0))
34675 .unwrap();
34676 let mut req_result = {
34677 let client = &self.hub.client;
34678 dlg.pre_request();
34679 let mut req_builder = hyper::Request::builder()
34680 .method(hyper::Method::POST)
34681 .uri(url.as_str())
34682 .header(USER_AGENT, self.hub._user_agent.clone());
34683
34684 if let Some(token) = token.as_ref() {
34685 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34686 }
34687
34688 let request = req_builder
34689 .header(CONTENT_TYPE, json_mime_type.to_string())
34690 .header(CONTENT_LENGTH, request_size as u64)
34691 .body(common::to_body(
34692 request_value_reader.get_ref().clone().into(),
34693 ));
34694
34695 client.request(request.unwrap()).await
34696 };
34697
34698 match req_result {
34699 Err(err) => {
34700 if let common::Retry::After(d) = dlg.http_error(&err) {
34701 sleep(d).await;
34702 continue;
34703 }
34704 dlg.finished(false);
34705 return Err(common::Error::HttpError(err));
34706 }
34707 Ok(res) => {
34708 let (mut parts, body) = res.into_parts();
34709 let mut body = common::Body::new(body);
34710 if !parts.status.is_success() {
34711 let bytes = common::to_bytes(body).await.unwrap_or_default();
34712 let error = serde_json::from_str(&common::to_string(&bytes));
34713 let response = common::to_response(parts, bytes.into());
34714
34715 if let common::Retry::After(d) =
34716 dlg.http_failure(&response, error.as_ref().ok())
34717 {
34718 sleep(d).await;
34719 continue;
34720 }
34721
34722 dlg.finished(false);
34723
34724 return Err(match error {
34725 Ok(value) => common::Error::BadRequest(value),
34726 _ => common::Error::Failure(response),
34727 });
34728 }
34729 let response = {
34730 let bytes = common::to_bytes(body).await.unwrap_or_default();
34731 let encoded = common::to_string(&bytes);
34732 match serde_json::from_str(&encoded) {
34733 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34734 Err(error) => {
34735 dlg.response_json_decode_error(&encoded, &error);
34736 return Err(common::Error::JsonDecodeError(
34737 encoded.to_string(),
34738 error,
34739 ));
34740 }
34741 }
34742 };
34743
34744 dlg.finished(true);
34745 return Ok(response);
34746 }
34747 }
34748 }
34749 }
34750
34751 ///
34752 /// Sets the *request* property to the given value.
34753 ///
34754 /// Even though the property as already been set when instantiating this call,
34755 /// we provide this method for API completeness.
34756 pub fn request(
34757 mut self,
34758 new_value: SearchResourcesRequest,
34759 ) -> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C> {
34760 self._request = new_value;
34761 self
34762 }
34763 /// Required. Name of the FHIR store to retrieve resources from.
34764 ///
34765 /// Sets the *parent* path property to the given value.
34766 ///
34767 /// Even though the property as already been set when instantiating this call,
34768 /// we provide this method for API completeness.
34769 pub fn parent(
34770 mut self,
34771 new_value: &str,
34772 ) -> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C> {
34773 self._parent = new_value.to_string();
34774 self
34775 }
34776 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34777 /// while executing the actual API request.
34778 ///
34779 /// ````text
34780 /// It should be used to handle progress information, and to implement a certain level of resilience.
34781 /// ````
34782 ///
34783 /// Sets the *delegate* property to the given value.
34784 pub fn delegate(
34785 mut self,
34786 new_value: &'a mut dyn common::Delegate,
34787 ) -> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C> {
34788 self._delegate = Some(new_value);
34789 self
34790 }
34791
34792 /// Set any additional parameter of the query string used in the request.
34793 /// It should be used to set parameters which are not yet available through their own
34794 /// setters.
34795 ///
34796 /// Please note that this method must not be used to set any of the known parameters
34797 /// which have their own setter method. If done anyway, the request will fail.
34798 ///
34799 /// # Additional Parameters
34800 ///
34801 /// * *$.xgafv* (query-string) - V1 error format.
34802 /// * *access_token* (query-string) - OAuth access token.
34803 /// * *alt* (query-string) - Data format for response.
34804 /// * *callback* (query-string) - JSONP
34805 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34806 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
34807 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34808 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34809 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
34810 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34811 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34812 pub fn param<T>(
34813 mut self,
34814 name: T,
34815 value: T,
34816 ) -> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C>
34817 where
34818 T: AsRef<str>,
34819 {
34820 self._additional_params
34821 .insert(name.as_ref().to_string(), value.as_ref().to_string());
34822 self
34823 }
34824
34825 /// Identifies the authorization scope for the method you are building.
34826 ///
34827 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34828 /// [`Scope::CloudHealthcare`].
34829 ///
34830 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34831 /// tokens for more than one scope.
34832 ///
34833 /// Usually there is more than one suitable scope to authorize an operation, some of which may
34834 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34835 /// sufficient, a read-write scope will do as well.
34836 pub fn add_scope<St>(
34837 mut self,
34838 scope: St,
34839 ) -> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C>
34840 where
34841 St: AsRef<str>,
34842 {
34843 self._scopes.insert(String::from(scope.as_ref()));
34844 self
34845 }
34846 /// Identifies the authorization scope(s) for the method you are building.
34847 ///
34848 /// See [`Self::add_scope()`] for details.
34849 pub fn add_scopes<I, St>(
34850 mut self,
34851 scopes: I,
34852 ) -> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C>
34853 where
34854 I: IntoIterator<Item = St>,
34855 St: AsRef<str>,
34856 {
34857 self._scopes
34858 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34859 self
34860 }
34861
34862 /// Removes all scopes, and no default scope will be used either.
34863 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34864 /// for details).
34865 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreFhirSearchCall<'a, C> {
34866 self._scopes.clear();
34867 self
34868 }
34869}
34870
34871/// Searches for resources in the given FHIR store according to criteria specified as query parameters. Implements the FHIR standard search interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#search), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#search), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#search)) using the search semantics described in the FHIR Search specification ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/search.html), [STU3](http://hl7.org/implement/standards/fhir/STU3/search.html), [R4](http://hl7.org/implement/standards/fhir/R4/search.html)). Supports four methods of search defined by the specification: * `GET [base]?[parameters]` to search across all resources. * `GET [base]/[type]?[parameters]` to search resources of a specified type. * `POST [base]/_search?[parameters]` as an alternate form having the same semantics as the `GET` method across all resources. * `POST [base]/[type]/_search?[parameters]` as an alternate form having the same semantics as the `GET` method for the specified type. The `GET` and `POST` methods do not support compartment searches. The `POST` method does not support `application/x-www-form-urlencoded` search parameters. On success, the response body contains a JSON-encoded representation of a `Bundle` resource of type `searchset`, containing the results of the search. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. The server's capability statement, retrieved through capabilities, indicates what search parameters are supported on each FHIR resource. A list of all search parameters defined by the specification can be found in the FHIR Search Parameter Registry ([STU3](http://hl7.org/implement/standards/fhir/STU3/searchparameter-registry.html), [R4](http://hl7.org/implement/standards/fhir/R4/searchparameter-registry.html)). FHIR search parameters for DSTU2 can be found on each resource's definition page. Supported search modifiers: `:missing`, `:exact`, `:contains`, `:text`, `:in`, `:not-in`, `:above`, `:below`, `:[type]`, `:not`, and `recurse` (DSTU2 and STU3) or `:iterate` (R4). Supported search result parameters: `_sort`, `_count`, `_include`, `_revinclude`, `_summary=text`, `_summary=data`, and `_elements`. The maximum number of search results returned defaults to 100, which can be overridden by the `_count` parameter up to a maximum limit of 1000. The server might return fewer resources than requested to prevent excessively large responses. If there are additional results, the returned `Bundle` contains a link of `relation` "next", which has a `_page_token` parameter for an opaque pagination token that can be used to retrieve the next page. Resources with a total size larger than 5MB or a field count larger than 50,000 might not be fully searchable as the server might trim its generated search index in those cases. Note: FHIR resources are indexed asynchronously, so there might be a slight delay between the time a resource is created or changed, and the time when the change reflects in search results. The only exception is resource identifier data, which is indexed synchronously as a special index. As a result, searching using resource identifier is not subject to indexing delay. To use the special synchronous index, the search term for identifier should be in the pattern `identifier=[system]|[value]` or `identifier=[value]`, and any of the following search result parameters can be used: * `_count` * `_include` * `_revinclude` * `_summary` * `_elements` If your query contains any other search parameters, the standard asynchronous index will be used instead. Note that searching against the special index is optimized for resolving a small number of matches. The search isn't optimized if your identifier search criteria matches a large number (i.e. more than 2,000) of resources. For a search query that will match a large number of resources, you can avoiding using the special synchronous index by including an additional `_sort` parameter in your query. Use `_sort=-_lastUpdated` if you want to keep the default sorting order. Note: The special synchronous identifier index are currently disabled for DocumentReference and DocumentManifest searches. For samples and detailed information, see [Searching for FHIR resources](https://cloud.google.com/healthcare/docs/how-tos/fhir-search) and [Advanced FHIR search features](https://cloud.google.com/healthcare/docs/how-tos/fhir-advanced-search).
34872///
34873/// A builder for the *locations.datasets.fhirStores.fhir.search-type* method supported by a *project* resource.
34874/// It is not used directly, but through a [`ProjectMethods`] instance.
34875///
34876/// # Example
34877///
34878/// Instantiate a resource method builder
34879///
34880/// ```test_harness,no_run
34881/// # extern crate hyper;
34882/// # extern crate hyper_rustls;
34883/// # extern crate google_healthcare1 as healthcare1;
34884/// use healthcare1::api::SearchResourcesRequest;
34885/// # async fn dox() {
34886/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34887///
34888/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34889/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34890/// # secret,
34891/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34892/// # ).build().await.unwrap();
34893///
34894/// # let client = hyper_util::client::legacy::Client::builder(
34895/// # hyper_util::rt::TokioExecutor::new()
34896/// # )
34897/// # .build(
34898/// # hyper_rustls::HttpsConnectorBuilder::new()
34899/// # .with_native_roots()
34900/// # .unwrap()
34901/// # .https_or_http()
34902/// # .enable_http1()
34903/// # .build()
34904/// # );
34905/// # let mut hub = CloudHealthcare::new(client, auth);
34906/// // As the method needs a request, you would usually fill it with the desired information
34907/// // into the respective structure. Some of the parts shown here might not be applicable !
34908/// // Values shown here are possibly random and not representative !
34909/// let mut req = SearchResourcesRequest::default();
34910///
34911/// // You can configure optional parameters by calling the respective setters at will, and
34912/// // execute the final call using `doit()`.
34913/// // Values shown here are possibly random and not representative !
34914/// let result = hub.projects().locations_datasets_fhir_stores_fhir_search_type(req, "parent", "resourceType")
34915/// .doit().await;
34916/// # }
34917/// ```
34918pub struct ProjectLocationDatasetFhirStoreFhirSearchTypeCall<'a, C>
34919where
34920 C: 'a,
34921{
34922 hub: &'a CloudHealthcare<C>,
34923 _request: SearchResourcesRequest,
34924 _parent: String,
34925 _resource_type: String,
34926 _delegate: Option<&'a mut dyn common::Delegate>,
34927 _additional_params: HashMap<String, String>,
34928 _scopes: BTreeSet<String>,
34929}
34930
34931impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreFhirSearchTypeCall<'a, C> {}
34932
34933impl<'a, C> ProjectLocationDatasetFhirStoreFhirSearchTypeCall<'a, C>
34934where
34935 C: common::Connector,
34936{
34937 /// Perform the operation you have build so far.
34938 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
34939 use std::borrow::Cow;
34940 use std::io::{Read, Seek};
34941
34942 use common::{url::Params, ToParts};
34943 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34944
34945 let mut dd = common::DefaultDelegate;
34946 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34947 dlg.begin(common::MethodInfo {
34948 id: "healthcare.projects.locations.datasets.fhirStores.fhir.search-type",
34949 http_method: hyper::Method::POST,
34950 });
34951
34952 for &field in ["alt", "parent", "resourceType"].iter() {
34953 if self._additional_params.contains_key(field) {
34954 dlg.finished(false);
34955 return Err(common::Error::FieldClash(field));
34956 }
34957 }
34958
34959 let mut params = Params::with_capacity(5 + self._additional_params.len());
34960 params.push("parent", self._parent);
34961 params.push("resourceType", self._resource_type);
34962
34963 params.extend(self._additional_params.iter());
34964
34965 params.push("alt", "json");
34966 let mut url = self.hub._base_url.clone() + "v1/{+parent}/fhir/{resourceType}/_search";
34967 if self._scopes.is_empty() {
34968 self._scopes
34969 .insert(Scope::CloudHealthcare.as_ref().to_string());
34970 }
34971
34972 #[allow(clippy::single_element_loop)]
34973 for &(find_this, param_name) in
34974 [("{+parent}", "parent"), ("{resourceType}", "resourceType")].iter()
34975 {
34976 url = params.uri_replacement(url, param_name, find_this, true);
34977 }
34978 {
34979 let to_remove = ["resourceType", "parent"];
34980 params.remove_params(&to_remove);
34981 }
34982
34983 let url = params.parse_with_url(&url);
34984
34985 let mut json_mime_type = mime::APPLICATION_JSON;
34986 let mut request_value_reader = {
34987 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
34988 common::remove_json_null_values(&mut value);
34989 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
34990 serde_json::to_writer(&mut dst, &value).unwrap();
34991 dst
34992 };
34993 let request_size = request_value_reader
34994 .seek(std::io::SeekFrom::End(0))
34995 .unwrap();
34996 request_value_reader
34997 .seek(std::io::SeekFrom::Start(0))
34998 .unwrap();
34999
35000 loop {
35001 let token = match self
35002 .hub
35003 .auth
35004 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35005 .await
35006 {
35007 Ok(token) => token,
35008 Err(e) => match dlg.token(e) {
35009 Ok(token) => token,
35010 Err(e) => {
35011 dlg.finished(false);
35012 return Err(common::Error::MissingToken(e));
35013 }
35014 },
35015 };
35016 request_value_reader
35017 .seek(std::io::SeekFrom::Start(0))
35018 .unwrap();
35019 let mut req_result = {
35020 let client = &self.hub.client;
35021 dlg.pre_request();
35022 let mut req_builder = hyper::Request::builder()
35023 .method(hyper::Method::POST)
35024 .uri(url.as_str())
35025 .header(USER_AGENT, self.hub._user_agent.clone());
35026
35027 if let Some(token) = token.as_ref() {
35028 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35029 }
35030
35031 let request = req_builder
35032 .header(CONTENT_TYPE, json_mime_type.to_string())
35033 .header(CONTENT_LENGTH, request_size as u64)
35034 .body(common::to_body(
35035 request_value_reader.get_ref().clone().into(),
35036 ));
35037
35038 client.request(request.unwrap()).await
35039 };
35040
35041 match req_result {
35042 Err(err) => {
35043 if let common::Retry::After(d) = dlg.http_error(&err) {
35044 sleep(d).await;
35045 continue;
35046 }
35047 dlg.finished(false);
35048 return Err(common::Error::HttpError(err));
35049 }
35050 Ok(res) => {
35051 let (mut parts, body) = res.into_parts();
35052 let mut body = common::Body::new(body);
35053 if !parts.status.is_success() {
35054 let bytes = common::to_bytes(body).await.unwrap_or_default();
35055 let error = serde_json::from_str(&common::to_string(&bytes));
35056 let response = common::to_response(parts, bytes.into());
35057
35058 if let common::Retry::After(d) =
35059 dlg.http_failure(&response, error.as_ref().ok())
35060 {
35061 sleep(d).await;
35062 continue;
35063 }
35064
35065 dlg.finished(false);
35066
35067 return Err(match error {
35068 Ok(value) => common::Error::BadRequest(value),
35069 _ => common::Error::Failure(response),
35070 });
35071 }
35072 let response = {
35073 let bytes = common::to_bytes(body).await.unwrap_or_default();
35074 let encoded = common::to_string(&bytes);
35075 match serde_json::from_str(&encoded) {
35076 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35077 Err(error) => {
35078 dlg.response_json_decode_error(&encoded, &error);
35079 return Err(common::Error::JsonDecodeError(
35080 encoded.to_string(),
35081 error,
35082 ));
35083 }
35084 }
35085 };
35086
35087 dlg.finished(true);
35088 return Ok(response);
35089 }
35090 }
35091 }
35092 }
35093
35094 ///
35095 /// Sets the *request* property to the given value.
35096 ///
35097 /// Even though the property as already been set when instantiating this call,
35098 /// we provide this method for API completeness.
35099 pub fn request(
35100 mut self,
35101 new_value: SearchResourcesRequest,
35102 ) -> ProjectLocationDatasetFhirStoreFhirSearchTypeCall<'a, C> {
35103 self._request = new_value;
35104 self
35105 }
35106 /// Required. Name of the FHIR store to retrieve resources from.
35107 ///
35108 /// Sets the *parent* path property to the given value.
35109 ///
35110 /// Even though the property as already been set when instantiating this call,
35111 /// we provide this method for API completeness.
35112 pub fn parent(
35113 mut self,
35114 new_value: &str,
35115 ) -> ProjectLocationDatasetFhirStoreFhirSearchTypeCall<'a, C> {
35116 self._parent = new_value.to_string();
35117 self
35118 }
35119 /// Required. The FHIR resource type to search, such as Patient or Observation. For a complete list, see the FHIR Resource Index ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/resourcelist.html), [STU3](http://hl7.org/implement/standards/fhir/STU3/resourcelist.html), [R4](http://hl7.org/implement/standards/fhir/R4/resourcelist.html)).
35120 ///
35121 /// Sets the *resource type* path property to the given value.
35122 ///
35123 /// Even though the property as already been set when instantiating this call,
35124 /// we provide this method for API completeness.
35125 pub fn resource_type(
35126 mut self,
35127 new_value: &str,
35128 ) -> ProjectLocationDatasetFhirStoreFhirSearchTypeCall<'a, C> {
35129 self._resource_type = new_value.to_string();
35130 self
35131 }
35132 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35133 /// while executing the actual API request.
35134 ///
35135 /// ````text
35136 /// It should be used to handle progress information, and to implement a certain level of resilience.
35137 /// ````
35138 ///
35139 /// Sets the *delegate* property to the given value.
35140 pub fn delegate(
35141 mut self,
35142 new_value: &'a mut dyn common::Delegate,
35143 ) -> ProjectLocationDatasetFhirStoreFhirSearchTypeCall<'a, C> {
35144 self._delegate = Some(new_value);
35145 self
35146 }
35147
35148 /// Set any additional parameter of the query string used in the request.
35149 /// It should be used to set parameters which are not yet available through their own
35150 /// setters.
35151 ///
35152 /// Please note that this method must not be used to set any of the known parameters
35153 /// which have their own setter method. If done anyway, the request will fail.
35154 ///
35155 /// # Additional Parameters
35156 ///
35157 /// * *$.xgafv* (query-string) - V1 error format.
35158 /// * *access_token* (query-string) - OAuth access token.
35159 /// * *alt* (query-string) - Data format for response.
35160 /// * *callback* (query-string) - JSONP
35161 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35162 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
35163 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35164 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35165 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
35166 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35167 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35168 pub fn param<T>(
35169 mut self,
35170 name: T,
35171 value: T,
35172 ) -> ProjectLocationDatasetFhirStoreFhirSearchTypeCall<'a, C>
35173 where
35174 T: AsRef<str>,
35175 {
35176 self._additional_params
35177 .insert(name.as_ref().to_string(), value.as_ref().to_string());
35178 self
35179 }
35180
35181 /// Identifies the authorization scope for the method you are building.
35182 ///
35183 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35184 /// [`Scope::CloudHealthcare`].
35185 ///
35186 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35187 /// tokens for more than one scope.
35188 ///
35189 /// Usually there is more than one suitable scope to authorize an operation, some of which may
35190 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35191 /// sufficient, a read-write scope will do as well.
35192 pub fn add_scope<St>(
35193 mut self,
35194 scope: St,
35195 ) -> ProjectLocationDatasetFhirStoreFhirSearchTypeCall<'a, C>
35196 where
35197 St: AsRef<str>,
35198 {
35199 self._scopes.insert(String::from(scope.as_ref()));
35200 self
35201 }
35202 /// Identifies the authorization scope(s) for the method you are building.
35203 ///
35204 /// See [`Self::add_scope()`] for details.
35205 pub fn add_scopes<I, St>(
35206 mut self,
35207 scopes: I,
35208 ) -> ProjectLocationDatasetFhirStoreFhirSearchTypeCall<'a, C>
35209 where
35210 I: IntoIterator<Item = St>,
35211 St: AsRef<str>,
35212 {
35213 self._scopes
35214 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35215 self
35216 }
35217
35218 /// Removes all scopes, and no default scope will be used either.
35219 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35220 /// for details).
35221 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreFhirSearchTypeCall<'a, C> {
35222 self._scopes.clear();
35223 self
35224 }
35225}
35226
35227/// Updates the entire contents of a resource. Implements the FHIR standard update interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#update), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#update), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#update)). If the specified resource does not exist and the FHIR store has enable_update_create set, creates the resource with the client-specified ID. It is strongly advised not to include or encode any sensitive data such as patient identifiers in client-specified resource IDs. Those IDs are part of the FHIR resource path recorded in Cloud Audit Logs and Pub/Sub notifications. Those IDs can also be contained in reference fields within other resources. The request body must contain a JSON-encoded FHIR resource, and the request headers must contain `Content-Type: application/fhir+json`. The resource must contain an `id` element having an identical value to the ID in the REST path of the request. On success, the response body contains a JSON-encoded representation of the updated resource, including the server-assigned version ID. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `update`, see [Updating a FHIR resource](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#updating_a_fhir_resource).
35228///
35229/// A builder for the *locations.datasets.fhirStores.fhir.update* method supported by a *project* resource.
35230/// It is not used directly, but through a [`ProjectMethods`] instance.
35231///
35232/// # Example
35233///
35234/// Instantiate a resource method builder
35235///
35236/// ```test_harness,no_run
35237/// # extern crate hyper;
35238/// # extern crate hyper_rustls;
35239/// # extern crate google_healthcare1 as healthcare1;
35240/// use healthcare1::api::HttpBody;
35241/// # async fn dox() {
35242/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35243///
35244/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35245/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35246/// # secret,
35247/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35248/// # ).build().await.unwrap();
35249///
35250/// # let client = hyper_util::client::legacy::Client::builder(
35251/// # hyper_util::rt::TokioExecutor::new()
35252/// # )
35253/// # .build(
35254/// # hyper_rustls::HttpsConnectorBuilder::new()
35255/// # .with_native_roots()
35256/// # .unwrap()
35257/// # .https_or_http()
35258/// # .enable_http1()
35259/// # .build()
35260/// # );
35261/// # let mut hub = CloudHealthcare::new(client, auth);
35262/// // As the method needs a request, you would usually fill it with the desired information
35263/// // into the respective structure. Some of the parts shown here might not be applicable !
35264/// // Values shown here are possibly random and not representative !
35265/// let mut req = HttpBody::default();
35266///
35267/// // You can configure optional parameters by calling the respective setters at will, and
35268/// // execute the final call using `doit()`.
35269/// // Values shown here are possibly random and not representative !
35270/// let result = hub.projects().locations_datasets_fhir_stores_fhir_update(req, "name")
35271/// .doit().await;
35272/// # }
35273/// ```
35274pub struct ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C>
35275where
35276 C: 'a,
35277{
35278 hub: &'a CloudHealthcare<C>,
35279 _request: HttpBody,
35280 _name: String,
35281 _delegate: Option<&'a mut dyn common::Delegate>,
35282 _additional_params: HashMap<String, String>,
35283 _scopes: BTreeSet<String>,
35284}
35285
35286impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C> {}
35287
35288impl<'a, C> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C>
35289where
35290 C: common::Connector,
35291{
35292 /// Perform the operation you have build so far.
35293 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
35294 use std::borrow::Cow;
35295 use std::io::{Read, Seek};
35296
35297 use common::{url::Params, ToParts};
35298 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35299
35300 let mut dd = common::DefaultDelegate;
35301 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35302 dlg.begin(common::MethodInfo {
35303 id: "healthcare.projects.locations.datasets.fhirStores.fhir.update",
35304 http_method: hyper::Method::PUT,
35305 });
35306
35307 for &field in ["alt", "name"].iter() {
35308 if self._additional_params.contains_key(field) {
35309 dlg.finished(false);
35310 return Err(common::Error::FieldClash(field));
35311 }
35312 }
35313
35314 let mut params = Params::with_capacity(4 + self._additional_params.len());
35315 params.push("name", self._name);
35316
35317 params.extend(self._additional_params.iter());
35318
35319 params.push("alt", "json");
35320 let mut url = self.hub._base_url.clone() + "v1/{+name}";
35321 if self._scopes.is_empty() {
35322 self._scopes
35323 .insert(Scope::CloudHealthcare.as_ref().to_string());
35324 }
35325
35326 #[allow(clippy::single_element_loop)]
35327 for &(find_this, param_name) in [("{+name}", "name")].iter() {
35328 url = params.uri_replacement(url, param_name, find_this, true);
35329 }
35330 {
35331 let to_remove = ["name"];
35332 params.remove_params(&to_remove);
35333 }
35334
35335 let url = params.parse_with_url(&url);
35336
35337 let mut json_mime_type = mime::APPLICATION_JSON;
35338 let mut request_value_reader = {
35339 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
35340 common::remove_json_null_values(&mut value);
35341 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
35342 serde_json::to_writer(&mut dst, &value).unwrap();
35343 dst
35344 };
35345 let request_size = request_value_reader
35346 .seek(std::io::SeekFrom::End(0))
35347 .unwrap();
35348 request_value_reader
35349 .seek(std::io::SeekFrom::Start(0))
35350 .unwrap();
35351
35352 loop {
35353 let token = match self
35354 .hub
35355 .auth
35356 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35357 .await
35358 {
35359 Ok(token) => token,
35360 Err(e) => match dlg.token(e) {
35361 Ok(token) => token,
35362 Err(e) => {
35363 dlg.finished(false);
35364 return Err(common::Error::MissingToken(e));
35365 }
35366 },
35367 };
35368 request_value_reader
35369 .seek(std::io::SeekFrom::Start(0))
35370 .unwrap();
35371 let mut req_result = {
35372 let client = &self.hub.client;
35373 dlg.pre_request();
35374 let mut req_builder = hyper::Request::builder()
35375 .method(hyper::Method::PUT)
35376 .uri(url.as_str())
35377 .header(USER_AGENT, self.hub._user_agent.clone());
35378
35379 if let Some(token) = token.as_ref() {
35380 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35381 }
35382
35383 let request = req_builder
35384 .header(CONTENT_TYPE, json_mime_type.to_string())
35385 .header(CONTENT_LENGTH, request_size as u64)
35386 .body(common::to_body(
35387 request_value_reader.get_ref().clone().into(),
35388 ));
35389
35390 client.request(request.unwrap()).await
35391 };
35392
35393 match req_result {
35394 Err(err) => {
35395 if let common::Retry::After(d) = dlg.http_error(&err) {
35396 sleep(d).await;
35397 continue;
35398 }
35399 dlg.finished(false);
35400 return Err(common::Error::HttpError(err));
35401 }
35402 Ok(res) => {
35403 let (mut parts, body) = res.into_parts();
35404 let mut body = common::Body::new(body);
35405 if !parts.status.is_success() {
35406 let bytes = common::to_bytes(body).await.unwrap_or_default();
35407 let error = serde_json::from_str(&common::to_string(&bytes));
35408 let response = common::to_response(parts, bytes.into());
35409
35410 if let common::Retry::After(d) =
35411 dlg.http_failure(&response, error.as_ref().ok())
35412 {
35413 sleep(d).await;
35414 continue;
35415 }
35416
35417 dlg.finished(false);
35418
35419 return Err(match error {
35420 Ok(value) => common::Error::BadRequest(value),
35421 _ => common::Error::Failure(response),
35422 });
35423 }
35424 let response = {
35425 let bytes = common::to_bytes(body).await.unwrap_or_default();
35426 let encoded = common::to_string(&bytes);
35427 match serde_json::from_str(&encoded) {
35428 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35429 Err(error) => {
35430 dlg.response_json_decode_error(&encoded, &error);
35431 return Err(common::Error::JsonDecodeError(
35432 encoded.to_string(),
35433 error,
35434 ));
35435 }
35436 }
35437 };
35438
35439 dlg.finished(true);
35440 return Ok(response);
35441 }
35442 }
35443 }
35444 }
35445
35446 ///
35447 /// Sets the *request* property to the given value.
35448 ///
35449 /// Even though the property as already been set when instantiating this call,
35450 /// we provide this method for API completeness.
35451 pub fn request(
35452 mut self,
35453 new_value: HttpBody,
35454 ) -> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C> {
35455 self._request = new_value;
35456 self
35457 }
35458 /// Required. The name of the resource to update.
35459 ///
35460 /// Sets the *name* path property to the given value.
35461 ///
35462 /// Even though the property as already been set when instantiating this call,
35463 /// we provide this method for API completeness.
35464 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C> {
35465 self._name = new_value.to_string();
35466 self
35467 }
35468 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35469 /// while executing the actual API request.
35470 ///
35471 /// ````text
35472 /// It should be used to handle progress information, and to implement a certain level of resilience.
35473 /// ````
35474 ///
35475 /// Sets the *delegate* property to the given value.
35476 pub fn delegate(
35477 mut self,
35478 new_value: &'a mut dyn common::Delegate,
35479 ) -> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C> {
35480 self._delegate = Some(new_value);
35481 self
35482 }
35483
35484 /// Set any additional parameter of the query string used in the request.
35485 /// It should be used to set parameters which are not yet available through their own
35486 /// setters.
35487 ///
35488 /// Please note that this method must not be used to set any of the known parameters
35489 /// which have their own setter method. If done anyway, the request will fail.
35490 ///
35491 /// # Additional Parameters
35492 ///
35493 /// * *$.xgafv* (query-string) - V1 error format.
35494 /// * *access_token* (query-string) - OAuth access token.
35495 /// * *alt* (query-string) - Data format for response.
35496 /// * *callback* (query-string) - JSONP
35497 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35498 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
35499 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35500 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35501 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
35502 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35503 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35504 pub fn param<T>(
35505 mut self,
35506 name: T,
35507 value: T,
35508 ) -> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C>
35509 where
35510 T: AsRef<str>,
35511 {
35512 self._additional_params
35513 .insert(name.as_ref().to_string(), value.as_ref().to_string());
35514 self
35515 }
35516
35517 /// Identifies the authorization scope for the method you are building.
35518 ///
35519 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35520 /// [`Scope::CloudHealthcare`].
35521 ///
35522 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35523 /// tokens for more than one scope.
35524 ///
35525 /// Usually there is more than one suitable scope to authorize an operation, some of which may
35526 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35527 /// sufficient, a read-write scope will do as well.
35528 pub fn add_scope<St>(
35529 mut self,
35530 scope: St,
35531 ) -> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C>
35532 where
35533 St: AsRef<str>,
35534 {
35535 self._scopes.insert(String::from(scope.as_ref()));
35536 self
35537 }
35538 /// Identifies the authorization scope(s) for the method you are building.
35539 ///
35540 /// See [`Self::add_scope()`] for details.
35541 pub fn add_scopes<I, St>(
35542 mut self,
35543 scopes: I,
35544 ) -> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C>
35545 where
35546 I: IntoIterator<Item = St>,
35547 St: AsRef<str>,
35548 {
35549 self._scopes
35550 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35551 self
35552 }
35553
35554 /// Removes all scopes, and no default scope will be used either.
35555 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35556 /// for details).
35557 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreFhirUpdateCall<'a, C> {
35558 self._scopes.clear();
35559 self
35560 }
35561}
35562
35563/// Gets the contents of a version (current or historical) of a FHIR resource by version ID. Implements the FHIR standard vread interaction ([DSTU2](http://hl7.org/implement/standards/fhir/DSTU2/http.html#vread), [STU3](http://hl7.org/implement/standards/fhir/STU3/http.html#vread), [R4](http://hl7.org/implement/standards/fhir/R4/http.html#vread)). On success, the response body contains a JSON-encoded representation of the resource. Errors generated by the FHIR store contain a JSON-encoded `OperationOutcome` resource describing the reason for the error. If the request cannot be mapped to a valid API method on a FHIR store, a generic GCP error might be returned instead. For samples that show how to call `vread`, see [Retrieving a FHIR resource version](https://cloud.google.com/healthcare/docs/how-tos/fhir-resources#retrieving_a_fhir_resource_version).
35564///
35565/// A builder for the *locations.datasets.fhirStores.fhir.vread* method supported by a *project* resource.
35566/// It is not used directly, but through a [`ProjectMethods`] instance.
35567///
35568/// # Example
35569///
35570/// Instantiate a resource method builder
35571///
35572/// ```test_harness,no_run
35573/// # extern crate hyper;
35574/// # extern crate hyper_rustls;
35575/// # extern crate google_healthcare1 as healthcare1;
35576/// # async fn dox() {
35577/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35578///
35579/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35580/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35581/// # secret,
35582/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35583/// # ).build().await.unwrap();
35584///
35585/// # let client = hyper_util::client::legacy::Client::builder(
35586/// # hyper_util::rt::TokioExecutor::new()
35587/// # )
35588/// # .build(
35589/// # hyper_rustls::HttpsConnectorBuilder::new()
35590/// # .with_native_roots()
35591/// # .unwrap()
35592/// # .https_or_http()
35593/// # .enable_http1()
35594/// # .build()
35595/// # );
35596/// # let mut hub = CloudHealthcare::new(client, auth);
35597/// // You can configure optional parameters by calling the respective setters at will, and
35598/// // execute the final call using `doit()`.
35599/// // Values shown here are possibly random and not representative !
35600/// let result = hub.projects().locations_datasets_fhir_stores_fhir_vread("name")
35601/// .doit().await;
35602/// # }
35603/// ```
35604pub struct ProjectLocationDatasetFhirStoreFhirVreadCall<'a, C>
35605where
35606 C: 'a,
35607{
35608 hub: &'a CloudHealthcare<C>,
35609 _name: String,
35610 _delegate: Option<&'a mut dyn common::Delegate>,
35611 _additional_params: HashMap<String, String>,
35612 _scopes: BTreeSet<String>,
35613}
35614
35615impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreFhirVreadCall<'a, C> {}
35616
35617impl<'a, C> ProjectLocationDatasetFhirStoreFhirVreadCall<'a, C>
35618where
35619 C: common::Connector,
35620{
35621 /// Perform the operation you have build so far.
35622 pub async fn doit(mut self) -> common::Result<(common::Response, HttpBody)> {
35623 use std::borrow::Cow;
35624 use std::io::{Read, Seek};
35625
35626 use common::{url::Params, ToParts};
35627 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35628
35629 let mut dd = common::DefaultDelegate;
35630 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35631 dlg.begin(common::MethodInfo {
35632 id: "healthcare.projects.locations.datasets.fhirStores.fhir.vread",
35633 http_method: hyper::Method::GET,
35634 });
35635
35636 for &field in ["alt", "name"].iter() {
35637 if self._additional_params.contains_key(field) {
35638 dlg.finished(false);
35639 return Err(common::Error::FieldClash(field));
35640 }
35641 }
35642
35643 let mut params = Params::with_capacity(3 + self._additional_params.len());
35644 params.push("name", self._name);
35645
35646 params.extend(self._additional_params.iter());
35647
35648 params.push("alt", "json");
35649 let mut url = self.hub._base_url.clone() + "v1/{+name}";
35650 if self._scopes.is_empty() {
35651 self._scopes
35652 .insert(Scope::CloudHealthcare.as_ref().to_string());
35653 }
35654
35655 #[allow(clippy::single_element_loop)]
35656 for &(find_this, param_name) in [("{+name}", "name")].iter() {
35657 url = params.uri_replacement(url, param_name, find_this, true);
35658 }
35659 {
35660 let to_remove = ["name"];
35661 params.remove_params(&to_remove);
35662 }
35663
35664 let url = params.parse_with_url(&url);
35665
35666 loop {
35667 let token = match self
35668 .hub
35669 .auth
35670 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35671 .await
35672 {
35673 Ok(token) => token,
35674 Err(e) => match dlg.token(e) {
35675 Ok(token) => token,
35676 Err(e) => {
35677 dlg.finished(false);
35678 return Err(common::Error::MissingToken(e));
35679 }
35680 },
35681 };
35682 let mut req_result = {
35683 let client = &self.hub.client;
35684 dlg.pre_request();
35685 let mut req_builder = hyper::Request::builder()
35686 .method(hyper::Method::GET)
35687 .uri(url.as_str())
35688 .header(USER_AGENT, self.hub._user_agent.clone());
35689
35690 if let Some(token) = token.as_ref() {
35691 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
35692 }
35693
35694 let request = req_builder
35695 .header(CONTENT_LENGTH, 0_u64)
35696 .body(common::to_body::<String>(None));
35697
35698 client.request(request.unwrap()).await
35699 };
35700
35701 match req_result {
35702 Err(err) => {
35703 if let common::Retry::After(d) = dlg.http_error(&err) {
35704 sleep(d).await;
35705 continue;
35706 }
35707 dlg.finished(false);
35708 return Err(common::Error::HttpError(err));
35709 }
35710 Ok(res) => {
35711 let (mut parts, body) = res.into_parts();
35712 let mut body = common::Body::new(body);
35713 if !parts.status.is_success() {
35714 let bytes = common::to_bytes(body).await.unwrap_or_default();
35715 let error = serde_json::from_str(&common::to_string(&bytes));
35716 let response = common::to_response(parts, bytes.into());
35717
35718 if let common::Retry::After(d) =
35719 dlg.http_failure(&response, error.as_ref().ok())
35720 {
35721 sleep(d).await;
35722 continue;
35723 }
35724
35725 dlg.finished(false);
35726
35727 return Err(match error {
35728 Ok(value) => common::Error::BadRequest(value),
35729 _ => common::Error::Failure(response),
35730 });
35731 }
35732 let response = {
35733 let bytes = common::to_bytes(body).await.unwrap_or_default();
35734 let encoded = common::to_string(&bytes);
35735 match serde_json::from_str(&encoded) {
35736 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
35737 Err(error) => {
35738 dlg.response_json_decode_error(&encoded, &error);
35739 return Err(common::Error::JsonDecodeError(
35740 encoded.to_string(),
35741 error,
35742 ));
35743 }
35744 }
35745 };
35746
35747 dlg.finished(true);
35748 return Ok(response);
35749 }
35750 }
35751 }
35752 }
35753
35754 /// Required. The name of the resource version to retrieve.
35755 ///
35756 /// Sets the *name* path property to the given value.
35757 ///
35758 /// Even though the property as already been set when instantiating this call,
35759 /// we provide this method for API completeness.
35760 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreFhirVreadCall<'a, C> {
35761 self._name = new_value.to_string();
35762 self
35763 }
35764 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
35765 /// while executing the actual API request.
35766 ///
35767 /// ````text
35768 /// It should be used to handle progress information, and to implement a certain level of resilience.
35769 /// ````
35770 ///
35771 /// Sets the *delegate* property to the given value.
35772 pub fn delegate(
35773 mut self,
35774 new_value: &'a mut dyn common::Delegate,
35775 ) -> ProjectLocationDatasetFhirStoreFhirVreadCall<'a, C> {
35776 self._delegate = Some(new_value);
35777 self
35778 }
35779
35780 /// Set any additional parameter of the query string used in the request.
35781 /// It should be used to set parameters which are not yet available through their own
35782 /// setters.
35783 ///
35784 /// Please note that this method must not be used to set any of the known parameters
35785 /// which have their own setter method. If done anyway, the request will fail.
35786 ///
35787 /// # Additional Parameters
35788 ///
35789 /// * *$.xgafv* (query-string) - V1 error format.
35790 /// * *access_token* (query-string) - OAuth access token.
35791 /// * *alt* (query-string) - Data format for response.
35792 /// * *callback* (query-string) - JSONP
35793 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
35794 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
35795 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
35796 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
35797 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
35798 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
35799 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
35800 pub fn param<T>(
35801 mut self,
35802 name: T,
35803 value: T,
35804 ) -> ProjectLocationDatasetFhirStoreFhirVreadCall<'a, C>
35805 where
35806 T: AsRef<str>,
35807 {
35808 self._additional_params
35809 .insert(name.as_ref().to_string(), value.as_ref().to_string());
35810 self
35811 }
35812
35813 /// Identifies the authorization scope for the method you are building.
35814 ///
35815 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
35816 /// [`Scope::CloudHealthcare`].
35817 ///
35818 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
35819 /// tokens for more than one scope.
35820 ///
35821 /// Usually there is more than one suitable scope to authorize an operation, some of which may
35822 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
35823 /// sufficient, a read-write scope will do as well.
35824 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetFhirStoreFhirVreadCall<'a, C>
35825 where
35826 St: AsRef<str>,
35827 {
35828 self._scopes.insert(String::from(scope.as_ref()));
35829 self
35830 }
35831 /// Identifies the authorization scope(s) for the method you are building.
35832 ///
35833 /// See [`Self::add_scope()`] for details.
35834 pub fn add_scopes<I, St>(
35835 mut self,
35836 scopes: I,
35837 ) -> ProjectLocationDatasetFhirStoreFhirVreadCall<'a, C>
35838 where
35839 I: IntoIterator<Item = St>,
35840 St: AsRef<str>,
35841 {
35842 self._scopes
35843 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
35844 self
35845 }
35846
35847 /// Removes all scopes, and no default scope will be used either.
35848 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
35849 /// for details).
35850 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreFhirVreadCall<'a, C> {
35851 self._scopes.clear();
35852 self
35853 }
35854}
35855
35856/// Creates a new FHIR store within the parent dataset.
35857///
35858/// A builder for the *locations.datasets.fhirStores.create* method supported by a *project* resource.
35859/// It is not used directly, but through a [`ProjectMethods`] instance.
35860///
35861/// # Example
35862///
35863/// Instantiate a resource method builder
35864///
35865/// ```test_harness,no_run
35866/// # extern crate hyper;
35867/// # extern crate hyper_rustls;
35868/// # extern crate google_healthcare1 as healthcare1;
35869/// use healthcare1::api::FhirStore;
35870/// # async fn dox() {
35871/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
35872///
35873/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
35874/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
35875/// # secret,
35876/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
35877/// # ).build().await.unwrap();
35878///
35879/// # let client = hyper_util::client::legacy::Client::builder(
35880/// # hyper_util::rt::TokioExecutor::new()
35881/// # )
35882/// # .build(
35883/// # hyper_rustls::HttpsConnectorBuilder::new()
35884/// # .with_native_roots()
35885/// # .unwrap()
35886/// # .https_or_http()
35887/// # .enable_http1()
35888/// # .build()
35889/// # );
35890/// # let mut hub = CloudHealthcare::new(client, auth);
35891/// // As the method needs a request, you would usually fill it with the desired information
35892/// // into the respective structure. Some of the parts shown here might not be applicable !
35893/// // Values shown here are possibly random and not representative !
35894/// let mut req = FhirStore::default();
35895///
35896/// // You can configure optional parameters by calling the respective setters at will, and
35897/// // execute the final call using `doit()`.
35898/// // Values shown here are possibly random and not representative !
35899/// let result = hub.projects().locations_datasets_fhir_stores_create(req, "parent")
35900/// .fhir_store_id("et")
35901/// .doit().await;
35902/// # }
35903/// ```
35904pub struct ProjectLocationDatasetFhirStoreCreateCall<'a, C>
35905where
35906 C: 'a,
35907{
35908 hub: &'a CloudHealthcare<C>,
35909 _request: FhirStore,
35910 _parent: String,
35911 _fhir_store_id: Option<String>,
35912 _delegate: Option<&'a mut dyn common::Delegate>,
35913 _additional_params: HashMap<String, String>,
35914 _scopes: BTreeSet<String>,
35915}
35916
35917impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreCreateCall<'a, C> {}
35918
35919impl<'a, C> ProjectLocationDatasetFhirStoreCreateCall<'a, C>
35920where
35921 C: common::Connector,
35922{
35923 /// Perform the operation you have build so far.
35924 pub async fn doit(mut self) -> common::Result<(common::Response, FhirStore)> {
35925 use std::borrow::Cow;
35926 use std::io::{Read, Seek};
35927
35928 use common::{url::Params, ToParts};
35929 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
35930
35931 let mut dd = common::DefaultDelegate;
35932 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
35933 dlg.begin(common::MethodInfo {
35934 id: "healthcare.projects.locations.datasets.fhirStores.create",
35935 http_method: hyper::Method::POST,
35936 });
35937
35938 for &field in ["alt", "parent", "fhirStoreId"].iter() {
35939 if self._additional_params.contains_key(field) {
35940 dlg.finished(false);
35941 return Err(common::Error::FieldClash(field));
35942 }
35943 }
35944
35945 let mut params = Params::with_capacity(5 + self._additional_params.len());
35946 params.push("parent", self._parent);
35947 if let Some(value) = self._fhir_store_id.as_ref() {
35948 params.push("fhirStoreId", value);
35949 }
35950
35951 params.extend(self._additional_params.iter());
35952
35953 params.push("alt", "json");
35954 let mut url = self.hub._base_url.clone() + "v1/{+parent}/fhirStores";
35955 if self._scopes.is_empty() {
35956 self._scopes
35957 .insert(Scope::CloudHealthcare.as_ref().to_string());
35958 }
35959
35960 #[allow(clippy::single_element_loop)]
35961 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
35962 url = params.uri_replacement(url, param_name, find_this, true);
35963 }
35964 {
35965 let to_remove = ["parent"];
35966 params.remove_params(&to_remove);
35967 }
35968
35969 let url = params.parse_with_url(&url);
35970
35971 let mut json_mime_type = mime::APPLICATION_JSON;
35972 let mut request_value_reader = {
35973 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
35974 common::remove_json_null_values(&mut value);
35975 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
35976 serde_json::to_writer(&mut dst, &value).unwrap();
35977 dst
35978 };
35979 let request_size = request_value_reader
35980 .seek(std::io::SeekFrom::End(0))
35981 .unwrap();
35982 request_value_reader
35983 .seek(std::io::SeekFrom::Start(0))
35984 .unwrap();
35985
35986 loop {
35987 let token = match self
35988 .hub
35989 .auth
35990 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
35991 .await
35992 {
35993 Ok(token) => token,
35994 Err(e) => match dlg.token(e) {
35995 Ok(token) => token,
35996 Err(e) => {
35997 dlg.finished(false);
35998 return Err(common::Error::MissingToken(e));
35999 }
36000 },
36001 };
36002 request_value_reader
36003 .seek(std::io::SeekFrom::Start(0))
36004 .unwrap();
36005 let mut req_result = {
36006 let client = &self.hub.client;
36007 dlg.pre_request();
36008 let mut req_builder = hyper::Request::builder()
36009 .method(hyper::Method::POST)
36010 .uri(url.as_str())
36011 .header(USER_AGENT, self.hub._user_agent.clone());
36012
36013 if let Some(token) = token.as_ref() {
36014 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36015 }
36016
36017 let request = req_builder
36018 .header(CONTENT_TYPE, json_mime_type.to_string())
36019 .header(CONTENT_LENGTH, request_size as u64)
36020 .body(common::to_body(
36021 request_value_reader.get_ref().clone().into(),
36022 ));
36023
36024 client.request(request.unwrap()).await
36025 };
36026
36027 match req_result {
36028 Err(err) => {
36029 if let common::Retry::After(d) = dlg.http_error(&err) {
36030 sleep(d).await;
36031 continue;
36032 }
36033 dlg.finished(false);
36034 return Err(common::Error::HttpError(err));
36035 }
36036 Ok(res) => {
36037 let (mut parts, body) = res.into_parts();
36038 let mut body = common::Body::new(body);
36039 if !parts.status.is_success() {
36040 let bytes = common::to_bytes(body).await.unwrap_or_default();
36041 let error = serde_json::from_str(&common::to_string(&bytes));
36042 let response = common::to_response(parts, bytes.into());
36043
36044 if let common::Retry::After(d) =
36045 dlg.http_failure(&response, error.as_ref().ok())
36046 {
36047 sleep(d).await;
36048 continue;
36049 }
36050
36051 dlg.finished(false);
36052
36053 return Err(match error {
36054 Ok(value) => common::Error::BadRequest(value),
36055 _ => common::Error::Failure(response),
36056 });
36057 }
36058 let response = {
36059 let bytes = common::to_bytes(body).await.unwrap_or_default();
36060 let encoded = common::to_string(&bytes);
36061 match serde_json::from_str(&encoded) {
36062 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36063 Err(error) => {
36064 dlg.response_json_decode_error(&encoded, &error);
36065 return Err(common::Error::JsonDecodeError(
36066 encoded.to_string(),
36067 error,
36068 ));
36069 }
36070 }
36071 };
36072
36073 dlg.finished(true);
36074 return Ok(response);
36075 }
36076 }
36077 }
36078 }
36079
36080 ///
36081 /// Sets the *request* property to the given value.
36082 ///
36083 /// Even though the property as already been set when instantiating this call,
36084 /// we provide this method for API completeness.
36085 pub fn request(
36086 mut self,
36087 new_value: FhirStore,
36088 ) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C> {
36089 self._request = new_value;
36090 self
36091 }
36092 /// Required. The name of the dataset this FHIR store belongs to.
36093 ///
36094 /// Sets the *parent* path property to the given value.
36095 ///
36096 /// Even though the property as already been set when instantiating this call,
36097 /// we provide this method for API completeness.
36098 pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C> {
36099 self._parent = new_value.to_string();
36100 self
36101 }
36102 /// Required. The ID of the FHIR store that is being created. The string must match the following regex: `[\p{L}\p{N}_\-\.]{1,256}`.
36103 ///
36104 /// Sets the *fhir store id* query property to the given value.
36105 pub fn fhir_store_id(
36106 mut self,
36107 new_value: &str,
36108 ) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C> {
36109 self._fhir_store_id = Some(new_value.to_string());
36110 self
36111 }
36112 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36113 /// while executing the actual API request.
36114 ///
36115 /// ````text
36116 /// It should be used to handle progress information, and to implement a certain level of resilience.
36117 /// ````
36118 ///
36119 /// Sets the *delegate* property to the given value.
36120 pub fn delegate(
36121 mut self,
36122 new_value: &'a mut dyn common::Delegate,
36123 ) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C> {
36124 self._delegate = Some(new_value);
36125 self
36126 }
36127
36128 /// Set any additional parameter of the query string used in the request.
36129 /// It should be used to set parameters which are not yet available through their own
36130 /// setters.
36131 ///
36132 /// Please note that this method must not be used to set any of the known parameters
36133 /// which have their own setter method. If done anyway, the request will fail.
36134 ///
36135 /// # Additional Parameters
36136 ///
36137 /// * *$.xgafv* (query-string) - V1 error format.
36138 /// * *access_token* (query-string) - OAuth access token.
36139 /// * *alt* (query-string) - Data format for response.
36140 /// * *callback* (query-string) - JSONP
36141 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36142 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
36143 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36144 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36145 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
36146 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36147 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36148 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C>
36149 where
36150 T: AsRef<str>,
36151 {
36152 self._additional_params
36153 .insert(name.as_ref().to_string(), value.as_ref().to_string());
36154 self
36155 }
36156
36157 /// Identifies the authorization scope for the method you are building.
36158 ///
36159 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36160 /// [`Scope::CloudHealthcare`].
36161 ///
36162 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36163 /// tokens for more than one scope.
36164 ///
36165 /// Usually there is more than one suitable scope to authorize an operation, some of which may
36166 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36167 /// sufficient, a read-write scope will do as well.
36168 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C>
36169 where
36170 St: AsRef<str>,
36171 {
36172 self._scopes.insert(String::from(scope.as_ref()));
36173 self
36174 }
36175 /// Identifies the authorization scope(s) for the method you are building.
36176 ///
36177 /// See [`Self::add_scope()`] for details.
36178 pub fn add_scopes<I, St>(
36179 mut self,
36180 scopes: I,
36181 ) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C>
36182 where
36183 I: IntoIterator<Item = St>,
36184 St: AsRef<str>,
36185 {
36186 self._scopes
36187 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36188 self
36189 }
36190
36191 /// Removes all scopes, and no default scope will be used either.
36192 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36193 /// for details).
36194 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreCreateCall<'a, C> {
36195 self._scopes.clear();
36196 self
36197 }
36198}
36199
36200/// De-identifies data from the source store and writes it to the destination store. The metadata field type is OperationMetadata. If the request is successful, the response field type is DeidentifyFhirStoreSummary. If errors occur, error is set. Error details are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)).
36201///
36202/// A builder for the *locations.datasets.fhirStores.deidentify* method supported by a *project* resource.
36203/// It is not used directly, but through a [`ProjectMethods`] instance.
36204///
36205/// # Example
36206///
36207/// Instantiate a resource method builder
36208///
36209/// ```test_harness,no_run
36210/// # extern crate hyper;
36211/// # extern crate hyper_rustls;
36212/// # extern crate google_healthcare1 as healthcare1;
36213/// use healthcare1::api::DeidentifyFhirStoreRequest;
36214/// # async fn dox() {
36215/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36216///
36217/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36218/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
36219/// # secret,
36220/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36221/// # ).build().await.unwrap();
36222///
36223/// # let client = hyper_util::client::legacy::Client::builder(
36224/// # hyper_util::rt::TokioExecutor::new()
36225/// # )
36226/// # .build(
36227/// # hyper_rustls::HttpsConnectorBuilder::new()
36228/// # .with_native_roots()
36229/// # .unwrap()
36230/// # .https_or_http()
36231/// # .enable_http1()
36232/// # .build()
36233/// # );
36234/// # let mut hub = CloudHealthcare::new(client, auth);
36235/// // As the method needs a request, you would usually fill it with the desired information
36236/// // into the respective structure. Some of the parts shown here might not be applicable !
36237/// // Values shown here are possibly random and not representative !
36238/// let mut req = DeidentifyFhirStoreRequest::default();
36239///
36240/// // You can configure optional parameters by calling the respective setters at will, and
36241/// // execute the final call using `doit()`.
36242/// // Values shown here are possibly random and not representative !
36243/// let result = hub.projects().locations_datasets_fhir_stores_deidentify(req, "sourceStore")
36244/// .doit().await;
36245/// # }
36246/// ```
36247pub struct ProjectLocationDatasetFhirStoreDeidentifyCall<'a, C>
36248where
36249 C: 'a,
36250{
36251 hub: &'a CloudHealthcare<C>,
36252 _request: DeidentifyFhirStoreRequest,
36253 _source_store: String,
36254 _delegate: Option<&'a mut dyn common::Delegate>,
36255 _additional_params: HashMap<String, String>,
36256 _scopes: BTreeSet<String>,
36257}
36258
36259impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreDeidentifyCall<'a, C> {}
36260
36261impl<'a, C> ProjectLocationDatasetFhirStoreDeidentifyCall<'a, C>
36262where
36263 C: common::Connector,
36264{
36265 /// Perform the operation you have build so far.
36266 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
36267 use std::borrow::Cow;
36268 use std::io::{Read, Seek};
36269
36270 use common::{url::Params, ToParts};
36271 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36272
36273 let mut dd = common::DefaultDelegate;
36274 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36275 dlg.begin(common::MethodInfo {
36276 id: "healthcare.projects.locations.datasets.fhirStores.deidentify",
36277 http_method: hyper::Method::POST,
36278 });
36279
36280 for &field in ["alt", "sourceStore"].iter() {
36281 if self._additional_params.contains_key(field) {
36282 dlg.finished(false);
36283 return Err(common::Error::FieldClash(field));
36284 }
36285 }
36286
36287 let mut params = Params::with_capacity(4 + self._additional_params.len());
36288 params.push("sourceStore", self._source_store);
36289
36290 params.extend(self._additional_params.iter());
36291
36292 params.push("alt", "json");
36293 let mut url = self.hub._base_url.clone() + "v1/{+sourceStore}:deidentify";
36294 if self._scopes.is_empty() {
36295 self._scopes
36296 .insert(Scope::CloudHealthcare.as_ref().to_string());
36297 }
36298
36299 #[allow(clippy::single_element_loop)]
36300 for &(find_this, param_name) in [("{+sourceStore}", "sourceStore")].iter() {
36301 url = params.uri_replacement(url, param_name, find_this, true);
36302 }
36303 {
36304 let to_remove = ["sourceStore"];
36305 params.remove_params(&to_remove);
36306 }
36307
36308 let url = params.parse_with_url(&url);
36309
36310 let mut json_mime_type = mime::APPLICATION_JSON;
36311 let mut request_value_reader = {
36312 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
36313 common::remove_json_null_values(&mut value);
36314 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
36315 serde_json::to_writer(&mut dst, &value).unwrap();
36316 dst
36317 };
36318 let request_size = request_value_reader
36319 .seek(std::io::SeekFrom::End(0))
36320 .unwrap();
36321 request_value_reader
36322 .seek(std::io::SeekFrom::Start(0))
36323 .unwrap();
36324
36325 loop {
36326 let token = match self
36327 .hub
36328 .auth
36329 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36330 .await
36331 {
36332 Ok(token) => token,
36333 Err(e) => match dlg.token(e) {
36334 Ok(token) => token,
36335 Err(e) => {
36336 dlg.finished(false);
36337 return Err(common::Error::MissingToken(e));
36338 }
36339 },
36340 };
36341 request_value_reader
36342 .seek(std::io::SeekFrom::Start(0))
36343 .unwrap();
36344 let mut req_result = {
36345 let client = &self.hub.client;
36346 dlg.pre_request();
36347 let mut req_builder = hyper::Request::builder()
36348 .method(hyper::Method::POST)
36349 .uri(url.as_str())
36350 .header(USER_AGENT, self.hub._user_agent.clone());
36351
36352 if let Some(token) = token.as_ref() {
36353 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36354 }
36355
36356 let request = req_builder
36357 .header(CONTENT_TYPE, json_mime_type.to_string())
36358 .header(CONTENT_LENGTH, request_size as u64)
36359 .body(common::to_body(
36360 request_value_reader.get_ref().clone().into(),
36361 ));
36362
36363 client.request(request.unwrap()).await
36364 };
36365
36366 match req_result {
36367 Err(err) => {
36368 if let common::Retry::After(d) = dlg.http_error(&err) {
36369 sleep(d).await;
36370 continue;
36371 }
36372 dlg.finished(false);
36373 return Err(common::Error::HttpError(err));
36374 }
36375 Ok(res) => {
36376 let (mut parts, body) = res.into_parts();
36377 let mut body = common::Body::new(body);
36378 if !parts.status.is_success() {
36379 let bytes = common::to_bytes(body).await.unwrap_or_default();
36380 let error = serde_json::from_str(&common::to_string(&bytes));
36381 let response = common::to_response(parts, bytes.into());
36382
36383 if let common::Retry::After(d) =
36384 dlg.http_failure(&response, error.as_ref().ok())
36385 {
36386 sleep(d).await;
36387 continue;
36388 }
36389
36390 dlg.finished(false);
36391
36392 return Err(match error {
36393 Ok(value) => common::Error::BadRequest(value),
36394 _ => common::Error::Failure(response),
36395 });
36396 }
36397 let response = {
36398 let bytes = common::to_bytes(body).await.unwrap_or_default();
36399 let encoded = common::to_string(&bytes);
36400 match serde_json::from_str(&encoded) {
36401 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36402 Err(error) => {
36403 dlg.response_json_decode_error(&encoded, &error);
36404 return Err(common::Error::JsonDecodeError(
36405 encoded.to_string(),
36406 error,
36407 ));
36408 }
36409 }
36410 };
36411
36412 dlg.finished(true);
36413 return Ok(response);
36414 }
36415 }
36416 }
36417 }
36418
36419 ///
36420 /// Sets the *request* property to the given value.
36421 ///
36422 /// Even though the property as already been set when instantiating this call,
36423 /// we provide this method for API completeness.
36424 pub fn request(
36425 mut self,
36426 new_value: DeidentifyFhirStoreRequest,
36427 ) -> ProjectLocationDatasetFhirStoreDeidentifyCall<'a, C> {
36428 self._request = new_value;
36429 self
36430 }
36431 /// Required. Source FHIR store resource name. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
36432 ///
36433 /// Sets the *source store* path property to the given value.
36434 ///
36435 /// Even though the property as already been set when instantiating this call,
36436 /// we provide this method for API completeness.
36437 pub fn source_store(
36438 mut self,
36439 new_value: &str,
36440 ) -> ProjectLocationDatasetFhirStoreDeidentifyCall<'a, C> {
36441 self._source_store = new_value.to_string();
36442 self
36443 }
36444 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36445 /// while executing the actual API request.
36446 ///
36447 /// ````text
36448 /// It should be used to handle progress information, and to implement a certain level of resilience.
36449 /// ````
36450 ///
36451 /// Sets the *delegate* property to the given value.
36452 pub fn delegate(
36453 mut self,
36454 new_value: &'a mut dyn common::Delegate,
36455 ) -> ProjectLocationDatasetFhirStoreDeidentifyCall<'a, C> {
36456 self._delegate = Some(new_value);
36457 self
36458 }
36459
36460 /// Set any additional parameter of the query string used in the request.
36461 /// It should be used to set parameters which are not yet available through their own
36462 /// setters.
36463 ///
36464 /// Please note that this method must not be used to set any of the known parameters
36465 /// which have their own setter method. If done anyway, the request will fail.
36466 ///
36467 /// # Additional Parameters
36468 ///
36469 /// * *$.xgafv* (query-string) - V1 error format.
36470 /// * *access_token* (query-string) - OAuth access token.
36471 /// * *alt* (query-string) - Data format for response.
36472 /// * *callback* (query-string) - JSONP
36473 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36474 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
36475 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36476 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36477 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
36478 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36479 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36480 pub fn param<T>(
36481 mut self,
36482 name: T,
36483 value: T,
36484 ) -> ProjectLocationDatasetFhirStoreDeidentifyCall<'a, C>
36485 where
36486 T: AsRef<str>,
36487 {
36488 self._additional_params
36489 .insert(name.as_ref().to_string(), value.as_ref().to_string());
36490 self
36491 }
36492
36493 /// Identifies the authorization scope for the method you are building.
36494 ///
36495 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36496 /// [`Scope::CloudHealthcare`].
36497 ///
36498 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36499 /// tokens for more than one scope.
36500 ///
36501 /// Usually there is more than one suitable scope to authorize an operation, some of which may
36502 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36503 /// sufficient, a read-write scope will do as well.
36504 pub fn add_scope<St>(
36505 mut self,
36506 scope: St,
36507 ) -> ProjectLocationDatasetFhirStoreDeidentifyCall<'a, C>
36508 where
36509 St: AsRef<str>,
36510 {
36511 self._scopes.insert(String::from(scope.as_ref()));
36512 self
36513 }
36514 /// Identifies the authorization scope(s) for the method you are building.
36515 ///
36516 /// See [`Self::add_scope()`] for details.
36517 pub fn add_scopes<I, St>(
36518 mut self,
36519 scopes: I,
36520 ) -> ProjectLocationDatasetFhirStoreDeidentifyCall<'a, C>
36521 where
36522 I: IntoIterator<Item = St>,
36523 St: AsRef<str>,
36524 {
36525 self._scopes
36526 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36527 self
36528 }
36529
36530 /// Removes all scopes, and no default scope will be used either.
36531 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36532 /// for details).
36533 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreDeidentifyCall<'a, C> {
36534 self._scopes.clear();
36535 self
36536 }
36537}
36538
36539/// Deletes the specified FHIR store and removes all resources within it.
36540///
36541/// A builder for the *locations.datasets.fhirStores.delete* method supported by a *project* resource.
36542/// It is not used directly, but through a [`ProjectMethods`] instance.
36543///
36544/// # Example
36545///
36546/// Instantiate a resource method builder
36547///
36548/// ```test_harness,no_run
36549/// # extern crate hyper;
36550/// # extern crate hyper_rustls;
36551/// # extern crate google_healthcare1 as healthcare1;
36552/// # async fn dox() {
36553/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36554///
36555/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36556/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
36557/// # secret,
36558/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36559/// # ).build().await.unwrap();
36560///
36561/// # let client = hyper_util::client::legacy::Client::builder(
36562/// # hyper_util::rt::TokioExecutor::new()
36563/// # )
36564/// # .build(
36565/// # hyper_rustls::HttpsConnectorBuilder::new()
36566/// # .with_native_roots()
36567/// # .unwrap()
36568/// # .https_or_http()
36569/// # .enable_http1()
36570/// # .build()
36571/// # );
36572/// # let mut hub = CloudHealthcare::new(client, auth);
36573/// // You can configure optional parameters by calling the respective setters at will, and
36574/// // execute the final call using `doit()`.
36575/// // Values shown here are possibly random and not representative !
36576/// let result = hub.projects().locations_datasets_fhir_stores_delete("name")
36577/// .doit().await;
36578/// # }
36579/// ```
36580pub struct ProjectLocationDatasetFhirStoreDeleteCall<'a, C>
36581where
36582 C: 'a,
36583{
36584 hub: &'a CloudHealthcare<C>,
36585 _name: String,
36586 _delegate: Option<&'a mut dyn common::Delegate>,
36587 _additional_params: HashMap<String, String>,
36588 _scopes: BTreeSet<String>,
36589}
36590
36591impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreDeleteCall<'a, C> {}
36592
36593impl<'a, C> ProjectLocationDatasetFhirStoreDeleteCall<'a, C>
36594where
36595 C: common::Connector,
36596{
36597 /// Perform the operation you have build so far.
36598 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
36599 use std::borrow::Cow;
36600 use std::io::{Read, Seek};
36601
36602 use common::{url::Params, ToParts};
36603 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36604
36605 let mut dd = common::DefaultDelegate;
36606 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36607 dlg.begin(common::MethodInfo {
36608 id: "healthcare.projects.locations.datasets.fhirStores.delete",
36609 http_method: hyper::Method::DELETE,
36610 });
36611
36612 for &field in ["alt", "name"].iter() {
36613 if self._additional_params.contains_key(field) {
36614 dlg.finished(false);
36615 return Err(common::Error::FieldClash(field));
36616 }
36617 }
36618
36619 let mut params = Params::with_capacity(3 + self._additional_params.len());
36620 params.push("name", self._name);
36621
36622 params.extend(self._additional_params.iter());
36623
36624 params.push("alt", "json");
36625 let mut url = self.hub._base_url.clone() + "v1/{+name}";
36626 if self._scopes.is_empty() {
36627 self._scopes
36628 .insert(Scope::CloudHealthcare.as_ref().to_string());
36629 }
36630
36631 #[allow(clippy::single_element_loop)]
36632 for &(find_this, param_name) in [("{+name}", "name")].iter() {
36633 url = params.uri_replacement(url, param_name, find_this, true);
36634 }
36635 {
36636 let to_remove = ["name"];
36637 params.remove_params(&to_remove);
36638 }
36639
36640 let url = params.parse_with_url(&url);
36641
36642 loop {
36643 let token = match self
36644 .hub
36645 .auth
36646 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36647 .await
36648 {
36649 Ok(token) => token,
36650 Err(e) => match dlg.token(e) {
36651 Ok(token) => token,
36652 Err(e) => {
36653 dlg.finished(false);
36654 return Err(common::Error::MissingToken(e));
36655 }
36656 },
36657 };
36658 let mut req_result = {
36659 let client = &self.hub.client;
36660 dlg.pre_request();
36661 let mut req_builder = hyper::Request::builder()
36662 .method(hyper::Method::DELETE)
36663 .uri(url.as_str())
36664 .header(USER_AGENT, self.hub._user_agent.clone());
36665
36666 if let Some(token) = token.as_ref() {
36667 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36668 }
36669
36670 let request = req_builder
36671 .header(CONTENT_LENGTH, 0_u64)
36672 .body(common::to_body::<String>(None));
36673
36674 client.request(request.unwrap()).await
36675 };
36676
36677 match req_result {
36678 Err(err) => {
36679 if let common::Retry::After(d) = dlg.http_error(&err) {
36680 sleep(d).await;
36681 continue;
36682 }
36683 dlg.finished(false);
36684 return Err(common::Error::HttpError(err));
36685 }
36686 Ok(res) => {
36687 let (mut parts, body) = res.into_parts();
36688 let mut body = common::Body::new(body);
36689 if !parts.status.is_success() {
36690 let bytes = common::to_bytes(body).await.unwrap_or_default();
36691 let error = serde_json::from_str(&common::to_string(&bytes));
36692 let response = common::to_response(parts, bytes.into());
36693
36694 if let common::Retry::After(d) =
36695 dlg.http_failure(&response, error.as_ref().ok())
36696 {
36697 sleep(d).await;
36698 continue;
36699 }
36700
36701 dlg.finished(false);
36702
36703 return Err(match error {
36704 Ok(value) => common::Error::BadRequest(value),
36705 _ => common::Error::Failure(response),
36706 });
36707 }
36708 let response = {
36709 let bytes = common::to_bytes(body).await.unwrap_or_default();
36710 let encoded = common::to_string(&bytes);
36711 match serde_json::from_str(&encoded) {
36712 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
36713 Err(error) => {
36714 dlg.response_json_decode_error(&encoded, &error);
36715 return Err(common::Error::JsonDecodeError(
36716 encoded.to_string(),
36717 error,
36718 ));
36719 }
36720 }
36721 };
36722
36723 dlg.finished(true);
36724 return Ok(response);
36725 }
36726 }
36727 }
36728 }
36729
36730 /// Required. The resource name of the FHIR store to delete.
36731 ///
36732 /// Sets the *name* path property to the given value.
36733 ///
36734 /// Even though the property as already been set when instantiating this call,
36735 /// we provide this method for API completeness.
36736 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreDeleteCall<'a, C> {
36737 self._name = new_value.to_string();
36738 self
36739 }
36740 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
36741 /// while executing the actual API request.
36742 ///
36743 /// ````text
36744 /// It should be used to handle progress information, and to implement a certain level of resilience.
36745 /// ````
36746 ///
36747 /// Sets the *delegate* property to the given value.
36748 pub fn delegate(
36749 mut self,
36750 new_value: &'a mut dyn common::Delegate,
36751 ) -> ProjectLocationDatasetFhirStoreDeleteCall<'a, C> {
36752 self._delegate = Some(new_value);
36753 self
36754 }
36755
36756 /// Set any additional parameter of the query string used in the request.
36757 /// It should be used to set parameters which are not yet available through their own
36758 /// setters.
36759 ///
36760 /// Please note that this method must not be used to set any of the known parameters
36761 /// which have their own setter method. If done anyway, the request will fail.
36762 ///
36763 /// # Additional Parameters
36764 ///
36765 /// * *$.xgafv* (query-string) - V1 error format.
36766 /// * *access_token* (query-string) - OAuth access token.
36767 /// * *alt* (query-string) - Data format for response.
36768 /// * *callback* (query-string) - JSONP
36769 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
36770 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
36771 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
36772 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
36773 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
36774 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
36775 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
36776 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreDeleteCall<'a, C>
36777 where
36778 T: AsRef<str>,
36779 {
36780 self._additional_params
36781 .insert(name.as_ref().to_string(), value.as_ref().to_string());
36782 self
36783 }
36784
36785 /// Identifies the authorization scope for the method you are building.
36786 ///
36787 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
36788 /// [`Scope::CloudHealthcare`].
36789 ///
36790 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
36791 /// tokens for more than one scope.
36792 ///
36793 /// Usually there is more than one suitable scope to authorize an operation, some of which may
36794 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
36795 /// sufficient, a read-write scope will do as well.
36796 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetFhirStoreDeleteCall<'a, C>
36797 where
36798 St: AsRef<str>,
36799 {
36800 self._scopes.insert(String::from(scope.as_ref()));
36801 self
36802 }
36803 /// Identifies the authorization scope(s) for the method you are building.
36804 ///
36805 /// See [`Self::add_scope()`] for details.
36806 pub fn add_scopes<I, St>(
36807 mut self,
36808 scopes: I,
36809 ) -> ProjectLocationDatasetFhirStoreDeleteCall<'a, C>
36810 where
36811 I: IntoIterator<Item = St>,
36812 St: AsRef<str>,
36813 {
36814 self._scopes
36815 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
36816 self
36817 }
36818
36819 /// Removes all scopes, and no default scope will be used either.
36820 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
36821 /// for details).
36822 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreDeleteCall<'a, C> {
36823 self._scopes.clear();
36824 self
36825 }
36826}
36827
36828/// Export resources from the FHIR store to the specified destination. This method returns an Operation that can be used to track the status of the export by calling GetOperation. Immediate fatal errors appear in the error field, errors are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). Otherwise, when the operation finishes, a detailed response of type ExportResourcesResponse is returned in the response field. The metadata field type for this operation is OperationMetadata.
36829///
36830/// A builder for the *locations.datasets.fhirStores.export* method supported by a *project* resource.
36831/// It is not used directly, but through a [`ProjectMethods`] instance.
36832///
36833/// # Example
36834///
36835/// Instantiate a resource method builder
36836///
36837/// ```test_harness,no_run
36838/// # extern crate hyper;
36839/// # extern crate hyper_rustls;
36840/// # extern crate google_healthcare1 as healthcare1;
36841/// use healthcare1::api::ExportResourcesRequest;
36842/// # async fn dox() {
36843/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
36844///
36845/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
36846/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
36847/// # secret,
36848/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
36849/// # ).build().await.unwrap();
36850///
36851/// # let client = hyper_util::client::legacy::Client::builder(
36852/// # hyper_util::rt::TokioExecutor::new()
36853/// # )
36854/// # .build(
36855/// # hyper_rustls::HttpsConnectorBuilder::new()
36856/// # .with_native_roots()
36857/// # .unwrap()
36858/// # .https_or_http()
36859/// # .enable_http1()
36860/// # .build()
36861/// # );
36862/// # let mut hub = CloudHealthcare::new(client, auth);
36863/// // As the method needs a request, you would usually fill it with the desired information
36864/// // into the respective structure. Some of the parts shown here might not be applicable !
36865/// // Values shown here are possibly random and not representative !
36866/// let mut req = ExportResourcesRequest::default();
36867///
36868/// // You can configure optional parameters by calling the respective setters at will, and
36869/// // execute the final call using `doit()`.
36870/// // Values shown here are possibly random and not representative !
36871/// let result = hub.projects().locations_datasets_fhir_stores_export(req, "name")
36872/// .doit().await;
36873/// # }
36874/// ```
36875pub struct ProjectLocationDatasetFhirStoreExportCall<'a, C>
36876where
36877 C: 'a,
36878{
36879 hub: &'a CloudHealthcare<C>,
36880 _request: ExportResourcesRequest,
36881 _name: String,
36882 _delegate: Option<&'a mut dyn common::Delegate>,
36883 _additional_params: HashMap<String, String>,
36884 _scopes: BTreeSet<String>,
36885}
36886
36887impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreExportCall<'a, C> {}
36888
36889impl<'a, C> ProjectLocationDatasetFhirStoreExportCall<'a, C>
36890where
36891 C: common::Connector,
36892{
36893 /// Perform the operation you have build so far.
36894 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
36895 use std::borrow::Cow;
36896 use std::io::{Read, Seek};
36897
36898 use common::{url::Params, ToParts};
36899 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
36900
36901 let mut dd = common::DefaultDelegate;
36902 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
36903 dlg.begin(common::MethodInfo {
36904 id: "healthcare.projects.locations.datasets.fhirStores.export",
36905 http_method: hyper::Method::POST,
36906 });
36907
36908 for &field in ["alt", "name"].iter() {
36909 if self._additional_params.contains_key(field) {
36910 dlg.finished(false);
36911 return Err(common::Error::FieldClash(field));
36912 }
36913 }
36914
36915 let mut params = Params::with_capacity(4 + self._additional_params.len());
36916 params.push("name", self._name);
36917
36918 params.extend(self._additional_params.iter());
36919
36920 params.push("alt", "json");
36921 let mut url = self.hub._base_url.clone() + "v1/{+name}:export";
36922 if self._scopes.is_empty() {
36923 self._scopes
36924 .insert(Scope::CloudHealthcare.as_ref().to_string());
36925 }
36926
36927 #[allow(clippy::single_element_loop)]
36928 for &(find_this, param_name) in [("{+name}", "name")].iter() {
36929 url = params.uri_replacement(url, param_name, find_this, true);
36930 }
36931 {
36932 let to_remove = ["name"];
36933 params.remove_params(&to_remove);
36934 }
36935
36936 let url = params.parse_with_url(&url);
36937
36938 let mut json_mime_type = mime::APPLICATION_JSON;
36939 let mut request_value_reader = {
36940 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
36941 common::remove_json_null_values(&mut value);
36942 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
36943 serde_json::to_writer(&mut dst, &value).unwrap();
36944 dst
36945 };
36946 let request_size = request_value_reader
36947 .seek(std::io::SeekFrom::End(0))
36948 .unwrap();
36949 request_value_reader
36950 .seek(std::io::SeekFrom::Start(0))
36951 .unwrap();
36952
36953 loop {
36954 let token = match self
36955 .hub
36956 .auth
36957 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
36958 .await
36959 {
36960 Ok(token) => token,
36961 Err(e) => match dlg.token(e) {
36962 Ok(token) => token,
36963 Err(e) => {
36964 dlg.finished(false);
36965 return Err(common::Error::MissingToken(e));
36966 }
36967 },
36968 };
36969 request_value_reader
36970 .seek(std::io::SeekFrom::Start(0))
36971 .unwrap();
36972 let mut req_result = {
36973 let client = &self.hub.client;
36974 dlg.pre_request();
36975 let mut req_builder = hyper::Request::builder()
36976 .method(hyper::Method::POST)
36977 .uri(url.as_str())
36978 .header(USER_AGENT, self.hub._user_agent.clone());
36979
36980 if let Some(token) = token.as_ref() {
36981 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
36982 }
36983
36984 let request = req_builder
36985 .header(CONTENT_TYPE, json_mime_type.to_string())
36986 .header(CONTENT_LENGTH, request_size as u64)
36987 .body(common::to_body(
36988 request_value_reader.get_ref().clone().into(),
36989 ));
36990
36991 client.request(request.unwrap()).await
36992 };
36993
36994 match req_result {
36995 Err(err) => {
36996 if let common::Retry::After(d) = dlg.http_error(&err) {
36997 sleep(d).await;
36998 continue;
36999 }
37000 dlg.finished(false);
37001 return Err(common::Error::HttpError(err));
37002 }
37003 Ok(res) => {
37004 let (mut parts, body) = res.into_parts();
37005 let mut body = common::Body::new(body);
37006 if !parts.status.is_success() {
37007 let bytes = common::to_bytes(body).await.unwrap_or_default();
37008 let error = serde_json::from_str(&common::to_string(&bytes));
37009 let response = common::to_response(parts, bytes.into());
37010
37011 if let common::Retry::After(d) =
37012 dlg.http_failure(&response, error.as_ref().ok())
37013 {
37014 sleep(d).await;
37015 continue;
37016 }
37017
37018 dlg.finished(false);
37019
37020 return Err(match error {
37021 Ok(value) => common::Error::BadRequest(value),
37022 _ => common::Error::Failure(response),
37023 });
37024 }
37025 let response = {
37026 let bytes = common::to_bytes(body).await.unwrap_or_default();
37027 let encoded = common::to_string(&bytes);
37028 match serde_json::from_str(&encoded) {
37029 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37030 Err(error) => {
37031 dlg.response_json_decode_error(&encoded, &error);
37032 return Err(common::Error::JsonDecodeError(
37033 encoded.to_string(),
37034 error,
37035 ));
37036 }
37037 }
37038 };
37039
37040 dlg.finished(true);
37041 return Ok(response);
37042 }
37043 }
37044 }
37045 }
37046
37047 ///
37048 /// Sets the *request* property to the given value.
37049 ///
37050 /// Even though the property as already been set when instantiating this call,
37051 /// we provide this method for API completeness.
37052 pub fn request(
37053 mut self,
37054 new_value: ExportResourcesRequest,
37055 ) -> ProjectLocationDatasetFhirStoreExportCall<'a, C> {
37056 self._request = new_value;
37057 self
37058 }
37059 /// Required. The name of the FHIR store to export resource from, in the format of `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
37060 ///
37061 /// Sets the *name* path property to the given value.
37062 ///
37063 /// Even though the property as already been set when instantiating this call,
37064 /// we provide this method for API completeness.
37065 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreExportCall<'a, C> {
37066 self._name = new_value.to_string();
37067 self
37068 }
37069 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37070 /// while executing the actual API request.
37071 ///
37072 /// ````text
37073 /// It should be used to handle progress information, and to implement a certain level of resilience.
37074 /// ````
37075 ///
37076 /// Sets the *delegate* property to the given value.
37077 pub fn delegate(
37078 mut self,
37079 new_value: &'a mut dyn common::Delegate,
37080 ) -> ProjectLocationDatasetFhirStoreExportCall<'a, C> {
37081 self._delegate = Some(new_value);
37082 self
37083 }
37084
37085 /// Set any additional parameter of the query string used in the request.
37086 /// It should be used to set parameters which are not yet available through their own
37087 /// setters.
37088 ///
37089 /// Please note that this method must not be used to set any of the known parameters
37090 /// which have their own setter method. If done anyway, the request will fail.
37091 ///
37092 /// # Additional Parameters
37093 ///
37094 /// * *$.xgafv* (query-string) - V1 error format.
37095 /// * *access_token* (query-string) - OAuth access token.
37096 /// * *alt* (query-string) - Data format for response.
37097 /// * *callback* (query-string) - JSONP
37098 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37099 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
37100 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37101 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37102 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
37103 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37104 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37105 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreExportCall<'a, C>
37106 where
37107 T: AsRef<str>,
37108 {
37109 self._additional_params
37110 .insert(name.as_ref().to_string(), value.as_ref().to_string());
37111 self
37112 }
37113
37114 /// Identifies the authorization scope for the method you are building.
37115 ///
37116 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37117 /// [`Scope::CloudHealthcare`].
37118 ///
37119 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37120 /// tokens for more than one scope.
37121 ///
37122 /// Usually there is more than one suitable scope to authorize an operation, some of which may
37123 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37124 /// sufficient, a read-write scope will do as well.
37125 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetFhirStoreExportCall<'a, C>
37126 where
37127 St: AsRef<str>,
37128 {
37129 self._scopes.insert(String::from(scope.as_ref()));
37130 self
37131 }
37132 /// Identifies the authorization scope(s) for the method you are building.
37133 ///
37134 /// See [`Self::add_scope()`] for details.
37135 pub fn add_scopes<I, St>(
37136 mut self,
37137 scopes: I,
37138 ) -> ProjectLocationDatasetFhirStoreExportCall<'a, C>
37139 where
37140 I: IntoIterator<Item = St>,
37141 St: AsRef<str>,
37142 {
37143 self._scopes
37144 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37145 self
37146 }
37147
37148 /// Removes all scopes, and no default scope will be used either.
37149 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37150 /// for details).
37151 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreExportCall<'a, C> {
37152 self._scopes.clear();
37153 self
37154 }
37155}
37156
37157/// Gets the configuration of the specified FHIR store.
37158///
37159/// A builder for the *locations.datasets.fhirStores.get* method supported by a *project* resource.
37160/// It is not used directly, but through a [`ProjectMethods`] instance.
37161///
37162/// # Example
37163///
37164/// Instantiate a resource method builder
37165///
37166/// ```test_harness,no_run
37167/// # extern crate hyper;
37168/// # extern crate hyper_rustls;
37169/// # extern crate google_healthcare1 as healthcare1;
37170/// # async fn dox() {
37171/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37172///
37173/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37174/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
37175/// # secret,
37176/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37177/// # ).build().await.unwrap();
37178///
37179/// # let client = hyper_util::client::legacy::Client::builder(
37180/// # hyper_util::rt::TokioExecutor::new()
37181/// # )
37182/// # .build(
37183/// # hyper_rustls::HttpsConnectorBuilder::new()
37184/// # .with_native_roots()
37185/// # .unwrap()
37186/// # .https_or_http()
37187/// # .enable_http1()
37188/// # .build()
37189/// # );
37190/// # let mut hub = CloudHealthcare::new(client, auth);
37191/// // You can configure optional parameters by calling the respective setters at will, and
37192/// // execute the final call using `doit()`.
37193/// // Values shown here are possibly random and not representative !
37194/// let result = hub.projects().locations_datasets_fhir_stores_get("name")
37195/// .doit().await;
37196/// # }
37197/// ```
37198pub struct ProjectLocationDatasetFhirStoreGetCall<'a, C>
37199where
37200 C: 'a,
37201{
37202 hub: &'a CloudHealthcare<C>,
37203 _name: String,
37204 _delegate: Option<&'a mut dyn common::Delegate>,
37205 _additional_params: HashMap<String, String>,
37206 _scopes: BTreeSet<String>,
37207}
37208
37209impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreGetCall<'a, C> {}
37210
37211impl<'a, C> ProjectLocationDatasetFhirStoreGetCall<'a, C>
37212where
37213 C: common::Connector,
37214{
37215 /// Perform the operation you have build so far.
37216 pub async fn doit(mut self) -> common::Result<(common::Response, FhirStore)> {
37217 use std::borrow::Cow;
37218 use std::io::{Read, Seek};
37219
37220 use common::{url::Params, ToParts};
37221 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37222
37223 let mut dd = common::DefaultDelegate;
37224 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37225 dlg.begin(common::MethodInfo {
37226 id: "healthcare.projects.locations.datasets.fhirStores.get",
37227 http_method: hyper::Method::GET,
37228 });
37229
37230 for &field in ["alt", "name"].iter() {
37231 if self._additional_params.contains_key(field) {
37232 dlg.finished(false);
37233 return Err(common::Error::FieldClash(field));
37234 }
37235 }
37236
37237 let mut params = Params::with_capacity(3 + self._additional_params.len());
37238 params.push("name", self._name);
37239
37240 params.extend(self._additional_params.iter());
37241
37242 params.push("alt", "json");
37243 let mut url = self.hub._base_url.clone() + "v1/{+name}";
37244 if self._scopes.is_empty() {
37245 self._scopes
37246 .insert(Scope::CloudHealthcare.as_ref().to_string());
37247 }
37248
37249 #[allow(clippy::single_element_loop)]
37250 for &(find_this, param_name) in [("{+name}", "name")].iter() {
37251 url = params.uri_replacement(url, param_name, find_this, true);
37252 }
37253 {
37254 let to_remove = ["name"];
37255 params.remove_params(&to_remove);
37256 }
37257
37258 let url = params.parse_with_url(&url);
37259
37260 loop {
37261 let token = match self
37262 .hub
37263 .auth
37264 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37265 .await
37266 {
37267 Ok(token) => token,
37268 Err(e) => match dlg.token(e) {
37269 Ok(token) => token,
37270 Err(e) => {
37271 dlg.finished(false);
37272 return Err(common::Error::MissingToken(e));
37273 }
37274 },
37275 };
37276 let mut req_result = {
37277 let client = &self.hub.client;
37278 dlg.pre_request();
37279 let mut req_builder = hyper::Request::builder()
37280 .method(hyper::Method::GET)
37281 .uri(url.as_str())
37282 .header(USER_AGENT, self.hub._user_agent.clone());
37283
37284 if let Some(token) = token.as_ref() {
37285 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37286 }
37287
37288 let request = req_builder
37289 .header(CONTENT_LENGTH, 0_u64)
37290 .body(common::to_body::<String>(None));
37291
37292 client.request(request.unwrap()).await
37293 };
37294
37295 match req_result {
37296 Err(err) => {
37297 if let common::Retry::After(d) = dlg.http_error(&err) {
37298 sleep(d).await;
37299 continue;
37300 }
37301 dlg.finished(false);
37302 return Err(common::Error::HttpError(err));
37303 }
37304 Ok(res) => {
37305 let (mut parts, body) = res.into_parts();
37306 let mut body = common::Body::new(body);
37307 if !parts.status.is_success() {
37308 let bytes = common::to_bytes(body).await.unwrap_or_default();
37309 let error = serde_json::from_str(&common::to_string(&bytes));
37310 let response = common::to_response(parts, bytes.into());
37311
37312 if let common::Retry::After(d) =
37313 dlg.http_failure(&response, error.as_ref().ok())
37314 {
37315 sleep(d).await;
37316 continue;
37317 }
37318
37319 dlg.finished(false);
37320
37321 return Err(match error {
37322 Ok(value) => common::Error::BadRequest(value),
37323 _ => common::Error::Failure(response),
37324 });
37325 }
37326 let response = {
37327 let bytes = common::to_bytes(body).await.unwrap_or_default();
37328 let encoded = common::to_string(&bytes);
37329 match serde_json::from_str(&encoded) {
37330 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37331 Err(error) => {
37332 dlg.response_json_decode_error(&encoded, &error);
37333 return Err(common::Error::JsonDecodeError(
37334 encoded.to_string(),
37335 error,
37336 ));
37337 }
37338 }
37339 };
37340
37341 dlg.finished(true);
37342 return Ok(response);
37343 }
37344 }
37345 }
37346 }
37347
37348 /// Required. The resource name of the FHIR store to get.
37349 ///
37350 /// Sets the *name* path property to the given value.
37351 ///
37352 /// Even though the property as already been set when instantiating this call,
37353 /// we provide this method for API completeness.
37354 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreGetCall<'a, C> {
37355 self._name = new_value.to_string();
37356 self
37357 }
37358 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37359 /// while executing the actual API request.
37360 ///
37361 /// ````text
37362 /// It should be used to handle progress information, and to implement a certain level of resilience.
37363 /// ````
37364 ///
37365 /// Sets the *delegate* property to the given value.
37366 pub fn delegate(
37367 mut self,
37368 new_value: &'a mut dyn common::Delegate,
37369 ) -> ProjectLocationDatasetFhirStoreGetCall<'a, C> {
37370 self._delegate = Some(new_value);
37371 self
37372 }
37373
37374 /// Set any additional parameter of the query string used in the request.
37375 /// It should be used to set parameters which are not yet available through their own
37376 /// setters.
37377 ///
37378 /// Please note that this method must not be used to set any of the known parameters
37379 /// which have their own setter method. If done anyway, the request will fail.
37380 ///
37381 /// # Additional Parameters
37382 ///
37383 /// * *$.xgafv* (query-string) - V1 error format.
37384 /// * *access_token* (query-string) - OAuth access token.
37385 /// * *alt* (query-string) - Data format for response.
37386 /// * *callback* (query-string) - JSONP
37387 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37388 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
37389 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37390 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37391 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
37392 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37393 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37394 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreGetCall<'a, C>
37395 where
37396 T: AsRef<str>,
37397 {
37398 self._additional_params
37399 .insert(name.as_ref().to_string(), value.as_ref().to_string());
37400 self
37401 }
37402
37403 /// Identifies the authorization scope for the method you are building.
37404 ///
37405 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37406 /// [`Scope::CloudHealthcare`].
37407 ///
37408 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37409 /// tokens for more than one scope.
37410 ///
37411 /// Usually there is more than one suitable scope to authorize an operation, some of which may
37412 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37413 /// sufficient, a read-write scope will do as well.
37414 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetFhirStoreGetCall<'a, C>
37415 where
37416 St: AsRef<str>,
37417 {
37418 self._scopes.insert(String::from(scope.as_ref()));
37419 self
37420 }
37421 /// Identifies the authorization scope(s) for the method you are building.
37422 ///
37423 /// See [`Self::add_scope()`] for details.
37424 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetFhirStoreGetCall<'a, C>
37425 where
37426 I: IntoIterator<Item = St>,
37427 St: AsRef<str>,
37428 {
37429 self._scopes
37430 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37431 self
37432 }
37433
37434 /// Removes all scopes, and no default scope will be used either.
37435 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37436 /// for details).
37437 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreGetCall<'a, C> {
37438 self._scopes.clear();
37439 self
37440 }
37441}
37442
37443/// Gets metrics associated with the FHIR store.
37444///
37445/// A builder for the *locations.datasets.fhirStores.getFHIRStoreMetrics* method supported by a *project* resource.
37446/// It is not used directly, but through a [`ProjectMethods`] instance.
37447///
37448/// # Example
37449///
37450/// Instantiate a resource method builder
37451///
37452/// ```test_harness,no_run
37453/// # extern crate hyper;
37454/// # extern crate hyper_rustls;
37455/// # extern crate google_healthcare1 as healthcare1;
37456/// # async fn dox() {
37457/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37458///
37459/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37460/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
37461/// # secret,
37462/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37463/// # ).build().await.unwrap();
37464///
37465/// # let client = hyper_util::client::legacy::Client::builder(
37466/// # hyper_util::rt::TokioExecutor::new()
37467/// # )
37468/// # .build(
37469/// # hyper_rustls::HttpsConnectorBuilder::new()
37470/// # .with_native_roots()
37471/// # .unwrap()
37472/// # .https_or_http()
37473/// # .enable_http1()
37474/// # .build()
37475/// # );
37476/// # let mut hub = CloudHealthcare::new(client, auth);
37477/// // You can configure optional parameters by calling the respective setters at will, and
37478/// // execute the final call using `doit()`.
37479/// // Values shown here are possibly random and not representative !
37480/// let result = hub.projects().locations_datasets_fhir_stores_get_fhir_store_metrics("name")
37481/// .doit().await;
37482/// # }
37483/// ```
37484pub struct ProjectLocationDatasetFhirStoreGetFHIRStoreMetricCall<'a, C>
37485where
37486 C: 'a,
37487{
37488 hub: &'a CloudHealthcare<C>,
37489 _name: String,
37490 _delegate: Option<&'a mut dyn common::Delegate>,
37491 _additional_params: HashMap<String, String>,
37492 _scopes: BTreeSet<String>,
37493}
37494
37495impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreGetFHIRStoreMetricCall<'a, C> {}
37496
37497impl<'a, C> ProjectLocationDatasetFhirStoreGetFHIRStoreMetricCall<'a, C>
37498where
37499 C: common::Connector,
37500{
37501 /// Perform the operation you have build so far.
37502 pub async fn doit(mut self) -> common::Result<(common::Response, FhirStoreMetrics)> {
37503 use std::borrow::Cow;
37504 use std::io::{Read, Seek};
37505
37506 use common::{url::Params, ToParts};
37507 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37508
37509 let mut dd = common::DefaultDelegate;
37510 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37511 dlg.begin(common::MethodInfo {
37512 id: "healthcare.projects.locations.datasets.fhirStores.getFHIRStoreMetrics",
37513 http_method: hyper::Method::GET,
37514 });
37515
37516 for &field in ["alt", "name"].iter() {
37517 if self._additional_params.contains_key(field) {
37518 dlg.finished(false);
37519 return Err(common::Error::FieldClash(field));
37520 }
37521 }
37522
37523 let mut params = Params::with_capacity(3 + self._additional_params.len());
37524 params.push("name", self._name);
37525
37526 params.extend(self._additional_params.iter());
37527
37528 params.push("alt", "json");
37529 let mut url = self.hub._base_url.clone() + "v1/{+name}:getFHIRStoreMetrics";
37530 if self._scopes.is_empty() {
37531 self._scopes
37532 .insert(Scope::CloudHealthcare.as_ref().to_string());
37533 }
37534
37535 #[allow(clippy::single_element_loop)]
37536 for &(find_this, param_name) in [("{+name}", "name")].iter() {
37537 url = params.uri_replacement(url, param_name, find_this, true);
37538 }
37539 {
37540 let to_remove = ["name"];
37541 params.remove_params(&to_remove);
37542 }
37543
37544 let url = params.parse_with_url(&url);
37545
37546 loop {
37547 let token = match self
37548 .hub
37549 .auth
37550 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37551 .await
37552 {
37553 Ok(token) => token,
37554 Err(e) => match dlg.token(e) {
37555 Ok(token) => token,
37556 Err(e) => {
37557 dlg.finished(false);
37558 return Err(common::Error::MissingToken(e));
37559 }
37560 },
37561 };
37562 let mut req_result = {
37563 let client = &self.hub.client;
37564 dlg.pre_request();
37565 let mut req_builder = hyper::Request::builder()
37566 .method(hyper::Method::GET)
37567 .uri(url.as_str())
37568 .header(USER_AGENT, self.hub._user_agent.clone());
37569
37570 if let Some(token) = token.as_ref() {
37571 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37572 }
37573
37574 let request = req_builder
37575 .header(CONTENT_LENGTH, 0_u64)
37576 .body(common::to_body::<String>(None));
37577
37578 client.request(request.unwrap()).await
37579 };
37580
37581 match req_result {
37582 Err(err) => {
37583 if let common::Retry::After(d) = dlg.http_error(&err) {
37584 sleep(d).await;
37585 continue;
37586 }
37587 dlg.finished(false);
37588 return Err(common::Error::HttpError(err));
37589 }
37590 Ok(res) => {
37591 let (mut parts, body) = res.into_parts();
37592 let mut body = common::Body::new(body);
37593 if !parts.status.is_success() {
37594 let bytes = common::to_bytes(body).await.unwrap_or_default();
37595 let error = serde_json::from_str(&common::to_string(&bytes));
37596 let response = common::to_response(parts, bytes.into());
37597
37598 if let common::Retry::After(d) =
37599 dlg.http_failure(&response, error.as_ref().ok())
37600 {
37601 sleep(d).await;
37602 continue;
37603 }
37604
37605 dlg.finished(false);
37606
37607 return Err(match error {
37608 Ok(value) => common::Error::BadRequest(value),
37609 _ => common::Error::Failure(response),
37610 });
37611 }
37612 let response = {
37613 let bytes = common::to_bytes(body).await.unwrap_or_default();
37614 let encoded = common::to_string(&bytes);
37615 match serde_json::from_str(&encoded) {
37616 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37617 Err(error) => {
37618 dlg.response_json_decode_error(&encoded, &error);
37619 return Err(common::Error::JsonDecodeError(
37620 encoded.to_string(),
37621 error,
37622 ));
37623 }
37624 }
37625 };
37626
37627 dlg.finished(true);
37628 return Ok(response);
37629 }
37630 }
37631 }
37632 }
37633
37634 /// Required. The resource name of the FHIR store to get metrics for.
37635 ///
37636 /// Sets the *name* path property to the given value.
37637 ///
37638 /// Even though the property as already been set when instantiating this call,
37639 /// we provide this method for API completeness.
37640 pub fn name(
37641 mut self,
37642 new_value: &str,
37643 ) -> ProjectLocationDatasetFhirStoreGetFHIRStoreMetricCall<'a, C> {
37644 self._name = new_value.to_string();
37645 self
37646 }
37647 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37648 /// while executing the actual API request.
37649 ///
37650 /// ````text
37651 /// It should be used to handle progress information, and to implement a certain level of resilience.
37652 /// ````
37653 ///
37654 /// Sets the *delegate* property to the given value.
37655 pub fn delegate(
37656 mut self,
37657 new_value: &'a mut dyn common::Delegate,
37658 ) -> ProjectLocationDatasetFhirStoreGetFHIRStoreMetricCall<'a, C> {
37659 self._delegate = Some(new_value);
37660 self
37661 }
37662
37663 /// Set any additional parameter of the query string used in the request.
37664 /// It should be used to set parameters which are not yet available through their own
37665 /// setters.
37666 ///
37667 /// Please note that this method must not be used to set any of the known parameters
37668 /// which have their own setter method. If done anyway, the request will fail.
37669 ///
37670 /// # Additional Parameters
37671 ///
37672 /// * *$.xgafv* (query-string) - V1 error format.
37673 /// * *access_token* (query-string) - OAuth access token.
37674 /// * *alt* (query-string) - Data format for response.
37675 /// * *callback* (query-string) - JSONP
37676 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37677 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
37678 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37679 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37680 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
37681 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37682 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37683 pub fn param<T>(
37684 mut self,
37685 name: T,
37686 value: T,
37687 ) -> ProjectLocationDatasetFhirStoreGetFHIRStoreMetricCall<'a, C>
37688 where
37689 T: AsRef<str>,
37690 {
37691 self._additional_params
37692 .insert(name.as_ref().to_string(), value.as_ref().to_string());
37693 self
37694 }
37695
37696 /// Identifies the authorization scope for the method you are building.
37697 ///
37698 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
37699 /// [`Scope::CloudHealthcare`].
37700 ///
37701 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
37702 /// tokens for more than one scope.
37703 ///
37704 /// Usually there is more than one suitable scope to authorize an operation, some of which may
37705 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
37706 /// sufficient, a read-write scope will do as well.
37707 pub fn add_scope<St>(
37708 mut self,
37709 scope: St,
37710 ) -> ProjectLocationDatasetFhirStoreGetFHIRStoreMetricCall<'a, C>
37711 where
37712 St: AsRef<str>,
37713 {
37714 self._scopes.insert(String::from(scope.as_ref()));
37715 self
37716 }
37717 /// Identifies the authorization scope(s) for the method you are building.
37718 ///
37719 /// See [`Self::add_scope()`] for details.
37720 pub fn add_scopes<I, St>(
37721 mut self,
37722 scopes: I,
37723 ) -> ProjectLocationDatasetFhirStoreGetFHIRStoreMetricCall<'a, C>
37724 where
37725 I: IntoIterator<Item = St>,
37726 St: AsRef<str>,
37727 {
37728 self._scopes
37729 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
37730 self
37731 }
37732
37733 /// Removes all scopes, and no default scope will be used either.
37734 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
37735 /// for details).
37736 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreGetFHIRStoreMetricCall<'a, C> {
37737 self._scopes.clear();
37738 self
37739 }
37740}
37741
37742/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
37743///
37744/// A builder for the *locations.datasets.fhirStores.getIamPolicy* method supported by a *project* resource.
37745/// It is not used directly, but through a [`ProjectMethods`] instance.
37746///
37747/// # Example
37748///
37749/// Instantiate a resource method builder
37750///
37751/// ```test_harness,no_run
37752/// # extern crate hyper;
37753/// # extern crate hyper_rustls;
37754/// # extern crate google_healthcare1 as healthcare1;
37755/// # async fn dox() {
37756/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
37757///
37758/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
37759/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
37760/// # secret,
37761/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
37762/// # ).build().await.unwrap();
37763///
37764/// # let client = hyper_util::client::legacy::Client::builder(
37765/// # hyper_util::rt::TokioExecutor::new()
37766/// # )
37767/// # .build(
37768/// # hyper_rustls::HttpsConnectorBuilder::new()
37769/// # .with_native_roots()
37770/// # .unwrap()
37771/// # .https_or_http()
37772/// # .enable_http1()
37773/// # .build()
37774/// # );
37775/// # let mut hub = CloudHealthcare::new(client, auth);
37776/// // You can configure optional parameters by calling the respective setters at will, and
37777/// // execute the final call using `doit()`.
37778/// // Values shown here are possibly random and not representative !
37779/// let result = hub.projects().locations_datasets_fhir_stores_get_iam_policy("resource")
37780/// .options_requested_policy_version(-25)
37781/// .doit().await;
37782/// # }
37783/// ```
37784pub struct ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C>
37785where
37786 C: 'a,
37787{
37788 hub: &'a CloudHealthcare<C>,
37789 _resource: String,
37790 _options_requested_policy_version: Option<i32>,
37791 _delegate: Option<&'a mut dyn common::Delegate>,
37792 _additional_params: HashMap<String, String>,
37793 _scopes: BTreeSet<String>,
37794}
37795
37796impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C> {}
37797
37798impl<'a, C> ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C>
37799where
37800 C: common::Connector,
37801{
37802 /// Perform the operation you have build so far.
37803 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
37804 use std::borrow::Cow;
37805 use std::io::{Read, Seek};
37806
37807 use common::{url::Params, ToParts};
37808 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
37809
37810 let mut dd = common::DefaultDelegate;
37811 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
37812 dlg.begin(common::MethodInfo {
37813 id: "healthcare.projects.locations.datasets.fhirStores.getIamPolicy",
37814 http_method: hyper::Method::GET,
37815 });
37816
37817 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
37818 if self._additional_params.contains_key(field) {
37819 dlg.finished(false);
37820 return Err(common::Error::FieldClash(field));
37821 }
37822 }
37823
37824 let mut params = Params::with_capacity(4 + self._additional_params.len());
37825 params.push("resource", self._resource);
37826 if let Some(value) = self._options_requested_policy_version.as_ref() {
37827 params.push("options.requestedPolicyVersion", value.to_string());
37828 }
37829
37830 params.extend(self._additional_params.iter());
37831
37832 params.push("alt", "json");
37833 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
37834 if self._scopes.is_empty() {
37835 self._scopes
37836 .insert(Scope::CloudHealthcare.as_ref().to_string());
37837 }
37838
37839 #[allow(clippy::single_element_loop)]
37840 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
37841 url = params.uri_replacement(url, param_name, find_this, true);
37842 }
37843 {
37844 let to_remove = ["resource"];
37845 params.remove_params(&to_remove);
37846 }
37847
37848 let url = params.parse_with_url(&url);
37849
37850 loop {
37851 let token = match self
37852 .hub
37853 .auth
37854 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
37855 .await
37856 {
37857 Ok(token) => token,
37858 Err(e) => match dlg.token(e) {
37859 Ok(token) => token,
37860 Err(e) => {
37861 dlg.finished(false);
37862 return Err(common::Error::MissingToken(e));
37863 }
37864 },
37865 };
37866 let mut req_result = {
37867 let client = &self.hub.client;
37868 dlg.pre_request();
37869 let mut req_builder = hyper::Request::builder()
37870 .method(hyper::Method::GET)
37871 .uri(url.as_str())
37872 .header(USER_AGENT, self.hub._user_agent.clone());
37873
37874 if let Some(token) = token.as_ref() {
37875 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
37876 }
37877
37878 let request = req_builder
37879 .header(CONTENT_LENGTH, 0_u64)
37880 .body(common::to_body::<String>(None));
37881
37882 client.request(request.unwrap()).await
37883 };
37884
37885 match req_result {
37886 Err(err) => {
37887 if let common::Retry::After(d) = dlg.http_error(&err) {
37888 sleep(d).await;
37889 continue;
37890 }
37891 dlg.finished(false);
37892 return Err(common::Error::HttpError(err));
37893 }
37894 Ok(res) => {
37895 let (mut parts, body) = res.into_parts();
37896 let mut body = common::Body::new(body);
37897 if !parts.status.is_success() {
37898 let bytes = common::to_bytes(body).await.unwrap_or_default();
37899 let error = serde_json::from_str(&common::to_string(&bytes));
37900 let response = common::to_response(parts, bytes.into());
37901
37902 if let common::Retry::After(d) =
37903 dlg.http_failure(&response, error.as_ref().ok())
37904 {
37905 sleep(d).await;
37906 continue;
37907 }
37908
37909 dlg.finished(false);
37910
37911 return Err(match error {
37912 Ok(value) => common::Error::BadRequest(value),
37913 _ => common::Error::Failure(response),
37914 });
37915 }
37916 let response = {
37917 let bytes = common::to_bytes(body).await.unwrap_or_default();
37918 let encoded = common::to_string(&bytes);
37919 match serde_json::from_str(&encoded) {
37920 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
37921 Err(error) => {
37922 dlg.response_json_decode_error(&encoded, &error);
37923 return Err(common::Error::JsonDecodeError(
37924 encoded.to_string(),
37925 error,
37926 ));
37927 }
37928 }
37929 };
37930
37931 dlg.finished(true);
37932 return Ok(response);
37933 }
37934 }
37935 }
37936 }
37937
37938 /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
37939 ///
37940 /// Sets the *resource* path property to the given value.
37941 ///
37942 /// Even though the property as already been set when instantiating this call,
37943 /// we provide this method for API completeness.
37944 pub fn resource(
37945 mut self,
37946 new_value: &str,
37947 ) -> ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C> {
37948 self._resource = new_value.to_string();
37949 self
37950 }
37951 /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
37952 ///
37953 /// Sets the *options.requested policy version* query property to the given value.
37954 pub fn options_requested_policy_version(
37955 mut self,
37956 new_value: i32,
37957 ) -> ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C> {
37958 self._options_requested_policy_version = Some(new_value);
37959 self
37960 }
37961 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
37962 /// while executing the actual API request.
37963 ///
37964 /// ````text
37965 /// It should be used to handle progress information, and to implement a certain level of resilience.
37966 /// ````
37967 ///
37968 /// Sets the *delegate* property to the given value.
37969 pub fn delegate(
37970 mut self,
37971 new_value: &'a mut dyn common::Delegate,
37972 ) -> ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C> {
37973 self._delegate = Some(new_value);
37974 self
37975 }
37976
37977 /// Set any additional parameter of the query string used in the request.
37978 /// It should be used to set parameters which are not yet available through their own
37979 /// setters.
37980 ///
37981 /// Please note that this method must not be used to set any of the known parameters
37982 /// which have their own setter method. If done anyway, the request will fail.
37983 ///
37984 /// # Additional Parameters
37985 ///
37986 /// * *$.xgafv* (query-string) - V1 error format.
37987 /// * *access_token* (query-string) - OAuth access token.
37988 /// * *alt* (query-string) - Data format for response.
37989 /// * *callback* (query-string) - JSONP
37990 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
37991 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
37992 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
37993 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
37994 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
37995 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
37996 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
37997 pub fn param<T>(
37998 mut self,
37999 name: T,
38000 value: T,
38001 ) -> ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C>
38002 where
38003 T: AsRef<str>,
38004 {
38005 self._additional_params
38006 .insert(name.as_ref().to_string(), value.as_ref().to_string());
38007 self
38008 }
38009
38010 /// Identifies the authorization scope for the method you are building.
38011 ///
38012 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38013 /// [`Scope::CloudHealthcare`].
38014 ///
38015 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38016 /// tokens for more than one scope.
38017 ///
38018 /// Usually there is more than one suitable scope to authorize an operation, some of which may
38019 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38020 /// sufficient, a read-write scope will do as well.
38021 pub fn add_scope<St>(
38022 mut self,
38023 scope: St,
38024 ) -> ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C>
38025 where
38026 St: AsRef<str>,
38027 {
38028 self._scopes.insert(String::from(scope.as_ref()));
38029 self
38030 }
38031 /// Identifies the authorization scope(s) for the method you are building.
38032 ///
38033 /// See [`Self::add_scope()`] for details.
38034 pub fn add_scopes<I, St>(
38035 mut self,
38036 scopes: I,
38037 ) -> ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C>
38038 where
38039 I: IntoIterator<Item = St>,
38040 St: AsRef<str>,
38041 {
38042 self._scopes
38043 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38044 self
38045 }
38046
38047 /// Removes all scopes, and no default scope will be used either.
38048 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38049 /// for details).
38050 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreGetIamPolicyCall<'a, C> {
38051 self._scopes.clear();
38052 self
38053 }
38054}
38055
38056/// Imports resources to the FHIR store by loading data from the specified sources. This method is optimized to load large quantities of data using import semantics that ignore some FHIR store configuration options and are not suitable for all use cases. It is primarily intended to load data into an empty FHIR store that is not being used by other clients. In cases where this method is not appropriate, consider using ExecuteBundle to load data. Every resource in the input must contain a client-supplied ID. Each resource is stored using the supplied ID regardless of the enable_update_create setting on the FHIR store. It is strongly advised not to include or encode any sensitive data such as patient identifiers in client-specified resource IDs. Those IDs are part of the FHIR resource path recorded in Cloud Audit Logs and Cloud Pub/Sub notifications. Those IDs can also be contained in reference fields within other resources. The import process does not enforce referential integrity, regardless of the disable_referential_integrity setting on the FHIR store. This allows the import of resources with arbitrary interdependencies without considering grouping or ordering, but if the input data contains invalid references or if some resources fail to be imported, the FHIR store might be left in a state that violates referential integrity. The import process does not trigger Pub/Sub notification or BigQuery streaming update, regardless of how those are configured on the FHIR store. If a resource with the specified ID already exists, the most recent version of the resource is overwritten without creating a new historical version, regardless of the disable_resource_versioning setting on the FHIR store. If transient failures occur during the import, it's possible that successfully imported resources will be overwritten more than once. The import operation is idempotent unless the input data contains multiple valid resources with the same ID but different contents. In that case, after the import completes, the store contains exactly one resource with that ID but there is no ordering guarantee on which version of the contents it will have. The operation result counters do not count duplicate IDs as an error and count one success for each resource in the input, which might result in a success count larger than the number of resources in the FHIR store. This often occurs when importing data organized in bundles produced by Patient-everything where each bundle contains its own copy of a resource such as Practitioner that might be referred to by many patients. If some resources fail to import, for example due to parsing errors, successfully imported resources are not rolled back. The location and format of the input data is specified by the parameters in ImportResourcesRequest. Note that if no format is specified, this method assumes the `BUNDLE` format. When using the `BUNDLE` format this method ignores the `Bundle.type` field, except that `history` bundles are rejected, and does not apply any of the bundle processing semantics for batch or transaction bundles. Unlike in ExecuteBundle, transaction bundles are not executed as a single transaction and bundle-internal references are not rewritten. The bundle is treated as a collection of resources to be written as provided in `Bundle.entry.resource`, ignoring `Bundle.entry.request`. As an example, this allows the import of `searchset` bundles produced by a FHIR search or Patient-everything operation. This method returns an Operation that can be used to track the status of the import by calling GetOperation. Immediate fatal errors appear in the error field, errors are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). Otherwise, when the operation finishes, a detailed response of type ImportResourcesResponse is returned in the response field. The metadata field type for this operation is OperationMetadata.
38057///
38058/// A builder for the *locations.datasets.fhirStores.import* method supported by a *project* resource.
38059/// It is not used directly, but through a [`ProjectMethods`] instance.
38060///
38061/// # Example
38062///
38063/// Instantiate a resource method builder
38064///
38065/// ```test_harness,no_run
38066/// # extern crate hyper;
38067/// # extern crate hyper_rustls;
38068/// # extern crate google_healthcare1 as healthcare1;
38069/// use healthcare1::api::ImportResourcesRequest;
38070/// # async fn dox() {
38071/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38072///
38073/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38074/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
38075/// # secret,
38076/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38077/// # ).build().await.unwrap();
38078///
38079/// # let client = hyper_util::client::legacy::Client::builder(
38080/// # hyper_util::rt::TokioExecutor::new()
38081/// # )
38082/// # .build(
38083/// # hyper_rustls::HttpsConnectorBuilder::new()
38084/// # .with_native_roots()
38085/// # .unwrap()
38086/// # .https_or_http()
38087/// # .enable_http1()
38088/// # .build()
38089/// # );
38090/// # let mut hub = CloudHealthcare::new(client, auth);
38091/// // As the method needs a request, you would usually fill it with the desired information
38092/// // into the respective structure. Some of the parts shown here might not be applicable !
38093/// // Values shown here are possibly random and not representative !
38094/// let mut req = ImportResourcesRequest::default();
38095///
38096/// // You can configure optional parameters by calling the respective setters at will, and
38097/// // execute the final call using `doit()`.
38098/// // Values shown here are possibly random and not representative !
38099/// let result = hub.projects().locations_datasets_fhir_stores_import(req, "name")
38100/// .doit().await;
38101/// # }
38102/// ```
38103pub struct ProjectLocationDatasetFhirStoreImportCall<'a, C>
38104where
38105 C: 'a,
38106{
38107 hub: &'a CloudHealthcare<C>,
38108 _request: ImportResourcesRequest,
38109 _name: String,
38110 _delegate: Option<&'a mut dyn common::Delegate>,
38111 _additional_params: HashMap<String, String>,
38112 _scopes: BTreeSet<String>,
38113}
38114
38115impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreImportCall<'a, C> {}
38116
38117impl<'a, C> ProjectLocationDatasetFhirStoreImportCall<'a, C>
38118where
38119 C: common::Connector,
38120{
38121 /// Perform the operation you have build so far.
38122 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
38123 use std::borrow::Cow;
38124 use std::io::{Read, Seek};
38125
38126 use common::{url::Params, ToParts};
38127 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38128
38129 let mut dd = common::DefaultDelegate;
38130 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38131 dlg.begin(common::MethodInfo {
38132 id: "healthcare.projects.locations.datasets.fhirStores.import",
38133 http_method: hyper::Method::POST,
38134 });
38135
38136 for &field in ["alt", "name"].iter() {
38137 if self._additional_params.contains_key(field) {
38138 dlg.finished(false);
38139 return Err(common::Error::FieldClash(field));
38140 }
38141 }
38142
38143 let mut params = Params::with_capacity(4 + self._additional_params.len());
38144 params.push("name", self._name);
38145
38146 params.extend(self._additional_params.iter());
38147
38148 params.push("alt", "json");
38149 let mut url = self.hub._base_url.clone() + "v1/{+name}:import";
38150 if self._scopes.is_empty() {
38151 self._scopes
38152 .insert(Scope::CloudHealthcare.as_ref().to_string());
38153 }
38154
38155 #[allow(clippy::single_element_loop)]
38156 for &(find_this, param_name) in [("{+name}", "name")].iter() {
38157 url = params.uri_replacement(url, param_name, find_this, true);
38158 }
38159 {
38160 let to_remove = ["name"];
38161 params.remove_params(&to_remove);
38162 }
38163
38164 let url = params.parse_with_url(&url);
38165
38166 let mut json_mime_type = mime::APPLICATION_JSON;
38167 let mut request_value_reader = {
38168 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
38169 common::remove_json_null_values(&mut value);
38170 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
38171 serde_json::to_writer(&mut dst, &value).unwrap();
38172 dst
38173 };
38174 let request_size = request_value_reader
38175 .seek(std::io::SeekFrom::End(0))
38176 .unwrap();
38177 request_value_reader
38178 .seek(std::io::SeekFrom::Start(0))
38179 .unwrap();
38180
38181 loop {
38182 let token = match self
38183 .hub
38184 .auth
38185 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38186 .await
38187 {
38188 Ok(token) => token,
38189 Err(e) => match dlg.token(e) {
38190 Ok(token) => token,
38191 Err(e) => {
38192 dlg.finished(false);
38193 return Err(common::Error::MissingToken(e));
38194 }
38195 },
38196 };
38197 request_value_reader
38198 .seek(std::io::SeekFrom::Start(0))
38199 .unwrap();
38200 let mut req_result = {
38201 let client = &self.hub.client;
38202 dlg.pre_request();
38203 let mut req_builder = hyper::Request::builder()
38204 .method(hyper::Method::POST)
38205 .uri(url.as_str())
38206 .header(USER_AGENT, self.hub._user_agent.clone());
38207
38208 if let Some(token) = token.as_ref() {
38209 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38210 }
38211
38212 let request = req_builder
38213 .header(CONTENT_TYPE, json_mime_type.to_string())
38214 .header(CONTENT_LENGTH, request_size as u64)
38215 .body(common::to_body(
38216 request_value_reader.get_ref().clone().into(),
38217 ));
38218
38219 client.request(request.unwrap()).await
38220 };
38221
38222 match req_result {
38223 Err(err) => {
38224 if let common::Retry::After(d) = dlg.http_error(&err) {
38225 sleep(d).await;
38226 continue;
38227 }
38228 dlg.finished(false);
38229 return Err(common::Error::HttpError(err));
38230 }
38231 Ok(res) => {
38232 let (mut parts, body) = res.into_parts();
38233 let mut body = common::Body::new(body);
38234 if !parts.status.is_success() {
38235 let bytes = common::to_bytes(body).await.unwrap_or_default();
38236 let error = serde_json::from_str(&common::to_string(&bytes));
38237 let response = common::to_response(parts, bytes.into());
38238
38239 if let common::Retry::After(d) =
38240 dlg.http_failure(&response, error.as_ref().ok())
38241 {
38242 sleep(d).await;
38243 continue;
38244 }
38245
38246 dlg.finished(false);
38247
38248 return Err(match error {
38249 Ok(value) => common::Error::BadRequest(value),
38250 _ => common::Error::Failure(response),
38251 });
38252 }
38253 let response = {
38254 let bytes = common::to_bytes(body).await.unwrap_or_default();
38255 let encoded = common::to_string(&bytes);
38256 match serde_json::from_str(&encoded) {
38257 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38258 Err(error) => {
38259 dlg.response_json_decode_error(&encoded, &error);
38260 return Err(common::Error::JsonDecodeError(
38261 encoded.to_string(),
38262 error,
38263 ));
38264 }
38265 }
38266 };
38267
38268 dlg.finished(true);
38269 return Ok(response);
38270 }
38271 }
38272 }
38273 }
38274
38275 ///
38276 /// Sets the *request* property to the given value.
38277 ///
38278 /// Even though the property as already been set when instantiating this call,
38279 /// we provide this method for API completeness.
38280 pub fn request(
38281 mut self,
38282 new_value: ImportResourcesRequest,
38283 ) -> ProjectLocationDatasetFhirStoreImportCall<'a, C> {
38284 self._request = new_value;
38285 self
38286 }
38287 /// Required. The name of the FHIR store to import FHIR resources to, in the format of `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
38288 ///
38289 /// Sets the *name* path property to the given value.
38290 ///
38291 /// Even though the property as already been set when instantiating this call,
38292 /// we provide this method for API completeness.
38293 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreImportCall<'a, C> {
38294 self._name = new_value.to_string();
38295 self
38296 }
38297 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38298 /// while executing the actual API request.
38299 ///
38300 /// ````text
38301 /// It should be used to handle progress information, and to implement a certain level of resilience.
38302 /// ````
38303 ///
38304 /// Sets the *delegate* property to the given value.
38305 pub fn delegate(
38306 mut self,
38307 new_value: &'a mut dyn common::Delegate,
38308 ) -> ProjectLocationDatasetFhirStoreImportCall<'a, C> {
38309 self._delegate = Some(new_value);
38310 self
38311 }
38312
38313 /// Set any additional parameter of the query string used in the request.
38314 /// It should be used to set parameters which are not yet available through their own
38315 /// setters.
38316 ///
38317 /// Please note that this method must not be used to set any of the known parameters
38318 /// which have their own setter method. If done anyway, the request will fail.
38319 ///
38320 /// # Additional Parameters
38321 ///
38322 /// * *$.xgafv* (query-string) - V1 error format.
38323 /// * *access_token* (query-string) - OAuth access token.
38324 /// * *alt* (query-string) - Data format for response.
38325 /// * *callback* (query-string) - JSONP
38326 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38327 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
38328 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38329 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38330 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
38331 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38332 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38333 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreImportCall<'a, C>
38334 where
38335 T: AsRef<str>,
38336 {
38337 self._additional_params
38338 .insert(name.as_ref().to_string(), value.as_ref().to_string());
38339 self
38340 }
38341
38342 /// Identifies the authorization scope for the method you are building.
38343 ///
38344 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38345 /// [`Scope::CloudHealthcare`].
38346 ///
38347 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38348 /// tokens for more than one scope.
38349 ///
38350 /// Usually there is more than one suitable scope to authorize an operation, some of which may
38351 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38352 /// sufficient, a read-write scope will do as well.
38353 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetFhirStoreImportCall<'a, C>
38354 where
38355 St: AsRef<str>,
38356 {
38357 self._scopes.insert(String::from(scope.as_ref()));
38358 self
38359 }
38360 /// Identifies the authorization scope(s) for the method you are building.
38361 ///
38362 /// See [`Self::add_scope()`] for details.
38363 pub fn add_scopes<I, St>(
38364 mut self,
38365 scopes: I,
38366 ) -> ProjectLocationDatasetFhirStoreImportCall<'a, C>
38367 where
38368 I: IntoIterator<Item = St>,
38369 St: AsRef<str>,
38370 {
38371 self._scopes
38372 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38373 self
38374 }
38375
38376 /// Removes all scopes, and no default scope will be used either.
38377 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38378 /// for details).
38379 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreImportCall<'a, C> {
38380 self._scopes.clear();
38381 self
38382 }
38383}
38384
38385/// Lists the FHIR stores in the given dataset.
38386///
38387/// A builder for the *locations.datasets.fhirStores.list* method supported by a *project* resource.
38388/// It is not used directly, but through a [`ProjectMethods`] instance.
38389///
38390/// # Example
38391///
38392/// Instantiate a resource method builder
38393///
38394/// ```test_harness,no_run
38395/// # extern crate hyper;
38396/// # extern crate hyper_rustls;
38397/// # extern crate google_healthcare1 as healthcare1;
38398/// # async fn dox() {
38399/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38400///
38401/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38402/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
38403/// # secret,
38404/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38405/// # ).build().await.unwrap();
38406///
38407/// # let client = hyper_util::client::legacy::Client::builder(
38408/// # hyper_util::rt::TokioExecutor::new()
38409/// # )
38410/// # .build(
38411/// # hyper_rustls::HttpsConnectorBuilder::new()
38412/// # .with_native_roots()
38413/// # .unwrap()
38414/// # .https_or_http()
38415/// # .enable_http1()
38416/// # .build()
38417/// # );
38418/// # let mut hub = CloudHealthcare::new(client, auth);
38419/// // You can configure optional parameters by calling the respective setters at will, and
38420/// // execute the final call using `doit()`.
38421/// // Values shown here are possibly random and not representative !
38422/// let result = hub.projects().locations_datasets_fhir_stores_list("parent")
38423/// .page_token("consetetur")
38424/// .page_size(-62)
38425/// .filter("dolor")
38426/// .doit().await;
38427/// # }
38428/// ```
38429pub struct ProjectLocationDatasetFhirStoreListCall<'a, C>
38430where
38431 C: 'a,
38432{
38433 hub: &'a CloudHealthcare<C>,
38434 _parent: String,
38435 _page_token: Option<String>,
38436 _page_size: Option<i32>,
38437 _filter: Option<String>,
38438 _delegate: Option<&'a mut dyn common::Delegate>,
38439 _additional_params: HashMap<String, String>,
38440 _scopes: BTreeSet<String>,
38441}
38442
38443impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreListCall<'a, C> {}
38444
38445impl<'a, C> ProjectLocationDatasetFhirStoreListCall<'a, C>
38446where
38447 C: common::Connector,
38448{
38449 /// Perform the operation you have build so far.
38450 pub async fn doit(mut self) -> common::Result<(common::Response, ListFhirStoresResponse)> {
38451 use std::borrow::Cow;
38452 use std::io::{Read, Seek};
38453
38454 use common::{url::Params, ToParts};
38455 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38456
38457 let mut dd = common::DefaultDelegate;
38458 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38459 dlg.begin(common::MethodInfo {
38460 id: "healthcare.projects.locations.datasets.fhirStores.list",
38461 http_method: hyper::Method::GET,
38462 });
38463
38464 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
38465 if self._additional_params.contains_key(field) {
38466 dlg.finished(false);
38467 return Err(common::Error::FieldClash(field));
38468 }
38469 }
38470
38471 let mut params = Params::with_capacity(6 + self._additional_params.len());
38472 params.push("parent", self._parent);
38473 if let Some(value) = self._page_token.as_ref() {
38474 params.push("pageToken", value);
38475 }
38476 if let Some(value) = self._page_size.as_ref() {
38477 params.push("pageSize", value.to_string());
38478 }
38479 if let Some(value) = self._filter.as_ref() {
38480 params.push("filter", value);
38481 }
38482
38483 params.extend(self._additional_params.iter());
38484
38485 params.push("alt", "json");
38486 let mut url = self.hub._base_url.clone() + "v1/{+parent}/fhirStores";
38487 if self._scopes.is_empty() {
38488 self._scopes
38489 .insert(Scope::CloudHealthcare.as_ref().to_string());
38490 }
38491
38492 #[allow(clippy::single_element_loop)]
38493 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
38494 url = params.uri_replacement(url, param_name, find_this, true);
38495 }
38496 {
38497 let to_remove = ["parent"];
38498 params.remove_params(&to_remove);
38499 }
38500
38501 let url = params.parse_with_url(&url);
38502
38503 loop {
38504 let token = match self
38505 .hub
38506 .auth
38507 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38508 .await
38509 {
38510 Ok(token) => token,
38511 Err(e) => match dlg.token(e) {
38512 Ok(token) => token,
38513 Err(e) => {
38514 dlg.finished(false);
38515 return Err(common::Error::MissingToken(e));
38516 }
38517 },
38518 };
38519 let mut req_result = {
38520 let client = &self.hub.client;
38521 dlg.pre_request();
38522 let mut req_builder = hyper::Request::builder()
38523 .method(hyper::Method::GET)
38524 .uri(url.as_str())
38525 .header(USER_AGENT, self.hub._user_agent.clone());
38526
38527 if let Some(token) = token.as_ref() {
38528 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38529 }
38530
38531 let request = req_builder
38532 .header(CONTENT_LENGTH, 0_u64)
38533 .body(common::to_body::<String>(None));
38534
38535 client.request(request.unwrap()).await
38536 };
38537
38538 match req_result {
38539 Err(err) => {
38540 if let common::Retry::After(d) = dlg.http_error(&err) {
38541 sleep(d).await;
38542 continue;
38543 }
38544 dlg.finished(false);
38545 return Err(common::Error::HttpError(err));
38546 }
38547 Ok(res) => {
38548 let (mut parts, body) = res.into_parts();
38549 let mut body = common::Body::new(body);
38550 if !parts.status.is_success() {
38551 let bytes = common::to_bytes(body).await.unwrap_or_default();
38552 let error = serde_json::from_str(&common::to_string(&bytes));
38553 let response = common::to_response(parts, bytes.into());
38554
38555 if let common::Retry::After(d) =
38556 dlg.http_failure(&response, error.as_ref().ok())
38557 {
38558 sleep(d).await;
38559 continue;
38560 }
38561
38562 dlg.finished(false);
38563
38564 return Err(match error {
38565 Ok(value) => common::Error::BadRequest(value),
38566 _ => common::Error::Failure(response),
38567 });
38568 }
38569 let response = {
38570 let bytes = common::to_bytes(body).await.unwrap_or_default();
38571 let encoded = common::to_string(&bytes);
38572 match serde_json::from_str(&encoded) {
38573 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38574 Err(error) => {
38575 dlg.response_json_decode_error(&encoded, &error);
38576 return Err(common::Error::JsonDecodeError(
38577 encoded.to_string(),
38578 error,
38579 ));
38580 }
38581 }
38582 };
38583
38584 dlg.finished(true);
38585 return Ok(response);
38586 }
38587 }
38588 }
38589 }
38590
38591 /// Required. Name of the dataset.
38592 ///
38593 /// Sets the *parent* path property to the given value.
38594 ///
38595 /// Even though the property as already been set when instantiating this call,
38596 /// we provide this method for API completeness.
38597 pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreListCall<'a, C> {
38598 self._parent = new_value.to_string();
38599 self
38600 }
38601 /// The next_page_token value returned from the previous List request, if any.
38602 ///
38603 /// Sets the *page token* query property to the given value.
38604 pub fn page_token(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreListCall<'a, C> {
38605 self._page_token = Some(new_value.to_string());
38606 self
38607 }
38608 /// Limit on the number of FHIR stores to return in a single response. If not specified, 100 is used. May not be larger than 1000.
38609 ///
38610 /// Sets the *page size* query property to the given value.
38611 pub fn page_size(mut self, new_value: i32) -> ProjectLocationDatasetFhirStoreListCall<'a, C> {
38612 self._page_size = Some(new_value);
38613 self
38614 }
38615 /// Restricts stores returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. Only filtering on labels is supported, for example `labels.key=value`.
38616 ///
38617 /// Sets the *filter* query property to the given value.
38618 pub fn filter(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreListCall<'a, C> {
38619 self._filter = Some(new_value.to_string());
38620 self
38621 }
38622 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38623 /// while executing the actual API request.
38624 ///
38625 /// ````text
38626 /// It should be used to handle progress information, and to implement a certain level of resilience.
38627 /// ````
38628 ///
38629 /// Sets the *delegate* property to the given value.
38630 pub fn delegate(
38631 mut self,
38632 new_value: &'a mut dyn common::Delegate,
38633 ) -> ProjectLocationDatasetFhirStoreListCall<'a, C> {
38634 self._delegate = Some(new_value);
38635 self
38636 }
38637
38638 /// Set any additional parameter of the query string used in the request.
38639 /// It should be used to set parameters which are not yet available through their own
38640 /// setters.
38641 ///
38642 /// Please note that this method must not be used to set any of the known parameters
38643 /// which have their own setter method. If done anyway, the request will fail.
38644 ///
38645 /// # Additional Parameters
38646 ///
38647 /// * *$.xgafv* (query-string) - V1 error format.
38648 /// * *access_token* (query-string) - OAuth access token.
38649 /// * *alt* (query-string) - Data format for response.
38650 /// * *callback* (query-string) - JSONP
38651 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38652 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
38653 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38654 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38655 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
38656 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38657 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38658 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStoreListCall<'a, C>
38659 where
38660 T: AsRef<str>,
38661 {
38662 self._additional_params
38663 .insert(name.as_ref().to_string(), value.as_ref().to_string());
38664 self
38665 }
38666
38667 /// Identifies the authorization scope for the method you are building.
38668 ///
38669 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
38670 /// [`Scope::CloudHealthcare`].
38671 ///
38672 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
38673 /// tokens for more than one scope.
38674 ///
38675 /// Usually there is more than one suitable scope to authorize an operation, some of which may
38676 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
38677 /// sufficient, a read-write scope will do as well.
38678 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetFhirStoreListCall<'a, C>
38679 where
38680 St: AsRef<str>,
38681 {
38682 self._scopes.insert(String::from(scope.as_ref()));
38683 self
38684 }
38685 /// Identifies the authorization scope(s) for the method you are building.
38686 ///
38687 /// See [`Self::add_scope()`] for details.
38688 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetFhirStoreListCall<'a, C>
38689 where
38690 I: IntoIterator<Item = St>,
38691 St: AsRef<str>,
38692 {
38693 self._scopes
38694 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
38695 self
38696 }
38697
38698 /// Removes all scopes, and no default scope will be used either.
38699 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
38700 /// for details).
38701 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreListCall<'a, C> {
38702 self._scopes.clear();
38703 self
38704 }
38705}
38706
38707/// Updates the configuration of the specified FHIR store.
38708///
38709/// A builder for the *locations.datasets.fhirStores.patch* method supported by a *project* resource.
38710/// It is not used directly, but through a [`ProjectMethods`] instance.
38711///
38712/// # Example
38713///
38714/// Instantiate a resource method builder
38715///
38716/// ```test_harness,no_run
38717/// # extern crate hyper;
38718/// # extern crate hyper_rustls;
38719/// # extern crate google_healthcare1 as healthcare1;
38720/// use healthcare1::api::FhirStore;
38721/// # async fn dox() {
38722/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
38723///
38724/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
38725/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
38726/// # secret,
38727/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
38728/// # ).build().await.unwrap();
38729///
38730/// # let client = hyper_util::client::legacy::Client::builder(
38731/// # hyper_util::rt::TokioExecutor::new()
38732/// # )
38733/// # .build(
38734/// # hyper_rustls::HttpsConnectorBuilder::new()
38735/// # .with_native_roots()
38736/// # .unwrap()
38737/// # .https_or_http()
38738/// # .enable_http1()
38739/// # .build()
38740/// # );
38741/// # let mut hub = CloudHealthcare::new(client, auth);
38742/// // As the method needs a request, you would usually fill it with the desired information
38743/// // into the respective structure. Some of the parts shown here might not be applicable !
38744/// // Values shown here are possibly random and not representative !
38745/// let mut req = FhirStore::default();
38746///
38747/// // You can configure optional parameters by calling the respective setters at will, and
38748/// // execute the final call using `doit()`.
38749/// // Values shown here are possibly random and not representative !
38750/// let result = hub.projects().locations_datasets_fhir_stores_patch(req, "name")
38751/// .update_mask(FieldMask::new::<&str>(&[]))
38752/// .doit().await;
38753/// # }
38754/// ```
38755pub struct ProjectLocationDatasetFhirStorePatchCall<'a, C>
38756where
38757 C: 'a,
38758{
38759 hub: &'a CloudHealthcare<C>,
38760 _request: FhirStore,
38761 _name: String,
38762 _update_mask: Option<common::FieldMask>,
38763 _delegate: Option<&'a mut dyn common::Delegate>,
38764 _additional_params: HashMap<String, String>,
38765 _scopes: BTreeSet<String>,
38766}
38767
38768impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStorePatchCall<'a, C> {}
38769
38770impl<'a, C> ProjectLocationDatasetFhirStorePatchCall<'a, C>
38771where
38772 C: common::Connector,
38773{
38774 /// Perform the operation you have build so far.
38775 pub async fn doit(mut self) -> common::Result<(common::Response, FhirStore)> {
38776 use std::borrow::Cow;
38777 use std::io::{Read, Seek};
38778
38779 use common::{url::Params, ToParts};
38780 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
38781
38782 let mut dd = common::DefaultDelegate;
38783 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
38784 dlg.begin(common::MethodInfo {
38785 id: "healthcare.projects.locations.datasets.fhirStores.patch",
38786 http_method: hyper::Method::PATCH,
38787 });
38788
38789 for &field in ["alt", "name", "updateMask"].iter() {
38790 if self._additional_params.contains_key(field) {
38791 dlg.finished(false);
38792 return Err(common::Error::FieldClash(field));
38793 }
38794 }
38795
38796 let mut params = Params::with_capacity(5 + self._additional_params.len());
38797 params.push("name", self._name);
38798 if let Some(value) = self._update_mask.as_ref() {
38799 params.push("updateMask", value.to_string());
38800 }
38801
38802 params.extend(self._additional_params.iter());
38803
38804 params.push("alt", "json");
38805 let mut url = self.hub._base_url.clone() + "v1/{+name}";
38806 if self._scopes.is_empty() {
38807 self._scopes
38808 .insert(Scope::CloudHealthcare.as_ref().to_string());
38809 }
38810
38811 #[allow(clippy::single_element_loop)]
38812 for &(find_this, param_name) in [("{+name}", "name")].iter() {
38813 url = params.uri_replacement(url, param_name, find_this, true);
38814 }
38815 {
38816 let to_remove = ["name"];
38817 params.remove_params(&to_remove);
38818 }
38819
38820 let url = params.parse_with_url(&url);
38821
38822 let mut json_mime_type = mime::APPLICATION_JSON;
38823 let mut request_value_reader = {
38824 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
38825 common::remove_json_null_values(&mut value);
38826 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
38827 serde_json::to_writer(&mut dst, &value).unwrap();
38828 dst
38829 };
38830 let request_size = request_value_reader
38831 .seek(std::io::SeekFrom::End(0))
38832 .unwrap();
38833 request_value_reader
38834 .seek(std::io::SeekFrom::Start(0))
38835 .unwrap();
38836
38837 loop {
38838 let token = match self
38839 .hub
38840 .auth
38841 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
38842 .await
38843 {
38844 Ok(token) => token,
38845 Err(e) => match dlg.token(e) {
38846 Ok(token) => token,
38847 Err(e) => {
38848 dlg.finished(false);
38849 return Err(common::Error::MissingToken(e));
38850 }
38851 },
38852 };
38853 request_value_reader
38854 .seek(std::io::SeekFrom::Start(0))
38855 .unwrap();
38856 let mut req_result = {
38857 let client = &self.hub.client;
38858 dlg.pre_request();
38859 let mut req_builder = hyper::Request::builder()
38860 .method(hyper::Method::PATCH)
38861 .uri(url.as_str())
38862 .header(USER_AGENT, self.hub._user_agent.clone());
38863
38864 if let Some(token) = token.as_ref() {
38865 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
38866 }
38867
38868 let request = req_builder
38869 .header(CONTENT_TYPE, json_mime_type.to_string())
38870 .header(CONTENT_LENGTH, request_size as u64)
38871 .body(common::to_body(
38872 request_value_reader.get_ref().clone().into(),
38873 ));
38874
38875 client.request(request.unwrap()).await
38876 };
38877
38878 match req_result {
38879 Err(err) => {
38880 if let common::Retry::After(d) = dlg.http_error(&err) {
38881 sleep(d).await;
38882 continue;
38883 }
38884 dlg.finished(false);
38885 return Err(common::Error::HttpError(err));
38886 }
38887 Ok(res) => {
38888 let (mut parts, body) = res.into_parts();
38889 let mut body = common::Body::new(body);
38890 if !parts.status.is_success() {
38891 let bytes = common::to_bytes(body).await.unwrap_or_default();
38892 let error = serde_json::from_str(&common::to_string(&bytes));
38893 let response = common::to_response(parts, bytes.into());
38894
38895 if let common::Retry::After(d) =
38896 dlg.http_failure(&response, error.as_ref().ok())
38897 {
38898 sleep(d).await;
38899 continue;
38900 }
38901
38902 dlg.finished(false);
38903
38904 return Err(match error {
38905 Ok(value) => common::Error::BadRequest(value),
38906 _ => common::Error::Failure(response),
38907 });
38908 }
38909 let response = {
38910 let bytes = common::to_bytes(body).await.unwrap_or_default();
38911 let encoded = common::to_string(&bytes);
38912 match serde_json::from_str(&encoded) {
38913 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
38914 Err(error) => {
38915 dlg.response_json_decode_error(&encoded, &error);
38916 return Err(common::Error::JsonDecodeError(
38917 encoded.to_string(),
38918 error,
38919 ));
38920 }
38921 }
38922 };
38923
38924 dlg.finished(true);
38925 return Ok(response);
38926 }
38927 }
38928 }
38929 }
38930
38931 ///
38932 /// Sets the *request* property to the given value.
38933 ///
38934 /// Even though the property as already been set when instantiating this call,
38935 /// we provide this method for API completeness.
38936 pub fn request(
38937 mut self,
38938 new_value: FhirStore,
38939 ) -> ProjectLocationDatasetFhirStorePatchCall<'a, C> {
38940 self._request = new_value;
38941 self
38942 }
38943 /// Output only. Identifier. Resource name of the FHIR store, of the form `projects/{project_id}/locations/{location}/datasets/{dataset_id}/fhirStores/{fhir_store_id}`.
38944 ///
38945 /// Sets the *name* path property to the given value.
38946 ///
38947 /// Even though the property as already been set when instantiating this call,
38948 /// we provide this method for API completeness.
38949 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStorePatchCall<'a, C> {
38950 self._name = new_value.to_string();
38951 self
38952 }
38953 /// Required. The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
38954 ///
38955 /// Sets the *update mask* query property to the given value.
38956 pub fn update_mask(
38957 mut self,
38958 new_value: common::FieldMask,
38959 ) -> ProjectLocationDatasetFhirStorePatchCall<'a, C> {
38960 self._update_mask = Some(new_value);
38961 self
38962 }
38963 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
38964 /// while executing the actual API request.
38965 ///
38966 /// ````text
38967 /// It should be used to handle progress information, and to implement a certain level of resilience.
38968 /// ````
38969 ///
38970 /// Sets the *delegate* property to the given value.
38971 pub fn delegate(
38972 mut self,
38973 new_value: &'a mut dyn common::Delegate,
38974 ) -> ProjectLocationDatasetFhirStorePatchCall<'a, C> {
38975 self._delegate = Some(new_value);
38976 self
38977 }
38978
38979 /// Set any additional parameter of the query string used in the request.
38980 /// It should be used to set parameters which are not yet available through their own
38981 /// setters.
38982 ///
38983 /// Please note that this method must not be used to set any of the known parameters
38984 /// which have their own setter method. If done anyway, the request will fail.
38985 ///
38986 /// # Additional Parameters
38987 ///
38988 /// * *$.xgafv* (query-string) - V1 error format.
38989 /// * *access_token* (query-string) - OAuth access token.
38990 /// * *alt* (query-string) - Data format for response.
38991 /// * *callback* (query-string) - JSONP
38992 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
38993 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
38994 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
38995 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
38996 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
38997 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
38998 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
38999 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetFhirStorePatchCall<'a, C>
39000 where
39001 T: AsRef<str>,
39002 {
39003 self._additional_params
39004 .insert(name.as_ref().to_string(), value.as_ref().to_string());
39005 self
39006 }
39007
39008 /// Identifies the authorization scope for the method you are building.
39009 ///
39010 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
39011 /// [`Scope::CloudHealthcare`].
39012 ///
39013 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
39014 /// tokens for more than one scope.
39015 ///
39016 /// Usually there is more than one suitable scope to authorize an operation, some of which may
39017 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
39018 /// sufficient, a read-write scope will do as well.
39019 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetFhirStorePatchCall<'a, C>
39020 where
39021 St: AsRef<str>,
39022 {
39023 self._scopes.insert(String::from(scope.as_ref()));
39024 self
39025 }
39026 /// Identifies the authorization scope(s) for the method you are building.
39027 ///
39028 /// See [`Self::add_scope()`] for details.
39029 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetFhirStorePatchCall<'a, C>
39030 where
39031 I: IntoIterator<Item = St>,
39032 St: AsRef<str>,
39033 {
39034 self._scopes
39035 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
39036 self
39037 }
39038
39039 /// Removes all scopes, and no default scope will be used either.
39040 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
39041 /// for details).
39042 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStorePatchCall<'a, C> {
39043 self._scopes.clear();
39044 self
39045 }
39046}
39047
39048/// Rolls back resources from the FHIR store to the specified time. This method returns an Operation that can be used to track the status of the rollback by calling GetOperation. Immediate fatal errors appear in the error field, errors are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). Otherwise, when the operation finishes, a detailed response of type RollbackFhirResourcesResponse is returned in the response field. The metadata field type for this operation is OperationMetadata.
39049///
39050/// A builder for the *locations.datasets.fhirStores.rollback* method supported by a *project* resource.
39051/// It is not used directly, but through a [`ProjectMethods`] instance.
39052///
39053/// # Example
39054///
39055/// Instantiate a resource method builder
39056///
39057/// ```test_harness,no_run
39058/// # extern crate hyper;
39059/// # extern crate hyper_rustls;
39060/// # extern crate google_healthcare1 as healthcare1;
39061/// use healthcare1::api::RollbackFhirResourcesRequest;
39062/// # async fn dox() {
39063/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
39064///
39065/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
39066/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
39067/// # secret,
39068/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
39069/// # ).build().await.unwrap();
39070///
39071/// # let client = hyper_util::client::legacy::Client::builder(
39072/// # hyper_util::rt::TokioExecutor::new()
39073/// # )
39074/// # .build(
39075/// # hyper_rustls::HttpsConnectorBuilder::new()
39076/// # .with_native_roots()
39077/// # .unwrap()
39078/// # .https_or_http()
39079/// # .enable_http1()
39080/// # .build()
39081/// # );
39082/// # let mut hub = CloudHealthcare::new(client, auth);
39083/// // As the method needs a request, you would usually fill it with the desired information
39084/// // into the respective structure. Some of the parts shown here might not be applicable !
39085/// // Values shown here are possibly random and not representative !
39086/// let mut req = RollbackFhirResourcesRequest::default();
39087///
39088/// // You can configure optional parameters by calling the respective setters at will, and
39089/// // execute the final call using `doit()`.
39090/// // Values shown here are possibly random and not representative !
39091/// let result = hub.projects().locations_datasets_fhir_stores_rollback(req, "name")
39092/// .doit().await;
39093/// # }
39094/// ```
39095pub struct ProjectLocationDatasetFhirStoreRollbackCall<'a, C>
39096where
39097 C: 'a,
39098{
39099 hub: &'a CloudHealthcare<C>,
39100 _request: RollbackFhirResourcesRequest,
39101 _name: String,
39102 _delegate: Option<&'a mut dyn common::Delegate>,
39103 _additional_params: HashMap<String, String>,
39104 _scopes: BTreeSet<String>,
39105}
39106
39107impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreRollbackCall<'a, C> {}
39108
39109impl<'a, C> ProjectLocationDatasetFhirStoreRollbackCall<'a, C>
39110where
39111 C: common::Connector,
39112{
39113 /// Perform the operation you have build so far.
39114 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
39115 use std::borrow::Cow;
39116 use std::io::{Read, Seek};
39117
39118 use common::{url::Params, ToParts};
39119 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
39120
39121 let mut dd = common::DefaultDelegate;
39122 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
39123 dlg.begin(common::MethodInfo {
39124 id: "healthcare.projects.locations.datasets.fhirStores.rollback",
39125 http_method: hyper::Method::POST,
39126 });
39127
39128 for &field in ["alt", "name"].iter() {
39129 if self._additional_params.contains_key(field) {
39130 dlg.finished(false);
39131 return Err(common::Error::FieldClash(field));
39132 }
39133 }
39134
39135 let mut params = Params::with_capacity(4 + self._additional_params.len());
39136 params.push("name", self._name);
39137
39138 params.extend(self._additional_params.iter());
39139
39140 params.push("alt", "json");
39141 let mut url = self.hub._base_url.clone() + "v1/{+name}:rollback";
39142 if self._scopes.is_empty() {
39143 self._scopes
39144 .insert(Scope::CloudHealthcare.as_ref().to_string());
39145 }
39146
39147 #[allow(clippy::single_element_loop)]
39148 for &(find_this, param_name) in [("{+name}", "name")].iter() {
39149 url = params.uri_replacement(url, param_name, find_this, true);
39150 }
39151 {
39152 let to_remove = ["name"];
39153 params.remove_params(&to_remove);
39154 }
39155
39156 let url = params.parse_with_url(&url);
39157
39158 let mut json_mime_type = mime::APPLICATION_JSON;
39159 let mut request_value_reader = {
39160 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
39161 common::remove_json_null_values(&mut value);
39162 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
39163 serde_json::to_writer(&mut dst, &value).unwrap();
39164 dst
39165 };
39166 let request_size = request_value_reader
39167 .seek(std::io::SeekFrom::End(0))
39168 .unwrap();
39169 request_value_reader
39170 .seek(std::io::SeekFrom::Start(0))
39171 .unwrap();
39172
39173 loop {
39174 let token = match self
39175 .hub
39176 .auth
39177 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
39178 .await
39179 {
39180 Ok(token) => token,
39181 Err(e) => match dlg.token(e) {
39182 Ok(token) => token,
39183 Err(e) => {
39184 dlg.finished(false);
39185 return Err(common::Error::MissingToken(e));
39186 }
39187 },
39188 };
39189 request_value_reader
39190 .seek(std::io::SeekFrom::Start(0))
39191 .unwrap();
39192 let mut req_result = {
39193 let client = &self.hub.client;
39194 dlg.pre_request();
39195 let mut req_builder = hyper::Request::builder()
39196 .method(hyper::Method::POST)
39197 .uri(url.as_str())
39198 .header(USER_AGENT, self.hub._user_agent.clone());
39199
39200 if let Some(token) = token.as_ref() {
39201 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
39202 }
39203
39204 let request = req_builder
39205 .header(CONTENT_TYPE, json_mime_type.to_string())
39206 .header(CONTENT_LENGTH, request_size as u64)
39207 .body(common::to_body(
39208 request_value_reader.get_ref().clone().into(),
39209 ));
39210
39211 client.request(request.unwrap()).await
39212 };
39213
39214 match req_result {
39215 Err(err) => {
39216 if let common::Retry::After(d) = dlg.http_error(&err) {
39217 sleep(d).await;
39218 continue;
39219 }
39220 dlg.finished(false);
39221 return Err(common::Error::HttpError(err));
39222 }
39223 Ok(res) => {
39224 let (mut parts, body) = res.into_parts();
39225 let mut body = common::Body::new(body);
39226 if !parts.status.is_success() {
39227 let bytes = common::to_bytes(body).await.unwrap_or_default();
39228 let error = serde_json::from_str(&common::to_string(&bytes));
39229 let response = common::to_response(parts, bytes.into());
39230
39231 if let common::Retry::After(d) =
39232 dlg.http_failure(&response, error.as_ref().ok())
39233 {
39234 sleep(d).await;
39235 continue;
39236 }
39237
39238 dlg.finished(false);
39239
39240 return Err(match error {
39241 Ok(value) => common::Error::BadRequest(value),
39242 _ => common::Error::Failure(response),
39243 });
39244 }
39245 let response = {
39246 let bytes = common::to_bytes(body).await.unwrap_or_default();
39247 let encoded = common::to_string(&bytes);
39248 match serde_json::from_str(&encoded) {
39249 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
39250 Err(error) => {
39251 dlg.response_json_decode_error(&encoded, &error);
39252 return Err(common::Error::JsonDecodeError(
39253 encoded.to_string(),
39254 error,
39255 ));
39256 }
39257 }
39258 };
39259
39260 dlg.finished(true);
39261 return Ok(response);
39262 }
39263 }
39264 }
39265 }
39266
39267 ///
39268 /// Sets the *request* property to the given value.
39269 ///
39270 /// Even though the property as already been set when instantiating this call,
39271 /// we provide this method for API completeness.
39272 pub fn request(
39273 mut self,
39274 new_value: RollbackFhirResourcesRequest,
39275 ) -> ProjectLocationDatasetFhirStoreRollbackCall<'a, C> {
39276 self._request = new_value;
39277 self
39278 }
39279 /// Required. The name of the FHIR store to rollback, in the format of "projects/{project_id}/locations/{location_id}/datasets/{dataset_id} /fhirStores/{fhir_store_id}".
39280 ///
39281 /// Sets the *name* path property to the given value.
39282 ///
39283 /// Even though the property as already been set when instantiating this call,
39284 /// we provide this method for API completeness.
39285 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetFhirStoreRollbackCall<'a, C> {
39286 self._name = new_value.to_string();
39287 self
39288 }
39289 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
39290 /// while executing the actual API request.
39291 ///
39292 /// ````text
39293 /// It should be used to handle progress information, and to implement a certain level of resilience.
39294 /// ````
39295 ///
39296 /// Sets the *delegate* property to the given value.
39297 pub fn delegate(
39298 mut self,
39299 new_value: &'a mut dyn common::Delegate,
39300 ) -> ProjectLocationDatasetFhirStoreRollbackCall<'a, C> {
39301 self._delegate = Some(new_value);
39302 self
39303 }
39304
39305 /// Set any additional parameter of the query string used in the request.
39306 /// It should be used to set parameters which are not yet available through their own
39307 /// setters.
39308 ///
39309 /// Please note that this method must not be used to set any of the known parameters
39310 /// which have their own setter method. If done anyway, the request will fail.
39311 ///
39312 /// # Additional Parameters
39313 ///
39314 /// * *$.xgafv* (query-string) - V1 error format.
39315 /// * *access_token* (query-string) - OAuth access token.
39316 /// * *alt* (query-string) - Data format for response.
39317 /// * *callback* (query-string) - JSONP
39318 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
39319 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
39320 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
39321 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
39322 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
39323 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
39324 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
39325 pub fn param<T>(
39326 mut self,
39327 name: T,
39328 value: T,
39329 ) -> ProjectLocationDatasetFhirStoreRollbackCall<'a, C>
39330 where
39331 T: AsRef<str>,
39332 {
39333 self._additional_params
39334 .insert(name.as_ref().to_string(), value.as_ref().to_string());
39335 self
39336 }
39337
39338 /// Identifies the authorization scope for the method you are building.
39339 ///
39340 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
39341 /// [`Scope::CloudHealthcare`].
39342 ///
39343 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
39344 /// tokens for more than one scope.
39345 ///
39346 /// Usually there is more than one suitable scope to authorize an operation, some of which may
39347 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
39348 /// sufficient, a read-write scope will do as well.
39349 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetFhirStoreRollbackCall<'a, C>
39350 where
39351 St: AsRef<str>,
39352 {
39353 self._scopes.insert(String::from(scope.as_ref()));
39354 self
39355 }
39356 /// Identifies the authorization scope(s) for the method you are building.
39357 ///
39358 /// See [`Self::add_scope()`] for details.
39359 pub fn add_scopes<I, St>(
39360 mut self,
39361 scopes: I,
39362 ) -> ProjectLocationDatasetFhirStoreRollbackCall<'a, C>
39363 where
39364 I: IntoIterator<Item = St>,
39365 St: AsRef<str>,
39366 {
39367 self._scopes
39368 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
39369 self
39370 }
39371
39372 /// Removes all scopes, and no default scope will be used either.
39373 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
39374 /// for details).
39375 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreRollbackCall<'a, C> {
39376 self._scopes.clear();
39377 self
39378 }
39379}
39380
39381/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
39382///
39383/// A builder for the *locations.datasets.fhirStores.setIamPolicy* method supported by a *project* resource.
39384/// It is not used directly, but through a [`ProjectMethods`] instance.
39385///
39386/// # Example
39387///
39388/// Instantiate a resource method builder
39389///
39390/// ```test_harness,no_run
39391/// # extern crate hyper;
39392/// # extern crate hyper_rustls;
39393/// # extern crate google_healthcare1 as healthcare1;
39394/// use healthcare1::api::SetIamPolicyRequest;
39395/// # async fn dox() {
39396/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
39397///
39398/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
39399/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
39400/// # secret,
39401/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
39402/// # ).build().await.unwrap();
39403///
39404/// # let client = hyper_util::client::legacy::Client::builder(
39405/// # hyper_util::rt::TokioExecutor::new()
39406/// # )
39407/// # .build(
39408/// # hyper_rustls::HttpsConnectorBuilder::new()
39409/// # .with_native_roots()
39410/// # .unwrap()
39411/// # .https_or_http()
39412/// # .enable_http1()
39413/// # .build()
39414/// # );
39415/// # let mut hub = CloudHealthcare::new(client, auth);
39416/// // As the method needs a request, you would usually fill it with the desired information
39417/// // into the respective structure. Some of the parts shown here might not be applicable !
39418/// // Values shown here are possibly random and not representative !
39419/// let mut req = SetIamPolicyRequest::default();
39420///
39421/// // You can configure optional parameters by calling the respective setters at will, and
39422/// // execute the final call using `doit()`.
39423/// // Values shown here are possibly random and not representative !
39424/// let result = hub.projects().locations_datasets_fhir_stores_set_iam_policy(req, "resource")
39425/// .doit().await;
39426/// # }
39427/// ```
39428pub struct ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C>
39429where
39430 C: 'a,
39431{
39432 hub: &'a CloudHealthcare<C>,
39433 _request: SetIamPolicyRequest,
39434 _resource: String,
39435 _delegate: Option<&'a mut dyn common::Delegate>,
39436 _additional_params: HashMap<String, String>,
39437 _scopes: BTreeSet<String>,
39438}
39439
39440impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C> {}
39441
39442impl<'a, C> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C>
39443where
39444 C: common::Connector,
39445{
39446 /// Perform the operation you have build so far.
39447 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
39448 use std::borrow::Cow;
39449 use std::io::{Read, Seek};
39450
39451 use common::{url::Params, ToParts};
39452 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
39453
39454 let mut dd = common::DefaultDelegate;
39455 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
39456 dlg.begin(common::MethodInfo {
39457 id: "healthcare.projects.locations.datasets.fhirStores.setIamPolicy",
39458 http_method: hyper::Method::POST,
39459 });
39460
39461 for &field in ["alt", "resource"].iter() {
39462 if self._additional_params.contains_key(field) {
39463 dlg.finished(false);
39464 return Err(common::Error::FieldClash(field));
39465 }
39466 }
39467
39468 let mut params = Params::with_capacity(4 + self._additional_params.len());
39469 params.push("resource", self._resource);
39470
39471 params.extend(self._additional_params.iter());
39472
39473 params.push("alt", "json");
39474 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
39475 if self._scopes.is_empty() {
39476 self._scopes
39477 .insert(Scope::CloudHealthcare.as_ref().to_string());
39478 }
39479
39480 #[allow(clippy::single_element_loop)]
39481 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
39482 url = params.uri_replacement(url, param_name, find_this, true);
39483 }
39484 {
39485 let to_remove = ["resource"];
39486 params.remove_params(&to_remove);
39487 }
39488
39489 let url = params.parse_with_url(&url);
39490
39491 let mut json_mime_type = mime::APPLICATION_JSON;
39492 let mut request_value_reader = {
39493 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
39494 common::remove_json_null_values(&mut value);
39495 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
39496 serde_json::to_writer(&mut dst, &value).unwrap();
39497 dst
39498 };
39499 let request_size = request_value_reader
39500 .seek(std::io::SeekFrom::End(0))
39501 .unwrap();
39502 request_value_reader
39503 .seek(std::io::SeekFrom::Start(0))
39504 .unwrap();
39505
39506 loop {
39507 let token = match self
39508 .hub
39509 .auth
39510 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
39511 .await
39512 {
39513 Ok(token) => token,
39514 Err(e) => match dlg.token(e) {
39515 Ok(token) => token,
39516 Err(e) => {
39517 dlg.finished(false);
39518 return Err(common::Error::MissingToken(e));
39519 }
39520 },
39521 };
39522 request_value_reader
39523 .seek(std::io::SeekFrom::Start(0))
39524 .unwrap();
39525 let mut req_result = {
39526 let client = &self.hub.client;
39527 dlg.pre_request();
39528 let mut req_builder = hyper::Request::builder()
39529 .method(hyper::Method::POST)
39530 .uri(url.as_str())
39531 .header(USER_AGENT, self.hub._user_agent.clone());
39532
39533 if let Some(token) = token.as_ref() {
39534 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
39535 }
39536
39537 let request = req_builder
39538 .header(CONTENT_TYPE, json_mime_type.to_string())
39539 .header(CONTENT_LENGTH, request_size as u64)
39540 .body(common::to_body(
39541 request_value_reader.get_ref().clone().into(),
39542 ));
39543
39544 client.request(request.unwrap()).await
39545 };
39546
39547 match req_result {
39548 Err(err) => {
39549 if let common::Retry::After(d) = dlg.http_error(&err) {
39550 sleep(d).await;
39551 continue;
39552 }
39553 dlg.finished(false);
39554 return Err(common::Error::HttpError(err));
39555 }
39556 Ok(res) => {
39557 let (mut parts, body) = res.into_parts();
39558 let mut body = common::Body::new(body);
39559 if !parts.status.is_success() {
39560 let bytes = common::to_bytes(body).await.unwrap_or_default();
39561 let error = serde_json::from_str(&common::to_string(&bytes));
39562 let response = common::to_response(parts, bytes.into());
39563
39564 if let common::Retry::After(d) =
39565 dlg.http_failure(&response, error.as_ref().ok())
39566 {
39567 sleep(d).await;
39568 continue;
39569 }
39570
39571 dlg.finished(false);
39572
39573 return Err(match error {
39574 Ok(value) => common::Error::BadRequest(value),
39575 _ => common::Error::Failure(response),
39576 });
39577 }
39578 let response = {
39579 let bytes = common::to_bytes(body).await.unwrap_or_default();
39580 let encoded = common::to_string(&bytes);
39581 match serde_json::from_str(&encoded) {
39582 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
39583 Err(error) => {
39584 dlg.response_json_decode_error(&encoded, &error);
39585 return Err(common::Error::JsonDecodeError(
39586 encoded.to_string(),
39587 error,
39588 ));
39589 }
39590 }
39591 };
39592
39593 dlg.finished(true);
39594 return Ok(response);
39595 }
39596 }
39597 }
39598 }
39599
39600 ///
39601 /// Sets the *request* property to the given value.
39602 ///
39603 /// Even though the property as already been set when instantiating this call,
39604 /// we provide this method for API completeness.
39605 pub fn request(
39606 mut self,
39607 new_value: SetIamPolicyRequest,
39608 ) -> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C> {
39609 self._request = new_value;
39610 self
39611 }
39612 /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
39613 ///
39614 /// Sets the *resource* path property to the given value.
39615 ///
39616 /// Even though the property as already been set when instantiating this call,
39617 /// we provide this method for API completeness.
39618 pub fn resource(
39619 mut self,
39620 new_value: &str,
39621 ) -> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C> {
39622 self._resource = new_value.to_string();
39623 self
39624 }
39625 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
39626 /// while executing the actual API request.
39627 ///
39628 /// ````text
39629 /// It should be used to handle progress information, and to implement a certain level of resilience.
39630 /// ````
39631 ///
39632 /// Sets the *delegate* property to the given value.
39633 pub fn delegate(
39634 mut self,
39635 new_value: &'a mut dyn common::Delegate,
39636 ) -> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C> {
39637 self._delegate = Some(new_value);
39638 self
39639 }
39640
39641 /// Set any additional parameter of the query string used in the request.
39642 /// It should be used to set parameters which are not yet available through their own
39643 /// setters.
39644 ///
39645 /// Please note that this method must not be used to set any of the known parameters
39646 /// which have their own setter method. If done anyway, the request will fail.
39647 ///
39648 /// # Additional Parameters
39649 ///
39650 /// * *$.xgafv* (query-string) - V1 error format.
39651 /// * *access_token* (query-string) - OAuth access token.
39652 /// * *alt* (query-string) - Data format for response.
39653 /// * *callback* (query-string) - JSONP
39654 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
39655 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
39656 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
39657 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
39658 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
39659 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
39660 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
39661 pub fn param<T>(
39662 mut self,
39663 name: T,
39664 value: T,
39665 ) -> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C>
39666 where
39667 T: AsRef<str>,
39668 {
39669 self._additional_params
39670 .insert(name.as_ref().to_string(), value.as_ref().to_string());
39671 self
39672 }
39673
39674 /// Identifies the authorization scope for the method you are building.
39675 ///
39676 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
39677 /// [`Scope::CloudHealthcare`].
39678 ///
39679 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
39680 /// tokens for more than one scope.
39681 ///
39682 /// Usually there is more than one suitable scope to authorize an operation, some of which may
39683 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
39684 /// sufficient, a read-write scope will do as well.
39685 pub fn add_scope<St>(
39686 mut self,
39687 scope: St,
39688 ) -> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C>
39689 where
39690 St: AsRef<str>,
39691 {
39692 self._scopes.insert(String::from(scope.as_ref()));
39693 self
39694 }
39695 /// Identifies the authorization scope(s) for the method you are building.
39696 ///
39697 /// See [`Self::add_scope()`] for details.
39698 pub fn add_scopes<I, St>(
39699 mut self,
39700 scopes: I,
39701 ) -> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C>
39702 where
39703 I: IntoIterator<Item = St>,
39704 St: AsRef<str>,
39705 {
39706 self._scopes
39707 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
39708 self
39709 }
39710
39711 /// Removes all scopes, and no default scope will be used either.
39712 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
39713 /// for details).
39714 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreSetIamPolicyCall<'a, C> {
39715 self._scopes.clear();
39716 self
39717 }
39718}
39719
39720/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
39721///
39722/// A builder for the *locations.datasets.fhirStores.testIamPermissions* method supported by a *project* resource.
39723/// It is not used directly, but through a [`ProjectMethods`] instance.
39724///
39725/// # Example
39726///
39727/// Instantiate a resource method builder
39728///
39729/// ```test_harness,no_run
39730/// # extern crate hyper;
39731/// # extern crate hyper_rustls;
39732/// # extern crate google_healthcare1 as healthcare1;
39733/// use healthcare1::api::TestIamPermissionsRequest;
39734/// # async fn dox() {
39735/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
39736///
39737/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
39738/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
39739/// # secret,
39740/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
39741/// # ).build().await.unwrap();
39742///
39743/// # let client = hyper_util::client::legacy::Client::builder(
39744/// # hyper_util::rt::TokioExecutor::new()
39745/// # )
39746/// # .build(
39747/// # hyper_rustls::HttpsConnectorBuilder::new()
39748/// # .with_native_roots()
39749/// # .unwrap()
39750/// # .https_or_http()
39751/// # .enable_http1()
39752/// # .build()
39753/// # );
39754/// # let mut hub = CloudHealthcare::new(client, auth);
39755/// // As the method needs a request, you would usually fill it with the desired information
39756/// // into the respective structure. Some of the parts shown here might not be applicable !
39757/// // Values shown here are possibly random and not representative !
39758/// let mut req = TestIamPermissionsRequest::default();
39759///
39760/// // You can configure optional parameters by calling the respective setters at will, and
39761/// // execute the final call using `doit()`.
39762/// // Values shown here are possibly random and not representative !
39763/// let result = hub.projects().locations_datasets_fhir_stores_test_iam_permissions(req, "resource")
39764/// .doit().await;
39765/// # }
39766/// ```
39767pub struct ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C>
39768where
39769 C: 'a,
39770{
39771 hub: &'a CloudHealthcare<C>,
39772 _request: TestIamPermissionsRequest,
39773 _resource: String,
39774 _delegate: Option<&'a mut dyn common::Delegate>,
39775 _additional_params: HashMap<String, String>,
39776 _scopes: BTreeSet<String>,
39777}
39778
39779impl<'a, C> common::CallBuilder for ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C> {}
39780
39781impl<'a, C> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C>
39782where
39783 C: common::Connector,
39784{
39785 /// Perform the operation you have build so far.
39786 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
39787 use std::borrow::Cow;
39788 use std::io::{Read, Seek};
39789
39790 use common::{url::Params, ToParts};
39791 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
39792
39793 let mut dd = common::DefaultDelegate;
39794 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
39795 dlg.begin(common::MethodInfo {
39796 id: "healthcare.projects.locations.datasets.fhirStores.testIamPermissions",
39797 http_method: hyper::Method::POST,
39798 });
39799
39800 for &field in ["alt", "resource"].iter() {
39801 if self._additional_params.contains_key(field) {
39802 dlg.finished(false);
39803 return Err(common::Error::FieldClash(field));
39804 }
39805 }
39806
39807 let mut params = Params::with_capacity(4 + self._additional_params.len());
39808 params.push("resource", self._resource);
39809
39810 params.extend(self._additional_params.iter());
39811
39812 params.push("alt", "json");
39813 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
39814 if self._scopes.is_empty() {
39815 self._scopes
39816 .insert(Scope::CloudHealthcare.as_ref().to_string());
39817 }
39818
39819 #[allow(clippy::single_element_loop)]
39820 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
39821 url = params.uri_replacement(url, param_name, find_this, true);
39822 }
39823 {
39824 let to_remove = ["resource"];
39825 params.remove_params(&to_remove);
39826 }
39827
39828 let url = params.parse_with_url(&url);
39829
39830 let mut json_mime_type = mime::APPLICATION_JSON;
39831 let mut request_value_reader = {
39832 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
39833 common::remove_json_null_values(&mut value);
39834 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
39835 serde_json::to_writer(&mut dst, &value).unwrap();
39836 dst
39837 };
39838 let request_size = request_value_reader
39839 .seek(std::io::SeekFrom::End(0))
39840 .unwrap();
39841 request_value_reader
39842 .seek(std::io::SeekFrom::Start(0))
39843 .unwrap();
39844
39845 loop {
39846 let token = match self
39847 .hub
39848 .auth
39849 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
39850 .await
39851 {
39852 Ok(token) => token,
39853 Err(e) => match dlg.token(e) {
39854 Ok(token) => token,
39855 Err(e) => {
39856 dlg.finished(false);
39857 return Err(common::Error::MissingToken(e));
39858 }
39859 },
39860 };
39861 request_value_reader
39862 .seek(std::io::SeekFrom::Start(0))
39863 .unwrap();
39864 let mut req_result = {
39865 let client = &self.hub.client;
39866 dlg.pre_request();
39867 let mut req_builder = hyper::Request::builder()
39868 .method(hyper::Method::POST)
39869 .uri(url.as_str())
39870 .header(USER_AGENT, self.hub._user_agent.clone());
39871
39872 if let Some(token) = token.as_ref() {
39873 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
39874 }
39875
39876 let request = req_builder
39877 .header(CONTENT_TYPE, json_mime_type.to_string())
39878 .header(CONTENT_LENGTH, request_size as u64)
39879 .body(common::to_body(
39880 request_value_reader.get_ref().clone().into(),
39881 ));
39882
39883 client.request(request.unwrap()).await
39884 };
39885
39886 match req_result {
39887 Err(err) => {
39888 if let common::Retry::After(d) = dlg.http_error(&err) {
39889 sleep(d).await;
39890 continue;
39891 }
39892 dlg.finished(false);
39893 return Err(common::Error::HttpError(err));
39894 }
39895 Ok(res) => {
39896 let (mut parts, body) = res.into_parts();
39897 let mut body = common::Body::new(body);
39898 if !parts.status.is_success() {
39899 let bytes = common::to_bytes(body).await.unwrap_or_default();
39900 let error = serde_json::from_str(&common::to_string(&bytes));
39901 let response = common::to_response(parts, bytes.into());
39902
39903 if let common::Retry::After(d) =
39904 dlg.http_failure(&response, error.as_ref().ok())
39905 {
39906 sleep(d).await;
39907 continue;
39908 }
39909
39910 dlg.finished(false);
39911
39912 return Err(match error {
39913 Ok(value) => common::Error::BadRequest(value),
39914 _ => common::Error::Failure(response),
39915 });
39916 }
39917 let response = {
39918 let bytes = common::to_bytes(body).await.unwrap_or_default();
39919 let encoded = common::to_string(&bytes);
39920 match serde_json::from_str(&encoded) {
39921 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
39922 Err(error) => {
39923 dlg.response_json_decode_error(&encoded, &error);
39924 return Err(common::Error::JsonDecodeError(
39925 encoded.to_string(),
39926 error,
39927 ));
39928 }
39929 }
39930 };
39931
39932 dlg.finished(true);
39933 return Ok(response);
39934 }
39935 }
39936 }
39937 }
39938
39939 ///
39940 /// Sets the *request* property to the given value.
39941 ///
39942 /// Even though the property as already been set when instantiating this call,
39943 /// we provide this method for API completeness.
39944 pub fn request(
39945 mut self,
39946 new_value: TestIamPermissionsRequest,
39947 ) -> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C> {
39948 self._request = new_value;
39949 self
39950 }
39951 /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
39952 ///
39953 /// Sets the *resource* path property to the given value.
39954 ///
39955 /// Even though the property as already been set when instantiating this call,
39956 /// we provide this method for API completeness.
39957 pub fn resource(
39958 mut self,
39959 new_value: &str,
39960 ) -> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C> {
39961 self._resource = new_value.to_string();
39962 self
39963 }
39964 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
39965 /// while executing the actual API request.
39966 ///
39967 /// ````text
39968 /// It should be used to handle progress information, and to implement a certain level of resilience.
39969 /// ````
39970 ///
39971 /// Sets the *delegate* property to the given value.
39972 pub fn delegate(
39973 mut self,
39974 new_value: &'a mut dyn common::Delegate,
39975 ) -> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C> {
39976 self._delegate = Some(new_value);
39977 self
39978 }
39979
39980 /// Set any additional parameter of the query string used in the request.
39981 /// It should be used to set parameters which are not yet available through their own
39982 /// setters.
39983 ///
39984 /// Please note that this method must not be used to set any of the known parameters
39985 /// which have their own setter method. If done anyway, the request will fail.
39986 ///
39987 /// # Additional Parameters
39988 ///
39989 /// * *$.xgafv* (query-string) - V1 error format.
39990 /// * *access_token* (query-string) - OAuth access token.
39991 /// * *alt* (query-string) - Data format for response.
39992 /// * *callback* (query-string) - JSONP
39993 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
39994 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
39995 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
39996 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
39997 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
39998 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
39999 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
40000 pub fn param<T>(
40001 mut self,
40002 name: T,
40003 value: T,
40004 ) -> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C>
40005 where
40006 T: AsRef<str>,
40007 {
40008 self._additional_params
40009 .insert(name.as_ref().to_string(), value.as_ref().to_string());
40010 self
40011 }
40012
40013 /// Identifies the authorization scope for the method you are building.
40014 ///
40015 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
40016 /// [`Scope::CloudHealthcare`].
40017 ///
40018 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
40019 /// tokens for more than one scope.
40020 ///
40021 /// Usually there is more than one suitable scope to authorize an operation, some of which may
40022 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
40023 /// sufficient, a read-write scope will do as well.
40024 pub fn add_scope<St>(
40025 mut self,
40026 scope: St,
40027 ) -> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C>
40028 where
40029 St: AsRef<str>,
40030 {
40031 self._scopes.insert(String::from(scope.as_ref()));
40032 self
40033 }
40034 /// Identifies the authorization scope(s) for the method you are building.
40035 ///
40036 /// See [`Self::add_scope()`] for details.
40037 pub fn add_scopes<I, St>(
40038 mut self,
40039 scopes: I,
40040 ) -> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C>
40041 where
40042 I: IntoIterator<Item = St>,
40043 St: AsRef<str>,
40044 {
40045 self._scopes
40046 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
40047 self
40048 }
40049
40050 /// Removes all scopes, and no default scope will be used either.
40051 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
40052 /// for details).
40053 pub fn clear_scopes(mut self) -> ProjectLocationDatasetFhirStoreTestIamPermissionCall<'a, C> {
40054 self._scopes.clear();
40055 self
40056 }
40057}
40058
40059/// Parses and stores an HL7v2 message. This method triggers an asynchronous notification to any Pub/Sub topic configured in Hl7V2Store.Hl7V2NotificationConfig, if the filtering matches the message. If an MLLP adapter is configured to listen to a Pub/Sub topic, the adapter transmits the message when a notification is received.
40060///
40061/// A builder for the *locations.datasets.hl7V2Stores.messages.create* method supported by a *project* resource.
40062/// It is not used directly, but through a [`ProjectMethods`] instance.
40063///
40064/// # Example
40065///
40066/// Instantiate a resource method builder
40067///
40068/// ```test_harness,no_run
40069/// # extern crate hyper;
40070/// # extern crate hyper_rustls;
40071/// # extern crate google_healthcare1 as healthcare1;
40072/// use healthcare1::api::CreateMessageRequest;
40073/// # async fn dox() {
40074/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
40075///
40076/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
40077/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
40078/// # secret,
40079/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
40080/// # ).build().await.unwrap();
40081///
40082/// # let client = hyper_util::client::legacy::Client::builder(
40083/// # hyper_util::rt::TokioExecutor::new()
40084/// # )
40085/// # .build(
40086/// # hyper_rustls::HttpsConnectorBuilder::new()
40087/// # .with_native_roots()
40088/// # .unwrap()
40089/// # .https_or_http()
40090/// # .enable_http1()
40091/// # .build()
40092/// # );
40093/// # let mut hub = CloudHealthcare::new(client, auth);
40094/// // As the method needs a request, you would usually fill it with the desired information
40095/// // into the respective structure. Some of the parts shown here might not be applicable !
40096/// // Values shown here are possibly random and not representative !
40097/// let mut req = CreateMessageRequest::default();
40098///
40099/// // You can configure optional parameters by calling the respective setters at will, and
40100/// // execute the final call using `doit()`.
40101/// // Values shown here are possibly random and not representative !
40102/// let result = hub.projects().locations_datasets_hl7_v2_stores_messages_create(req, "parent")
40103/// .doit().await;
40104/// # }
40105/// ```
40106pub struct ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C>
40107where
40108 C: 'a,
40109{
40110 hub: &'a CloudHealthcare<C>,
40111 _request: CreateMessageRequest,
40112 _parent: String,
40113 _delegate: Option<&'a mut dyn common::Delegate>,
40114 _additional_params: HashMap<String, String>,
40115 _scopes: BTreeSet<String>,
40116}
40117
40118impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C> {}
40119
40120impl<'a, C> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C>
40121where
40122 C: common::Connector,
40123{
40124 /// Perform the operation you have build so far.
40125 pub async fn doit(mut self) -> common::Result<(common::Response, Message)> {
40126 use std::borrow::Cow;
40127 use std::io::{Read, Seek};
40128
40129 use common::{url::Params, ToParts};
40130 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
40131
40132 let mut dd = common::DefaultDelegate;
40133 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
40134 dlg.begin(common::MethodInfo {
40135 id: "healthcare.projects.locations.datasets.hl7V2Stores.messages.create",
40136 http_method: hyper::Method::POST,
40137 });
40138
40139 for &field in ["alt", "parent"].iter() {
40140 if self._additional_params.contains_key(field) {
40141 dlg.finished(false);
40142 return Err(common::Error::FieldClash(field));
40143 }
40144 }
40145
40146 let mut params = Params::with_capacity(4 + self._additional_params.len());
40147 params.push("parent", self._parent);
40148
40149 params.extend(self._additional_params.iter());
40150
40151 params.push("alt", "json");
40152 let mut url = self.hub._base_url.clone() + "v1/{+parent}/messages";
40153 if self._scopes.is_empty() {
40154 self._scopes
40155 .insert(Scope::CloudHealthcare.as_ref().to_string());
40156 }
40157
40158 #[allow(clippy::single_element_loop)]
40159 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
40160 url = params.uri_replacement(url, param_name, find_this, true);
40161 }
40162 {
40163 let to_remove = ["parent"];
40164 params.remove_params(&to_remove);
40165 }
40166
40167 let url = params.parse_with_url(&url);
40168
40169 let mut json_mime_type = mime::APPLICATION_JSON;
40170 let mut request_value_reader = {
40171 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
40172 common::remove_json_null_values(&mut value);
40173 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
40174 serde_json::to_writer(&mut dst, &value).unwrap();
40175 dst
40176 };
40177 let request_size = request_value_reader
40178 .seek(std::io::SeekFrom::End(0))
40179 .unwrap();
40180 request_value_reader
40181 .seek(std::io::SeekFrom::Start(0))
40182 .unwrap();
40183
40184 loop {
40185 let token = match self
40186 .hub
40187 .auth
40188 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
40189 .await
40190 {
40191 Ok(token) => token,
40192 Err(e) => match dlg.token(e) {
40193 Ok(token) => token,
40194 Err(e) => {
40195 dlg.finished(false);
40196 return Err(common::Error::MissingToken(e));
40197 }
40198 },
40199 };
40200 request_value_reader
40201 .seek(std::io::SeekFrom::Start(0))
40202 .unwrap();
40203 let mut req_result = {
40204 let client = &self.hub.client;
40205 dlg.pre_request();
40206 let mut req_builder = hyper::Request::builder()
40207 .method(hyper::Method::POST)
40208 .uri(url.as_str())
40209 .header(USER_AGENT, self.hub._user_agent.clone());
40210
40211 if let Some(token) = token.as_ref() {
40212 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
40213 }
40214
40215 let request = req_builder
40216 .header(CONTENT_TYPE, json_mime_type.to_string())
40217 .header(CONTENT_LENGTH, request_size as u64)
40218 .body(common::to_body(
40219 request_value_reader.get_ref().clone().into(),
40220 ));
40221
40222 client.request(request.unwrap()).await
40223 };
40224
40225 match req_result {
40226 Err(err) => {
40227 if let common::Retry::After(d) = dlg.http_error(&err) {
40228 sleep(d).await;
40229 continue;
40230 }
40231 dlg.finished(false);
40232 return Err(common::Error::HttpError(err));
40233 }
40234 Ok(res) => {
40235 let (mut parts, body) = res.into_parts();
40236 let mut body = common::Body::new(body);
40237 if !parts.status.is_success() {
40238 let bytes = common::to_bytes(body).await.unwrap_or_default();
40239 let error = serde_json::from_str(&common::to_string(&bytes));
40240 let response = common::to_response(parts, bytes.into());
40241
40242 if let common::Retry::After(d) =
40243 dlg.http_failure(&response, error.as_ref().ok())
40244 {
40245 sleep(d).await;
40246 continue;
40247 }
40248
40249 dlg.finished(false);
40250
40251 return Err(match error {
40252 Ok(value) => common::Error::BadRequest(value),
40253 _ => common::Error::Failure(response),
40254 });
40255 }
40256 let response = {
40257 let bytes = common::to_bytes(body).await.unwrap_or_default();
40258 let encoded = common::to_string(&bytes);
40259 match serde_json::from_str(&encoded) {
40260 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
40261 Err(error) => {
40262 dlg.response_json_decode_error(&encoded, &error);
40263 return Err(common::Error::JsonDecodeError(
40264 encoded.to_string(),
40265 error,
40266 ));
40267 }
40268 }
40269 };
40270
40271 dlg.finished(true);
40272 return Ok(response);
40273 }
40274 }
40275 }
40276 }
40277
40278 ///
40279 /// Sets the *request* property to the given value.
40280 ///
40281 /// Even though the property as already been set when instantiating this call,
40282 /// we provide this method for API completeness.
40283 pub fn request(
40284 mut self,
40285 new_value: CreateMessageRequest,
40286 ) -> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C> {
40287 self._request = new_value;
40288 self
40289 }
40290 /// Required. The name of the HL7v2 store this message belongs to.
40291 ///
40292 /// Sets the *parent* path property to the given value.
40293 ///
40294 /// Even though the property as already been set when instantiating this call,
40295 /// we provide this method for API completeness.
40296 pub fn parent(
40297 mut self,
40298 new_value: &str,
40299 ) -> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C> {
40300 self._parent = new_value.to_string();
40301 self
40302 }
40303 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
40304 /// while executing the actual API request.
40305 ///
40306 /// ````text
40307 /// It should be used to handle progress information, and to implement a certain level of resilience.
40308 /// ````
40309 ///
40310 /// Sets the *delegate* property to the given value.
40311 pub fn delegate(
40312 mut self,
40313 new_value: &'a mut dyn common::Delegate,
40314 ) -> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C> {
40315 self._delegate = Some(new_value);
40316 self
40317 }
40318
40319 /// Set any additional parameter of the query string used in the request.
40320 /// It should be used to set parameters which are not yet available through their own
40321 /// setters.
40322 ///
40323 /// Please note that this method must not be used to set any of the known parameters
40324 /// which have their own setter method. If done anyway, the request will fail.
40325 ///
40326 /// # Additional Parameters
40327 ///
40328 /// * *$.xgafv* (query-string) - V1 error format.
40329 /// * *access_token* (query-string) - OAuth access token.
40330 /// * *alt* (query-string) - Data format for response.
40331 /// * *callback* (query-string) - JSONP
40332 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
40333 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
40334 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
40335 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
40336 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
40337 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
40338 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
40339 pub fn param<T>(
40340 mut self,
40341 name: T,
40342 value: T,
40343 ) -> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C>
40344 where
40345 T: AsRef<str>,
40346 {
40347 self._additional_params
40348 .insert(name.as_ref().to_string(), value.as_ref().to_string());
40349 self
40350 }
40351
40352 /// Identifies the authorization scope for the method you are building.
40353 ///
40354 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
40355 /// [`Scope::CloudHealthcare`].
40356 ///
40357 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
40358 /// tokens for more than one scope.
40359 ///
40360 /// Usually there is more than one suitable scope to authorize an operation, some of which may
40361 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
40362 /// sufficient, a read-write scope will do as well.
40363 pub fn add_scope<St>(
40364 mut self,
40365 scope: St,
40366 ) -> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C>
40367 where
40368 St: AsRef<str>,
40369 {
40370 self._scopes.insert(String::from(scope.as_ref()));
40371 self
40372 }
40373 /// Identifies the authorization scope(s) for the method you are building.
40374 ///
40375 /// See [`Self::add_scope()`] for details.
40376 pub fn add_scopes<I, St>(
40377 mut self,
40378 scopes: I,
40379 ) -> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C>
40380 where
40381 I: IntoIterator<Item = St>,
40382 St: AsRef<str>,
40383 {
40384 self._scopes
40385 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
40386 self
40387 }
40388
40389 /// Removes all scopes, and no default scope will be used either.
40390 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
40391 /// for details).
40392 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StoreMessageCreateCall<'a, C> {
40393 self._scopes.clear();
40394 self
40395 }
40396}
40397
40398/// Deletes an HL7v2 message.
40399///
40400/// A builder for the *locations.datasets.hl7V2Stores.messages.delete* method supported by a *project* resource.
40401/// It is not used directly, but through a [`ProjectMethods`] instance.
40402///
40403/// # Example
40404///
40405/// Instantiate a resource method builder
40406///
40407/// ```test_harness,no_run
40408/// # extern crate hyper;
40409/// # extern crate hyper_rustls;
40410/// # extern crate google_healthcare1 as healthcare1;
40411/// # async fn dox() {
40412/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
40413///
40414/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
40415/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
40416/// # secret,
40417/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
40418/// # ).build().await.unwrap();
40419///
40420/// # let client = hyper_util::client::legacy::Client::builder(
40421/// # hyper_util::rt::TokioExecutor::new()
40422/// # )
40423/// # .build(
40424/// # hyper_rustls::HttpsConnectorBuilder::new()
40425/// # .with_native_roots()
40426/// # .unwrap()
40427/// # .https_or_http()
40428/// # .enable_http1()
40429/// # .build()
40430/// # );
40431/// # let mut hub = CloudHealthcare::new(client, auth);
40432/// // You can configure optional parameters by calling the respective setters at will, and
40433/// // execute the final call using `doit()`.
40434/// // Values shown here are possibly random and not representative !
40435/// let result = hub.projects().locations_datasets_hl7_v2_stores_messages_delete("name")
40436/// .doit().await;
40437/// # }
40438/// ```
40439pub struct ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C>
40440where
40441 C: 'a,
40442{
40443 hub: &'a CloudHealthcare<C>,
40444 _name: String,
40445 _delegate: Option<&'a mut dyn common::Delegate>,
40446 _additional_params: HashMap<String, String>,
40447 _scopes: BTreeSet<String>,
40448}
40449
40450impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C> {}
40451
40452impl<'a, C> ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C>
40453where
40454 C: common::Connector,
40455{
40456 /// Perform the operation you have build so far.
40457 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
40458 use std::borrow::Cow;
40459 use std::io::{Read, Seek};
40460
40461 use common::{url::Params, ToParts};
40462 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
40463
40464 let mut dd = common::DefaultDelegate;
40465 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
40466 dlg.begin(common::MethodInfo {
40467 id: "healthcare.projects.locations.datasets.hl7V2Stores.messages.delete",
40468 http_method: hyper::Method::DELETE,
40469 });
40470
40471 for &field in ["alt", "name"].iter() {
40472 if self._additional_params.contains_key(field) {
40473 dlg.finished(false);
40474 return Err(common::Error::FieldClash(field));
40475 }
40476 }
40477
40478 let mut params = Params::with_capacity(3 + self._additional_params.len());
40479 params.push("name", self._name);
40480
40481 params.extend(self._additional_params.iter());
40482
40483 params.push("alt", "json");
40484 let mut url = self.hub._base_url.clone() + "v1/{+name}";
40485 if self._scopes.is_empty() {
40486 self._scopes
40487 .insert(Scope::CloudHealthcare.as_ref().to_string());
40488 }
40489
40490 #[allow(clippy::single_element_loop)]
40491 for &(find_this, param_name) in [("{+name}", "name")].iter() {
40492 url = params.uri_replacement(url, param_name, find_this, true);
40493 }
40494 {
40495 let to_remove = ["name"];
40496 params.remove_params(&to_remove);
40497 }
40498
40499 let url = params.parse_with_url(&url);
40500
40501 loop {
40502 let token = match self
40503 .hub
40504 .auth
40505 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
40506 .await
40507 {
40508 Ok(token) => token,
40509 Err(e) => match dlg.token(e) {
40510 Ok(token) => token,
40511 Err(e) => {
40512 dlg.finished(false);
40513 return Err(common::Error::MissingToken(e));
40514 }
40515 },
40516 };
40517 let mut req_result = {
40518 let client = &self.hub.client;
40519 dlg.pre_request();
40520 let mut req_builder = hyper::Request::builder()
40521 .method(hyper::Method::DELETE)
40522 .uri(url.as_str())
40523 .header(USER_AGENT, self.hub._user_agent.clone());
40524
40525 if let Some(token) = token.as_ref() {
40526 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
40527 }
40528
40529 let request = req_builder
40530 .header(CONTENT_LENGTH, 0_u64)
40531 .body(common::to_body::<String>(None));
40532
40533 client.request(request.unwrap()).await
40534 };
40535
40536 match req_result {
40537 Err(err) => {
40538 if let common::Retry::After(d) = dlg.http_error(&err) {
40539 sleep(d).await;
40540 continue;
40541 }
40542 dlg.finished(false);
40543 return Err(common::Error::HttpError(err));
40544 }
40545 Ok(res) => {
40546 let (mut parts, body) = res.into_parts();
40547 let mut body = common::Body::new(body);
40548 if !parts.status.is_success() {
40549 let bytes = common::to_bytes(body).await.unwrap_or_default();
40550 let error = serde_json::from_str(&common::to_string(&bytes));
40551 let response = common::to_response(parts, bytes.into());
40552
40553 if let common::Retry::After(d) =
40554 dlg.http_failure(&response, error.as_ref().ok())
40555 {
40556 sleep(d).await;
40557 continue;
40558 }
40559
40560 dlg.finished(false);
40561
40562 return Err(match error {
40563 Ok(value) => common::Error::BadRequest(value),
40564 _ => common::Error::Failure(response),
40565 });
40566 }
40567 let response = {
40568 let bytes = common::to_bytes(body).await.unwrap_or_default();
40569 let encoded = common::to_string(&bytes);
40570 match serde_json::from_str(&encoded) {
40571 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
40572 Err(error) => {
40573 dlg.response_json_decode_error(&encoded, &error);
40574 return Err(common::Error::JsonDecodeError(
40575 encoded.to_string(),
40576 error,
40577 ));
40578 }
40579 }
40580 };
40581
40582 dlg.finished(true);
40583 return Ok(response);
40584 }
40585 }
40586 }
40587 }
40588
40589 /// Required. The resource name of the HL7v2 message to delete.
40590 ///
40591 /// Sets the *name* path property to the given value.
40592 ///
40593 /// Even though the property as already been set when instantiating this call,
40594 /// we provide this method for API completeness.
40595 pub fn name(
40596 mut self,
40597 new_value: &str,
40598 ) -> ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C> {
40599 self._name = new_value.to_string();
40600 self
40601 }
40602 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
40603 /// while executing the actual API request.
40604 ///
40605 /// ````text
40606 /// It should be used to handle progress information, and to implement a certain level of resilience.
40607 /// ````
40608 ///
40609 /// Sets the *delegate* property to the given value.
40610 pub fn delegate(
40611 mut self,
40612 new_value: &'a mut dyn common::Delegate,
40613 ) -> ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C> {
40614 self._delegate = Some(new_value);
40615 self
40616 }
40617
40618 /// Set any additional parameter of the query string used in the request.
40619 /// It should be used to set parameters which are not yet available through their own
40620 /// setters.
40621 ///
40622 /// Please note that this method must not be used to set any of the known parameters
40623 /// which have their own setter method. If done anyway, the request will fail.
40624 ///
40625 /// # Additional Parameters
40626 ///
40627 /// * *$.xgafv* (query-string) - V1 error format.
40628 /// * *access_token* (query-string) - OAuth access token.
40629 /// * *alt* (query-string) - Data format for response.
40630 /// * *callback* (query-string) - JSONP
40631 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
40632 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
40633 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
40634 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
40635 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
40636 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
40637 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
40638 pub fn param<T>(
40639 mut self,
40640 name: T,
40641 value: T,
40642 ) -> ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C>
40643 where
40644 T: AsRef<str>,
40645 {
40646 self._additional_params
40647 .insert(name.as_ref().to_string(), value.as_ref().to_string());
40648 self
40649 }
40650
40651 /// Identifies the authorization scope for the method you are building.
40652 ///
40653 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
40654 /// [`Scope::CloudHealthcare`].
40655 ///
40656 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
40657 /// tokens for more than one scope.
40658 ///
40659 /// Usually there is more than one suitable scope to authorize an operation, some of which may
40660 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
40661 /// sufficient, a read-write scope will do as well.
40662 pub fn add_scope<St>(
40663 mut self,
40664 scope: St,
40665 ) -> ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C>
40666 where
40667 St: AsRef<str>,
40668 {
40669 self._scopes.insert(String::from(scope.as_ref()));
40670 self
40671 }
40672 /// Identifies the authorization scope(s) for the method you are building.
40673 ///
40674 /// See [`Self::add_scope()`] for details.
40675 pub fn add_scopes<I, St>(
40676 mut self,
40677 scopes: I,
40678 ) -> ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C>
40679 where
40680 I: IntoIterator<Item = St>,
40681 St: AsRef<str>,
40682 {
40683 self._scopes
40684 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
40685 self
40686 }
40687
40688 /// Removes all scopes, and no default scope will be used either.
40689 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
40690 /// for details).
40691 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StoreMessageDeleteCall<'a, C> {
40692 self._scopes.clear();
40693 self
40694 }
40695}
40696
40697/// Gets an HL7v2 message.
40698///
40699/// A builder for the *locations.datasets.hl7V2Stores.messages.get* method supported by a *project* resource.
40700/// It is not used directly, but through a [`ProjectMethods`] instance.
40701///
40702/// # Example
40703///
40704/// Instantiate a resource method builder
40705///
40706/// ```test_harness,no_run
40707/// # extern crate hyper;
40708/// # extern crate hyper_rustls;
40709/// # extern crate google_healthcare1 as healthcare1;
40710/// # async fn dox() {
40711/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
40712///
40713/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
40714/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
40715/// # secret,
40716/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
40717/// # ).build().await.unwrap();
40718///
40719/// # let client = hyper_util::client::legacy::Client::builder(
40720/// # hyper_util::rt::TokioExecutor::new()
40721/// # )
40722/// # .build(
40723/// # hyper_rustls::HttpsConnectorBuilder::new()
40724/// # .with_native_roots()
40725/// # .unwrap()
40726/// # .https_or_http()
40727/// # .enable_http1()
40728/// # .build()
40729/// # );
40730/// # let mut hub = CloudHealthcare::new(client, auth);
40731/// // You can configure optional parameters by calling the respective setters at will, and
40732/// // execute the final call using `doit()`.
40733/// // Values shown here are possibly random and not representative !
40734/// let result = hub.projects().locations_datasets_hl7_v2_stores_messages_get("name")
40735/// .view("sadipscing")
40736/// .doit().await;
40737/// # }
40738/// ```
40739pub struct ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C>
40740where
40741 C: 'a,
40742{
40743 hub: &'a CloudHealthcare<C>,
40744 _name: String,
40745 _view: Option<String>,
40746 _delegate: Option<&'a mut dyn common::Delegate>,
40747 _additional_params: HashMap<String, String>,
40748 _scopes: BTreeSet<String>,
40749}
40750
40751impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C> {}
40752
40753impl<'a, C> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C>
40754where
40755 C: common::Connector,
40756{
40757 /// Perform the operation you have build so far.
40758 pub async fn doit(mut self) -> common::Result<(common::Response, Message)> {
40759 use std::borrow::Cow;
40760 use std::io::{Read, Seek};
40761
40762 use common::{url::Params, ToParts};
40763 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
40764
40765 let mut dd = common::DefaultDelegate;
40766 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
40767 dlg.begin(common::MethodInfo {
40768 id: "healthcare.projects.locations.datasets.hl7V2Stores.messages.get",
40769 http_method: hyper::Method::GET,
40770 });
40771
40772 for &field in ["alt", "name", "view"].iter() {
40773 if self._additional_params.contains_key(field) {
40774 dlg.finished(false);
40775 return Err(common::Error::FieldClash(field));
40776 }
40777 }
40778
40779 let mut params = Params::with_capacity(4 + self._additional_params.len());
40780 params.push("name", self._name);
40781 if let Some(value) = self._view.as_ref() {
40782 params.push("view", value);
40783 }
40784
40785 params.extend(self._additional_params.iter());
40786
40787 params.push("alt", "json");
40788 let mut url = self.hub._base_url.clone() + "v1/{+name}";
40789 if self._scopes.is_empty() {
40790 self._scopes
40791 .insert(Scope::CloudHealthcare.as_ref().to_string());
40792 }
40793
40794 #[allow(clippy::single_element_loop)]
40795 for &(find_this, param_name) in [("{+name}", "name")].iter() {
40796 url = params.uri_replacement(url, param_name, find_this, true);
40797 }
40798 {
40799 let to_remove = ["name"];
40800 params.remove_params(&to_remove);
40801 }
40802
40803 let url = params.parse_with_url(&url);
40804
40805 loop {
40806 let token = match self
40807 .hub
40808 .auth
40809 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
40810 .await
40811 {
40812 Ok(token) => token,
40813 Err(e) => match dlg.token(e) {
40814 Ok(token) => token,
40815 Err(e) => {
40816 dlg.finished(false);
40817 return Err(common::Error::MissingToken(e));
40818 }
40819 },
40820 };
40821 let mut req_result = {
40822 let client = &self.hub.client;
40823 dlg.pre_request();
40824 let mut req_builder = hyper::Request::builder()
40825 .method(hyper::Method::GET)
40826 .uri(url.as_str())
40827 .header(USER_AGENT, self.hub._user_agent.clone());
40828
40829 if let Some(token) = token.as_ref() {
40830 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
40831 }
40832
40833 let request = req_builder
40834 .header(CONTENT_LENGTH, 0_u64)
40835 .body(common::to_body::<String>(None));
40836
40837 client.request(request.unwrap()).await
40838 };
40839
40840 match req_result {
40841 Err(err) => {
40842 if let common::Retry::After(d) = dlg.http_error(&err) {
40843 sleep(d).await;
40844 continue;
40845 }
40846 dlg.finished(false);
40847 return Err(common::Error::HttpError(err));
40848 }
40849 Ok(res) => {
40850 let (mut parts, body) = res.into_parts();
40851 let mut body = common::Body::new(body);
40852 if !parts.status.is_success() {
40853 let bytes = common::to_bytes(body).await.unwrap_or_default();
40854 let error = serde_json::from_str(&common::to_string(&bytes));
40855 let response = common::to_response(parts, bytes.into());
40856
40857 if let common::Retry::After(d) =
40858 dlg.http_failure(&response, error.as_ref().ok())
40859 {
40860 sleep(d).await;
40861 continue;
40862 }
40863
40864 dlg.finished(false);
40865
40866 return Err(match error {
40867 Ok(value) => common::Error::BadRequest(value),
40868 _ => common::Error::Failure(response),
40869 });
40870 }
40871 let response = {
40872 let bytes = common::to_bytes(body).await.unwrap_or_default();
40873 let encoded = common::to_string(&bytes);
40874 match serde_json::from_str(&encoded) {
40875 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
40876 Err(error) => {
40877 dlg.response_json_decode_error(&encoded, &error);
40878 return Err(common::Error::JsonDecodeError(
40879 encoded.to_string(),
40880 error,
40881 ));
40882 }
40883 }
40884 };
40885
40886 dlg.finished(true);
40887 return Ok(response);
40888 }
40889 }
40890 }
40891 }
40892
40893 /// Required. The resource name of the HL7v2 message to retrieve.
40894 ///
40895 /// Sets the *name* path property to the given value.
40896 ///
40897 /// Even though the property as already been set when instantiating this call,
40898 /// we provide this method for API completeness.
40899 pub fn name(
40900 mut self,
40901 new_value: &str,
40902 ) -> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C> {
40903 self._name = new_value.to_string();
40904 self
40905 }
40906 /// Specifies which parts of the Message resource to return in the response. When unspecified, equivalent to FULL.
40907 ///
40908 /// Sets the *view* query property to the given value.
40909 pub fn view(
40910 mut self,
40911 new_value: &str,
40912 ) -> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C> {
40913 self._view = Some(new_value.to_string());
40914 self
40915 }
40916 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
40917 /// while executing the actual API request.
40918 ///
40919 /// ````text
40920 /// It should be used to handle progress information, and to implement a certain level of resilience.
40921 /// ````
40922 ///
40923 /// Sets the *delegate* property to the given value.
40924 pub fn delegate(
40925 mut self,
40926 new_value: &'a mut dyn common::Delegate,
40927 ) -> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C> {
40928 self._delegate = Some(new_value);
40929 self
40930 }
40931
40932 /// Set any additional parameter of the query string used in the request.
40933 /// It should be used to set parameters which are not yet available through their own
40934 /// setters.
40935 ///
40936 /// Please note that this method must not be used to set any of the known parameters
40937 /// which have their own setter method. If done anyway, the request will fail.
40938 ///
40939 /// # Additional Parameters
40940 ///
40941 /// * *$.xgafv* (query-string) - V1 error format.
40942 /// * *access_token* (query-string) - OAuth access token.
40943 /// * *alt* (query-string) - Data format for response.
40944 /// * *callback* (query-string) - JSONP
40945 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
40946 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
40947 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
40948 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
40949 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
40950 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
40951 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
40952 pub fn param<T>(
40953 mut self,
40954 name: T,
40955 value: T,
40956 ) -> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C>
40957 where
40958 T: AsRef<str>,
40959 {
40960 self._additional_params
40961 .insert(name.as_ref().to_string(), value.as_ref().to_string());
40962 self
40963 }
40964
40965 /// Identifies the authorization scope for the method you are building.
40966 ///
40967 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
40968 /// [`Scope::CloudHealthcare`].
40969 ///
40970 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
40971 /// tokens for more than one scope.
40972 ///
40973 /// Usually there is more than one suitable scope to authorize an operation, some of which may
40974 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
40975 /// sufficient, a read-write scope will do as well.
40976 pub fn add_scope<St>(
40977 mut self,
40978 scope: St,
40979 ) -> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C>
40980 where
40981 St: AsRef<str>,
40982 {
40983 self._scopes.insert(String::from(scope.as_ref()));
40984 self
40985 }
40986 /// Identifies the authorization scope(s) for the method you are building.
40987 ///
40988 /// See [`Self::add_scope()`] for details.
40989 pub fn add_scopes<I, St>(
40990 mut self,
40991 scopes: I,
40992 ) -> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C>
40993 where
40994 I: IntoIterator<Item = St>,
40995 St: AsRef<str>,
40996 {
40997 self._scopes
40998 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
40999 self
41000 }
41001
41002 /// Removes all scopes, and no default scope will be used either.
41003 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
41004 /// for details).
41005 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StoreMessageGetCall<'a, C> {
41006 self._scopes.clear();
41007 self
41008 }
41009}
41010
41011/// Parses and stores an HL7v2 message. This method triggers an asynchronous notification to any Pub/Sub topic configured in Hl7V2Store.Hl7V2NotificationConfig, if the filtering matches the message. If an MLLP adapter is configured to listen to a Pub/Sub topic, the adapter transmits the message when a notification is received. If the method is successful, it generates a response containing an HL7v2 acknowledgment (`ACK`) message. If the method encounters an error, it returns a negative acknowledgment (`NACK`) message. This behavior is suitable for replying to HL7v2 interface systems that expect these acknowledgments.
41012///
41013/// A builder for the *locations.datasets.hl7V2Stores.messages.ingest* method supported by a *project* resource.
41014/// It is not used directly, but through a [`ProjectMethods`] instance.
41015///
41016/// # Example
41017///
41018/// Instantiate a resource method builder
41019///
41020/// ```test_harness,no_run
41021/// # extern crate hyper;
41022/// # extern crate hyper_rustls;
41023/// # extern crate google_healthcare1 as healthcare1;
41024/// use healthcare1::api::IngestMessageRequest;
41025/// # async fn dox() {
41026/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
41027///
41028/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
41029/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
41030/// # secret,
41031/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
41032/// # ).build().await.unwrap();
41033///
41034/// # let client = hyper_util::client::legacy::Client::builder(
41035/// # hyper_util::rt::TokioExecutor::new()
41036/// # )
41037/// # .build(
41038/// # hyper_rustls::HttpsConnectorBuilder::new()
41039/// # .with_native_roots()
41040/// # .unwrap()
41041/// # .https_or_http()
41042/// # .enable_http1()
41043/// # .build()
41044/// # );
41045/// # let mut hub = CloudHealthcare::new(client, auth);
41046/// // As the method needs a request, you would usually fill it with the desired information
41047/// // into the respective structure. Some of the parts shown here might not be applicable !
41048/// // Values shown here are possibly random and not representative !
41049/// let mut req = IngestMessageRequest::default();
41050///
41051/// // You can configure optional parameters by calling the respective setters at will, and
41052/// // execute the final call using `doit()`.
41053/// // Values shown here are possibly random and not representative !
41054/// let result = hub.projects().locations_datasets_hl7_v2_stores_messages_ingest(req, "parent")
41055/// .doit().await;
41056/// # }
41057/// ```
41058pub struct ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C>
41059where
41060 C: 'a,
41061{
41062 hub: &'a CloudHealthcare<C>,
41063 _request: IngestMessageRequest,
41064 _parent: String,
41065 _delegate: Option<&'a mut dyn common::Delegate>,
41066 _additional_params: HashMap<String, String>,
41067 _scopes: BTreeSet<String>,
41068}
41069
41070impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C> {}
41071
41072impl<'a, C> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C>
41073where
41074 C: common::Connector,
41075{
41076 /// Perform the operation you have build so far.
41077 pub async fn doit(mut self) -> common::Result<(common::Response, IngestMessageResponse)> {
41078 use std::borrow::Cow;
41079 use std::io::{Read, Seek};
41080
41081 use common::{url::Params, ToParts};
41082 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
41083
41084 let mut dd = common::DefaultDelegate;
41085 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
41086 dlg.begin(common::MethodInfo {
41087 id: "healthcare.projects.locations.datasets.hl7V2Stores.messages.ingest",
41088 http_method: hyper::Method::POST,
41089 });
41090
41091 for &field in ["alt", "parent"].iter() {
41092 if self._additional_params.contains_key(field) {
41093 dlg.finished(false);
41094 return Err(common::Error::FieldClash(field));
41095 }
41096 }
41097
41098 let mut params = Params::with_capacity(4 + self._additional_params.len());
41099 params.push("parent", self._parent);
41100
41101 params.extend(self._additional_params.iter());
41102
41103 params.push("alt", "json");
41104 let mut url = self.hub._base_url.clone() + "v1/{+parent}/messages:ingest";
41105 if self._scopes.is_empty() {
41106 self._scopes
41107 .insert(Scope::CloudHealthcare.as_ref().to_string());
41108 }
41109
41110 #[allow(clippy::single_element_loop)]
41111 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
41112 url = params.uri_replacement(url, param_name, find_this, true);
41113 }
41114 {
41115 let to_remove = ["parent"];
41116 params.remove_params(&to_remove);
41117 }
41118
41119 let url = params.parse_with_url(&url);
41120
41121 let mut json_mime_type = mime::APPLICATION_JSON;
41122 let mut request_value_reader = {
41123 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
41124 common::remove_json_null_values(&mut value);
41125 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
41126 serde_json::to_writer(&mut dst, &value).unwrap();
41127 dst
41128 };
41129 let request_size = request_value_reader
41130 .seek(std::io::SeekFrom::End(0))
41131 .unwrap();
41132 request_value_reader
41133 .seek(std::io::SeekFrom::Start(0))
41134 .unwrap();
41135
41136 loop {
41137 let token = match self
41138 .hub
41139 .auth
41140 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
41141 .await
41142 {
41143 Ok(token) => token,
41144 Err(e) => match dlg.token(e) {
41145 Ok(token) => token,
41146 Err(e) => {
41147 dlg.finished(false);
41148 return Err(common::Error::MissingToken(e));
41149 }
41150 },
41151 };
41152 request_value_reader
41153 .seek(std::io::SeekFrom::Start(0))
41154 .unwrap();
41155 let mut req_result = {
41156 let client = &self.hub.client;
41157 dlg.pre_request();
41158 let mut req_builder = hyper::Request::builder()
41159 .method(hyper::Method::POST)
41160 .uri(url.as_str())
41161 .header(USER_AGENT, self.hub._user_agent.clone());
41162
41163 if let Some(token) = token.as_ref() {
41164 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
41165 }
41166
41167 let request = req_builder
41168 .header(CONTENT_TYPE, json_mime_type.to_string())
41169 .header(CONTENT_LENGTH, request_size as u64)
41170 .body(common::to_body(
41171 request_value_reader.get_ref().clone().into(),
41172 ));
41173
41174 client.request(request.unwrap()).await
41175 };
41176
41177 match req_result {
41178 Err(err) => {
41179 if let common::Retry::After(d) = dlg.http_error(&err) {
41180 sleep(d).await;
41181 continue;
41182 }
41183 dlg.finished(false);
41184 return Err(common::Error::HttpError(err));
41185 }
41186 Ok(res) => {
41187 let (mut parts, body) = res.into_parts();
41188 let mut body = common::Body::new(body);
41189 if !parts.status.is_success() {
41190 let bytes = common::to_bytes(body).await.unwrap_or_default();
41191 let error = serde_json::from_str(&common::to_string(&bytes));
41192 let response = common::to_response(parts, bytes.into());
41193
41194 if let common::Retry::After(d) =
41195 dlg.http_failure(&response, error.as_ref().ok())
41196 {
41197 sleep(d).await;
41198 continue;
41199 }
41200
41201 dlg.finished(false);
41202
41203 return Err(match error {
41204 Ok(value) => common::Error::BadRequest(value),
41205 _ => common::Error::Failure(response),
41206 });
41207 }
41208 let response = {
41209 let bytes = common::to_bytes(body).await.unwrap_or_default();
41210 let encoded = common::to_string(&bytes);
41211 match serde_json::from_str(&encoded) {
41212 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
41213 Err(error) => {
41214 dlg.response_json_decode_error(&encoded, &error);
41215 return Err(common::Error::JsonDecodeError(
41216 encoded.to_string(),
41217 error,
41218 ));
41219 }
41220 }
41221 };
41222
41223 dlg.finished(true);
41224 return Ok(response);
41225 }
41226 }
41227 }
41228 }
41229
41230 ///
41231 /// Sets the *request* property to the given value.
41232 ///
41233 /// Even though the property as already been set when instantiating this call,
41234 /// we provide this method for API completeness.
41235 pub fn request(
41236 mut self,
41237 new_value: IngestMessageRequest,
41238 ) -> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C> {
41239 self._request = new_value;
41240 self
41241 }
41242 /// Required. The name of the HL7v2 store this message belongs to.
41243 ///
41244 /// Sets the *parent* path property to the given value.
41245 ///
41246 /// Even though the property as already been set when instantiating this call,
41247 /// we provide this method for API completeness.
41248 pub fn parent(
41249 mut self,
41250 new_value: &str,
41251 ) -> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C> {
41252 self._parent = new_value.to_string();
41253 self
41254 }
41255 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
41256 /// while executing the actual API request.
41257 ///
41258 /// ````text
41259 /// It should be used to handle progress information, and to implement a certain level of resilience.
41260 /// ````
41261 ///
41262 /// Sets the *delegate* property to the given value.
41263 pub fn delegate(
41264 mut self,
41265 new_value: &'a mut dyn common::Delegate,
41266 ) -> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C> {
41267 self._delegate = Some(new_value);
41268 self
41269 }
41270
41271 /// Set any additional parameter of the query string used in the request.
41272 /// It should be used to set parameters which are not yet available through their own
41273 /// setters.
41274 ///
41275 /// Please note that this method must not be used to set any of the known parameters
41276 /// which have their own setter method. If done anyway, the request will fail.
41277 ///
41278 /// # Additional Parameters
41279 ///
41280 /// * *$.xgafv* (query-string) - V1 error format.
41281 /// * *access_token* (query-string) - OAuth access token.
41282 /// * *alt* (query-string) - Data format for response.
41283 /// * *callback* (query-string) - JSONP
41284 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
41285 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
41286 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
41287 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
41288 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
41289 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
41290 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
41291 pub fn param<T>(
41292 mut self,
41293 name: T,
41294 value: T,
41295 ) -> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C>
41296 where
41297 T: AsRef<str>,
41298 {
41299 self._additional_params
41300 .insert(name.as_ref().to_string(), value.as_ref().to_string());
41301 self
41302 }
41303
41304 /// Identifies the authorization scope for the method you are building.
41305 ///
41306 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
41307 /// [`Scope::CloudHealthcare`].
41308 ///
41309 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
41310 /// tokens for more than one scope.
41311 ///
41312 /// Usually there is more than one suitable scope to authorize an operation, some of which may
41313 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
41314 /// sufficient, a read-write scope will do as well.
41315 pub fn add_scope<St>(
41316 mut self,
41317 scope: St,
41318 ) -> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C>
41319 where
41320 St: AsRef<str>,
41321 {
41322 self._scopes.insert(String::from(scope.as_ref()));
41323 self
41324 }
41325 /// Identifies the authorization scope(s) for the method you are building.
41326 ///
41327 /// See [`Self::add_scope()`] for details.
41328 pub fn add_scopes<I, St>(
41329 mut self,
41330 scopes: I,
41331 ) -> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C>
41332 where
41333 I: IntoIterator<Item = St>,
41334 St: AsRef<str>,
41335 {
41336 self._scopes
41337 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
41338 self
41339 }
41340
41341 /// Removes all scopes, and no default scope will be used either.
41342 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
41343 /// for details).
41344 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StoreMessageIngestCall<'a, C> {
41345 self._scopes.clear();
41346 self
41347 }
41348}
41349
41350/// Lists all the messages in the given HL7v2 store with support for filtering. Note: HL7v2 messages are indexed asynchronously, so there might be a slight delay between the time a message is created and when it can be found through a filter.
41351///
41352/// A builder for the *locations.datasets.hl7V2Stores.messages.list* method supported by a *project* resource.
41353/// It is not used directly, but through a [`ProjectMethods`] instance.
41354///
41355/// # Example
41356///
41357/// Instantiate a resource method builder
41358///
41359/// ```test_harness,no_run
41360/// # extern crate hyper;
41361/// # extern crate hyper_rustls;
41362/// # extern crate google_healthcare1 as healthcare1;
41363/// # async fn dox() {
41364/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
41365///
41366/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
41367/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
41368/// # secret,
41369/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
41370/// # ).build().await.unwrap();
41371///
41372/// # let client = hyper_util::client::legacy::Client::builder(
41373/// # hyper_util::rt::TokioExecutor::new()
41374/// # )
41375/// # .build(
41376/// # hyper_rustls::HttpsConnectorBuilder::new()
41377/// # .with_native_roots()
41378/// # .unwrap()
41379/// # .https_or_http()
41380/// # .enable_http1()
41381/// # .build()
41382/// # );
41383/// # let mut hub = CloudHealthcare::new(client, auth);
41384/// // You can configure optional parameters by calling the respective setters at will, and
41385/// // execute the final call using `doit()`.
41386/// // Values shown here are possibly random and not representative !
41387/// let result = hub.projects().locations_datasets_hl7_v2_stores_messages_list("parent")
41388/// .view("duo")
41389/// .page_token("sit")
41390/// .page_size(-83)
41391/// .order_by("et")
41392/// .filter("rebum.")
41393/// .doit().await;
41394/// # }
41395/// ```
41396pub struct ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C>
41397where
41398 C: 'a,
41399{
41400 hub: &'a CloudHealthcare<C>,
41401 _parent: String,
41402 _view: Option<String>,
41403 _page_token: Option<String>,
41404 _page_size: Option<i32>,
41405 _order_by: Option<String>,
41406 _filter: Option<String>,
41407 _delegate: Option<&'a mut dyn common::Delegate>,
41408 _additional_params: HashMap<String, String>,
41409 _scopes: BTreeSet<String>,
41410}
41411
41412impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C> {}
41413
41414impl<'a, C> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C>
41415where
41416 C: common::Connector,
41417{
41418 /// Perform the operation you have build so far.
41419 pub async fn doit(mut self) -> common::Result<(common::Response, ListMessagesResponse)> {
41420 use std::borrow::Cow;
41421 use std::io::{Read, Seek};
41422
41423 use common::{url::Params, ToParts};
41424 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
41425
41426 let mut dd = common::DefaultDelegate;
41427 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
41428 dlg.begin(common::MethodInfo {
41429 id: "healthcare.projects.locations.datasets.hl7V2Stores.messages.list",
41430 http_method: hyper::Method::GET,
41431 });
41432
41433 for &field in [
41434 "alt",
41435 "parent",
41436 "view",
41437 "pageToken",
41438 "pageSize",
41439 "orderBy",
41440 "filter",
41441 ]
41442 .iter()
41443 {
41444 if self._additional_params.contains_key(field) {
41445 dlg.finished(false);
41446 return Err(common::Error::FieldClash(field));
41447 }
41448 }
41449
41450 let mut params = Params::with_capacity(8 + self._additional_params.len());
41451 params.push("parent", self._parent);
41452 if let Some(value) = self._view.as_ref() {
41453 params.push("view", value);
41454 }
41455 if let Some(value) = self._page_token.as_ref() {
41456 params.push("pageToken", value);
41457 }
41458 if let Some(value) = self._page_size.as_ref() {
41459 params.push("pageSize", value.to_string());
41460 }
41461 if let Some(value) = self._order_by.as_ref() {
41462 params.push("orderBy", value);
41463 }
41464 if let Some(value) = self._filter.as_ref() {
41465 params.push("filter", value);
41466 }
41467
41468 params.extend(self._additional_params.iter());
41469
41470 params.push("alt", "json");
41471 let mut url = self.hub._base_url.clone() + "v1/{+parent}/messages";
41472 if self._scopes.is_empty() {
41473 self._scopes
41474 .insert(Scope::CloudHealthcare.as_ref().to_string());
41475 }
41476
41477 #[allow(clippy::single_element_loop)]
41478 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
41479 url = params.uri_replacement(url, param_name, find_this, true);
41480 }
41481 {
41482 let to_remove = ["parent"];
41483 params.remove_params(&to_remove);
41484 }
41485
41486 let url = params.parse_with_url(&url);
41487
41488 loop {
41489 let token = match self
41490 .hub
41491 .auth
41492 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
41493 .await
41494 {
41495 Ok(token) => token,
41496 Err(e) => match dlg.token(e) {
41497 Ok(token) => token,
41498 Err(e) => {
41499 dlg.finished(false);
41500 return Err(common::Error::MissingToken(e));
41501 }
41502 },
41503 };
41504 let mut req_result = {
41505 let client = &self.hub.client;
41506 dlg.pre_request();
41507 let mut req_builder = hyper::Request::builder()
41508 .method(hyper::Method::GET)
41509 .uri(url.as_str())
41510 .header(USER_AGENT, self.hub._user_agent.clone());
41511
41512 if let Some(token) = token.as_ref() {
41513 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
41514 }
41515
41516 let request = req_builder
41517 .header(CONTENT_LENGTH, 0_u64)
41518 .body(common::to_body::<String>(None));
41519
41520 client.request(request.unwrap()).await
41521 };
41522
41523 match req_result {
41524 Err(err) => {
41525 if let common::Retry::After(d) = dlg.http_error(&err) {
41526 sleep(d).await;
41527 continue;
41528 }
41529 dlg.finished(false);
41530 return Err(common::Error::HttpError(err));
41531 }
41532 Ok(res) => {
41533 let (mut parts, body) = res.into_parts();
41534 let mut body = common::Body::new(body);
41535 if !parts.status.is_success() {
41536 let bytes = common::to_bytes(body).await.unwrap_or_default();
41537 let error = serde_json::from_str(&common::to_string(&bytes));
41538 let response = common::to_response(parts, bytes.into());
41539
41540 if let common::Retry::After(d) =
41541 dlg.http_failure(&response, error.as_ref().ok())
41542 {
41543 sleep(d).await;
41544 continue;
41545 }
41546
41547 dlg.finished(false);
41548
41549 return Err(match error {
41550 Ok(value) => common::Error::BadRequest(value),
41551 _ => common::Error::Failure(response),
41552 });
41553 }
41554 let response = {
41555 let bytes = common::to_bytes(body).await.unwrap_or_default();
41556 let encoded = common::to_string(&bytes);
41557 match serde_json::from_str(&encoded) {
41558 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
41559 Err(error) => {
41560 dlg.response_json_decode_error(&encoded, &error);
41561 return Err(common::Error::JsonDecodeError(
41562 encoded.to_string(),
41563 error,
41564 ));
41565 }
41566 }
41567 };
41568
41569 dlg.finished(true);
41570 return Ok(response);
41571 }
41572 }
41573 }
41574 }
41575
41576 /// Required. Name of the HL7v2 store to retrieve messages from.
41577 ///
41578 /// Sets the *parent* path property to the given value.
41579 ///
41580 /// Even though the property as already been set when instantiating this call,
41581 /// we provide this method for API completeness.
41582 pub fn parent(
41583 mut self,
41584 new_value: &str,
41585 ) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C> {
41586 self._parent = new_value.to_string();
41587 self
41588 }
41589 /// Specifies the parts of the Message to return in the response. When unspecified, equivalent to BASIC. Setting this to anything other than BASIC with a `page_size` larger than the default can generate a large response, which impacts the performance of this method.
41590 ///
41591 /// Sets the *view* query property to the given value.
41592 pub fn view(
41593 mut self,
41594 new_value: &str,
41595 ) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C> {
41596 self._view = Some(new_value.to_string());
41597 self
41598 }
41599 /// The next_page_token value returned from the previous List request, if any.
41600 ///
41601 /// Sets the *page token* query property to the given value.
41602 pub fn page_token(
41603 mut self,
41604 new_value: &str,
41605 ) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C> {
41606 self._page_token = Some(new_value.to_string());
41607 self
41608 }
41609 /// Limit on the number of messages to return in a single response. If not specified, 100 is used. May not be larger than 1000.
41610 ///
41611 /// Sets the *page size* query property to the given value.
41612 pub fn page_size(
41613 mut self,
41614 new_value: i32,
41615 ) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C> {
41616 self._page_size = Some(new_value);
41617 self
41618 }
41619 /// Orders messages returned by the specified order_by clause. Syntax: https://cloud.google.com/apis/design/design_patterns#sorting_order Fields available for ordering are: * `send_time`
41620 ///
41621 /// Sets the *order by* query property to the given value.
41622 pub fn order_by(
41623 mut self,
41624 new_value: &str,
41625 ) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C> {
41626 self._order_by = Some(new_value.to_string());
41627 self
41628 }
41629 /// Restricts messages returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. Fields/functions available for filtering are: * `message_type`, from the MSH-9.1 field. For example, `NOT message_type = "ADT"`. * `send_date` or `sendDate`, the YYYY-MM-DD date the message was sent in the dataset's time_zone, from the MSH-7 segment. For example, `send_date < "2017-01-02"`. * `send_time`, the timestamp when the message was sent, using the RFC3339 time format for comparisons, from the MSH-7 segment. For example, `send_time < "2017-01-02T00:00:00-05:00"`. * `create_time`, the timestamp when the message was created in the HL7v2 store. Use the RFC3339 time format for comparisons. For example, `create_time < "2017-01-02T00:00:00-05:00"`. * `send_facility`, the care center that the message came from, from the MSH-4 segment. For example, `send_facility = "ABC"`. * `PatientId(value, type)`, which matches if the message lists a patient having an ID of the given value and type in the PID-2, PID-3, or PID-4 segments. For example, `PatientId("123456", "MRN")`. * `labels.x`, a string value of the label with key `x` as set using the Message.labels map. For example, `labels."priority"="high"`. The operator `:*` can be used to assert the existence of a label. For example, `labels."priority":*`.
41630 ///
41631 /// Sets the *filter* query property to the given value.
41632 pub fn filter(
41633 mut self,
41634 new_value: &str,
41635 ) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C> {
41636 self._filter = Some(new_value.to_string());
41637 self
41638 }
41639 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
41640 /// while executing the actual API request.
41641 ///
41642 /// ````text
41643 /// It should be used to handle progress information, and to implement a certain level of resilience.
41644 /// ````
41645 ///
41646 /// Sets the *delegate* property to the given value.
41647 pub fn delegate(
41648 mut self,
41649 new_value: &'a mut dyn common::Delegate,
41650 ) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C> {
41651 self._delegate = Some(new_value);
41652 self
41653 }
41654
41655 /// Set any additional parameter of the query string used in the request.
41656 /// It should be used to set parameters which are not yet available through their own
41657 /// setters.
41658 ///
41659 /// Please note that this method must not be used to set any of the known parameters
41660 /// which have their own setter method. If done anyway, the request will fail.
41661 ///
41662 /// # Additional Parameters
41663 ///
41664 /// * *$.xgafv* (query-string) - V1 error format.
41665 /// * *access_token* (query-string) - OAuth access token.
41666 /// * *alt* (query-string) - Data format for response.
41667 /// * *callback* (query-string) - JSONP
41668 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
41669 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
41670 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
41671 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
41672 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
41673 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
41674 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
41675 pub fn param<T>(
41676 mut self,
41677 name: T,
41678 value: T,
41679 ) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C>
41680 where
41681 T: AsRef<str>,
41682 {
41683 self._additional_params
41684 .insert(name.as_ref().to_string(), value.as_ref().to_string());
41685 self
41686 }
41687
41688 /// Identifies the authorization scope for the method you are building.
41689 ///
41690 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
41691 /// [`Scope::CloudHealthcare`].
41692 ///
41693 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
41694 /// tokens for more than one scope.
41695 ///
41696 /// Usually there is more than one suitable scope to authorize an operation, some of which may
41697 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
41698 /// sufficient, a read-write scope will do as well.
41699 pub fn add_scope<St>(
41700 mut self,
41701 scope: St,
41702 ) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C>
41703 where
41704 St: AsRef<str>,
41705 {
41706 self._scopes.insert(String::from(scope.as_ref()));
41707 self
41708 }
41709 /// Identifies the authorization scope(s) for the method you are building.
41710 ///
41711 /// See [`Self::add_scope()`] for details.
41712 pub fn add_scopes<I, St>(
41713 mut self,
41714 scopes: I,
41715 ) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C>
41716 where
41717 I: IntoIterator<Item = St>,
41718 St: AsRef<str>,
41719 {
41720 self._scopes
41721 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
41722 self
41723 }
41724
41725 /// Removes all scopes, and no default scope will be used either.
41726 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
41727 /// for details).
41728 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StoreMessageListCall<'a, C> {
41729 self._scopes.clear();
41730 self
41731 }
41732}
41733
41734/// Update the message. The contents of the message in Message.data and data extracted from the contents such as Message.create_time cannot be altered. Only the Message.labels field is allowed to be updated. The labels in the request are merged with the existing set of labels. Existing labels with the same keys are updated.
41735///
41736/// A builder for the *locations.datasets.hl7V2Stores.messages.patch* method supported by a *project* resource.
41737/// It is not used directly, but through a [`ProjectMethods`] instance.
41738///
41739/// # Example
41740///
41741/// Instantiate a resource method builder
41742///
41743/// ```test_harness,no_run
41744/// # extern crate hyper;
41745/// # extern crate hyper_rustls;
41746/// # extern crate google_healthcare1 as healthcare1;
41747/// use healthcare1::api::Message;
41748/// # async fn dox() {
41749/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
41750///
41751/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
41752/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
41753/// # secret,
41754/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
41755/// # ).build().await.unwrap();
41756///
41757/// # let client = hyper_util::client::legacy::Client::builder(
41758/// # hyper_util::rt::TokioExecutor::new()
41759/// # )
41760/// # .build(
41761/// # hyper_rustls::HttpsConnectorBuilder::new()
41762/// # .with_native_roots()
41763/// # .unwrap()
41764/// # .https_or_http()
41765/// # .enable_http1()
41766/// # .build()
41767/// # );
41768/// # let mut hub = CloudHealthcare::new(client, auth);
41769/// // As the method needs a request, you would usually fill it with the desired information
41770/// // into the respective structure. Some of the parts shown here might not be applicable !
41771/// // Values shown here are possibly random and not representative !
41772/// let mut req = Message::default();
41773///
41774/// // You can configure optional parameters by calling the respective setters at will, and
41775/// // execute the final call using `doit()`.
41776/// // Values shown here are possibly random and not representative !
41777/// let result = hub.projects().locations_datasets_hl7_v2_stores_messages_patch(req, "name")
41778/// .update_mask(FieldMask::new::<&str>(&[]))
41779/// .doit().await;
41780/// # }
41781/// ```
41782pub struct ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C>
41783where
41784 C: 'a,
41785{
41786 hub: &'a CloudHealthcare<C>,
41787 _request: Message,
41788 _name: String,
41789 _update_mask: Option<common::FieldMask>,
41790 _delegate: Option<&'a mut dyn common::Delegate>,
41791 _additional_params: HashMap<String, String>,
41792 _scopes: BTreeSet<String>,
41793}
41794
41795impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C> {}
41796
41797impl<'a, C> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C>
41798where
41799 C: common::Connector,
41800{
41801 /// Perform the operation you have build so far.
41802 pub async fn doit(mut self) -> common::Result<(common::Response, Message)> {
41803 use std::borrow::Cow;
41804 use std::io::{Read, Seek};
41805
41806 use common::{url::Params, ToParts};
41807 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
41808
41809 let mut dd = common::DefaultDelegate;
41810 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
41811 dlg.begin(common::MethodInfo {
41812 id: "healthcare.projects.locations.datasets.hl7V2Stores.messages.patch",
41813 http_method: hyper::Method::PATCH,
41814 });
41815
41816 for &field in ["alt", "name", "updateMask"].iter() {
41817 if self._additional_params.contains_key(field) {
41818 dlg.finished(false);
41819 return Err(common::Error::FieldClash(field));
41820 }
41821 }
41822
41823 let mut params = Params::with_capacity(5 + self._additional_params.len());
41824 params.push("name", self._name);
41825 if let Some(value) = self._update_mask.as_ref() {
41826 params.push("updateMask", value.to_string());
41827 }
41828
41829 params.extend(self._additional_params.iter());
41830
41831 params.push("alt", "json");
41832 let mut url = self.hub._base_url.clone() + "v1/{+name}";
41833 if self._scopes.is_empty() {
41834 self._scopes
41835 .insert(Scope::CloudHealthcare.as_ref().to_string());
41836 }
41837
41838 #[allow(clippy::single_element_loop)]
41839 for &(find_this, param_name) in [("{+name}", "name")].iter() {
41840 url = params.uri_replacement(url, param_name, find_this, true);
41841 }
41842 {
41843 let to_remove = ["name"];
41844 params.remove_params(&to_remove);
41845 }
41846
41847 let url = params.parse_with_url(&url);
41848
41849 let mut json_mime_type = mime::APPLICATION_JSON;
41850 let mut request_value_reader = {
41851 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
41852 common::remove_json_null_values(&mut value);
41853 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
41854 serde_json::to_writer(&mut dst, &value).unwrap();
41855 dst
41856 };
41857 let request_size = request_value_reader
41858 .seek(std::io::SeekFrom::End(0))
41859 .unwrap();
41860 request_value_reader
41861 .seek(std::io::SeekFrom::Start(0))
41862 .unwrap();
41863
41864 loop {
41865 let token = match self
41866 .hub
41867 .auth
41868 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
41869 .await
41870 {
41871 Ok(token) => token,
41872 Err(e) => match dlg.token(e) {
41873 Ok(token) => token,
41874 Err(e) => {
41875 dlg.finished(false);
41876 return Err(common::Error::MissingToken(e));
41877 }
41878 },
41879 };
41880 request_value_reader
41881 .seek(std::io::SeekFrom::Start(0))
41882 .unwrap();
41883 let mut req_result = {
41884 let client = &self.hub.client;
41885 dlg.pre_request();
41886 let mut req_builder = hyper::Request::builder()
41887 .method(hyper::Method::PATCH)
41888 .uri(url.as_str())
41889 .header(USER_AGENT, self.hub._user_agent.clone());
41890
41891 if let Some(token) = token.as_ref() {
41892 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
41893 }
41894
41895 let request = req_builder
41896 .header(CONTENT_TYPE, json_mime_type.to_string())
41897 .header(CONTENT_LENGTH, request_size as u64)
41898 .body(common::to_body(
41899 request_value_reader.get_ref().clone().into(),
41900 ));
41901
41902 client.request(request.unwrap()).await
41903 };
41904
41905 match req_result {
41906 Err(err) => {
41907 if let common::Retry::After(d) = dlg.http_error(&err) {
41908 sleep(d).await;
41909 continue;
41910 }
41911 dlg.finished(false);
41912 return Err(common::Error::HttpError(err));
41913 }
41914 Ok(res) => {
41915 let (mut parts, body) = res.into_parts();
41916 let mut body = common::Body::new(body);
41917 if !parts.status.is_success() {
41918 let bytes = common::to_bytes(body).await.unwrap_or_default();
41919 let error = serde_json::from_str(&common::to_string(&bytes));
41920 let response = common::to_response(parts, bytes.into());
41921
41922 if let common::Retry::After(d) =
41923 dlg.http_failure(&response, error.as_ref().ok())
41924 {
41925 sleep(d).await;
41926 continue;
41927 }
41928
41929 dlg.finished(false);
41930
41931 return Err(match error {
41932 Ok(value) => common::Error::BadRequest(value),
41933 _ => common::Error::Failure(response),
41934 });
41935 }
41936 let response = {
41937 let bytes = common::to_bytes(body).await.unwrap_or_default();
41938 let encoded = common::to_string(&bytes);
41939 match serde_json::from_str(&encoded) {
41940 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
41941 Err(error) => {
41942 dlg.response_json_decode_error(&encoded, &error);
41943 return Err(common::Error::JsonDecodeError(
41944 encoded.to_string(),
41945 error,
41946 ));
41947 }
41948 }
41949 };
41950
41951 dlg.finished(true);
41952 return Ok(response);
41953 }
41954 }
41955 }
41956 }
41957
41958 ///
41959 /// Sets the *request* property to the given value.
41960 ///
41961 /// Even though the property as already been set when instantiating this call,
41962 /// we provide this method for API completeness.
41963 pub fn request(
41964 mut self,
41965 new_value: Message,
41966 ) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C> {
41967 self._request = new_value;
41968 self
41969 }
41970 /// Output only. Resource name of the Message, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7V2Stores/{hl7_v2_store_id}/messages/{message_id}`. Assigned by the server.
41971 ///
41972 /// Sets the *name* path property to the given value.
41973 ///
41974 /// Even though the property as already been set when instantiating this call,
41975 /// we provide this method for API completeness.
41976 pub fn name(
41977 mut self,
41978 new_value: &str,
41979 ) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C> {
41980 self._name = new_value.to_string();
41981 self
41982 }
41983 /// Required. The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
41984 ///
41985 /// Sets the *update mask* query property to the given value.
41986 pub fn update_mask(
41987 mut self,
41988 new_value: common::FieldMask,
41989 ) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C> {
41990 self._update_mask = Some(new_value);
41991 self
41992 }
41993 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
41994 /// while executing the actual API request.
41995 ///
41996 /// ````text
41997 /// It should be used to handle progress information, and to implement a certain level of resilience.
41998 /// ````
41999 ///
42000 /// Sets the *delegate* property to the given value.
42001 pub fn delegate(
42002 mut self,
42003 new_value: &'a mut dyn common::Delegate,
42004 ) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C> {
42005 self._delegate = Some(new_value);
42006 self
42007 }
42008
42009 /// Set any additional parameter of the query string used in the request.
42010 /// It should be used to set parameters which are not yet available through their own
42011 /// setters.
42012 ///
42013 /// Please note that this method must not be used to set any of the known parameters
42014 /// which have their own setter method. If done anyway, the request will fail.
42015 ///
42016 /// # Additional Parameters
42017 ///
42018 /// * *$.xgafv* (query-string) - V1 error format.
42019 /// * *access_token* (query-string) - OAuth access token.
42020 /// * *alt* (query-string) - Data format for response.
42021 /// * *callback* (query-string) - JSONP
42022 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
42023 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
42024 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
42025 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
42026 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
42027 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
42028 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
42029 pub fn param<T>(
42030 mut self,
42031 name: T,
42032 value: T,
42033 ) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C>
42034 where
42035 T: AsRef<str>,
42036 {
42037 self._additional_params
42038 .insert(name.as_ref().to_string(), value.as_ref().to_string());
42039 self
42040 }
42041
42042 /// Identifies the authorization scope for the method you are building.
42043 ///
42044 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
42045 /// [`Scope::CloudHealthcare`].
42046 ///
42047 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
42048 /// tokens for more than one scope.
42049 ///
42050 /// Usually there is more than one suitable scope to authorize an operation, some of which may
42051 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
42052 /// sufficient, a read-write scope will do as well.
42053 pub fn add_scope<St>(
42054 mut self,
42055 scope: St,
42056 ) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C>
42057 where
42058 St: AsRef<str>,
42059 {
42060 self._scopes.insert(String::from(scope.as_ref()));
42061 self
42062 }
42063 /// Identifies the authorization scope(s) for the method you are building.
42064 ///
42065 /// See [`Self::add_scope()`] for details.
42066 pub fn add_scopes<I, St>(
42067 mut self,
42068 scopes: I,
42069 ) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C>
42070 where
42071 I: IntoIterator<Item = St>,
42072 St: AsRef<str>,
42073 {
42074 self._scopes
42075 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
42076 self
42077 }
42078
42079 /// Removes all scopes, and no default scope will be used either.
42080 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
42081 /// for details).
42082 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StoreMessagePatchCall<'a, C> {
42083 self._scopes.clear();
42084 self
42085 }
42086}
42087
42088/// Creates a new HL7v2 store within the parent dataset.
42089///
42090/// A builder for the *locations.datasets.hl7V2Stores.create* method supported by a *project* resource.
42091/// It is not used directly, but through a [`ProjectMethods`] instance.
42092///
42093/// # Example
42094///
42095/// Instantiate a resource method builder
42096///
42097/// ```test_harness,no_run
42098/// # extern crate hyper;
42099/// # extern crate hyper_rustls;
42100/// # extern crate google_healthcare1 as healthcare1;
42101/// use healthcare1::api::Hl7V2Store;
42102/// # async fn dox() {
42103/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
42104///
42105/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
42106/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
42107/// # secret,
42108/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
42109/// # ).build().await.unwrap();
42110///
42111/// # let client = hyper_util::client::legacy::Client::builder(
42112/// # hyper_util::rt::TokioExecutor::new()
42113/// # )
42114/// # .build(
42115/// # hyper_rustls::HttpsConnectorBuilder::new()
42116/// # .with_native_roots()
42117/// # .unwrap()
42118/// # .https_or_http()
42119/// # .enable_http1()
42120/// # .build()
42121/// # );
42122/// # let mut hub = CloudHealthcare::new(client, auth);
42123/// // As the method needs a request, you would usually fill it with the desired information
42124/// // into the respective structure. Some of the parts shown here might not be applicable !
42125/// // Values shown here are possibly random and not representative !
42126/// let mut req = Hl7V2Store::default();
42127///
42128/// // You can configure optional parameters by calling the respective setters at will, and
42129/// // execute the final call using `doit()`.
42130/// // Values shown here are possibly random and not representative !
42131/// let result = hub.projects().locations_datasets_hl7_v2_stores_create(req, "parent")
42132/// .hl7_v2_store_id("justo")
42133/// .doit().await;
42134/// # }
42135/// ```
42136pub struct ProjectLocationDatasetHl7V2StoreCreateCall<'a, C>
42137where
42138 C: 'a,
42139{
42140 hub: &'a CloudHealthcare<C>,
42141 _request: Hl7V2Store,
42142 _parent: String,
42143 _hl7_v2_store_id: Option<String>,
42144 _delegate: Option<&'a mut dyn common::Delegate>,
42145 _additional_params: HashMap<String, String>,
42146 _scopes: BTreeSet<String>,
42147}
42148
42149impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreCreateCall<'a, C> {}
42150
42151impl<'a, C> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C>
42152where
42153 C: common::Connector,
42154{
42155 /// Perform the operation you have build so far.
42156 pub async fn doit(mut self) -> common::Result<(common::Response, Hl7V2Store)> {
42157 use std::borrow::Cow;
42158 use std::io::{Read, Seek};
42159
42160 use common::{url::Params, ToParts};
42161 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
42162
42163 let mut dd = common::DefaultDelegate;
42164 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
42165 dlg.begin(common::MethodInfo {
42166 id: "healthcare.projects.locations.datasets.hl7V2Stores.create",
42167 http_method: hyper::Method::POST,
42168 });
42169
42170 for &field in ["alt", "parent", "hl7V2StoreId"].iter() {
42171 if self._additional_params.contains_key(field) {
42172 dlg.finished(false);
42173 return Err(common::Error::FieldClash(field));
42174 }
42175 }
42176
42177 let mut params = Params::with_capacity(5 + self._additional_params.len());
42178 params.push("parent", self._parent);
42179 if let Some(value) = self._hl7_v2_store_id.as_ref() {
42180 params.push("hl7V2StoreId", value);
42181 }
42182
42183 params.extend(self._additional_params.iter());
42184
42185 params.push("alt", "json");
42186 let mut url = self.hub._base_url.clone() + "v1/{+parent}/hl7V2Stores";
42187 if self._scopes.is_empty() {
42188 self._scopes
42189 .insert(Scope::CloudHealthcare.as_ref().to_string());
42190 }
42191
42192 #[allow(clippy::single_element_loop)]
42193 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
42194 url = params.uri_replacement(url, param_name, find_this, true);
42195 }
42196 {
42197 let to_remove = ["parent"];
42198 params.remove_params(&to_remove);
42199 }
42200
42201 let url = params.parse_with_url(&url);
42202
42203 let mut json_mime_type = mime::APPLICATION_JSON;
42204 let mut request_value_reader = {
42205 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
42206 common::remove_json_null_values(&mut value);
42207 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
42208 serde_json::to_writer(&mut dst, &value).unwrap();
42209 dst
42210 };
42211 let request_size = request_value_reader
42212 .seek(std::io::SeekFrom::End(0))
42213 .unwrap();
42214 request_value_reader
42215 .seek(std::io::SeekFrom::Start(0))
42216 .unwrap();
42217
42218 loop {
42219 let token = match self
42220 .hub
42221 .auth
42222 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
42223 .await
42224 {
42225 Ok(token) => token,
42226 Err(e) => match dlg.token(e) {
42227 Ok(token) => token,
42228 Err(e) => {
42229 dlg.finished(false);
42230 return Err(common::Error::MissingToken(e));
42231 }
42232 },
42233 };
42234 request_value_reader
42235 .seek(std::io::SeekFrom::Start(0))
42236 .unwrap();
42237 let mut req_result = {
42238 let client = &self.hub.client;
42239 dlg.pre_request();
42240 let mut req_builder = hyper::Request::builder()
42241 .method(hyper::Method::POST)
42242 .uri(url.as_str())
42243 .header(USER_AGENT, self.hub._user_agent.clone());
42244
42245 if let Some(token) = token.as_ref() {
42246 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
42247 }
42248
42249 let request = req_builder
42250 .header(CONTENT_TYPE, json_mime_type.to_string())
42251 .header(CONTENT_LENGTH, request_size as u64)
42252 .body(common::to_body(
42253 request_value_reader.get_ref().clone().into(),
42254 ));
42255
42256 client.request(request.unwrap()).await
42257 };
42258
42259 match req_result {
42260 Err(err) => {
42261 if let common::Retry::After(d) = dlg.http_error(&err) {
42262 sleep(d).await;
42263 continue;
42264 }
42265 dlg.finished(false);
42266 return Err(common::Error::HttpError(err));
42267 }
42268 Ok(res) => {
42269 let (mut parts, body) = res.into_parts();
42270 let mut body = common::Body::new(body);
42271 if !parts.status.is_success() {
42272 let bytes = common::to_bytes(body).await.unwrap_or_default();
42273 let error = serde_json::from_str(&common::to_string(&bytes));
42274 let response = common::to_response(parts, bytes.into());
42275
42276 if let common::Retry::After(d) =
42277 dlg.http_failure(&response, error.as_ref().ok())
42278 {
42279 sleep(d).await;
42280 continue;
42281 }
42282
42283 dlg.finished(false);
42284
42285 return Err(match error {
42286 Ok(value) => common::Error::BadRequest(value),
42287 _ => common::Error::Failure(response),
42288 });
42289 }
42290 let response = {
42291 let bytes = common::to_bytes(body).await.unwrap_or_default();
42292 let encoded = common::to_string(&bytes);
42293 match serde_json::from_str(&encoded) {
42294 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
42295 Err(error) => {
42296 dlg.response_json_decode_error(&encoded, &error);
42297 return Err(common::Error::JsonDecodeError(
42298 encoded.to_string(),
42299 error,
42300 ));
42301 }
42302 }
42303 };
42304
42305 dlg.finished(true);
42306 return Ok(response);
42307 }
42308 }
42309 }
42310 }
42311
42312 ///
42313 /// Sets the *request* property to the given value.
42314 ///
42315 /// Even though the property as already been set when instantiating this call,
42316 /// we provide this method for API completeness.
42317 pub fn request(
42318 mut self,
42319 new_value: Hl7V2Store,
42320 ) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C> {
42321 self._request = new_value;
42322 self
42323 }
42324 /// Required. The name of the dataset this HL7v2 store belongs to.
42325 ///
42326 /// Sets the *parent* path property to the given value.
42327 ///
42328 /// Even though the property as already been set when instantiating this call,
42329 /// we provide this method for API completeness.
42330 pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C> {
42331 self._parent = new_value.to_string();
42332 self
42333 }
42334 /// Required. The ID of the HL7v2 store that is being created. The string must match the following regex: `[\p{L}\p{N}_\-\.]{1,256}`.
42335 ///
42336 /// Sets the *hl7 v2 store id* query property to the given value.
42337 pub fn hl7_v2_store_id(
42338 mut self,
42339 new_value: &str,
42340 ) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C> {
42341 self._hl7_v2_store_id = Some(new_value.to_string());
42342 self
42343 }
42344 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
42345 /// while executing the actual API request.
42346 ///
42347 /// ````text
42348 /// It should be used to handle progress information, and to implement a certain level of resilience.
42349 /// ````
42350 ///
42351 /// Sets the *delegate* property to the given value.
42352 pub fn delegate(
42353 mut self,
42354 new_value: &'a mut dyn common::Delegate,
42355 ) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C> {
42356 self._delegate = Some(new_value);
42357 self
42358 }
42359
42360 /// Set any additional parameter of the query string used in the request.
42361 /// It should be used to set parameters which are not yet available through their own
42362 /// setters.
42363 ///
42364 /// Please note that this method must not be used to set any of the known parameters
42365 /// which have their own setter method. If done anyway, the request will fail.
42366 ///
42367 /// # Additional Parameters
42368 ///
42369 /// * *$.xgafv* (query-string) - V1 error format.
42370 /// * *access_token* (query-string) - OAuth access token.
42371 /// * *alt* (query-string) - Data format for response.
42372 /// * *callback* (query-string) - JSONP
42373 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
42374 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
42375 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
42376 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
42377 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
42378 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
42379 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
42380 pub fn param<T>(
42381 mut self,
42382 name: T,
42383 value: T,
42384 ) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C>
42385 where
42386 T: AsRef<str>,
42387 {
42388 self._additional_params
42389 .insert(name.as_ref().to_string(), value.as_ref().to_string());
42390 self
42391 }
42392
42393 /// Identifies the authorization scope for the method you are building.
42394 ///
42395 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
42396 /// [`Scope::CloudHealthcare`].
42397 ///
42398 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
42399 /// tokens for more than one scope.
42400 ///
42401 /// Usually there is more than one suitable scope to authorize an operation, some of which may
42402 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
42403 /// sufficient, a read-write scope will do as well.
42404 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C>
42405 where
42406 St: AsRef<str>,
42407 {
42408 self._scopes.insert(String::from(scope.as_ref()));
42409 self
42410 }
42411 /// Identifies the authorization scope(s) for the method you are building.
42412 ///
42413 /// See [`Self::add_scope()`] for details.
42414 pub fn add_scopes<I, St>(
42415 mut self,
42416 scopes: I,
42417 ) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C>
42418 where
42419 I: IntoIterator<Item = St>,
42420 St: AsRef<str>,
42421 {
42422 self._scopes
42423 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
42424 self
42425 }
42426
42427 /// Removes all scopes, and no default scope will be used either.
42428 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
42429 /// for details).
42430 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StoreCreateCall<'a, C> {
42431 self._scopes.clear();
42432 self
42433 }
42434}
42435
42436/// Deletes the specified HL7v2 store and removes all messages that it contains.
42437///
42438/// A builder for the *locations.datasets.hl7V2Stores.delete* method supported by a *project* resource.
42439/// It is not used directly, but through a [`ProjectMethods`] instance.
42440///
42441/// # Example
42442///
42443/// Instantiate a resource method builder
42444///
42445/// ```test_harness,no_run
42446/// # extern crate hyper;
42447/// # extern crate hyper_rustls;
42448/// # extern crate google_healthcare1 as healthcare1;
42449/// # async fn dox() {
42450/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
42451///
42452/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
42453/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
42454/// # secret,
42455/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
42456/// # ).build().await.unwrap();
42457///
42458/// # let client = hyper_util::client::legacy::Client::builder(
42459/// # hyper_util::rt::TokioExecutor::new()
42460/// # )
42461/// # .build(
42462/// # hyper_rustls::HttpsConnectorBuilder::new()
42463/// # .with_native_roots()
42464/// # .unwrap()
42465/// # .https_or_http()
42466/// # .enable_http1()
42467/// # .build()
42468/// # );
42469/// # let mut hub = CloudHealthcare::new(client, auth);
42470/// // You can configure optional parameters by calling the respective setters at will, and
42471/// // execute the final call using `doit()`.
42472/// // Values shown here are possibly random and not representative !
42473/// let result = hub.projects().locations_datasets_hl7_v2_stores_delete("name")
42474/// .doit().await;
42475/// # }
42476/// ```
42477pub struct ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C>
42478where
42479 C: 'a,
42480{
42481 hub: &'a CloudHealthcare<C>,
42482 _name: String,
42483 _delegate: Option<&'a mut dyn common::Delegate>,
42484 _additional_params: HashMap<String, String>,
42485 _scopes: BTreeSet<String>,
42486}
42487
42488impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C> {}
42489
42490impl<'a, C> ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C>
42491where
42492 C: common::Connector,
42493{
42494 /// Perform the operation you have build so far.
42495 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
42496 use std::borrow::Cow;
42497 use std::io::{Read, Seek};
42498
42499 use common::{url::Params, ToParts};
42500 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
42501
42502 let mut dd = common::DefaultDelegate;
42503 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
42504 dlg.begin(common::MethodInfo {
42505 id: "healthcare.projects.locations.datasets.hl7V2Stores.delete",
42506 http_method: hyper::Method::DELETE,
42507 });
42508
42509 for &field in ["alt", "name"].iter() {
42510 if self._additional_params.contains_key(field) {
42511 dlg.finished(false);
42512 return Err(common::Error::FieldClash(field));
42513 }
42514 }
42515
42516 let mut params = Params::with_capacity(3 + self._additional_params.len());
42517 params.push("name", self._name);
42518
42519 params.extend(self._additional_params.iter());
42520
42521 params.push("alt", "json");
42522 let mut url = self.hub._base_url.clone() + "v1/{+name}";
42523 if self._scopes.is_empty() {
42524 self._scopes
42525 .insert(Scope::CloudHealthcare.as_ref().to_string());
42526 }
42527
42528 #[allow(clippy::single_element_loop)]
42529 for &(find_this, param_name) in [("{+name}", "name")].iter() {
42530 url = params.uri_replacement(url, param_name, find_this, true);
42531 }
42532 {
42533 let to_remove = ["name"];
42534 params.remove_params(&to_remove);
42535 }
42536
42537 let url = params.parse_with_url(&url);
42538
42539 loop {
42540 let token = match self
42541 .hub
42542 .auth
42543 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
42544 .await
42545 {
42546 Ok(token) => token,
42547 Err(e) => match dlg.token(e) {
42548 Ok(token) => token,
42549 Err(e) => {
42550 dlg.finished(false);
42551 return Err(common::Error::MissingToken(e));
42552 }
42553 },
42554 };
42555 let mut req_result = {
42556 let client = &self.hub.client;
42557 dlg.pre_request();
42558 let mut req_builder = hyper::Request::builder()
42559 .method(hyper::Method::DELETE)
42560 .uri(url.as_str())
42561 .header(USER_AGENT, self.hub._user_agent.clone());
42562
42563 if let Some(token) = token.as_ref() {
42564 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
42565 }
42566
42567 let request = req_builder
42568 .header(CONTENT_LENGTH, 0_u64)
42569 .body(common::to_body::<String>(None));
42570
42571 client.request(request.unwrap()).await
42572 };
42573
42574 match req_result {
42575 Err(err) => {
42576 if let common::Retry::After(d) = dlg.http_error(&err) {
42577 sleep(d).await;
42578 continue;
42579 }
42580 dlg.finished(false);
42581 return Err(common::Error::HttpError(err));
42582 }
42583 Ok(res) => {
42584 let (mut parts, body) = res.into_parts();
42585 let mut body = common::Body::new(body);
42586 if !parts.status.is_success() {
42587 let bytes = common::to_bytes(body).await.unwrap_or_default();
42588 let error = serde_json::from_str(&common::to_string(&bytes));
42589 let response = common::to_response(parts, bytes.into());
42590
42591 if let common::Retry::After(d) =
42592 dlg.http_failure(&response, error.as_ref().ok())
42593 {
42594 sleep(d).await;
42595 continue;
42596 }
42597
42598 dlg.finished(false);
42599
42600 return Err(match error {
42601 Ok(value) => common::Error::BadRequest(value),
42602 _ => common::Error::Failure(response),
42603 });
42604 }
42605 let response = {
42606 let bytes = common::to_bytes(body).await.unwrap_or_default();
42607 let encoded = common::to_string(&bytes);
42608 match serde_json::from_str(&encoded) {
42609 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
42610 Err(error) => {
42611 dlg.response_json_decode_error(&encoded, &error);
42612 return Err(common::Error::JsonDecodeError(
42613 encoded.to_string(),
42614 error,
42615 ));
42616 }
42617 }
42618 };
42619
42620 dlg.finished(true);
42621 return Ok(response);
42622 }
42623 }
42624 }
42625 }
42626
42627 /// Required. The resource name of the HL7v2 store to delete.
42628 ///
42629 /// Sets the *name* path property to the given value.
42630 ///
42631 /// Even though the property as already been set when instantiating this call,
42632 /// we provide this method for API completeness.
42633 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C> {
42634 self._name = new_value.to_string();
42635 self
42636 }
42637 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
42638 /// while executing the actual API request.
42639 ///
42640 /// ````text
42641 /// It should be used to handle progress information, and to implement a certain level of resilience.
42642 /// ````
42643 ///
42644 /// Sets the *delegate* property to the given value.
42645 pub fn delegate(
42646 mut self,
42647 new_value: &'a mut dyn common::Delegate,
42648 ) -> ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C> {
42649 self._delegate = Some(new_value);
42650 self
42651 }
42652
42653 /// Set any additional parameter of the query string used in the request.
42654 /// It should be used to set parameters which are not yet available through their own
42655 /// setters.
42656 ///
42657 /// Please note that this method must not be used to set any of the known parameters
42658 /// which have their own setter method. If done anyway, the request will fail.
42659 ///
42660 /// # Additional Parameters
42661 ///
42662 /// * *$.xgafv* (query-string) - V1 error format.
42663 /// * *access_token* (query-string) - OAuth access token.
42664 /// * *alt* (query-string) - Data format for response.
42665 /// * *callback* (query-string) - JSONP
42666 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
42667 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
42668 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
42669 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
42670 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
42671 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
42672 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
42673 pub fn param<T>(
42674 mut self,
42675 name: T,
42676 value: T,
42677 ) -> ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C>
42678 where
42679 T: AsRef<str>,
42680 {
42681 self._additional_params
42682 .insert(name.as_ref().to_string(), value.as_ref().to_string());
42683 self
42684 }
42685
42686 /// Identifies the authorization scope for the method you are building.
42687 ///
42688 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
42689 /// [`Scope::CloudHealthcare`].
42690 ///
42691 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
42692 /// tokens for more than one scope.
42693 ///
42694 /// Usually there is more than one suitable scope to authorize an operation, some of which may
42695 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
42696 /// sufficient, a read-write scope will do as well.
42697 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C>
42698 where
42699 St: AsRef<str>,
42700 {
42701 self._scopes.insert(String::from(scope.as_ref()));
42702 self
42703 }
42704 /// Identifies the authorization scope(s) for the method you are building.
42705 ///
42706 /// See [`Self::add_scope()`] for details.
42707 pub fn add_scopes<I, St>(
42708 mut self,
42709 scopes: I,
42710 ) -> ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C>
42711 where
42712 I: IntoIterator<Item = St>,
42713 St: AsRef<str>,
42714 {
42715 self._scopes
42716 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
42717 self
42718 }
42719
42720 /// Removes all scopes, and no default scope will be used either.
42721 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
42722 /// for details).
42723 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StoreDeleteCall<'a, C> {
42724 self._scopes.clear();
42725 self
42726 }
42727}
42728
42729/// Exports the messages to a destination. To filter messages to be exported, define a filter using the start and end time, relative to the message generation time (MSH.7). This API returns an Operation that can be used to track the status of the job by calling GetOperation. Immediate fatal errors appear in the error field. Otherwise, when the operation finishes, a detailed response of type ExportMessagesResponse is returned in the response field. The metadata field type for this operation is OperationMetadata.
42730///
42731/// A builder for the *locations.datasets.hl7V2Stores.export* method supported by a *project* resource.
42732/// It is not used directly, but through a [`ProjectMethods`] instance.
42733///
42734/// # Example
42735///
42736/// Instantiate a resource method builder
42737///
42738/// ```test_harness,no_run
42739/// # extern crate hyper;
42740/// # extern crate hyper_rustls;
42741/// # extern crate google_healthcare1 as healthcare1;
42742/// use healthcare1::api::ExportMessagesRequest;
42743/// # async fn dox() {
42744/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
42745///
42746/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
42747/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
42748/// # secret,
42749/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
42750/// # ).build().await.unwrap();
42751///
42752/// # let client = hyper_util::client::legacy::Client::builder(
42753/// # hyper_util::rt::TokioExecutor::new()
42754/// # )
42755/// # .build(
42756/// # hyper_rustls::HttpsConnectorBuilder::new()
42757/// # .with_native_roots()
42758/// # .unwrap()
42759/// # .https_or_http()
42760/// # .enable_http1()
42761/// # .build()
42762/// # );
42763/// # let mut hub = CloudHealthcare::new(client, auth);
42764/// // As the method needs a request, you would usually fill it with the desired information
42765/// // into the respective structure. Some of the parts shown here might not be applicable !
42766/// // Values shown here are possibly random and not representative !
42767/// let mut req = ExportMessagesRequest::default();
42768///
42769/// // You can configure optional parameters by calling the respective setters at will, and
42770/// // execute the final call using `doit()`.
42771/// // Values shown here are possibly random and not representative !
42772/// let result = hub.projects().locations_datasets_hl7_v2_stores_export(req, "name")
42773/// .doit().await;
42774/// # }
42775/// ```
42776pub struct ProjectLocationDatasetHl7V2StoreExportCall<'a, C>
42777where
42778 C: 'a,
42779{
42780 hub: &'a CloudHealthcare<C>,
42781 _request: ExportMessagesRequest,
42782 _name: String,
42783 _delegate: Option<&'a mut dyn common::Delegate>,
42784 _additional_params: HashMap<String, String>,
42785 _scopes: BTreeSet<String>,
42786}
42787
42788impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreExportCall<'a, C> {}
42789
42790impl<'a, C> ProjectLocationDatasetHl7V2StoreExportCall<'a, C>
42791where
42792 C: common::Connector,
42793{
42794 /// Perform the operation you have build so far.
42795 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
42796 use std::borrow::Cow;
42797 use std::io::{Read, Seek};
42798
42799 use common::{url::Params, ToParts};
42800 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
42801
42802 let mut dd = common::DefaultDelegate;
42803 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
42804 dlg.begin(common::MethodInfo {
42805 id: "healthcare.projects.locations.datasets.hl7V2Stores.export",
42806 http_method: hyper::Method::POST,
42807 });
42808
42809 for &field in ["alt", "name"].iter() {
42810 if self._additional_params.contains_key(field) {
42811 dlg.finished(false);
42812 return Err(common::Error::FieldClash(field));
42813 }
42814 }
42815
42816 let mut params = Params::with_capacity(4 + self._additional_params.len());
42817 params.push("name", self._name);
42818
42819 params.extend(self._additional_params.iter());
42820
42821 params.push("alt", "json");
42822 let mut url = self.hub._base_url.clone() + "v1/{+name}:export";
42823 if self._scopes.is_empty() {
42824 self._scopes
42825 .insert(Scope::CloudHealthcare.as_ref().to_string());
42826 }
42827
42828 #[allow(clippy::single_element_loop)]
42829 for &(find_this, param_name) in [("{+name}", "name")].iter() {
42830 url = params.uri_replacement(url, param_name, find_this, true);
42831 }
42832 {
42833 let to_remove = ["name"];
42834 params.remove_params(&to_remove);
42835 }
42836
42837 let url = params.parse_with_url(&url);
42838
42839 let mut json_mime_type = mime::APPLICATION_JSON;
42840 let mut request_value_reader = {
42841 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
42842 common::remove_json_null_values(&mut value);
42843 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
42844 serde_json::to_writer(&mut dst, &value).unwrap();
42845 dst
42846 };
42847 let request_size = request_value_reader
42848 .seek(std::io::SeekFrom::End(0))
42849 .unwrap();
42850 request_value_reader
42851 .seek(std::io::SeekFrom::Start(0))
42852 .unwrap();
42853
42854 loop {
42855 let token = match self
42856 .hub
42857 .auth
42858 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
42859 .await
42860 {
42861 Ok(token) => token,
42862 Err(e) => match dlg.token(e) {
42863 Ok(token) => token,
42864 Err(e) => {
42865 dlg.finished(false);
42866 return Err(common::Error::MissingToken(e));
42867 }
42868 },
42869 };
42870 request_value_reader
42871 .seek(std::io::SeekFrom::Start(0))
42872 .unwrap();
42873 let mut req_result = {
42874 let client = &self.hub.client;
42875 dlg.pre_request();
42876 let mut req_builder = hyper::Request::builder()
42877 .method(hyper::Method::POST)
42878 .uri(url.as_str())
42879 .header(USER_AGENT, self.hub._user_agent.clone());
42880
42881 if let Some(token) = token.as_ref() {
42882 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
42883 }
42884
42885 let request = req_builder
42886 .header(CONTENT_TYPE, json_mime_type.to_string())
42887 .header(CONTENT_LENGTH, request_size as u64)
42888 .body(common::to_body(
42889 request_value_reader.get_ref().clone().into(),
42890 ));
42891
42892 client.request(request.unwrap()).await
42893 };
42894
42895 match req_result {
42896 Err(err) => {
42897 if let common::Retry::After(d) = dlg.http_error(&err) {
42898 sleep(d).await;
42899 continue;
42900 }
42901 dlg.finished(false);
42902 return Err(common::Error::HttpError(err));
42903 }
42904 Ok(res) => {
42905 let (mut parts, body) = res.into_parts();
42906 let mut body = common::Body::new(body);
42907 if !parts.status.is_success() {
42908 let bytes = common::to_bytes(body).await.unwrap_or_default();
42909 let error = serde_json::from_str(&common::to_string(&bytes));
42910 let response = common::to_response(parts, bytes.into());
42911
42912 if let common::Retry::After(d) =
42913 dlg.http_failure(&response, error.as_ref().ok())
42914 {
42915 sleep(d).await;
42916 continue;
42917 }
42918
42919 dlg.finished(false);
42920
42921 return Err(match error {
42922 Ok(value) => common::Error::BadRequest(value),
42923 _ => common::Error::Failure(response),
42924 });
42925 }
42926 let response = {
42927 let bytes = common::to_bytes(body).await.unwrap_or_default();
42928 let encoded = common::to_string(&bytes);
42929 match serde_json::from_str(&encoded) {
42930 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
42931 Err(error) => {
42932 dlg.response_json_decode_error(&encoded, &error);
42933 return Err(common::Error::JsonDecodeError(
42934 encoded.to_string(),
42935 error,
42936 ));
42937 }
42938 }
42939 };
42940
42941 dlg.finished(true);
42942 return Ok(response);
42943 }
42944 }
42945 }
42946 }
42947
42948 ///
42949 /// Sets the *request* property to the given value.
42950 ///
42951 /// Even though the property as already been set when instantiating this call,
42952 /// we provide this method for API completeness.
42953 pub fn request(
42954 mut self,
42955 new_value: ExportMessagesRequest,
42956 ) -> ProjectLocationDatasetHl7V2StoreExportCall<'a, C> {
42957 self._request = new_value;
42958 self
42959 }
42960 /// Required. The name of the source HL7v2 store, in the format `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7v2Stores/{hl7v2_store_id}`
42961 ///
42962 /// Sets the *name* path property to the given value.
42963 ///
42964 /// Even though the property as already been set when instantiating this call,
42965 /// we provide this method for API completeness.
42966 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreExportCall<'a, C> {
42967 self._name = new_value.to_string();
42968 self
42969 }
42970 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
42971 /// while executing the actual API request.
42972 ///
42973 /// ````text
42974 /// It should be used to handle progress information, and to implement a certain level of resilience.
42975 /// ````
42976 ///
42977 /// Sets the *delegate* property to the given value.
42978 pub fn delegate(
42979 mut self,
42980 new_value: &'a mut dyn common::Delegate,
42981 ) -> ProjectLocationDatasetHl7V2StoreExportCall<'a, C> {
42982 self._delegate = Some(new_value);
42983 self
42984 }
42985
42986 /// Set any additional parameter of the query string used in the request.
42987 /// It should be used to set parameters which are not yet available through their own
42988 /// setters.
42989 ///
42990 /// Please note that this method must not be used to set any of the known parameters
42991 /// which have their own setter method. If done anyway, the request will fail.
42992 ///
42993 /// # Additional Parameters
42994 ///
42995 /// * *$.xgafv* (query-string) - V1 error format.
42996 /// * *access_token* (query-string) - OAuth access token.
42997 /// * *alt* (query-string) - Data format for response.
42998 /// * *callback* (query-string) - JSONP
42999 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
43000 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
43001 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
43002 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
43003 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
43004 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
43005 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
43006 pub fn param<T>(
43007 mut self,
43008 name: T,
43009 value: T,
43010 ) -> ProjectLocationDatasetHl7V2StoreExportCall<'a, C>
43011 where
43012 T: AsRef<str>,
43013 {
43014 self._additional_params
43015 .insert(name.as_ref().to_string(), value.as_ref().to_string());
43016 self
43017 }
43018
43019 /// Identifies the authorization scope for the method you are building.
43020 ///
43021 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
43022 /// [`Scope::CloudHealthcare`].
43023 ///
43024 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
43025 /// tokens for more than one scope.
43026 ///
43027 /// Usually there is more than one suitable scope to authorize an operation, some of which may
43028 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
43029 /// sufficient, a read-write scope will do as well.
43030 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetHl7V2StoreExportCall<'a, C>
43031 where
43032 St: AsRef<str>,
43033 {
43034 self._scopes.insert(String::from(scope.as_ref()));
43035 self
43036 }
43037 /// Identifies the authorization scope(s) for the method you are building.
43038 ///
43039 /// See [`Self::add_scope()`] for details.
43040 pub fn add_scopes<I, St>(
43041 mut self,
43042 scopes: I,
43043 ) -> ProjectLocationDatasetHl7V2StoreExportCall<'a, C>
43044 where
43045 I: IntoIterator<Item = St>,
43046 St: AsRef<str>,
43047 {
43048 self._scopes
43049 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
43050 self
43051 }
43052
43053 /// Removes all scopes, and no default scope will be used either.
43054 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
43055 /// for details).
43056 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StoreExportCall<'a, C> {
43057 self._scopes.clear();
43058 self
43059 }
43060}
43061
43062/// Gets the specified HL7v2 store.
43063///
43064/// A builder for the *locations.datasets.hl7V2Stores.get* method supported by a *project* resource.
43065/// It is not used directly, but through a [`ProjectMethods`] instance.
43066///
43067/// # Example
43068///
43069/// Instantiate a resource method builder
43070///
43071/// ```test_harness,no_run
43072/// # extern crate hyper;
43073/// # extern crate hyper_rustls;
43074/// # extern crate google_healthcare1 as healthcare1;
43075/// # async fn dox() {
43076/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
43077///
43078/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
43079/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
43080/// # secret,
43081/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
43082/// # ).build().await.unwrap();
43083///
43084/// # let client = hyper_util::client::legacy::Client::builder(
43085/// # hyper_util::rt::TokioExecutor::new()
43086/// # )
43087/// # .build(
43088/// # hyper_rustls::HttpsConnectorBuilder::new()
43089/// # .with_native_roots()
43090/// # .unwrap()
43091/// # .https_or_http()
43092/// # .enable_http1()
43093/// # .build()
43094/// # );
43095/// # let mut hub = CloudHealthcare::new(client, auth);
43096/// // You can configure optional parameters by calling the respective setters at will, and
43097/// // execute the final call using `doit()`.
43098/// // Values shown here are possibly random and not representative !
43099/// let result = hub.projects().locations_datasets_hl7_v2_stores_get("name")
43100/// .doit().await;
43101/// # }
43102/// ```
43103pub struct ProjectLocationDatasetHl7V2StoreGetCall<'a, C>
43104where
43105 C: 'a,
43106{
43107 hub: &'a CloudHealthcare<C>,
43108 _name: String,
43109 _delegate: Option<&'a mut dyn common::Delegate>,
43110 _additional_params: HashMap<String, String>,
43111 _scopes: BTreeSet<String>,
43112}
43113
43114impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreGetCall<'a, C> {}
43115
43116impl<'a, C> ProjectLocationDatasetHl7V2StoreGetCall<'a, C>
43117where
43118 C: common::Connector,
43119{
43120 /// Perform the operation you have build so far.
43121 pub async fn doit(mut self) -> common::Result<(common::Response, Hl7V2Store)> {
43122 use std::borrow::Cow;
43123 use std::io::{Read, Seek};
43124
43125 use common::{url::Params, ToParts};
43126 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
43127
43128 let mut dd = common::DefaultDelegate;
43129 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
43130 dlg.begin(common::MethodInfo {
43131 id: "healthcare.projects.locations.datasets.hl7V2Stores.get",
43132 http_method: hyper::Method::GET,
43133 });
43134
43135 for &field in ["alt", "name"].iter() {
43136 if self._additional_params.contains_key(field) {
43137 dlg.finished(false);
43138 return Err(common::Error::FieldClash(field));
43139 }
43140 }
43141
43142 let mut params = Params::with_capacity(3 + self._additional_params.len());
43143 params.push("name", self._name);
43144
43145 params.extend(self._additional_params.iter());
43146
43147 params.push("alt", "json");
43148 let mut url = self.hub._base_url.clone() + "v1/{+name}";
43149 if self._scopes.is_empty() {
43150 self._scopes
43151 .insert(Scope::CloudHealthcare.as_ref().to_string());
43152 }
43153
43154 #[allow(clippy::single_element_loop)]
43155 for &(find_this, param_name) in [("{+name}", "name")].iter() {
43156 url = params.uri_replacement(url, param_name, find_this, true);
43157 }
43158 {
43159 let to_remove = ["name"];
43160 params.remove_params(&to_remove);
43161 }
43162
43163 let url = params.parse_with_url(&url);
43164
43165 loop {
43166 let token = match self
43167 .hub
43168 .auth
43169 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
43170 .await
43171 {
43172 Ok(token) => token,
43173 Err(e) => match dlg.token(e) {
43174 Ok(token) => token,
43175 Err(e) => {
43176 dlg.finished(false);
43177 return Err(common::Error::MissingToken(e));
43178 }
43179 },
43180 };
43181 let mut req_result = {
43182 let client = &self.hub.client;
43183 dlg.pre_request();
43184 let mut req_builder = hyper::Request::builder()
43185 .method(hyper::Method::GET)
43186 .uri(url.as_str())
43187 .header(USER_AGENT, self.hub._user_agent.clone());
43188
43189 if let Some(token) = token.as_ref() {
43190 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
43191 }
43192
43193 let request = req_builder
43194 .header(CONTENT_LENGTH, 0_u64)
43195 .body(common::to_body::<String>(None));
43196
43197 client.request(request.unwrap()).await
43198 };
43199
43200 match req_result {
43201 Err(err) => {
43202 if let common::Retry::After(d) = dlg.http_error(&err) {
43203 sleep(d).await;
43204 continue;
43205 }
43206 dlg.finished(false);
43207 return Err(common::Error::HttpError(err));
43208 }
43209 Ok(res) => {
43210 let (mut parts, body) = res.into_parts();
43211 let mut body = common::Body::new(body);
43212 if !parts.status.is_success() {
43213 let bytes = common::to_bytes(body).await.unwrap_or_default();
43214 let error = serde_json::from_str(&common::to_string(&bytes));
43215 let response = common::to_response(parts, bytes.into());
43216
43217 if let common::Retry::After(d) =
43218 dlg.http_failure(&response, error.as_ref().ok())
43219 {
43220 sleep(d).await;
43221 continue;
43222 }
43223
43224 dlg.finished(false);
43225
43226 return Err(match error {
43227 Ok(value) => common::Error::BadRequest(value),
43228 _ => common::Error::Failure(response),
43229 });
43230 }
43231 let response = {
43232 let bytes = common::to_bytes(body).await.unwrap_or_default();
43233 let encoded = common::to_string(&bytes);
43234 match serde_json::from_str(&encoded) {
43235 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
43236 Err(error) => {
43237 dlg.response_json_decode_error(&encoded, &error);
43238 return Err(common::Error::JsonDecodeError(
43239 encoded.to_string(),
43240 error,
43241 ));
43242 }
43243 }
43244 };
43245
43246 dlg.finished(true);
43247 return Ok(response);
43248 }
43249 }
43250 }
43251 }
43252
43253 /// Required. The resource name of the HL7v2 store to get.
43254 ///
43255 /// Sets the *name* path property to the given value.
43256 ///
43257 /// Even though the property as already been set when instantiating this call,
43258 /// we provide this method for API completeness.
43259 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreGetCall<'a, C> {
43260 self._name = new_value.to_string();
43261 self
43262 }
43263 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
43264 /// while executing the actual API request.
43265 ///
43266 /// ````text
43267 /// It should be used to handle progress information, and to implement a certain level of resilience.
43268 /// ````
43269 ///
43270 /// Sets the *delegate* property to the given value.
43271 pub fn delegate(
43272 mut self,
43273 new_value: &'a mut dyn common::Delegate,
43274 ) -> ProjectLocationDatasetHl7V2StoreGetCall<'a, C> {
43275 self._delegate = Some(new_value);
43276 self
43277 }
43278
43279 /// Set any additional parameter of the query string used in the request.
43280 /// It should be used to set parameters which are not yet available through their own
43281 /// setters.
43282 ///
43283 /// Please note that this method must not be used to set any of the known parameters
43284 /// which have their own setter method. If done anyway, the request will fail.
43285 ///
43286 /// # Additional Parameters
43287 ///
43288 /// * *$.xgafv* (query-string) - V1 error format.
43289 /// * *access_token* (query-string) - OAuth access token.
43290 /// * *alt* (query-string) - Data format for response.
43291 /// * *callback* (query-string) - JSONP
43292 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
43293 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
43294 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
43295 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
43296 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
43297 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
43298 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
43299 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StoreGetCall<'a, C>
43300 where
43301 T: AsRef<str>,
43302 {
43303 self._additional_params
43304 .insert(name.as_ref().to_string(), value.as_ref().to_string());
43305 self
43306 }
43307
43308 /// Identifies the authorization scope for the method you are building.
43309 ///
43310 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
43311 /// [`Scope::CloudHealthcare`].
43312 ///
43313 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
43314 /// tokens for more than one scope.
43315 ///
43316 /// Usually there is more than one suitable scope to authorize an operation, some of which may
43317 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
43318 /// sufficient, a read-write scope will do as well.
43319 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetHl7V2StoreGetCall<'a, C>
43320 where
43321 St: AsRef<str>,
43322 {
43323 self._scopes.insert(String::from(scope.as_ref()));
43324 self
43325 }
43326 /// Identifies the authorization scope(s) for the method you are building.
43327 ///
43328 /// See [`Self::add_scope()`] for details.
43329 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetHl7V2StoreGetCall<'a, C>
43330 where
43331 I: IntoIterator<Item = St>,
43332 St: AsRef<str>,
43333 {
43334 self._scopes
43335 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
43336 self
43337 }
43338
43339 /// Removes all scopes, and no default scope will be used either.
43340 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
43341 /// for details).
43342 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StoreGetCall<'a, C> {
43343 self._scopes.clear();
43344 self
43345 }
43346}
43347
43348/// Gets metrics associated with the HL7v2 store.
43349///
43350/// A builder for the *locations.datasets.hl7V2Stores.getHL7v2StoreMetrics* method supported by a *project* resource.
43351/// It is not used directly, but through a [`ProjectMethods`] instance.
43352///
43353/// # Example
43354///
43355/// Instantiate a resource method builder
43356///
43357/// ```test_harness,no_run
43358/// # extern crate hyper;
43359/// # extern crate hyper_rustls;
43360/// # extern crate google_healthcare1 as healthcare1;
43361/// # async fn dox() {
43362/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
43363///
43364/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
43365/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
43366/// # secret,
43367/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
43368/// # ).build().await.unwrap();
43369///
43370/// # let client = hyper_util::client::legacy::Client::builder(
43371/// # hyper_util::rt::TokioExecutor::new()
43372/// # )
43373/// # .build(
43374/// # hyper_rustls::HttpsConnectorBuilder::new()
43375/// # .with_native_roots()
43376/// # .unwrap()
43377/// # .https_or_http()
43378/// # .enable_http1()
43379/// # .build()
43380/// # );
43381/// # let mut hub = CloudHealthcare::new(client, auth);
43382/// // You can configure optional parameters by calling the respective setters at will, and
43383/// // execute the final call using `doit()`.
43384/// // Values shown here are possibly random and not representative !
43385/// let result = hub.projects().locations_datasets_hl7_v2_stores_get_hl7v2_store_metrics("name")
43386/// .doit().await;
43387/// # }
43388/// ```
43389pub struct ProjectLocationDatasetHl7V2StoreGetHL7v2StoreMetricCall<'a, C>
43390where
43391 C: 'a,
43392{
43393 hub: &'a CloudHealthcare<C>,
43394 _name: String,
43395 _delegate: Option<&'a mut dyn common::Delegate>,
43396 _additional_params: HashMap<String, String>,
43397 _scopes: BTreeSet<String>,
43398}
43399
43400impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreGetHL7v2StoreMetricCall<'a, C> {}
43401
43402impl<'a, C> ProjectLocationDatasetHl7V2StoreGetHL7v2StoreMetricCall<'a, C>
43403where
43404 C: common::Connector,
43405{
43406 /// Perform the operation you have build so far.
43407 pub async fn doit(mut self) -> common::Result<(common::Response, Hl7V2StoreMetrics)> {
43408 use std::borrow::Cow;
43409 use std::io::{Read, Seek};
43410
43411 use common::{url::Params, ToParts};
43412 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
43413
43414 let mut dd = common::DefaultDelegate;
43415 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
43416 dlg.begin(common::MethodInfo {
43417 id: "healthcare.projects.locations.datasets.hl7V2Stores.getHL7v2StoreMetrics",
43418 http_method: hyper::Method::GET,
43419 });
43420
43421 for &field in ["alt", "name"].iter() {
43422 if self._additional_params.contains_key(field) {
43423 dlg.finished(false);
43424 return Err(common::Error::FieldClash(field));
43425 }
43426 }
43427
43428 let mut params = Params::with_capacity(3 + self._additional_params.len());
43429 params.push("name", self._name);
43430
43431 params.extend(self._additional_params.iter());
43432
43433 params.push("alt", "json");
43434 let mut url = self.hub._base_url.clone() + "v1/{+name}:getHL7v2StoreMetrics";
43435 if self._scopes.is_empty() {
43436 self._scopes
43437 .insert(Scope::CloudHealthcare.as_ref().to_string());
43438 }
43439
43440 #[allow(clippy::single_element_loop)]
43441 for &(find_this, param_name) in [("{+name}", "name")].iter() {
43442 url = params.uri_replacement(url, param_name, find_this, true);
43443 }
43444 {
43445 let to_remove = ["name"];
43446 params.remove_params(&to_remove);
43447 }
43448
43449 let url = params.parse_with_url(&url);
43450
43451 loop {
43452 let token = match self
43453 .hub
43454 .auth
43455 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
43456 .await
43457 {
43458 Ok(token) => token,
43459 Err(e) => match dlg.token(e) {
43460 Ok(token) => token,
43461 Err(e) => {
43462 dlg.finished(false);
43463 return Err(common::Error::MissingToken(e));
43464 }
43465 },
43466 };
43467 let mut req_result = {
43468 let client = &self.hub.client;
43469 dlg.pre_request();
43470 let mut req_builder = hyper::Request::builder()
43471 .method(hyper::Method::GET)
43472 .uri(url.as_str())
43473 .header(USER_AGENT, self.hub._user_agent.clone());
43474
43475 if let Some(token) = token.as_ref() {
43476 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
43477 }
43478
43479 let request = req_builder
43480 .header(CONTENT_LENGTH, 0_u64)
43481 .body(common::to_body::<String>(None));
43482
43483 client.request(request.unwrap()).await
43484 };
43485
43486 match req_result {
43487 Err(err) => {
43488 if let common::Retry::After(d) = dlg.http_error(&err) {
43489 sleep(d).await;
43490 continue;
43491 }
43492 dlg.finished(false);
43493 return Err(common::Error::HttpError(err));
43494 }
43495 Ok(res) => {
43496 let (mut parts, body) = res.into_parts();
43497 let mut body = common::Body::new(body);
43498 if !parts.status.is_success() {
43499 let bytes = common::to_bytes(body).await.unwrap_or_default();
43500 let error = serde_json::from_str(&common::to_string(&bytes));
43501 let response = common::to_response(parts, bytes.into());
43502
43503 if let common::Retry::After(d) =
43504 dlg.http_failure(&response, error.as_ref().ok())
43505 {
43506 sleep(d).await;
43507 continue;
43508 }
43509
43510 dlg.finished(false);
43511
43512 return Err(match error {
43513 Ok(value) => common::Error::BadRequest(value),
43514 _ => common::Error::Failure(response),
43515 });
43516 }
43517 let response = {
43518 let bytes = common::to_bytes(body).await.unwrap_or_default();
43519 let encoded = common::to_string(&bytes);
43520 match serde_json::from_str(&encoded) {
43521 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
43522 Err(error) => {
43523 dlg.response_json_decode_error(&encoded, &error);
43524 return Err(common::Error::JsonDecodeError(
43525 encoded.to_string(),
43526 error,
43527 ));
43528 }
43529 }
43530 };
43531
43532 dlg.finished(true);
43533 return Ok(response);
43534 }
43535 }
43536 }
43537 }
43538
43539 /// Required. The resource name of the HL7v2 store to get metrics for, in the format `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7V2Stores/{hl7v2_store_id}`.
43540 ///
43541 /// Sets the *name* path property to the given value.
43542 ///
43543 /// Even though the property as already been set when instantiating this call,
43544 /// we provide this method for API completeness.
43545 pub fn name(
43546 mut self,
43547 new_value: &str,
43548 ) -> ProjectLocationDatasetHl7V2StoreGetHL7v2StoreMetricCall<'a, C> {
43549 self._name = new_value.to_string();
43550 self
43551 }
43552 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
43553 /// while executing the actual API request.
43554 ///
43555 /// ````text
43556 /// It should be used to handle progress information, and to implement a certain level of resilience.
43557 /// ````
43558 ///
43559 /// Sets the *delegate* property to the given value.
43560 pub fn delegate(
43561 mut self,
43562 new_value: &'a mut dyn common::Delegate,
43563 ) -> ProjectLocationDatasetHl7V2StoreGetHL7v2StoreMetricCall<'a, C> {
43564 self._delegate = Some(new_value);
43565 self
43566 }
43567
43568 /// Set any additional parameter of the query string used in the request.
43569 /// It should be used to set parameters which are not yet available through their own
43570 /// setters.
43571 ///
43572 /// Please note that this method must not be used to set any of the known parameters
43573 /// which have their own setter method. If done anyway, the request will fail.
43574 ///
43575 /// # Additional Parameters
43576 ///
43577 /// * *$.xgafv* (query-string) - V1 error format.
43578 /// * *access_token* (query-string) - OAuth access token.
43579 /// * *alt* (query-string) - Data format for response.
43580 /// * *callback* (query-string) - JSONP
43581 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
43582 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
43583 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
43584 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
43585 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
43586 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
43587 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
43588 pub fn param<T>(
43589 mut self,
43590 name: T,
43591 value: T,
43592 ) -> ProjectLocationDatasetHl7V2StoreGetHL7v2StoreMetricCall<'a, C>
43593 where
43594 T: AsRef<str>,
43595 {
43596 self._additional_params
43597 .insert(name.as_ref().to_string(), value.as_ref().to_string());
43598 self
43599 }
43600
43601 /// Identifies the authorization scope for the method you are building.
43602 ///
43603 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
43604 /// [`Scope::CloudHealthcare`].
43605 ///
43606 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
43607 /// tokens for more than one scope.
43608 ///
43609 /// Usually there is more than one suitable scope to authorize an operation, some of which may
43610 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
43611 /// sufficient, a read-write scope will do as well.
43612 pub fn add_scope<St>(
43613 mut self,
43614 scope: St,
43615 ) -> ProjectLocationDatasetHl7V2StoreGetHL7v2StoreMetricCall<'a, C>
43616 where
43617 St: AsRef<str>,
43618 {
43619 self._scopes.insert(String::from(scope.as_ref()));
43620 self
43621 }
43622 /// Identifies the authorization scope(s) for the method you are building.
43623 ///
43624 /// See [`Self::add_scope()`] for details.
43625 pub fn add_scopes<I, St>(
43626 mut self,
43627 scopes: I,
43628 ) -> ProjectLocationDatasetHl7V2StoreGetHL7v2StoreMetricCall<'a, C>
43629 where
43630 I: IntoIterator<Item = St>,
43631 St: AsRef<str>,
43632 {
43633 self._scopes
43634 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
43635 self
43636 }
43637
43638 /// Removes all scopes, and no default scope will be used either.
43639 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
43640 /// for details).
43641 pub fn clear_scopes(
43642 mut self,
43643 ) -> ProjectLocationDatasetHl7V2StoreGetHL7v2StoreMetricCall<'a, C> {
43644 self._scopes.clear();
43645 self
43646 }
43647}
43648
43649/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
43650///
43651/// A builder for the *locations.datasets.hl7V2Stores.getIamPolicy* method supported by a *project* resource.
43652/// It is not used directly, but through a [`ProjectMethods`] instance.
43653///
43654/// # Example
43655///
43656/// Instantiate a resource method builder
43657///
43658/// ```test_harness,no_run
43659/// # extern crate hyper;
43660/// # extern crate hyper_rustls;
43661/// # extern crate google_healthcare1 as healthcare1;
43662/// # async fn dox() {
43663/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
43664///
43665/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
43666/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
43667/// # secret,
43668/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
43669/// # ).build().await.unwrap();
43670///
43671/// # let client = hyper_util::client::legacy::Client::builder(
43672/// # hyper_util::rt::TokioExecutor::new()
43673/// # )
43674/// # .build(
43675/// # hyper_rustls::HttpsConnectorBuilder::new()
43676/// # .with_native_roots()
43677/// # .unwrap()
43678/// # .https_or_http()
43679/// # .enable_http1()
43680/// # .build()
43681/// # );
43682/// # let mut hub = CloudHealthcare::new(client, auth);
43683/// // You can configure optional parameters by calling the respective setters at will, and
43684/// // execute the final call using `doit()`.
43685/// // Values shown here are possibly random and not representative !
43686/// let result = hub.projects().locations_datasets_hl7_v2_stores_get_iam_policy("resource")
43687/// .options_requested_policy_version(-101)
43688/// .doit().await;
43689/// # }
43690/// ```
43691pub struct ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C>
43692where
43693 C: 'a,
43694{
43695 hub: &'a CloudHealthcare<C>,
43696 _resource: String,
43697 _options_requested_policy_version: Option<i32>,
43698 _delegate: Option<&'a mut dyn common::Delegate>,
43699 _additional_params: HashMap<String, String>,
43700 _scopes: BTreeSet<String>,
43701}
43702
43703impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C> {}
43704
43705impl<'a, C> ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C>
43706where
43707 C: common::Connector,
43708{
43709 /// Perform the operation you have build so far.
43710 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
43711 use std::borrow::Cow;
43712 use std::io::{Read, Seek};
43713
43714 use common::{url::Params, ToParts};
43715 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
43716
43717 let mut dd = common::DefaultDelegate;
43718 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
43719 dlg.begin(common::MethodInfo {
43720 id: "healthcare.projects.locations.datasets.hl7V2Stores.getIamPolicy",
43721 http_method: hyper::Method::GET,
43722 });
43723
43724 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
43725 if self._additional_params.contains_key(field) {
43726 dlg.finished(false);
43727 return Err(common::Error::FieldClash(field));
43728 }
43729 }
43730
43731 let mut params = Params::with_capacity(4 + self._additional_params.len());
43732 params.push("resource", self._resource);
43733 if let Some(value) = self._options_requested_policy_version.as_ref() {
43734 params.push("options.requestedPolicyVersion", value.to_string());
43735 }
43736
43737 params.extend(self._additional_params.iter());
43738
43739 params.push("alt", "json");
43740 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
43741 if self._scopes.is_empty() {
43742 self._scopes
43743 .insert(Scope::CloudHealthcare.as_ref().to_string());
43744 }
43745
43746 #[allow(clippy::single_element_loop)]
43747 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
43748 url = params.uri_replacement(url, param_name, find_this, true);
43749 }
43750 {
43751 let to_remove = ["resource"];
43752 params.remove_params(&to_remove);
43753 }
43754
43755 let url = params.parse_with_url(&url);
43756
43757 loop {
43758 let token = match self
43759 .hub
43760 .auth
43761 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
43762 .await
43763 {
43764 Ok(token) => token,
43765 Err(e) => match dlg.token(e) {
43766 Ok(token) => token,
43767 Err(e) => {
43768 dlg.finished(false);
43769 return Err(common::Error::MissingToken(e));
43770 }
43771 },
43772 };
43773 let mut req_result = {
43774 let client = &self.hub.client;
43775 dlg.pre_request();
43776 let mut req_builder = hyper::Request::builder()
43777 .method(hyper::Method::GET)
43778 .uri(url.as_str())
43779 .header(USER_AGENT, self.hub._user_agent.clone());
43780
43781 if let Some(token) = token.as_ref() {
43782 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
43783 }
43784
43785 let request = req_builder
43786 .header(CONTENT_LENGTH, 0_u64)
43787 .body(common::to_body::<String>(None));
43788
43789 client.request(request.unwrap()).await
43790 };
43791
43792 match req_result {
43793 Err(err) => {
43794 if let common::Retry::After(d) = dlg.http_error(&err) {
43795 sleep(d).await;
43796 continue;
43797 }
43798 dlg.finished(false);
43799 return Err(common::Error::HttpError(err));
43800 }
43801 Ok(res) => {
43802 let (mut parts, body) = res.into_parts();
43803 let mut body = common::Body::new(body);
43804 if !parts.status.is_success() {
43805 let bytes = common::to_bytes(body).await.unwrap_or_default();
43806 let error = serde_json::from_str(&common::to_string(&bytes));
43807 let response = common::to_response(parts, bytes.into());
43808
43809 if let common::Retry::After(d) =
43810 dlg.http_failure(&response, error.as_ref().ok())
43811 {
43812 sleep(d).await;
43813 continue;
43814 }
43815
43816 dlg.finished(false);
43817
43818 return Err(match error {
43819 Ok(value) => common::Error::BadRequest(value),
43820 _ => common::Error::Failure(response),
43821 });
43822 }
43823 let response = {
43824 let bytes = common::to_bytes(body).await.unwrap_or_default();
43825 let encoded = common::to_string(&bytes);
43826 match serde_json::from_str(&encoded) {
43827 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
43828 Err(error) => {
43829 dlg.response_json_decode_error(&encoded, &error);
43830 return Err(common::Error::JsonDecodeError(
43831 encoded.to_string(),
43832 error,
43833 ));
43834 }
43835 }
43836 };
43837
43838 dlg.finished(true);
43839 return Ok(response);
43840 }
43841 }
43842 }
43843 }
43844
43845 /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
43846 ///
43847 /// Sets the *resource* path property to the given value.
43848 ///
43849 /// Even though the property as already been set when instantiating this call,
43850 /// we provide this method for API completeness.
43851 pub fn resource(
43852 mut self,
43853 new_value: &str,
43854 ) -> ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C> {
43855 self._resource = new_value.to_string();
43856 self
43857 }
43858 /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
43859 ///
43860 /// Sets the *options.requested policy version* query property to the given value.
43861 pub fn options_requested_policy_version(
43862 mut self,
43863 new_value: i32,
43864 ) -> ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C> {
43865 self._options_requested_policy_version = Some(new_value);
43866 self
43867 }
43868 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
43869 /// while executing the actual API request.
43870 ///
43871 /// ````text
43872 /// It should be used to handle progress information, and to implement a certain level of resilience.
43873 /// ````
43874 ///
43875 /// Sets the *delegate* property to the given value.
43876 pub fn delegate(
43877 mut self,
43878 new_value: &'a mut dyn common::Delegate,
43879 ) -> ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C> {
43880 self._delegate = Some(new_value);
43881 self
43882 }
43883
43884 /// Set any additional parameter of the query string used in the request.
43885 /// It should be used to set parameters which are not yet available through their own
43886 /// setters.
43887 ///
43888 /// Please note that this method must not be used to set any of the known parameters
43889 /// which have their own setter method. If done anyway, the request will fail.
43890 ///
43891 /// # Additional Parameters
43892 ///
43893 /// * *$.xgafv* (query-string) - V1 error format.
43894 /// * *access_token* (query-string) - OAuth access token.
43895 /// * *alt* (query-string) - Data format for response.
43896 /// * *callback* (query-string) - JSONP
43897 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
43898 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
43899 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
43900 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
43901 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
43902 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
43903 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
43904 pub fn param<T>(
43905 mut self,
43906 name: T,
43907 value: T,
43908 ) -> ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C>
43909 where
43910 T: AsRef<str>,
43911 {
43912 self._additional_params
43913 .insert(name.as_ref().to_string(), value.as_ref().to_string());
43914 self
43915 }
43916
43917 /// Identifies the authorization scope for the method you are building.
43918 ///
43919 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
43920 /// [`Scope::CloudHealthcare`].
43921 ///
43922 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
43923 /// tokens for more than one scope.
43924 ///
43925 /// Usually there is more than one suitable scope to authorize an operation, some of which may
43926 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
43927 /// sufficient, a read-write scope will do as well.
43928 pub fn add_scope<St>(
43929 mut self,
43930 scope: St,
43931 ) -> ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C>
43932 where
43933 St: AsRef<str>,
43934 {
43935 self._scopes.insert(String::from(scope.as_ref()));
43936 self
43937 }
43938 /// Identifies the authorization scope(s) for the method you are building.
43939 ///
43940 /// See [`Self::add_scope()`] for details.
43941 pub fn add_scopes<I, St>(
43942 mut self,
43943 scopes: I,
43944 ) -> ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C>
43945 where
43946 I: IntoIterator<Item = St>,
43947 St: AsRef<str>,
43948 {
43949 self._scopes
43950 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
43951 self
43952 }
43953
43954 /// Removes all scopes, and no default scope will be used either.
43955 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
43956 /// for details).
43957 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StoreGetIamPolicyCall<'a, C> {
43958 self._scopes.clear();
43959 self
43960 }
43961}
43962
43963/// Import messages to the HL7v2 store by loading data from the specified sources. This method is optimized to load large quantities of data using import semantics that ignore some HL7v2 store configuration options and are not suitable for all use cases. It is primarily intended to load data into an empty HL7v2 store that is not being used by other clients. An existing message will be overwritten if a duplicate message is imported. A duplicate message is a message with the same raw bytes as a message that already exists in this HL7v2 store. When a message is overwritten, its labels will also be overwritten. The import operation is idempotent unless the input data contains multiple valid messages with the same raw bytes but different labels. In that case, after the import completes, the store contains exactly one message with those raw bytes but there is no ordering guarantee on which version of the labels it has. The operation result counters do not count duplicated raw bytes as an error and count one success for each message in the input, which might result in a success count larger than the number of messages in the HL7v2 store. If some messages fail to import, for example due to parsing errors, successfully imported messages are not rolled back. This method returns an Operation that can be used to track the status of the import by calling GetOperation. Immediate fatal errors appear in the error field, errors are also logged to Cloud Logging (see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging)). Otherwise, when the operation finishes, a response of type ImportMessagesResponse is returned in the response field. The metadata field type for this operation is OperationMetadata.
43964///
43965/// A builder for the *locations.datasets.hl7V2Stores.import* method supported by a *project* resource.
43966/// It is not used directly, but through a [`ProjectMethods`] instance.
43967///
43968/// # Example
43969///
43970/// Instantiate a resource method builder
43971///
43972/// ```test_harness,no_run
43973/// # extern crate hyper;
43974/// # extern crate hyper_rustls;
43975/// # extern crate google_healthcare1 as healthcare1;
43976/// use healthcare1::api::ImportMessagesRequest;
43977/// # async fn dox() {
43978/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
43979///
43980/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
43981/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
43982/// # secret,
43983/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
43984/// # ).build().await.unwrap();
43985///
43986/// # let client = hyper_util::client::legacy::Client::builder(
43987/// # hyper_util::rt::TokioExecutor::new()
43988/// # )
43989/// # .build(
43990/// # hyper_rustls::HttpsConnectorBuilder::new()
43991/// # .with_native_roots()
43992/// # .unwrap()
43993/// # .https_or_http()
43994/// # .enable_http1()
43995/// # .build()
43996/// # );
43997/// # let mut hub = CloudHealthcare::new(client, auth);
43998/// // As the method needs a request, you would usually fill it with the desired information
43999/// // into the respective structure. Some of the parts shown here might not be applicable !
44000/// // Values shown here are possibly random and not representative !
44001/// let mut req = ImportMessagesRequest::default();
44002///
44003/// // You can configure optional parameters by calling the respective setters at will, and
44004/// // execute the final call using `doit()`.
44005/// // Values shown here are possibly random and not representative !
44006/// let result = hub.projects().locations_datasets_hl7_v2_stores_import(req, "name")
44007/// .doit().await;
44008/// # }
44009/// ```
44010pub struct ProjectLocationDatasetHl7V2StoreImportCall<'a, C>
44011where
44012 C: 'a,
44013{
44014 hub: &'a CloudHealthcare<C>,
44015 _request: ImportMessagesRequest,
44016 _name: String,
44017 _delegate: Option<&'a mut dyn common::Delegate>,
44018 _additional_params: HashMap<String, String>,
44019 _scopes: BTreeSet<String>,
44020}
44021
44022impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreImportCall<'a, C> {}
44023
44024impl<'a, C> ProjectLocationDatasetHl7V2StoreImportCall<'a, C>
44025where
44026 C: common::Connector,
44027{
44028 /// Perform the operation you have build so far.
44029 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
44030 use std::borrow::Cow;
44031 use std::io::{Read, Seek};
44032
44033 use common::{url::Params, ToParts};
44034 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
44035
44036 let mut dd = common::DefaultDelegate;
44037 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
44038 dlg.begin(common::MethodInfo {
44039 id: "healthcare.projects.locations.datasets.hl7V2Stores.import",
44040 http_method: hyper::Method::POST,
44041 });
44042
44043 for &field in ["alt", "name"].iter() {
44044 if self._additional_params.contains_key(field) {
44045 dlg.finished(false);
44046 return Err(common::Error::FieldClash(field));
44047 }
44048 }
44049
44050 let mut params = Params::with_capacity(4 + self._additional_params.len());
44051 params.push("name", self._name);
44052
44053 params.extend(self._additional_params.iter());
44054
44055 params.push("alt", "json");
44056 let mut url = self.hub._base_url.clone() + "v1/{+name}:import";
44057 if self._scopes.is_empty() {
44058 self._scopes
44059 .insert(Scope::CloudHealthcare.as_ref().to_string());
44060 }
44061
44062 #[allow(clippy::single_element_loop)]
44063 for &(find_this, param_name) in [("{+name}", "name")].iter() {
44064 url = params.uri_replacement(url, param_name, find_this, true);
44065 }
44066 {
44067 let to_remove = ["name"];
44068 params.remove_params(&to_remove);
44069 }
44070
44071 let url = params.parse_with_url(&url);
44072
44073 let mut json_mime_type = mime::APPLICATION_JSON;
44074 let mut request_value_reader = {
44075 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
44076 common::remove_json_null_values(&mut value);
44077 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
44078 serde_json::to_writer(&mut dst, &value).unwrap();
44079 dst
44080 };
44081 let request_size = request_value_reader
44082 .seek(std::io::SeekFrom::End(0))
44083 .unwrap();
44084 request_value_reader
44085 .seek(std::io::SeekFrom::Start(0))
44086 .unwrap();
44087
44088 loop {
44089 let token = match self
44090 .hub
44091 .auth
44092 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
44093 .await
44094 {
44095 Ok(token) => token,
44096 Err(e) => match dlg.token(e) {
44097 Ok(token) => token,
44098 Err(e) => {
44099 dlg.finished(false);
44100 return Err(common::Error::MissingToken(e));
44101 }
44102 },
44103 };
44104 request_value_reader
44105 .seek(std::io::SeekFrom::Start(0))
44106 .unwrap();
44107 let mut req_result = {
44108 let client = &self.hub.client;
44109 dlg.pre_request();
44110 let mut req_builder = hyper::Request::builder()
44111 .method(hyper::Method::POST)
44112 .uri(url.as_str())
44113 .header(USER_AGENT, self.hub._user_agent.clone());
44114
44115 if let Some(token) = token.as_ref() {
44116 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
44117 }
44118
44119 let request = req_builder
44120 .header(CONTENT_TYPE, json_mime_type.to_string())
44121 .header(CONTENT_LENGTH, request_size as u64)
44122 .body(common::to_body(
44123 request_value_reader.get_ref().clone().into(),
44124 ));
44125
44126 client.request(request.unwrap()).await
44127 };
44128
44129 match req_result {
44130 Err(err) => {
44131 if let common::Retry::After(d) = dlg.http_error(&err) {
44132 sleep(d).await;
44133 continue;
44134 }
44135 dlg.finished(false);
44136 return Err(common::Error::HttpError(err));
44137 }
44138 Ok(res) => {
44139 let (mut parts, body) = res.into_parts();
44140 let mut body = common::Body::new(body);
44141 if !parts.status.is_success() {
44142 let bytes = common::to_bytes(body).await.unwrap_or_default();
44143 let error = serde_json::from_str(&common::to_string(&bytes));
44144 let response = common::to_response(parts, bytes.into());
44145
44146 if let common::Retry::After(d) =
44147 dlg.http_failure(&response, error.as_ref().ok())
44148 {
44149 sleep(d).await;
44150 continue;
44151 }
44152
44153 dlg.finished(false);
44154
44155 return Err(match error {
44156 Ok(value) => common::Error::BadRequest(value),
44157 _ => common::Error::Failure(response),
44158 });
44159 }
44160 let response = {
44161 let bytes = common::to_bytes(body).await.unwrap_or_default();
44162 let encoded = common::to_string(&bytes);
44163 match serde_json::from_str(&encoded) {
44164 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
44165 Err(error) => {
44166 dlg.response_json_decode_error(&encoded, &error);
44167 return Err(common::Error::JsonDecodeError(
44168 encoded.to_string(),
44169 error,
44170 ));
44171 }
44172 }
44173 };
44174
44175 dlg.finished(true);
44176 return Ok(response);
44177 }
44178 }
44179 }
44180 }
44181
44182 ///
44183 /// Sets the *request* property to the given value.
44184 ///
44185 /// Even though the property as already been set when instantiating this call,
44186 /// we provide this method for API completeness.
44187 pub fn request(
44188 mut self,
44189 new_value: ImportMessagesRequest,
44190 ) -> ProjectLocationDatasetHl7V2StoreImportCall<'a, C> {
44191 self._request = new_value;
44192 self
44193 }
44194 /// Required. The name of the target HL7v2 store, in the format `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7v2Stores/{hl7v2_store_id}`
44195 ///
44196 /// Sets the *name* path property to the given value.
44197 ///
44198 /// Even though the property as already been set when instantiating this call,
44199 /// we provide this method for API completeness.
44200 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreImportCall<'a, C> {
44201 self._name = new_value.to_string();
44202 self
44203 }
44204 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
44205 /// while executing the actual API request.
44206 ///
44207 /// ````text
44208 /// It should be used to handle progress information, and to implement a certain level of resilience.
44209 /// ````
44210 ///
44211 /// Sets the *delegate* property to the given value.
44212 pub fn delegate(
44213 mut self,
44214 new_value: &'a mut dyn common::Delegate,
44215 ) -> ProjectLocationDatasetHl7V2StoreImportCall<'a, C> {
44216 self._delegate = Some(new_value);
44217 self
44218 }
44219
44220 /// Set any additional parameter of the query string used in the request.
44221 /// It should be used to set parameters which are not yet available through their own
44222 /// setters.
44223 ///
44224 /// Please note that this method must not be used to set any of the known parameters
44225 /// which have their own setter method. If done anyway, the request will fail.
44226 ///
44227 /// # Additional Parameters
44228 ///
44229 /// * *$.xgafv* (query-string) - V1 error format.
44230 /// * *access_token* (query-string) - OAuth access token.
44231 /// * *alt* (query-string) - Data format for response.
44232 /// * *callback* (query-string) - JSONP
44233 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
44234 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
44235 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
44236 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
44237 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
44238 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
44239 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
44240 pub fn param<T>(
44241 mut self,
44242 name: T,
44243 value: T,
44244 ) -> ProjectLocationDatasetHl7V2StoreImportCall<'a, C>
44245 where
44246 T: AsRef<str>,
44247 {
44248 self._additional_params
44249 .insert(name.as_ref().to_string(), value.as_ref().to_string());
44250 self
44251 }
44252
44253 /// Identifies the authorization scope for the method you are building.
44254 ///
44255 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
44256 /// [`Scope::CloudHealthcare`].
44257 ///
44258 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
44259 /// tokens for more than one scope.
44260 ///
44261 /// Usually there is more than one suitable scope to authorize an operation, some of which may
44262 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
44263 /// sufficient, a read-write scope will do as well.
44264 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetHl7V2StoreImportCall<'a, C>
44265 where
44266 St: AsRef<str>,
44267 {
44268 self._scopes.insert(String::from(scope.as_ref()));
44269 self
44270 }
44271 /// Identifies the authorization scope(s) for the method you are building.
44272 ///
44273 /// See [`Self::add_scope()`] for details.
44274 pub fn add_scopes<I, St>(
44275 mut self,
44276 scopes: I,
44277 ) -> ProjectLocationDatasetHl7V2StoreImportCall<'a, C>
44278 where
44279 I: IntoIterator<Item = St>,
44280 St: AsRef<str>,
44281 {
44282 self._scopes
44283 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
44284 self
44285 }
44286
44287 /// Removes all scopes, and no default scope will be used either.
44288 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
44289 /// for details).
44290 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StoreImportCall<'a, C> {
44291 self._scopes.clear();
44292 self
44293 }
44294}
44295
44296/// Lists the HL7v2 stores in the given dataset.
44297///
44298/// A builder for the *locations.datasets.hl7V2Stores.list* method supported by a *project* resource.
44299/// It is not used directly, but through a [`ProjectMethods`] instance.
44300///
44301/// # Example
44302///
44303/// Instantiate a resource method builder
44304///
44305/// ```test_harness,no_run
44306/// # extern crate hyper;
44307/// # extern crate hyper_rustls;
44308/// # extern crate google_healthcare1 as healthcare1;
44309/// # async fn dox() {
44310/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
44311///
44312/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
44313/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
44314/// # secret,
44315/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
44316/// # ).build().await.unwrap();
44317///
44318/// # let client = hyper_util::client::legacy::Client::builder(
44319/// # hyper_util::rt::TokioExecutor::new()
44320/// # )
44321/// # .build(
44322/// # hyper_rustls::HttpsConnectorBuilder::new()
44323/// # .with_native_roots()
44324/// # .unwrap()
44325/// # .https_or_http()
44326/// # .enable_http1()
44327/// # .build()
44328/// # );
44329/// # let mut hub = CloudHealthcare::new(client, auth);
44330/// // You can configure optional parameters by calling the respective setters at will, and
44331/// // execute the final call using `doit()`.
44332/// // Values shown here are possibly random and not representative !
44333/// let result = hub.projects().locations_datasets_hl7_v2_stores_list("parent")
44334/// .page_token("rebum.")
44335/// .page_size(-39)
44336/// .filter("dolore")
44337/// .doit().await;
44338/// # }
44339/// ```
44340pub struct ProjectLocationDatasetHl7V2StoreListCall<'a, C>
44341where
44342 C: 'a,
44343{
44344 hub: &'a CloudHealthcare<C>,
44345 _parent: String,
44346 _page_token: Option<String>,
44347 _page_size: Option<i32>,
44348 _filter: Option<String>,
44349 _delegate: Option<&'a mut dyn common::Delegate>,
44350 _additional_params: HashMap<String, String>,
44351 _scopes: BTreeSet<String>,
44352}
44353
44354impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreListCall<'a, C> {}
44355
44356impl<'a, C> ProjectLocationDatasetHl7V2StoreListCall<'a, C>
44357where
44358 C: common::Connector,
44359{
44360 /// Perform the operation you have build so far.
44361 pub async fn doit(mut self) -> common::Result<(common::Response, ListHl7V2StoresResponse)> {
44362 use std::borrow::Cow;
44363 use std::io::{Read, Seek};
44364
44365 use common::{url::Params, ToParts};
44366 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
44367
44368 let mut dd = common::DefaultDelegate;
44369 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
44370 dlg.begin(common::MethodInfo {
44371 id: "healthcare.projects.locations.datasets.hl7V2Stores.list",
44372 http_method: hyper::Method::GET,
44373 });
44374
44375 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
44376 if self._additional_params.contains_key(field) {
44377 dlg.finished(false);
44378 return Err(common::Error::FieldClash(field));
44379 }
44380 }
44381
44382 let mut params = Params::with_capacity(6 + self._additional_params.len());
44383 params.push("parent", self._parent);
44384 if let Some(value) = self._page_token.as_ref() {
44385 params.push("pageToken", value);
44386 }
44387 if let Some(value) = self._page_size.as_ref() {
44388 params.push("pageSize", value.to_string());
44389 }
44390 if let Some(value) = self._filter.as_ref() {
44391 params.push("filter", value);
44392 }
44393
44394 params.extend(self._additional_params.iter());
44395
44396 params.push("alt", "json");
44397 let mut url = self.hub._base_url.clone() + "v1/{+parent}/hl7V2Stores";
44398 if self._scopes.is_empty() {
44399 self._scopes
44400 .insert(Scope::CloudHealthcare.as_ref().to_string());
44401 }
44402
44403 #[allow(clippy::single_element_loop)]
44404 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
44405 url = params.uri_replacement(url, param_name, find_this, true);
44406 }
44407 {
44408 let to_remove = ["parent"];
44409 params.remove_params(&to_remove);
44410 }
44411
44412 let url = params.parse_with_url(&url);
44413
44414 loop {
44415 let token = match self
44416 .hub
44417 .auth
44418 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
44419 .await
44420 {
44421 Ok(token) => token,
44422 Err(e) => match dlg.token(e) {
44423 Ok(token) => token,
44424 Err(e) => {
44425 dlg.finished(false);
44426 return Err(common::Error::MissingToken(e));
44427 }
44428 },
44429 };
44430 let mut req_result = {
44431 let client = &self.hub.client;
44432 dlg.pre_request();
44433 let mut req_builder = hyper::Request::builder()
44434 .method(hyper::Method::GET)
44435 .uri(url.as_str())
44436 .header(USER_AGENT, self.hub._user_agent.clone());
44437
44438 if let Some(token) = token.as_ref() {
44439 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
44440 }
44441
44442 let request = req_builder
44443 .header(CONTENT_LENGTH, 0_u64)
44444 .body(common::to_body::<String>(None));
44445
44446 client.request(request.unwrap()).await
44447 };
44448
44449 match req_result {
44450 Err(err) => {
44451 if let common::Retry::After(d) = dlg.http_error(&err) {
44452 sleep(d).await;
44453 continue;
44454 }
44455 dlg.finished(false);
44456 return Err(common::Error::HttpError(err));
44457 }
44458 Ok(res) => {
44459 let (mut parts, body) = res.into_parts();
44460 let mut body = common::Body::new(body);
44461 if !parts.status.is_success() {
44462 let bytes = common::to_bytes(body).await.unwrap_or_default();
44463 let error = serde_json::from_str(&common::to_string(&bytes));
44464 let response = common::to_response(parts, bytes.into());
44465
44466 if let common::Retry::After(d) =
44467 dlg.http_failure(&response, error.as_ref().ok())
44468 {
44469 sleep(d).await;
44470 continue;
44471 }
44472
44473 dlg.finished(false);
44474
44475 return Err(match error {
44476 Ok(value) => common::Error::BadRequest(value),
44477 _ => common::Error::Failure(response),
44478 });
44479 }
44480 let response = {
44481 let bytes = common::to_bytes(body).await.unwrap_or_default();
44482 let encoded = common::to_string(&bytes);
44483 match serde_json::from_str(&encoded) {
44484 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
44485 Err(error) => {
44486 dlg.response_json_decode_error(&encoded, &error);
44487 return Err(common::Error::JsonDecodeError(
44488 encoded.to_string(),
44489 error,
44490 ));
44491 }
44492 }
44493 };
44494
44495 dlg.finished(true);
44496 return Ok(response);
44497 }
44498 }
44499 }
44500 }
44501
44502 /// Required. Name of the dataset.
44503 ///
44504 /// Sets the *parent* path property to the given value.
44505 ///
44506 /// Even though the property as already been set when instantiating this call,
44507 /// we provide this method for API completeness.
44508 pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C> {
44509 self._parent = new_value.to_string();
44510 self
44511 }
44512 /// The next_page_token value returned from the previous List request, if any.
44513 ///
44514 /// Sets the *page token* query property to the given value.
44515 pub fn page_token(
44516 mut self,
44517 new_value: &str,
44518 ) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C> {
44519 self._page_token = Some(new_value.to_string());
44520 self
44521 }
44522 /// Limit on the number of HL7v2 stores to return in a single response. If not specified, 100 is used. May not be larger than 1000.
44523 ///
44524 /// Sets the *page size* query property to the given value.
44525 pub fn page_size(mut self, new_value: i32) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C> {
44526 self._page_size = Some(new_value);
44527 self
44528 }
44529 /// Restricts stores returned to those matching a filter. The following syntax is available: * A string field value can be written as text inside quotation marks, for example `"query text"`. The only valid relational operation for text fields is equality (`=`), where text is searched within the field, rather than having the field be equal to the text. For example, `"Comment = great"` returns messages with `great` in the comment field. * A number field value can be written as an integer, a decimal, or an exponential. The valid relational operators for number fields are the equality operator (`=`), along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * A date field value must be written in `yyyy-mm-dd` form. Fields with date and time use the RFC3339 time format. Leading zeros are required for one-digit months and days. The valid relational operators for date fields are the equality operator (`=`) , along with the less than/greater than operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend the `NOT` operator to an expression to negate it. * Multiple field query expressions can be combined in one query by adding `AND` or `OR` operators between the expressions. If a boolean operator appears within a quoted string, it is not treated as special, it's just another part of the character string to be matched. You can prepend the `NOT` operator to an expression to negate it. Only filtering on labels is supported. For example, `labels.key=value`.
44530 ///
44531 /// Sets the *filter* query property to the given value.
44532 pub fn filter(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C> {
44533 self._filter = Some(new_value.to_string());
44534 self
44535 }
44536 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
44537 /// while executing the actual API request.
44538 ///
44539 /// ````text
44540 /// It should be used to handle progress information, and to implement a certain level of resilience.
44541 /// ````
44542 ///
44543 /// Sets the *delegate* property to the given value.
44544 pub fn delegate(
44545 mut self,
44546 new_value: &'a mut dyn common::Delegate,
44547 ) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C> {
44548 self._delegate = Some(new_value);
44549 self
44550 }
44551
44552 /// Set any additional parameter of the query string used in the request.
44553 /// It should be used to set parameters which are not yet available through their own
44554 /// setters.
44555 ///
44556 /// Please note that this method must not be used to set any of the known parameters
44557 /// which have their own setter method. If done anyway, the request will fail.
44558 ///
44559 /// # Additional Parameters
44560 ///
44561 /// * *$.xgafv* (query-string) - V1 error format.
44562 /// * *access_token* (query-string) - OAuth access token.
44563 /// * *alt* (query-string) - Data format for response.
44564 /// * *callback* (query-string) - JSONP
44565 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
44566 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
44567 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
44568 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
44569 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
44570 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
44571 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
44572 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C>
44573 where
44574 T: AsRef<str>,
44575 {
44576 self._additional_params
44577 .insert(name.as_ref().to_string(), value.as_ref().to_string());
44578 self
44579 }
44580
44581 /// Identifies the authorization scope for the method you are building.
44582 ///
44583 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
44584 /// [`Scope::CloudHealthcare`].
44585 ///
44586 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
44587 /// tokens for more than one scope.
44588 ///
44589 /// Usually there is more than one suitable scope to authorize an operation, some of which may
44590 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
44591 /// sufficient, a read-write scope will do as well.
44592 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C>
44593 where
44594 St: AsRef<str>,
44595 {
44596 self._scopes.insert(String::from(scope.as_ref()));
44597 self
44598 }
44599 /// Identifies the authorization scope(s) for the method you are building.
44600 ///
44601 /// See [`Self::add_scope()`] for details.
44602 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C>
44603 where
44604 I: IntoIterator<Item = St>,
44605 St: AsRef<str>,
44606 {
44607 self._scopes
44608 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
44609 self
44610 }
44611
44612 /// Removes all scopes, and no default scope will be used either.
44613 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
44614 /// for details).
44615 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StoreListCall<'a, C> {
44616 self._scopes.clear();
44617 self
44618 }
44619}
44620
44621/// Updates the HL7v2 store.
44622///
44623/// A builder for the *locations.datasets.hl7V2Stores.patch* method supported by a *project* resource.
44624/// It is not used directly, but through a [`ProjectMethods`] instance.
44625///
44626/// # Example
44627///
44628/// Instantiate a resource method builder
44629///
44630/// ```test_harness,no_run
44631/// # extern crate hyper;
44632/// # extern crate hyper_rustls;
44633/// # extern crate google_healthcare1 as healthcare1;
44634/// use healthcare1::api::Hl7V2Store;
44635/// # async fn dox() {
44636/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
44637///
44638/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
44639/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
44640/// # secret,
44641/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
44642/// # ).build().await.unwrap();
44643///
44644/// # let client = hyper_util::client::legacy::Client::builder(
44645/// # hyper_util::rt::TokioExecutor::new()
44646/// # )
44647/// # .build(
44648/// # hyper_rustls::HttpsConnectorBuilder::new()
44649/// # .with_native_roots()
44650/// # .unwrap()
44651/// # .https_or_http()
44652/// # .enable_http1()
44653/// # .build()
44654/// # );
44655/// # let mut hub = CloudHealthcare::new(client, auth);
44656/// // As the method needs a request, you would usually fill it with the desired information
44657/// // into the respective structure. Some of the parts shown here might not be applicable !
44658/// // Values shown here are possibly random and not representative !
44659/// let mut req = Hl7V2Store::default();
44660///
44661/// // You can configure optional parameters by calling the respective setters at will, and
44662/// // execute the final call using `doit()`.
44663/// // Values shown here are possibly random and not representative !
44664/// let result = hub.projects().locations_datasets_hl7_v2_stores_patch(req, "name")
44665/// .update_mask(FieldMask::new::<&str>(&[]))
44666/// .doit().await;
44667/// # }
44668/// ```
44669pub struct ProjectLocationDatasetHl7V2StorePatchCall<'a, C>
44670where
44671 C: 'a,
44672{
44673 hub: &'a CloudHealthcare<C>,
44674 _request: Hl7V2Store,
44675 _name: String,
44676 _update_mask: Option<common::FieldMask>,
44677 _delegate: Option<&'a mut dyn common::Delegate>,
44678 _additional_params: HashMap<String, String>,
44679 _scopes: BTreeSet<String>,
44680}
44681
44682impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StorePatchCall<'a, C> {}
44683
44684impl<'a, C> ProjectLocationDatasetHl7V2StorePatchCall<'a, C>
44685where
44686 C: common::Connector,
44687{
44688 /// Perform the operation you have build so far.
44689 pub async fn doit(mut self) -> common::Result<(common::Response, Hl7V2Store)> {
44690 use std::borrow::Cow;
44691 use std::io::{Read, Seek};
44692
44693 use common::{url::Params, ToParts};
44694 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
44695
44696 let mut dd = common::DefaultDelegate;
44697 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
44698 dlg.begin(common::MethodInfo {
44699 id: "healthcare.projects.locations.datasets.hl7V2Stores.patch",
44700 http_method: hyper::Method::PATCH,
44701 });
44702
44703 for &field in ["alt", "name", "updateMask"].iter() {
44704 if self._additional_params.contains_key(field) {
44705 dlg.finished(false);
44706 return Err(common::Error::FieldClash(field));
44707 }
44708 }
44709
44710 let mut params = Params::with_capacity(5 + self._additional_params.len());
44711 params.push("name", self._name);
44712 if let Some(value) = self._update_mask.as_ref() {
44713 params.push("updateMask", value.to_string());
44714 }
44715
44716 params.extend(self._additional_params.iter());
44717
44718 params.push("alt", "json");
44719 let mut url = self.hub._base_url.clone() + "v1/{+name}";
44720 if self._scopes.is_empty() {
44721 self._scopes
44722 .insert(Scope::CloudHealthcare.as_ref().to_string());
44723 }
44724
44725 #[allow(clippy::single_element_loop)]
44726 for &(find_this, param_name) in [("{+name}", "name")].iter() {
44727 url = params.uri_replacement(url, param_name, find_this, true);
44728 }
44729 {
44730 let to_remove = ["name"];
44731 params.remove_params(&to_remove);
44732 }
44733
44734 let url = params.parse_with_url(&url);
44735
44736 let mut json_mime_type = mime::APPLICATION_JSON;
44737 let mut request_value_reader = {
44738 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
44739 common::remove_json_null_values(&mut value);
44740 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
44741 serde_json::to_writer(&mut dst, &value).unwrap();
44742 dst
44743 };
44744 let request_size = request_value_reader
44745 .seek(std::io::SeekFrom::End(0))
44746 .unwrap();
44747 request_value_reader
44748 .seek(std::io::SeekFrom::Start(0))
44749 .unwrap();
44750
44751 loop {
44752 let token = match self
44753 .hub
44754 .auth
44755 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
44756 .await
44757 {
44758 Ok(token) => token,
44759 Err(e) => match dlg.token(e) {
44760 Ok(token) => token,
44761 Err(e) => {
44762 dlg.finished(false);
44763 return Err(common::Error::MissingToken(e));
44764 }
44765 },
44766 };
44767 request_value_reader
44768 .seek(std::io::SeekFrom::Start(0))
44769 .unwrap();
44770 let mut req_result = {
44771 let client = &self.hub.client;
44772 dlg.pre_request();
44773 let mut req_builder = hyper::Request::builder()
44774 .method(hyper::Method::PATCH)
44775 .uri(url.as_str())
44776 .header(USER_AGENT, self.hub._user_agent.clone());
44777
44778 if let Some(token) = token.as_ref() {
44779 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
44780 }
44781
44782 let request = req_builder
44783 .header(CONTENT_TYPE, json_mime_type.to_string())
44784 .header(CONTENT_LENGTH, request_size as u64)
44785 .body(common::to_body(
44786 request_value_reader.get_ref().clone().into(),
44787 ));
44788
44789 client.request(request.unwrap()).await
44790 };
44791
44792 match req_result {
44793 Err(err) => {
44794 if let common::Retry::After(d) = dlg.http_error(&err) {
44795 sleep(d).await;
44796 continue;
44797 }
44798 dlg.finished(false);
44799 return Err(common::Error::HttpError(err));
44800 }
44801 Ok(res) => {
44802 let (mut parts, body) = res.into_parts();
44803 let mut body = common::Body::new(body);
44804 if !parts.status.is_success() {
44805 let bytes = common::to_bytes(body).await.unwrap_or_default();
44806 let error = serde_json::from_str(&common::to_string(&bytes));
44807 let response = common::to_response(parts, bytes.into());
44808
44809 if let common::Retry::After(d) =
44810 dlg.http_failure(&response, error.as_ref().ok())
44811 {
44812 sleep(d).await;
44813 continue;
44814 }
44815
44816 dlg.finished(false);
44817
44818 return Err(match error {
44819 Ok(value) => common::Error::BadRequest(value),
44820 _ => common::Error::Failure(response),
44821 });
44822 }
44823 let response = {
44824 let bytes = common::to_bytes(body).await.unwrap_or_default();
44825 let encoded = common::to_string(&bytes);
44826 match serde_json::from_str(&encoded) {
44827 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
44828 Err(error) => {
44829 dlg.response_json_decode_error(&encoded, &error);
44830 return Err(common::Error::JsonDecodeError(
44831 encoded.to_string(),
44832 error,
44833 ));
44834 }
44835 }
44836 };
44837
44838 dlg.finished(true);
44839 return Ok(response);
44840 }
44841 }
44842 }
44843 }
44844
44845 ///
44846 /// Sets the *request* property to the given value.
44847 ///
44848 /// Even though the property as already been set when instantiating this call,
44849 /// we provide this method for API completeness.
44850 pub fn request(
44851 mut self,
44852 new_value: Hl7V2Store,
44853 ) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C> {
44854 self._request = new_value;
44855 self
44856 }
44857 /// Identifier. Resource name of the HL7v2 store, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/hl7V2Stores/{hl7v2_store_id}`.
44858 ///
44859 /// Sets the *name* path property to the given value.
44860 ///
44861 /// Even though the property as already been set when instantiating this call,
44862 /// we provide this method for API completeness.
44863 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C> {
44864 self._name = new_value.to_string();
44865 self
44866 }
44867 /// Required. The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
44868 ///
44869 /// Sets the *update mask* query property to the given value.
44870 pub fn update_mask(
44871 mut self,
44872 new_value: common::FieldMask,
44873 ) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C> {
44874 self._update_mask = Some(new_value);
44875 self
44876 }
44877 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
44878 /// while executing the actual API request.
44879 ///
44880 /// ````text
44881 /// It should be used to handle progress information, and to implement a certain level of resilience.
44882 /// ````
44883 ///
44884 /// Sets the *delegate* property to the given value.
44885 pub fn delegate(
44886 mut self,
44887 new_value: &'a mut dyn common::Delegate,
44888 ) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C> {
44889 self._delegate = Some(new_value);
44890 self
44891 }
44892
44893 /// Set any additional parameter of the query string used in the request.
44894 /// It should be used to set parameters which are not yet available through their own
44895 /// setters.
44896 ///
44897 /// Please note that this method must not be used to set any of the known parameters
44898 /// which have their own setter method. If done anyway, the request will fail.
44899 ///
44900 /// # Additional Parameters
44901 ///
44902 /// * *$.xgafv* (query-string) - V1 error format.
44903 /// * *access_token* (query-string) - OAuth access token.
44904 /// * *alt* (query-string) - Data format for response.
44905 /// * *callback* (query-string) - JSONP
44906 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
44907 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
44908 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
44909 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
44910 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
44911 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
44912 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
44913 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C>
44914 where
44915 T: AsRef<str>,
44916 {
44917 self._additional_params
44918 .insert(name.as_ref().to_string(), value.as_ref().to_string());
44919 self
44920 }
44921
44922 /// Identifies the authorization scope for the method you are building.
44923 ///
44924 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
44925 /// [`Scope::CloudHealthcare`].
44926 ///
44927 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
44928 /// tokens for more than one scope.
44929 ///
44930 /// Usually there is more than one suitable scope to authorize an operation, some of which may
44931 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
44932 /// sufficient, a read-write scope will do as well.
44933 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C>
44934 where
44935 St: AsRef<str>,
44936 {
44937 self._scopes.insert(String::from(scope.as_ref()));
44938 self
44939 }
44940 /// Identifies the authorization scope(s) for the method you are building.
44941 ///
44942 /// See [`Self::add_scope()`] for details.
44943 pub fn add_scopes<I, St>(
44944 mut self,
44945 scopes: I,
44946 ) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C>
44947 where
44948 I: IntoIterator<Item = St>,
44949 St: AsRef<str>,
44950 {
44951 self._scopes
44952 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
44953 self
44954 }
44955
44956 /// Removes all scopes, and no default scope will be used either.
44957 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
44958 /// for details).
44959 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StorePatchCall<'a, C> {
44960 self._scopes.clear();
44961 self
44962 }
44963}
44964
44965/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
44966///
44967/// A builder for the *locations.datasets.hl7V2Stores.setIamPolicy* method supported by a *project* resource.
44968/// It is not used directly, but through a [`ProjectMethods`] instance.
44969///
44970/// # Example
44971///
44972/// Instantiate a resource method builder
44973///
44974/// ```test_harness,no_run
44975/// # extern crate hyper;
44976/// # extern crate hyper_rustls;
44977/// # extern crate google_healthcare1 as healthcare1;
44978/// use healthcare1::api::SetIamPolicyRequest;
44979/// # async fn dox() {
44980/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
44981///
44982/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
44983/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
44984/// # secret,
44985/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
44986/// # ).build().await.unwrap();
44987///
44988/// # let client = hyper_util::client::legacy::Client::builder(
44989/// # hyper_util::rt::TokioExecutor::new()
44990/// # )
44991/// # .build(
44992/// # hyper_rustls::HttpsConnectorBuilder::new()
44993/// # .with_native_roots()
44994/// # .unwrap()
44995/// # .https_or_http()
44996/// # .enable_http1()
44997/// # .build()
44998/// # );
44999/// # let mut hub = CloudHealthcare::new(client, auth);
45000/// // As the method needs a request, you would usually fill it with the desired information
45001/// // into the respective structure. Some of the parts shown here might not be applicable !
45002/// // Values shown here are possibly random and not representative !
45003/// let mut req = SetIamPolicyRequest::default();
45004///
45005/// // You can configure optional parameters by calling the respective setters at will, and
45006/// // execute the final call using `doit()`.
45007/// // Values shown here are possibly random and not representative !
45008/// let result = hub.projects().locations_datasets_hl7_v2_stores_set_iam_policy(req, "resource")
45009/// .doit().await;
45010/// # }
45011/// ```
45012pub struct ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C>
45013where
45014 C: 'a,
45015{
45016 hub: &'a CloudHealthcare<C>,
45017 _request: SetIamPolicyRequest,
45018 _resource: String,
45019 _delegate: Option<&'a mut dyn common::Delegate>,
45020 _additional_params: HashMap<String, String>,
45021 _scopes: BTreeSet<String>,
45022}
45023
45024impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C> {}
45025
45026impl<'a, C> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C>
45027where
45028 C: common::Connector,
45029{
45030 /// Perform the operation you have build so far.
45031 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
45032 use std::borrow::Cow;
45033 use std::io::{Read, Seek};
45034
45035 use common::{url::Params, ToParts};
45036 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
45037
45038 let mut dd = common::DefaultDelegate;
45039 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
45040 dlg.begin(common::MethodInfo {
45041 id: "healthcare.projects.locations.datasets.hl7V2Stores.setIamPolicy",
45042 http_method: hyper::Method::POST,
45043 });
45044
45045 for &field in ["alt", "resource"].iter() {
45046 if self._additional_params.contains_key(field) {
45047 dlg.finished(false);
45048 return Err(common::Error::FieldClash(field));
45049 }
45050 }
45051
45052 let mut params = Params::with_capacity(4 + self._additional_params.len());
45053 params.push("resource", self._resource);
45054
45055 params.extend(self._additional_params.iter());
45056
45057 params.push("alt", "json");
45058 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
45059 if self._scopes.is_empty() {
45060 self._scopes
45061 .insert(Scope::CloudHealthcare.as_ref().to_string());
45062 }
45063
45064 #[allow(clippy::single_element_loop)]
45065 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
45066 url = params.uri_replacement(url, param_name, find_this, true);
45067 }
45068 {
45069 let to_remove = ["resource"];
45070 params.remove_params(&to_remove);
45071 }
45072
45073 let url = params.parse_with_url(&url);
45074
45075 let mut json_mime_type = mime::APPLICATION_JSON;
45076 let mut request_value_reader = {
45077 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
45078 common::remove_json_null_values(&mut value);
45079 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
45080 serde_json::to_writer(&mut dst, &value).unwrap();
45081 dst
45082 };
45083 let request_size = request_value_reader
45084 .seek(std::io::SeekFrom::End(0))
45085 .unwrap();
45086 request_value_reader
45087 .seek(std::io::SeekFrom::Start(0))
45088 .unwrap();
45089
45090 loop {
45091 let token = match self
45092 .hub
45093 .auth
45094 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
45095 .await
45096 {
45097 Ok(token) => token,
45098 Err(e) => match dlg.token(e) {
45099 Ok(token) => token,
45100 Err(e) => {
45101 dlg.finished(false);
45102 return Err(common::Error::MissingToken(e));
45103 }
45104 },
45105 };
45106 request_value_reader
45107 .seek(std::io::SeekFrom::Start(0))
45108 .unwrap();
45109 let mut req_result = {
45110 let client = &self.hub.client;
45111 dlg.pre_request();
45112 let mut req_builder = hyper::Request::builder()
45113 .method(hyper::Method::POST)
45114 .uri(url.as_str())
45115 .header(USER_AGENT, self.hub._user_agent.clone());
45116
45117 if let Some(token) = token.as_ref() {
45118 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
45119 }
45120
45121 let request = req_builder
45122 .header(CONTENT_TYPE, json_mime_type.to_string())
45123 .header(CONTENT_LENGTH, request_size as u64)
45124 .body(common::to_body(
45125 request_value_reader.get_ref().clone().into(),
45126 ));
45127
45128 client.request(request.unwrap()).await
45129 };
45130
45131 match req_result {
45132 Err(err) => {
45133 if let common::Retry::After(d) = dlg.http_error(&err) {
45134 sleep(d).await;
45135 continue;
45136 }
45137 dlg.finished(false);
45138 return Err(common::Error::HttpError(err));
45139 }
45140 Ok(res) => {
45141 let (mut parts, body) = res.into_parts();
45142 let mut body = common::Body::new(body);
45143 if !parts.status.is_success() {
45144 let bytes = common::to_bytes(body).await.unwrap_or_default();
45145 let error = serde_json::from_str(&common::to_string(&bytes));
45146 let response = common::to_response(parts, bytes.into());
45147
45148 if let common::Retry::After(d) =
45149 dlg.http_failure(&response, error.as_ref().ok())
45150 {
45151 sleep(d).await;
45152 continue;
45153 }
45154
45155 dlg.finished(false);
45156
45157 return Err(match error {
45158 Ok(value) => common::Error::BadRequest(value),
45159 _ => common::Error::Failure(response),
45160 });
45161 }
45162 let response = {
45163 let bytes = common::to_bytes(body).await.unwrap_or_default();
45164 let encoded = common::to_string(&bytes);
45165 match serde_json::from_str(&encoded) {
45166 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
45167 Err(error) => {
45168 dlg.response_json_decode_error(&encoded, &error);
45169 return Err(common::Error::JsonDecodeError(
45170 encoded.to_string(),
45171 error,
45172 ));
45173 }
45174 }
45175 };
45176
45177 dlg.finished(true);
45178 return Ok(response);
45179 }
45180 }
45181 }
45182 }
45183
45184 ///
45185 /// Sets the *request* property to the given value.
45186 ///
45187 /// Even though the property as already been set when instantiating this call,
45188 /// we provide this method for API completeness.
45189 pub fn request(
45190 mut self,
45191 new_value: SetIamPolicyRequest,
45192 ) -> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C> {
45193 self._request = new_value;
45194 self
45195 }
45196 /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
45197 ///
45198 /// Sets the *resource* path property to the given value.
45199 ///
45200 /// Even though the property as already been set when instantiating this call,
45201 /// we provide this method for API completeness.
45202 pub fn resource(
45203 mut self,
45204 new_value: &str,
45205 ) -> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C> {
45206 self._resource = new_value.to_string();
45207 self
45208 }
45209 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
45210 /// while executing the actual API request.
45211 ///
45212 /// ````text
45213 /// It should be used to handle progress information, and to implement a certain level of resilience.
45214 /// ````
45215 ///
45216 /// Sets the *delegate* property to the given value.
45217 pub fn delegate(
45218 mut self,
45219 new_value: &'a mut dyn common::Delegate,
45220 ) -> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C> {
45221 self._delegate = Some(new_value);
45222 self
45223 }
45224
45225 /// Set any additional parameter of the query string used in the request.
45226 /// It should be used to set parameters which are not yet available through their own
45227 /// setters.
45228 ///
45229 /// Please note that this method must not be used to set any of the known parameters
45230 /// which have their own setter method. If done anyway, the request will fail.
45231 ///
45232 /// # Additional Parameters
45233 ///
45234 /// * *$.xgafv* (query-string) - V1 error format.
45235 /// * *access_token* (query-string) - OAuth access token.
45236 /// * *alt* (query-string) - Data format for response.
45237 /// * *callback* (query-string) - JSONP
45238 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
45239 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
45240 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
45241 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
45242 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
45243 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
45244 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
45245 pub fn param<T>(
45246 mut self,
45247 name: T,
45248 value: T,
45249 ) -> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C>
45250 where
45251 T: AsRef<str>,
45252 {
45253 self._additional_params
45254 .insert(name.as_ref().to_string(), value.as_ref().to_string());
45255 self
45256 }
45257
45258 /// Identifies the authorization scope for the method you are building.
45259 ///
45260 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
45261 /// [`Scope::CloudHealthcare`].
45262 ///
45263 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
45264 /// tokens for more than one scope.
45265 ///
45266 /// Usually there is more than one suitable scope to authorize an operation, some of which may
45267 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
45268 /// sufficient, a read-write scope will do as well.
45269 pub fn add_scope<St>(
45270 mut self,
45271 scope: St,
45272 ) -> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C>
45273 where
45274 St: AsRef<str>,
45275 {
45276 self._scopes.insert(String::from(scope.as_ref()));
45277 self
45278 }
45279 /// Identifies the authorization scope(s) for the method you are building.
45280 ///
45281 /// See [`Self::add_scope()`] for details.
45282 pub fn add_scopes<I, St>(
45283 mut self,
45284 scopes: I,
45285 ) -> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C>
45286 where
45287 I: IntoIterator<Item = St>,
45288 St: AsRef<str>,
45289 {
45290 self._scopes
45291 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
45292 self
45293 }
45294
45295 /// Removes all scopes, and no default scope will be used either.
45296 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
45297 /// for details).
45298 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StoreSetIamPolicyCall<'a, C> {
45299 self._scopes.clear();
45300 self
45301 }
45302}
45303
45304/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
45305///
45306/// A builder for the *locations.datasets.hl7V2Stores.testIamPermissions* method supported by a *project* resource.
45307/// It is not used directly, but through a [`ProjectMethods`] instance.
45308///
45309/// # Example
45310///
45311/// Instantiate a resource method builder
45312///
45313/// ```test_harness,no_run
45314/// # extern crate hyper;
45315/// # extern crate hyper_rustls;
45316/// # extern crate google_healthcare1 as healthcare1;
45317/// use healthcare1::api::TestIamPermissionsRequest;
45318/// # async fn dox() {
45319/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
45320///
45321/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
45322/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
45323/// # secret,
45324/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
45325/// # ).build().await.unwrap();
45326///
45327/// # let client = hyper_util::client::legacy::Client::builder(
45328/// # hyper_util::rt::TokioExecutor::new()
45329/// # )
45330/// # .build(
45331/// # hyper_rustls::HttpsConnectorBuilder::new()
45332/// # .with_native_roots()
45333/// # .unwrap()
45334/// # .https_or_http()
45335/// # .enable_http1()
45336/// # .build()
45337/// # );
45338/// # let mut hub = CloudHealthcare::new(client, auth);
45339/// // As the method needs a request, you would usually fill it with the desired information
45340/// // into the respective structure. Some of the parts shown here might not be applicable !
45341/// // Values shown here are possibly random and not representative !
45342/// let mut req = TestIamPermissionsRequest::default();
45343///
45344/// // You can configure optional parameters by calling the respective setters at will, and
45345/// // execute the final call using `doit()`.
45346/// // Values shown here are possibly random and not representative !
45347/// let result = hub.projects().locations_datasets_hl7_v2_stores_test_iam_permissions(req, "resource")
45348/// .doit().await;
45349/// # }
45350/// ```
45351pub struct ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C>
45352where
45353 C: 'a,
45354{
45355 hub: &'a CloudHealthcare<C>,
45356 _request: TestIamPermissionsRequest,
45357 _resource: String,
45358 _delegate: Option<&'a mut dyn common::Delegate>,
45359 _additional_params: HashMap<String, String>,
45360 _scopes: BTreeSet<String>,
45361}
45362
45363impl<'a, C> common::CallBuilder for ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C> {}
45364
45365impl<'a, C> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C>
45366where
45367 C: common::Connector,
45368{
45369 /// Perform the operation you have build so far.
45370 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
45371 use std::borrow::Cow;
45372 use std::io::{Read, Seek};
45373
45374 use common::{url::Params, ToParts};
45375 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
45376
45377 let mut dd = common::DefaultDelegate;
45378 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
45379 dlg.begin(common::MethodInfo {
45380 id: "healthcare.projects.locations.datasets.hl7V2Stores.testIamPermissions",
45381 http_method: hyper::Method::POST,
45382 });
45383
45384 for &field in ["alt", "resource"].iter() {
45385 if self._additional_params.contains_key(field) {
45386 dlg.finished(false);
45387 return Err(common::Error::FieldClash(field));
45388 }
45389 }
45390
45391 let mut params = Params::with_capacity(4 + self._additional_params.len());
45392 params.push("resource", self._resource);
45393
45394 params.extend(self._additional_params.iter());
45395
45396 params.push("alt", "json");
45397 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
45398 if self._scopes.is_empty() {
45399 self._scopes
45400 .insert(Scope::CloudHealthcare.as_ref().to_string());
45401 }
45402
45403 #[allow(clippy::single_element_loop)]
45404 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
45405 url = params.uri_replacement(url, param_name, find_this, true);
45406 }
45407 {
45408 let to_remove = ["resource"];
45409 params.remove_params(&to_remove);
45410 }
45411
45412 let url = params.parse_with_url(&url);
45413
45414 let mut json_mime_type = mime::APPLICATION_JSON;
45415 let mut request_value_reader = {
45416 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
45417 common::remove_json_null_values(&mut value);
45418 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
45419 serde_json::to_writer(&mut dst, &value).unwrap();
45420 dst
45421 };
45422 let request_size = request_value_reader
45423 .seek(std::io::SeekFrom::End(0))
45424 .unwrap();
45425 request_value_reader
45426 .seek(std::io::SeekFrom::Start(0))
45427 .unwrap();
45428
45429 loop {
45430 let token = match self
45431 .hub
45432 .auth
45433 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
45434 .await
45435 {
45436 Ok(token) => token,
45437 Err(e) => match dlg.token(e) {
45438 Ok(token) => token,
45439 Err(e) => {
45440 dlg.finished(false);
45441 return Err(common::Error::MissingToken(e));
45442 }
45443 },
45444 };
45445 request_value_reader
45446 .seek(std::io::SeekFrom::Start(0))
45447 .unwrap();
45448 let mut req_result = {
45449 let client = &self.hub.client;
45450 dlg.pre_request();
45451 let mut req_builder = hyper::Request::builder()
45452 .method(hyper::Method::POST)
45453 .uri(url.as_str())
45454 .header(USER_AGENT, self.hub._user_agent.clone());
45455
45456 if let Some(token) = token.as_ref() {
45457 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
45458 }
45459
45460 let request = req_builder
45461 .header(CONTENT_TYPE, json_mime_type.to_string())
45462 .header(CONTENT_LENGTH, request_size as u64)
45463 .body(common::to_body(
45464 request_value_reader.get_ref().clone().into(),
45465 ));
45466
45467 client.request(request.unwrap()).await
45468 };
45469
45470 match req_result {
45471 Err(err) => {
45472 if let common::Retry::After(d) = dlg.http_error(&err) {
45473 sleep(d).await;
45474 continue;
45475 }
45476 dlg.finished(false);
45477 return Err(common::Error::HttpError(err));
45478 }
45479 Ok(res) => {
45480 let (mut parts, body) = res.into_parts();
45481 let mut body = common::Body::new(body);
45482 if !parts.status.is_success() {
45483 let bytes = common::to_bytes(body).await.unwrap_or_default();
45484 let error = serde_json::from_str(&common::to_string(&bytes));
45485 let response = common::to_response(parts, bytes.into());
45486
45487 if let common::Retry::After(d) =
45488 dlg.http_failure(&response, error.as_ref().ok())
45489 {
45490 sleep(d).await;
45491 continue;
45492 }
45493
45494 dlg.finished(false);
45495
45496 return Err(match error {
45497 Ok(value) => common::Error::BadRequest(value),
45498 _ => common::Error::Failure(response),
45499 });
45500 }
45501 let response = {
45502 let bytes = common::to_bytes(body).await.unwrap_or_default();
45503 let encoded = common::to_string(&bytes);
45504 match serde_json::from_str(&encoded) {
45505 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
45506 Err(error) => {
45507 dlg.response_json_decode_error(&encoded, &error);
45508 return Err(common::Error::JsonDecodeError(
45509 encoded.to_string(),
45510 error,
45511 ));
45512 }
45513 }
45514 };
45515
45516 dlg.finished(true);
45517 return Ok(response);
45518 }
45519 }
45520 }
45521 }
45522
45523 ///
45524 /// Sets the *request* property to the given value.
45525 ///
45526 /// Even though the property as already been set when instantiating this call,
45527 /// we provide this method for API completeness.
45528 pub fn request(
45529 mut self,
45530 new_value: TestIamPermissionsRequest,
45531 ) -> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C> {
45532 self._request = new_value;
45533 self
45534 }
45535 /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
45536 ///
45537 /// Sets the *resource* path property to the given value.
45538 ///
45539 /// Even though the property as already been set when instantiating this call,
45540 /// we provide this method for API completeness.
45541 pub fn resource(
45542 mut self,
45543 new_value: &str,
45544 ) -> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C> {
45545 self._resource = new_value.to_string();
45546 self
45547 }
45548 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
45549 /// while executing the actual API request.
45550 ///
45551 /// ````text
45552 /// It should be used to handle progress information, and to implement a certain level of resilience.
45553 /// ````
45554 ///
45555 /// Sets the *delegate* property to the given value.
45556 pub fn delegate(
45557 mut self,
45558 new_value: &'a mut dyn common::Delegate,
45559 ) -> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C> {
45560 self._delegate = Some(new_value);
45561 self
45562 }
45563
45564 /// Set any additional parameter of the query string used in the request.
45565 /// It should be used to set parameters which are not yet available through their own
45566 /// setters.
45567 ///
45568 /// Please note that this method must not be used to set any of the known parameters
45569 /// which have their own setter method. If done anyway, the request will fail.
45570 ///
45571 /// # Additional Parameters
45572 ///
45573 /// * *$.xgafv* (query-string) - V1 error format.
45574 /// * *access_token* (query-string) - OAuth access token.
45575 /// * *alt* (query-string) - Data format for response.
45576 /// * *callback* (query-string) - JSONP
45577 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
45578 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
45579 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
45580 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
45581 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
45582 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
45583 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
45584 pub fn param<T>(
45585 mut self,
45586 name: T,
45587 value: T,
45588 ) -> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C>
45589 where
45590 T: AsRef<str>,
45591 {
45592 self._additional_params
45593 .insert(name.as_ref().to_string(), value.as_ref().to_string());
45594 self
45595 }
45596
45597 /// Identifies the authorization scope for the method you are building.
45598 ///
45599 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
45600 /// [`Scope::CloudHealthcare`].
45601 ///
45602 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
45603 /// tokens for more than one scope.
45604 ///
45605 /// Usually there is more than one suitable scope to authorize an operation, some of which may
45606 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
45607 /// sufficient, a read-write scope will do as well.
45608 pub fn add_scope<St>(
45609 mut self,
45610 scope: St,
45611 ) -> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C>
45612 where
45613 St: AsRef<str>,
45614 {
45615 self._scopes.insert(String::from(scope.as_ref()));
45616 self
45617 }
45618 /// Identifies the authorization scope(s) for the method you are building.
45619 ///
45620 /// See [`Self::add_scope()`] for details.
45621 pub fn add_scopes<I, St>(
45622 mut self,
45623 scopes: I,
45624 ) -> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C>
45625 where
45626 I: IntoIterator<Item = St>,
45627 St: AsRef<str>,
45628 {
45629 self._scopes
45630 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
45631 self
45632 }
45633
45634 /// Removes all scopes, and no default scope will be used either.
45635 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
45636 /// for details).
45637 pub fn clear_scopes(mut self) -> ProjectLocationDatasetHl7V2StoreTestIamPermissionCall<'a, C> {
45638 self._scopes.clear();
45639 self
45640 }
45641}
45642
45643/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
45644///
45645/// A builder for the *locations.datasets.operations.cancel* method supported by a *project* resource.
45646/// It is not used directly, but through a [`ProjectMethods`] instance.
45647///
45648/// # Example
45649///
45650/// Instantiate a resource method builder
45651///
45652/// ```test_harness,no_run
45653/// # extern crate hyper;
45654/// # extern crate hyper_rustls;
45655/// # extern crate google_healthcare1 as healthcare1;
45656/// use healthcare1::api::CancelOperationRequest;
45657/// # async fn dox() {
45658/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
45659///
45660/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
45661/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
45662/// # secret,
45663/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
45664/// # ).build().await.unwrap();
45665///
45666/// # let client = hyper_util::client::legacy::Client::builder(
45667/// # hyper_util::rt::TokioExecutor::new()
45668/// # )
45669/// # .build(
45670/// # hyper_rustls::HttpsConnectorBuilder::new()
45671/// # .with_native_roots()
45672/// # .unwrap()
45673/// # .https_or_http()
45674/// # .enable_http1()
45675/// # .build()
45676/// # );
45677/// # let mut hub = CloudHealthcare::new(client, auth);
45678/// // As the method needs a request, you would usually fill it with the desired information
45679/// // into the respective structure. Some of the parts shown here might not be applicable !
45680/// // Values shown here are possibly random and not representative !
45681/// let mut req = CancelOperationRequest::default();
45682///
45683/// // You can configure optional parameters by calling the respective setters at will, and
45684/// // execute the final call using `doit()`.
45685/// // Values shown here are possibly random and not representative !
45686/// let result = hub.projects().locations_datasets_operations_cancel(req, "name")
45687/// .doit().await;
45688/// # }
45689/// ```
45690pub struct ProjectLocationDatasetOperationCancelCall<'a, C>
45691where
45692 C: 'a,
45693{
45694 hub: &'a CloudHealthcare<C>,
45695 _request: CancelOperationRequest,
45696 _name: String,
45697 _delegate: Option<&'a mut dyn common::Delegate>,
45698 _additional_params: HashMap<String, String>,
45699 _scopes: BTreeSet<String>,
45700}
45701
45702impl<'a, C> common::CallBuilder for ProjectLocationDatasetOperationCancelCall<'a, C> {}
45703
45704impl<'a, C> ProjectLocationDatasetOperationCancelCall<'a, C>
45705where
45706 C: common::Connector,
45707{
45708 /// Perform the operation you have build so far.
45709 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
45710 use std::borrow::Cow;
45711 use std::io::{Read, Seek};
45712
45713 use common::{url::Params, ToParts};
45714 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
45715
45716 let mut dd = common::DefaultDelegate;
45717 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
45718 dlg.begin(common::MethodInfo {
45719 id: "healthcare.projects.locations.datasets.operations.cancel",
45720 http_method: hyper::Method::POST,
45721 });
45722
45723 for &field in ["alt", "name"].iter() {
45724 if self._additional_params.contains_key(field) {
45725 dlg.finished(false);
45726 return Err(common::Error::FieldClash(field));
45727 }
45728 }
45729
45730 let mut params = Params::with_capacity(4 + self._additional_params.len());
45731 params.push("name", self._name);
45732
45733 params.extend(self._additional_params.iter());
45734
45735 params.push("alt", "json");
45736 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
45737 if self._scopes.is_empty() {
45738 self._scopes
45739 .insert(Scope::CloudHealthcare.as_ref().to_string());
45740 }
45741
45742 #[allow(clippy::single_element_loop)]
45743 for &(find_this, param_name) in [("{+name}", "name")].iter() {
45744 url = params.uri_replacement(url, param_name, find_this, true);
45745 }
45746 {
45747 let to_remove = ["name"];
45748 params.remove_params(&to_remove);
45749 }
45750
45751 let url = params.parse_with_url(&url);
45752
45753 let mut json_mime_type = mime::APPLICATION_JSON;
45754 let mut request_value_reader = {
45755 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
45756 common::remove_json_null_values(&mut value);
45757 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
45758 serde_json::to_writer(&mut dst, &value).unwrap();
45759 dst
45760 };
45761 let request_size = request_value_reader
45762 .seek(std::io::SeekFrom::End(0))
45763 .unwrap();
45764 request_value_reader
45765 .seek(std::io::SeekFrom::Start(0))
45766 .unwrap();
45767
45768 loop {
45769 let token = match self
45770 .hub
45771 .auth
45772 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
45773 .await
45774 {
45775 Ok(token) => token,
45776 Err(e) => match dlg.token(e) {
45777 Ok(token) => token,
45778 Err(e) => {
45779 dlg.finished(false);
45780 return Err(common::Error::MissingToken(e));
45781 }
45782 },
45783 };
45784 request_value_reader
45785 .seek(std::io::SeekFrom::Start(0))
45786 .unwrap();
45787 let mut req_result = {
45788 let client = &self.hub.client;
45789 dlg.pre_request();
45790 let mut req_builder = hyper::Request::builder()
45791 .method(hyper::Method::POST)
45792 .uri(url.as_str())
45793 .header(USER_AGENT, self.hub._user_agent.clone());
45794
45795 if let Some(token) = token.as_ref() {
45796 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
45797 }
45798
45799 let request = req_builder
45800 .header(CONTENT_TYPE, json_mime_type.to_string())
45801 .header(CONTENT_LENGTH, request_size as u64)
45802 .body(common::to_body(
45803 request_value_reader.get_ref().clone().into(),
45804 ));
45805
45806 client.request(request.unwrap()).await
45807 };
45808
45809 match req_result {
45810 Err(err) => {
45811 if let common::Retry::After(d) = dlg.http_error(&err) {
45812 sleep(d).await;
45813 continue;
45814 }
45815 dlg.finished(false);
45816 return Err(common::Error::HttpError(err));
45817 }
45818 Ok(res) => {
45819 let (mut parts, body) = res.into_parts();
45820 let mut body = common::Body::new(body);
45821 if !parts.status.is_success() {
45822 let bytes = common::to_bytes(body).await.unwrap_or_default();
45823 let error = serde_json::from_str(&common::to_string(&bytes));
45824 let response = common::to_response(parts, bytes.into());
45825
45826 if let common::Retry::After(d) =
45827 dlg.http_failure(&response, error.as_ref().ok())
45828 {
45829 sleep(d).await;
45830 continue;
45831 }
45832
45833 dlg.finished(false);
45834
45835 return Err(match error {
45836 Ok(value) => common::Error::BadRequest(value),
45837 _ => common::Error::Failure(response),
45838 });
45839 }
45840 let response = {
45841 let bytes = common::to_bytes(body).await.unwrap_or_default();
45842 let encoded = common::to_string(&bytes);
45843 match serde_json::from_str(&encoded) {
45844 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
45845 Err(error) => {
45846 dlg.response_json_decode_error(&encoded, &error);
45847 return Err(common::Error::JsonDecodeError(
45848 encoded.to_string(),
45849 error,
45850 ));
45851 }
45852 }
45853 };
45854
45855 dlg.finished(true);
45856 return Ok(response);
45857 }
45858 }
45859 }
45860 }
45861
45862 ///
45863 /// Sets the *request* property to the given value.
45864 ///
45865 /// Even though the property as already been set when instantiating this call,
45866 /// we provide this method for API completeness.
45867 pub fn request(
45868 mut self,
45869 new_value: CancelOperationRequest,
45870 ) -> ProjectLocationDatasetOperationCancelCall<'a, C> {
45871 self._request = new_value;
45872 self
45873 }
45874 /// The name of the operation resource to be cancelled.
45875 ///
45876 /// Sets the *name* path property to the given value.
45877 ///
45878 /// Even though the property as already been set when instantiating this call,
45879 /// we provide this method for API completeness.
45880 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetOperationCancelCall<'a, C> {
45881 self._name = new_value.to_string();
45882 self
45883 }
45884 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
45885 /// while executing the actual API request.
45886 ///
45887 /// ````text
45888 /// It should be used to handle progress information, and to implement a certain level of resilience.
45889 /// ````
45890 ///
45891 /// Sets the *delegate* property to the given value.
45892 pub fn delegate(
45893 mut self,
45894 new_value: &'a mut dyn common::Delegate,
45895 ) -> ProjectLocationDatasetOperationCancelCall<'a, C> {
45896 self._delegate = Some(new_value);
45897 self
45898 }
45899
45900 /// Set any additional parameter of the query string used in the request.
45901 /// It should be used to set parameters which are not yet available through their own
45902 /// setters.
45903 ///
45904 /// Please note that this method must not be used to set any of the known parameters
45905 /// which have their own setter method. If done anyway, the request will fail.
45906 ///
45907 /// # Additional Parameters
45908 ///
45909 /// * *$.xgafv* (query-string) - V1 error format.
45910 /// * *access_token* (query-string) - OAuth access token.
45911 /// * *alt* (query-string) - Data format for response.
45912 /// * *callback* (query-string) - JSONP
45913 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
45914 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
45915 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
45916 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
45917 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
45918 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
45919 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
45920 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetOperationCancelCall<'a, C>
45921 where
45922 T: AsRef<str>,
45923 {
45924 self._additional_params
45925 .insert(name.as_ref().to_string(), value.as_ref().to_string());
45926 self
45927 }
45928
45929 /// Identifies the authorization scope for the method you are building.
45930 ///
45931 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
45932 /// [`Scope::CloudHealthcare`].
45933 ///
45934 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
45935 /// tokens for more than one scope.
45936 ///
45937 /// Usually there is more than one suitable scope to authorize an operation, some of which may
45938 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
45939 /// sufficient, a read-write scope will do as well.
45940 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetOperationCancelCall<'a, C>
45941 where
45942 St: AsRef<str>,
45943 {
45944 self._scopes.insert(String::from(scope.as_ref()));
45945 self
45946 }
45947 /// Identifies the authorization scope(s) for the method you are building.
45948 ///
45949 /// See [`Self::add_scope()`] for details.
45950 pub fn add_scopes<I, St>(
45951 mut self,
45952 scopes: I,
45953 ) -> ProjectLocationDatasetOperationCancelCall<'a, C>
45954 where
45955 I: IntoIterator<Item = St>,
45956 St: AsRef<str>,
45957 {
45958 self._scopes
45959 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
45960 self
45961 }
45962
45963 /// Removes all scopes, and no default scope will be used either.
45964 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
45965 /// for details).
45966 pub fn clear_scopes(mut self) -> ProjectLocationDatasetOperationCancelCall<'a, C> {
45967 self._scopes.clear();
45968 self
45969 }
45970}
45971
45972/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
45973///
45974/// A builder for the *locations.datasets.operations.get* method supported by a *project* resource.
45975/// It is not used directly, but through a [`ProjectMethods`] instance.
45976///
45977/// # Example
45978///
45979/// Instantiate a resource method builder
45980///
45981/// ```test_harness,no_run
45982/// # extern crate hyper;
45983/// # extern crate hyper_rustls;
45984/// # extern crate google_healthcare1 as healthcare1;
45985/// # async fn dox() {
45986/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
45987///
45988/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
45989/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
45990/// # secret,
45991/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
45992/// # ).build().await.unwrap();
45993///
45994/// # let client = hyper_util::client::legacy::Client::builder(
45995/// # hyper_util::rt::TokioExecutor::new()
45996/// # )
45997/// # .build(
45998/// # hyper_rustls::HttpsConnectorBuilder::new()
45999/// # .with_native_roots()
46000/// # .unwrap()
46001/// # .https_or_http()
46002/// # .enable_http1()
46003/// # .build()
46004/// # );
46005/// # let mut hub = CloudHealthcare::new(client, auth);
46006/// // You can configure optional parameters by calling the respective setters at will, and
46007/// // execute the final call using `doit()`.
46008/// // Values shown here are possibly random and not representative !
46009/// let result = hub.projects().locations_datasets_operations_get("name")
46010/// .doit().await;
46011/// # }
46012/// ```
46013pub struct ProjectLocationDatasetOperationGetCall<'a, C>
46014where
46015 C: 'a,
46016{
46017 hub: &'a CloudHealthcare<C>,
46018 _name: String,
46019 _delegate: Option<&'a mut dyn common::Delegate>,
46020 _additional_params: HashMap<String, String>,
46021 _scopes: BTreeSet<String>,
46022}
46023
46024impl<'a, C> common::CallBuilder for ProjectLocationDatasetOperationGetCall<'a, C> {}
46025
46026impl<'a, C> ProjectLocationDatasetOperationGetCall<'a, C>
46027where
46028 C: common::Connector,
46029{
46030 /// Perform the operation you have build so far.
46031 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
46032 use std::borrow::Cow;
46033 use std::io::{Read, Seek};
46034
46035 use common::{url::Params, ToParts};
46036 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
46037
46038 let mut dd = common::DefaultDelegate;
46039 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
46040 dlg.begin(common::MethodInfo {
46041 id: "healthcare.projects.locations.datasets.operations.get",
46042 http_method: hyper::Method::GET,
46043 });
46044
46045 for &field in ["alt", "name"].iter() {
46046 if self._additional_params.contains_key(field) {
46047 dlg.finished(false);
46048 return Err(common::Error::FieldClash(field));
46049 }
46050 }
46051
46052 let mut params = Params::with_capacity(3 + self._additional_params.len());
46053 params.push("name", self._name);
46054
46055 params.extend(self._additional_params.iter());
46056
46057 params.push("alt", "json");
46058 let mut url = self.hub._base_url.clone() + "v1/{+name}";
46059 if self._scopes.is_empty() {
46060 self._scopes
46061 .insert(Scope::CloudHealthcare.as_ref().to_string());
46062 }
46063
46064 #[allow(clippy::single_element_loop)]
46065 for &(find_this, param_name) in [("{+name}", "name")].iter() {
46066 url = params.uri_replacement(url, param_name, find_this, true);
46067 }
46068 {
46069 let to_remove = ["name"];
46070 params.remove_params(&to_remove);
46071 }
46072
46073 let url = params.parse_with_url(&url);
46074
46075 loop {
46076 let token = match self
46077 .hub
46078 .auth
46079 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
46080 .await
46081 {
46082 Ok(token) => token,
46083 Err(e) => match dlg.token(e) {
46084 Ok(token) => token,
46085 Err(e) => {
46086 dlg.finished(false);
46087 return Err(common::Error::MissingToken(e));
46088 }
46089 },
46090 };
46091 let mut req_result = {
46092 let client = &self.hub.client;
46093 dlg.pre_request();
46094 let mut req_builder = hyper::Request::builder()
46095 .method(hyper::Method::GET)
46096 .uri(url.as_str())
46097 .header(USER_AGENT, self.hub._user_agent.clone());
46098
46099 if let Some(token) = token.as_ref() {
46100 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
46101 }
46102
46103 let request = req_builder
46104 .header(CONTENT_LENGTH, 0_u64)
46105 .body(common::to_body::<String>(None));
46106
46107 client.request(request.unwrap()).await
46108 };
46109
46110 match req_result {
46111 Err(err) => {
46112 if let common::Retry::After(d) = dlg.http_error(&err) {
46113 sleep(d).await;
46114 continue;
46115 }
46116 dlg.finished(false);
46117 return Err(common::Error::HttpError(err));
46118 }
46119 Ok(res) => {
46120 let (mut parts, body) = res.into_parts();
46121 let mut body = common::Body::new(body);
46122 if !parts.status.is_success() {
46123 let bytes = common::to_bytes(body).await.unwrap_or_default();
46124 let error = serde_json::from_str(&common::to_string(&bytes));
46125 let response = common::to_response(parts, bytes.into());
46126
46127 if let common::Retry::After(d) =
46128 dlg.http_failure(&response, error.as_ref().ok())
46129 {
46130 sleep(d).await;
46131 continue;
46132 }
46133
46134 dlg.finished(false);
46135
46136 return Err(match error {
46137 Ok(value) => common::Error::BadRequest(value),
46138 _ => common::Error::Failure(response),
46139 });
46140 }
46141 let response = {
46142 let bytes = common::to_bytes(body).await.unwrap_or_default();
46143 let encoded = common::to_string(&bytes);
46144 match serde_json::from_str(&encoded) {
46145 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
46146 Err(error) => {
46147 dlg.response_json_decode_error(&encoded, &error);
46148 return Err(common::Error::JsonDecodeError(
46149 encoded.to_string(),
46150 error,
46151 ));
46152 }
46153 }
46154 };
46155
46156 dlg.finished(true);
46157 return Ok(response);
46158 }
46159 }
46160 }
46161 }
46162
46163 /// The name of the operation resource.
46164 ///
46165 /// Sets the *name* path property to the given value.
46166 ///
46167 /// Even though the property as already been set when instantiating this call,
46168 /// we provide this method for API completeness.
46169 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetOperationGetCall<'a, C> {
46170 self._name = new_value.to_string();
46171 self
46172 }
46173 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
46174 /// while executing the actual API request.
46175 ///
46176 /// ````text
46177 /// It should be used to handle progress information, and to implement a certain level of resilience.
46178 /// ````
46179 ///
46180 /// Sets the *delegate* property to the given value.
46181 pub fn delegate(
46182 mut self,
46183 new_value: &'a mut dyn common::Delegate,
46184 ) -> ProjectLocationDatasetOperationGetCall<'a, C> {
46185 self._delegate = Some(new_value);
46186 self
46187 }
46188
46189 /// Set any additional parameter of the query string used in the request.
46190 /// It should be used to set parameters which are not yet available through their own
46191 /// setters.
46192 ///
46193 /// Please note that this method must not be used to set any of the known parameters
46194 /// which have their own setter method. If done anyway, the request will fail.
46195 ///
46196 /// # Additional Parameters
46197 ///
46198 /// * *$.xgafv* (query-string) - V1 error format.
46199 /// * *access_token* (query-string) - OAuth access token.
46200 /// * *alt* (query-string) - Data format for response.
46201 /// * *callback* (query-string) - JSONP
46202 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
46203 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
46204 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
46205 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
46206 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
46207 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
46208 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
46209 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetOperationGetCall<'a, C>
46210 where
46211 T: AsRef<str>,
46212 {
46213 self._additional_params
46214 .insert(name.as_ref().to_string(), value.as_ref().to_string());
46215 self
46216 }
46217
46218 /// Identifies the authorization scope for the method you are building.
46219 ///
46220 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
46221 /// [`Scope::CloudHealthcare`].
46222 ///
46223 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
46224 /// tokens for more than one scope.
46225 ///
46226 /// Usually there is more than one suitable scope to authorize an operation, some of which may
46227 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
46228 /// sufficient, a read-write scope will do as well.
46229 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetOperationGetCall<'a, C>
46230 where
46231 St: AsRef<str>,
46232 {
46233 self._scopes.insert(String::from(scope.as_ref()));
46234 self
46235 }
46236 /// Identifies the authorization scope(s) for the method you are building.
46237 ///
46238 /// See [`Self::add_scope()`] for details.
46239 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetOperationGetCall<'a, C>
46240 where
46241 I: IntoIterator<Item = St>,
46242 St: AsRef<str>,
46243 {
46244 self._scopes
46245 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
46246 self
46247 }
46248
46249 /// Removes all scopes, and no default scope will be used either.
46250 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
46251 /// for details).
46252 pub fn clear_scopes(mut self) -> ProjectLocationDatasetOperationGetCall<'a, C> {
46253 self._scopes.clear();
46254 self
46255 }
46256}
46257
46258/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
46259///
46260/// A builder for the *locations.datasets.operations.list* method supported by a *project* resource.
46261/// It is not used directly, but through a [`ProjectMethods`] instance.
46262///
46263/// # Example
46264///
46265/// Instantiate a resource method builder
46266///
46267/// ```test_harness,no_run
46268/// # extern crate hyper;
46269/// # extern crate hyper_rustls;
46270/// # extern crate google_healthcare1 as healthcare1;
46271/// # async fn dox() {
46272/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
46273///
46274/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
46275/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
46276/// # secret,
46277/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
46278/// # ).build().await.unwrap();
46279///
46280/// # let client = hyper_util::client::legacy::Client::builder(
46281/// # hyper_util::rt::TokioExecutor::new()
46282/// # )
46283/// # .build(
46284/// # hyper_rustls::HttpsConnectorBuilder::new()
46285/// # .with_native_roots()
46286/// # .unwrap()
46287/// # .https_or_http()
46288/// # .enable_http1()
46289/// # .build()
46290/// # );
46291/// # let mut hub = CloudHealthcare::new(client, auth);
46292/// // You can configure optional parameters by calling the respective setters at will, and
46293/// // execute the final call using `doit()`.
46294/// // Values shown here are possibly random and not representative !
46295/// let result = hub.projects().locations_datasets_operations_list("name")
46296/// .page_token("sit")
46297/// .page_size(-76)
46298/// .filter("duo")
46299/// .doit().await;
46300/// # }
46301/// ```
46302pub struct ProjectLocationDatasetOperationListCall<'a, C>
46303where
46304 C: 'a,
46305{
46306 hub: &'a CloudHealthcare<C>,
46307 _name: String,
46308 _page_token: Option<String>,
46309 _page_size: Option<i32>,
46310 _filter: Option<String>,
46311 _delegate: Option<&'a mut dyn common::Delegate>,
46312 _additional_params: HashMap<String, String>,
46313 _scopes: BTreeSet<String>,
46314}
46315
46316impl<'a, C> common::CallBuilder for ProjectLocationDatasetOperationListCall<'a, C> {}
46317
46318impl<'a, C> ProjectLocationDatasetOperationListCall<'a, C>
46319where
46320 C: common::Connector,
46321{
46322 /// Perform the operation you have build so far.
46323 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
46324 use std::borrow::Cow;
46325 use std::io::{Read, Seek};
46326
46327 use common::{url::Params, ToParts};
46328 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
46329
46330 let mut dd = common::DefaultDelegate;
46331 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
46332 dlg.begin(common::MethodInfo {
46333 id: "healthcare.projects.locations.datasets.operations.list",
46334 http_method: hyper::Method::GET,
46335 });
46336
46337 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
46338 if self._additional_params.contains_key(field) {
46339 dlg.finished(false);
46340 return Err(common::Error::FieldClash(field));
46341 }
46342 }
46343
46344 let mut params = Params::with_capacity(6 + self._additional_params.len());
46345 params.push("name", self._name);
46346 if let Some(value) = self._page_token.as_ref() {
46347 params.push("pageToken", value);
46348 }
46349 if let Some(value) = self._page_size.as_ref() {
46350 params.push("pageSize", value.to_string());
46351 }
46352 if let Some(value) = self._filter.as_ref() {
46353 params.push("filter", value);
46354 }
46355
46356 params.extend(self._additional_params.iter());
46357
46358 params.push("alt", "json");
46359 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
46360 if self._scopes.is_empty() {
46361 self._scopes
46362 .insert(Scope::CloudHealthcare.as_ref().to_string());
46363 }
46364
46365 #[allow(clippy::single_element_loop)]
46366 for &(find_this, param_name) in [("{+name}", "name")].iter() {
46367 url = params.uri_replacement(url, param_name, find_this, true);
46368 }
46369 {
46370 let to_remove = ["name"];
46371 params.remove_params(&to_remove);
46372 }
46373
46374 let url = params.parse_with_url(&url);
46375
46376 loop {
46377 let token = match self
46378 .hub
46379 .auth
46380 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
46381 .await
46382 {
46383 Ok(token) => token,
46384 Err(e) => match dlg.token(e) {
46385 Ok(token) => token,
46386 Err(e) => {
46387 dlg.finished(false);
46388 return Err(common::Error::MissingToken(e));
46389 }
46390 },
46391 };
46392 let mut req_result = {
46393 let client = &self.hub.client;
46394 dlg.pre_request();
46395 let mut req_builder = hyper::Request::builder()
46396 .method(hyper::Method::GET)
46397 .uri(url.as_str())
46398 .header(USER_AGENT, self.hub._user_agent.clone());
46399
46400 if let Some(token) = token.as_ref() {
46401 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
46402 }
46403
46404 let request = req_builder
46405 .header(CONTENT_LENGTH, 0_u64)
46406 .body(common::to_body::<String>(None));
46407
46408 client.request(request.unwrap()).await
46409 };
46410
46411 match req_result {
46412 Err(err) => {
46413 if let common::Retry::After(d) = dlg.http_error(&err) {
46414 sleep(d).await;
46415 continue;
46416 }
46417 dlg.finished(false);
46418 return Err(common::Error::HttpError(err));
46419 }
46420 Ok(res) => {
46421 let (mut parts, body) = res.into_parts();
46422 let mut body = common::Body::new(body);
46423 if !parts.status.is_success() {
46424 let bytes = common::to_bytes(body).await.unwrap_or_default();
46425 let error = serde_json::from_str(&common::to_string(&bytes));
46426 let response = common::to_response(parts, bytes.into());
46427
46428 if let common::Retry::After(d) =
46429 dlg.http_failure(&response, error.as_ref().ok())
46430 {
46431 sleep(d).await;
46432 continue;
46433 }
46434
46435 dlg.finished(false);
46436
46437 return Err(match error {
46438 Ok(value) => common::Error::BadRequest(value),
46439 _ => common::Error::Failure(response),
46440 });
46441 }
46442 let response = {
46443 let bytes = common::to_bytes(body).await.unwrap_or_default();
46444 let encoded = common::to_string(&bytes);
46445 match serde_json::from_str(&encoded) {
46446 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
46447 Err(error) => {
46448 dlg.response_json_decode_error(&encoded, &error);
46449 return Err(common::Error::JsonDecodeError(
46450 encoded.to_string(),
46451 error,
46452 ));
46453 }
46454 }
46455 };
46456
46457 dlg.finished(true);
46458 return Ok(response);
46459 }
46460 }
46461 }
46462 }
46463
46464 /// The name of the operation's parent resource.
46465 ///
46466 /// Sets the *name* path property to the given value.
46467 ///
46468 /// Even though the property as already been set when instantiating this call,
46469 /// we provide this method for API completeness.
46470 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetOperationListCall<'a, C> {
46471 self._name = new_value.to_string();
46472 self
46473 }
46474 /// The standard list page token.
46475 ///
46476 /// Sets the *page token* query property to the given value.
46477 pub fn page_token(mut self, new_value: &str) -> ProjectLocationDatasetOperationListCall<'a, C> {
46478 self._page_token = Some(new_value.to_string());
46479 self
46480 }
46481 /// The standard list page size.
46482 ///
46483 /// Sets the *page size* query property to the given value.
46484 pub fn page_size(mut self, new_value: i32) -> ProjectLocationDatasetOperationListCall<'a, C> {
46485 self._page_size = Some(new_value);
46486 self
46487 }
46488 /// The standard list filter.
46489 ///
46490 /// Sets the *filter* query property to the given value.
46491 pub fn filter(mut self, new_value: &str) -> ProjectLocationDatasetOperationListCall<'a, C> {
46492 self._filter = Some(new_value.to_string());
46493 self
46494 }
46495 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
46496 /// while executing the actual API request.
46497 ///
46498 /// ````text
46499 /// It should be used to handle progress information, and to implement a certain level of resilience.
46500 /// ````
46501 ///
46502 /// Sets the *delegate* property to the given value.
46503 pub fn delegate(
46504 mut self,
46505 new_value: &'a mut dyn common::Delegate,
46506 ) -> ProjectLocationDatasetOperationListCall<'a, C> {
46507 self._delegate = Some(new_value);
46508 self
46509 }
46510
46511 /// Set any additional parameter of the query string used in the request.
46512 /// It should be used to set parameters which are not yet available through their own
46513 /// setters.
46514 ///
46515 /// Please note that this method must not be used to set any of the known parameters
46516 /// which have their own setter method. If done anyway, the request will fail.
46517 ///
46518 /// # Additional Parameters
46519 ///
46520 /// * *$.xgafv* (query-string) - V1 error format.
46521 /// * *access_token* (query-string) - OAuth access token.
46522 /// * *alt* (query-string) - Data format for response.
46523 /// * *callback* (query-string) - JSONP
46524 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
46525 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
46526 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
46527 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
46528 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
46529 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
46530 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
46531 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetOperationListCall<'a, C>
46532 where
46533 T: AsRef<str>,
46534 {
46535 self._additional_params
46536 .insert(name.as_ref().to_string(), value.as_ref().to_string());
46537 self
46538 }
46539
46540 /// Identifies the authorization scope for the method you are building.
46541 ///
46542 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
46543 /// [`Scope::CloudHealthcare`].
46544 ///
46545 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
46546 /// tokens for more than one scope.
46547 ///
46548 /// Usually there is more than one suitable scope to authorize an operation, some of which may
46549 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
46550 /// sufficient, a read-write scope will do as well.
46551 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetOperationListCall<'a, C>
46552 where
46553 St: AsRef<str>,
46554 {
46555 self._scopes.insert(String::from(scope.as_ref()));
46556 self
46557 }
46558 /// Identifies the authorization scope(s) for the method you are building.
46559 ///
46560 /// See [`Self::add_scope()`] for details.
46561 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetOperationListCall<'a, C>
46562 where
46563 I: IntoIterator<Item = St>,
46564 St: AsRef<str>,
46565 {
46566 self._scopes
46567 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
46568 self
46569 }
46570
46571 /// Removes all scopes, and no default scope will be used either.
46572 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
46573 /// for details).
46574 pub fn clear_scopes(mut self) -> ProjectLocationDatasetOperationListCall<'a, C> {
46575 self._scopes.clear();
46576 self
46577 }
46578}
46579
46580/// Creates a new health dataset. Results are returned through the Operation interface which returns either an `Operation.response` which contains a Dataset or `Operation.error`. The metadata field type is OperationMetadata.
46581///
46582/// A builder for the *locations.datasets.create* method supported by a *project* resource.
46583/// It is not used directly, but through a [`ProjectMethods`] instance.
46584///
46585/// # Example
46586///
46587/// Instantiate a resource method builder
46588///
46589/// ```test_harness,no_run
46590/// # extern crate hyper;
46591/// # extern crate hyper_rustls;
46592/// # extern crate google_healthcare1 as healthcare1;
46593/// use healthcare1::api::Dataset;
46594/// # async fn dox() {
46595/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
46596///
46597/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
46598/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
46599/// # secret,
46600/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
46601/// # ).build().await.unwrap();
46602///
46603/// # let client = hyper_util::client::legacy::Client::builder(
46604/// # hyper_util::rt::TokioExecutor::new()
46605/// # )
46606/// # .build(
46607/// # hyper_rustls::HttpsConnectorBuilder::new()
46608/// # .with_native_roots()
46609/// # .unwrap()
46610/// # .https_or_http()
46611/// # .enable_http1()
46612/// # .build()
46613/// # );
46614/// # let mut hub = CloudHealthcare::new(client, auth);
46615/// // As the method needs a request, you would usually fill it with the desired information
46616/// // into the respective structure. Some of the parts shown here might not be applicable !
46617/// // Values shown here are possibly random and not representative !
46618/// let mut req = Dataset::default();
46619///
46620/// // You can configure optional parameters by calling the respective setters at will, and
46621/// // execute the final call using `doit()`.
46622/// // Values shown here are possibly random and not representative !
46623/// let result = hub.projects().locations_datasets_create(req, "parent")
46624/// .dataset_id("ut")
46625/// .doit().await;
46626/// # }
46627/// ```
46628pub struct ProjectLocationDatasetCreateCall<'a, C>
46629where
46630 C: 'a,
46631{
46632 hub: &'a CloudHealthcare<C>,
46633 _request: Dataset,
46634 _parent: String,
46635 _dataset_id: Option<String>,
46636 _delegate: Option<&'a mut dyn common::Delegate>,
46637 _additional_params: HashMap<String, String>,
46638 _scopes: BTreeSet<String>,
46639}
46640
46641impl<'a, C> common::CallBuilder for ProjectLocationDatasetCreateCall<'a, C> {}
46642
46643impl<'a, C> ProjectLocationDatasetCreateCall<'a, C>
46644where
46645 C: common::Connector,
46646{
46647 /// Perform the operation you have build so far.
46648 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
46649 use std::borrow::Cow;
46650 use std::io::{Read, Seek};
46651
46652 use common::{url::Params, ToParts};
46653 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
46654
46655 let mut dd = common::DefaultDelegate;
46656 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
46657 dlg.begin(common::MethodInfo {
46658 id: "healthcare.projects.locations.datasets.create",
46659 http_method: hyper::Method::POST,
46660 });
46661
46662 for &field in ["alt", "parent", "datasetId"].iter() {
46663 if self._additional_params.contains_key(field) {
46664 dlg.finished(false);
46665 return Err(common::Error::FieldClash(field));
46666 }
46667 }
46668
46669 let mut params = Params::with_capacity(5 + self._additional_params.len());
46670 params.push("parent", self._parent);
46671 if let Some(value) = self._dataset_id.as_ref() {
46672 params.push("datasetId", value);
46673 }
46674
46675 params.extend(self._additional_params.iter());
46676
46677 params.push("alt", "json");
46678 let mut url = self.hub._base_url.clone() + "v1/{+parent}/datasets";
46679 if self._scopes.is_empty() {
46680 self._scopes
46681 .insert(Scope::CloudHealthcare.as_ref().to_string());
46682 }
46683
46684 #[allow(clippy::single_element_loop)]
46685 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
46686 url = params.uri_replacement(url, param_name, find_this, true);
46687 }
46688 {
46689 let to_remove = ["parent"];
46690 params.remove_params(&to_remove);
46691 }
46692
46693 let url = params.parse_with_url(&url);
46694
46695 let mut json_mime_type = mime::APPLICATION_JSON;
46696 let mut request_value_reader = {
46697 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
46698 common::remove_json_null_values(&mut value);
46699 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
46700 serde_json::to_writer(&mut dst, &value).unwrap();
46701 dst
46702 };
46703 let request_size = request_value_reader
46704 .seek(std::io::SeekFrom::End(0))
46705 .unwrap();
46706 request_value_reader
46707 .seek(std::io::SeekFrom::Start(0))
46708 .unwrap();
46709
46710 loop {
46711 let token = match self
46712 .hub
46713 .auth
46714 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
46715 .await
46716 {
46717 Ok(token) => token,
46718 Err(e) => match dlg.token(e) {
46719 Ok(token) => token,
46720 Err(e) => {
46721 dlg.finished(false);
46722 return Err(common::Error::MissingToken(e));
46723 }
46724 },
46725 };
46726 request_value_reader
46727 .seek(std::io::SeekFrom::Start(0))
46728 .unwrap();
46729 let mut req_result = {
46730 let client = &self.hub.client;
46731 dlg.pre_request();
46732 let mut req_builder = hyper::Request::builder()
46733 .method(hyper::Method::POST)
46734 .uri(url.as_str())
46735 .header(USER_AGENT, self.hub._user_agent.clone());
46736
46737 if let Some(token) = token.as_ref() {
46738 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
46739 }
46740
46741 let request = req_builder
46742 .header(CONTENT_TYPE, json_mime_type.to_string())
46743 .header(CONTENT_LENGTH, request_size as u64)
46744 .body(common::to_body(
46745 request_value_reader.get_ref().clone().into(),
46746 ));
46747
46748 client.request(request.unwrap()).await
46749 };
46750
46751 match req_result {
46752 Err(err) => {
46753 if let common::Retry::After(d) = dlg.http_error(&err) {
46754 sleep(d).await;
46755 continue;
46756 }
46757 dlg.finished(false);
46758 return Err(common::Error::HttpError(err));
46759 }
46760 Ok(res) => {
46761 let (mut parts, body) = res.into_parts();
46762 let mut body = common::Body::new(body);
46763 if !parts.status.is_success() {
46764 let bytes = common::to_bytes(body).await.unwrap_or_default();
46765 let error = serde_json::from_str(&common::to_string(&bytes));
46766 let response = common::to_response(parts, bytes.into());
46767
46768 if let common::Retry::After(d) =
46769 dlg.http_failure(&response, error.as_ref().ok())
46770 {
46771 sleep(d).await;
46772 continue;
46773 }
46774
46775 dlg.finished(false);
46776
46777 return Err(match error {
46778 Ok(value) => common::Error::BadRequest(value),
46779 _ => common::Error::Failure(response),
46780 });
46781 }
46782 let response = {
46783 let bytes = common::to_bytes(body).await.unwrap_or_default();
46784 let encoded = common::to_string(&bytes);
46785 match serde_json::from_str(&encoded) {
46786 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
46787 Err(error) => {
46788 dlg.response_json_decode_error(&encoded, &error);
46789 return Err(common::Error::JsonDecodeError(
46790 encoded.to_string(),
46791 error,
46792 ));
46793 }
46794 }
46795 };
46796
46797 dlg.finished(true);
46798 return Ok(response);
46799 }
46800 }
46801 }
46802 }
46803
46804 ///
46805 /// Sets the *request* property to the given value.
46806 ///
46807 /// Even though the property as already been set when instantiating this call,
46808 /// we provide this method for API completeness.
46809 pub fn request(mut self, new_value: Dataset) -> ProjectLocationDatasetCreateCall<'a, C> {
46810 self._request = new_value;
46811 self
46812 }
46813 /// Required. The name of the project where the server creates the dataset. For example, `projects/{project_id}/locations/{location_id}`.
46814 ///
46815 /// Sets the *parent* path property to the given value.
46816 ///
46817 /// Even though the property as already been set when instantiating this call,
46818 /// we provide this method for API completeness.
46819 pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetCreateCall<'a, C> {
46820 self._parent = new_value.to_string();
46821 self
46822 }
46823 /// Required. The ID of the dataset that is being created. The string must match the following regex: `[\p{L}\p{N}_\-\.]{1,256}`.
46824 ///
46825 /// Sets the *dataset id* query property to the given value.
46826 pub fn dataset_id(mut self, new_value: &str) -> ProjectLocationDatasetCreateCall<'a, C> {
46827 self._dataset_id = Some(new_value.to_string());
46828 self
46829 }
46830 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
46831 /// while executing the actual API request.
46832 ///
46833 /// ````text
46834 /// It should be used to handle progress information, and to implement a certain level of resilience.
46835 /// ````
46836 ///
46837 /// Sets the *delegate* property to the given value.
46838 pub fn delegate(
46839 mut self,
46840 new_value: &'a mut dyn common::Delegate,
46841 ) -> ProjectLocationDatasetCreateCall<'a, C> {
46842 self._delegate = Some(new_value);
46843 self
46844 }
46845
46846 /// Set any additional parameter of the query string used in the request.
46847 /// It should be used to set parameters which are not yet available through their own
46848 /// setters.
46849 ///
46850 /// Please note that this method must not be used to set any of the known parameters
46851 /// which have their own setter method. If done anyway, the request will fail.
46852 ///
46853 /// # Additional Parameters
46854 ///
46855 /// * *$.xgafv* (query-string) - V1 error format.
46856 /// * *access_token* (query-string) - OAuth access token.
46857 /// * *alt* (query-string) - Data format for response.
46858 /// * *callback* (query-string) - JSONP
46859 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
46860 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
46861 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
46862 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
46863 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
46864 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
46865 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
46866 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetCreateCall<'a, C>
46867 where
46868 T: AsRef<str>,
46869 {
46870 self._additional_params
46871 .insert(name.as_ref().to_string(), value.as_ref().to_string());
46872 self
46873 }
46874
46875 /// Identifies the authorization scope for the method you are building.
46876 ///
46877 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
46878 /// [`Scope::CloudHealthcare`].
46879 ///
46880 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
46881 /// tokens for more than one scope.
46882 ///
46883 /// Usually there is more than one suitable scope to authorize an operation, some of which may
46884 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
46885 /// sufficient, a read-write scope will do as well.
46886 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetCreateCall<'a, C>
46887 where
46888 St: AsRef<str>,
46889 {
46890 self._scopes.insert(String::from(scope.as_ref()));
46891 self
46892 }
46893 /// Identifies the authorization scope(s) for the method you are building.
46894 ///
46895 /// See [`Self::add_scope()`] for details.
46896 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetCreateCall<'a, C>
46897 where
46898 I: IntoIterator<Item = St>,
46899 St: AsRef<str>,
46900 {
46901 self._scopes
46902 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
46903 self
46904 }
46905
46906 /// Removes all scopes, and no default scope will be used either.
46907 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
46908 /// for details).
46909 pub fn clear_scopes(mut self) -> ProjectLocationDatasetCreateCall<'a, C> {
46910 self._scopes.clear();
46911 self
46912 }
46913}
46914
46915/// Creates a new dataset containing de-identified data from the source dataset. The metadata field type is OperationMetadata. If the request is successful, the response field type is DeidentifySummary. If errors occur, error is set. The LRO result may still be successful if de-identification fails for some DICOM instances. The new de-identified dataset will not contain these failed resources. Failed resource totals are tracked in Operation.metadata. Error details are also logged to Cloud Logging. For more information, see [Viewing error logs in Cloud Logging](https://cloud.google.com/healthcare/docs/how-tos/logging).
46916///
46917/// A builder for the *locations.datasets.deidentify* method supported by a *project* resource.
46918/// It is not used directly, but through a [`ProjectMethods`] instance.
46919///
46920/// # Example
46921///
46922/// Instantiate a resource method builder
46923///
46924/// ```test_harness,no_run
46925/// # extern crate hyper;
46926/// # extern crate hyper_rustls;
46927/// # extern crate google_healthcare1 as healthcare1;
46928/// use healthcare1::api::DeidentifyDatasetRequest;
46929/// # async fn dox() {
46930/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
46931///
46932/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
46933/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
46934/// # secret,
46935/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
46936/// # ).build().await.unwrap();
46937///
46938/// # let client = hyper_util::client::legacy::Client::builder(
46939/// # hyper_util::rt::TokioExecutor::new()
46940/// # )
46941/// # .build(
46942/// # hyper_rustls::HttpsConnectorBuilder::new()
46943/// # .with_native_roots()
46944/// # .unwrap()
46945/// # .https_or_http()
46946/// # .enable_http1()
46947/// # .build()
46948/// # );
46949/// # let mut hub = CloudHealthcare::new(client, auth);
46950/// // As the method needs a request, you would usually fill it with the desired information
46951/// // into the respective structure. Some of the parts shown here might not be applicable !
46952/// // Values shown here are possibly random and not representative !
46953/// let mut req = DeidentifyDatasetRequest::default();
46954///
46955/// // You can configure optional parameters by calling the respective setters at will, and
46956/// // execute the final call using `doit()`.
46957/// // Values shown here are possibly random and not representative !
46958/// let result = hub.projects().locations_datasets_deidentify(req, "sourceDataset")
46959/// .doit().await;
46960/// # }
46961/// ```
46962pub struct ProjectLocationDatasetDeidentifyCall<'a, C>
46963where
46964 C: 'a,
46965{
46966 hub: &'a CloudHealthcare<C>,
46967 _request: DeidentifyDatasetRequest,
46968 _source_dataset: String,
46969 _delegate: Option<&'a mut dyn common::Delegate>,
46970 _additional_params: HashMap<String, String>,
46971 _scopes: BTreeSet<String>,
46972}
46973
46974impl<'a, C> common::CallBuilder for ProjectLocationDatasetDeidentifyCall<'a, C> {}
46975
46976impl<'a, C> ProjectLocationDatasetDeidentifyCall<'a, C>
46977where
46978 C: common::Connector,
46979{
46980 /// Perform the operation you have build so far.
46981 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
46982 use std::borrow::Cow;
46983 use std::io::{Read, Seek};
46984
46985 use common::{url::Params, ToParts};
46986 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
46987
46988 let mut dd = common::DefaultDelegate;
46989 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
46990 dlg.begin(common::MethodInfo {
46991 id: "healthcare.projects.locations.datasets.deidentify",
46992 http_method: hyper::Method::POST,
46993 });
46994
46995 for &field in ["alt", "sourceDataset"].iter() {
46996 if self._additional_params.contains_key(field) {
46997 dlg.finished(false);
46998 return Err(common::Error::FieldClash(field));
46999 }
47000 }
47001
47002 let mut params = Params::with_capacity(4 + self._additional_params.len());
47003 params.push("sourceDataset", self._source_dataset);
47004
47005 params.extend(self._additional_params.iter());
47006
47007 params.push("alt", "json");
47008 let mut url = self.hub._base_url.clone() + "v1/{+sourceDataset}:deidentify";
47009 if self._scopes.is_empty() {
47010 self._scopes
47011 .insert(Scope::CloudHealthcare.as_ref().to_string());
47012 }
47013
47014 #[allow(clippy::single_element_loop)]
47015 for &(find_this, param_name) in [("{+sourceDataset}", "sourceDataset")].iter() {
47016 url = params.uri_replacement(url, param_name, find_this, true);
47017 }
47018 {
47019 let to_remove = ["sourceDataset"];
47020 params.remove_params(&to_remove);
47021 }
47022
47023 let url = params.parse_with_url(&url);
47024
47025 let mut json_mime_type = mime::APPLICATION_JSON;
47026 let mut request_value_reader = {
47027 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
47028 common::remove_json_null_values(&mut value);
47029 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
47030 serde_json::to_writer(&mut dst, &value).unwrap();
47031 dst
47032 };
47033 let request_size = request_value_reader
47034 .seek(std::io::SeekFrom::End(0))
47035 .unwrap();
47036 request_value_reader
47037 .seek(std::io::SeekFrom::Start(0))
47038 .unwrap();
47039
47040 loop {
47041 let token = match self
47042 .hub
47043 .auth
47044 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
47045 .await
47046 {
47047 Ok(token) => token,
47048 Err(e) => match dlg.token(e) {
47049 Ok(token) => token,
47050 Err(e) => {
47051 dlg.finished(false);
47052 return Err(common::Error::MissingToken(e));
47053 }
47054 },
47055 };
47056 request_value_reader
47057 .seek(std::io::SeekFrom::Start(0))
47058 .unwrap();
47059 let mut req_result = {
47060 let client = &self.hub.client;
47061 dlg.pre_request();
47062 let mut req_builder = hyper::Request::builder()
47063 .method(hyper::Method::POST)
47064 .uri(url.as_str())
47065 .header(USER_AGENT, self.hub._user_agent.clone());
47066
47067 if let Some(token) = token.as_ref() {
47068 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
47069 }
47070
47071 let request = req_builder
47072 .header(CONTENT_TYPE, json_mime_type.to_string())
47073 .header(CONTENT_LENGTH, request_size as u64)
47074 .body(common::to_body(
47075 request_value_reader.get_ref().clone().into(),
47076 ));
47077
47078 client.request(request.unwrap()).await
47079 };
47080
47081 match req_result {
47082 Err(err) => {
47083 if let common::Retry::After(d) = dlg.http_error(&err) {
47084 sleep(d).await;
47085 continue;
47086 }
47087 dlg.finished(false);
47088 return Err(common::Error::HttpError(err));
47089 }
47090 Ok(res) => {
47091 let (mut parts, body) = res.into_parts();
47092 let mut body = common::Body::new(body);
47093 if !parts.status.is_success() {
47094 let bytes = common::to_bytes(body).await.unwrap_or_default();
47095 let error = serde_json::from_str(&common::to_string(&bytes));
47096 let response = common::to_response(parts, bytes.into());
47097
47098 if let common::Retry::After(d) =
47099 dlg.http_failure(&response, error.as_ref().ok())
47100 {
47101 sleep(d).await;
47102 continue;
47103 }
47104
47105 dlg.finished(false);
47106
47107 return Err(match error {
47108 Ok(value) => common::Error::BadRequest(value),
47109 _ => common::Error::Failure(response),
47110 });
47111 }
47112 let response = {
47113 let bytes = common::to_bytes(body).await.unwrap_or_default();
47114 let encoded = common::to_string(&bytes);
47115 match serde_json::from_str(&encoded) {
47116 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
47117 Err(error) => {
47118 dlg.response_json_decode_error(&encoded, &error);
47119 return Err(common::Error::JsonDecodeError(
47120 encoded.to_string(),
47121 error,
47122 ));
47123 }
47124 }
47125 };
47126
47127 dlg.finished(true);
47128 return Ok(response);
47129 }
47130 }
47131 }
47132 }
47133
47134 ///
47135 /// Sets the *request* property to the given value.
47136 ///
47137 /// Even though the property as already been set when instantiating this call,
47138 /// we provide this method for API completeness.
47139 pub fn request(
47140 mut self,
47141 new_value: DeidentifyDatasetRequest,
47142 ) -> ProjectLocationDatasetDeidentifyCall<'a, C> {
47143 self._request = new_value;
47144 self
47145 }
47146 /// Required. Source dataset resource name. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
47147 ///
47148 /// Sets the *source dataset* path property to the given value.
47149 ///
47150 /// Even though the property as already been set when instantiating this call,
47151 /// we provide this method for API completeness.
47152 pub fn source_dataset(
47153 mut self,
47154 new_value: &str,
47155 ) -> ProjectLocationDatasetDeidentifyCall<'a, C> {
47156 self._source_dataset = new_value.to_string();
47157 self
47158 }
47159 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
47160 /// while executing the actual API request.
47161 ///
47162 /// ````text
47163 /// It should be used to handle progress information, and to implement a certain level of resilience.
47164 /// ````
47165 ///
47166 /// Sets the *delegate* property to the given value.
47167 pub fn delegate(
47168 mut self,
47169 new_value: &'a mut dyn common::Delegate,
47170 ) -> ProjectLocationDatasetDeidentifyCall<'a, C> {
47171 self._delegate = Some(new_value);
47172 self
47173 }
47174
47175 /// Set any additional parameter of the query string used in the request.
47176 /// It should be used to set parameters which are not yet available through their own
47177 /// setters.
47178 ///
47179 /// Please note that this method must not be used to set any of the known parameters
47180 /// which have their own setter method. If done anyway, the request will fail.
47181 ///
47182 /// # Additional Parameters
47183 ///
47184 /// * *$.xgafv* (query-string) - V1 error format.
47185 /// * *access_token* (query-string) - OAuth access token.
47186 /// * *alt* (query-string) - Data format for response.
47187 /// * *callback* (query-string) - JSONP
47188 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
47189 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
47190 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
47191 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
47192 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
47193 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
47194 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
47195 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetDeidentifyCall<'a, C>
47196 where
47197 T: AsRef<str>,
47198 {
47199 self._additional_params
47200 .insert(name.as_ref().to_string(), value.as_ref().to_string());
47201 self
47202 }
47203
47204 /// Identifies the authorization scope for the method you are building.
47205 ///
47206 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
47207 /// [`Scope::CloudHealthcare`].
47208 ///
47209 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
47210 /// tokens for more than one scope.
47211 ///
47212 /// Usually there is more than one suitable scope to authorize an operation, some of which may
47213 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
47214 /// sufficient, a read-write scope will do as well.
47215 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetDeidentifyCall<'a, C>
47216 where
47217 St: AsRef<str>,
47218 {
47219 self._scopes.insert(String::from(scope.as_ref()));
47220 self
47221 }
47222 /// Identifies the authorization scope(s) for the method you are building.
47223 ///
47224 /// See [`Self::add_scope()`] for details.
47225 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetDeidentifyCall<'a, C>
47226 where
47227 I: IntoIterator<Item = St>,
47228 St: AsRef<str>,
47229 {
47230 self._scopes
47231 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
47232 self
47233 }
47234
47235 /// Removes all scopes, and no default scope will be used either.
47236 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
47237 /// for details).
47238 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDeidentifyCall<'a, C> {
47239 self._scopes.clear();
47240 self
47241 }
47242}
47243
47244/// Deletes the specified health dataset and all data contained in the dataset. Deleting a dataset does not affect the sources from which the dataset was imported (if any).
47245///
47246/// A builder for the *locations.datasets.delete* method supported by a *project* resource.
47247/// It is not used directly, but through a [`ProjectMethods`] instance.
47248///
47249/// # Example
47250///
47251/// Instantiate a resource method builder
47252///
47253/// ```test_harness,no_run
47254/// # extern crate hyper;
47255/// # extern crate hyper_rustls;
47256/// # extern crate google_healthcare1 as healthcare1;
47257/// # async fn dox() {
47258/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
47259///
47260/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
47261/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
47262/// # secret,
47263/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
47264/// # ).build().await.unwrap();
47265///
47266/// # let client = hyper_util::client::legacy::Client::builder(
47267/// # hyper_util::rt::TokioExecutor::new()
47268/// # )
47269/// # .build(
47270/// # hyper_rustls::HttpsConnectorBuilder::new()
47271/// # .with_native_roots()
47272/// # .unwrap()
47273/// # .https_or_http()
47274/// # .enable_http1()
47275/// # .build()
47276/// # );
47277/// # let mut hub = CloudHealthcare::new(client, auth);
47278/// // You can configure optional parameters by calling the respective setters at will, and
47279/// // execute the final call using `doit()`.
47280/// // Values shown here are possibly random and not representative !
47281/// let result = hub.projects().locations_datasets_delete("name")
47282/// .doit().await;
47283/// # }
47284/// ```
47285pub struct ProjectLocationDatasetDeleteCall<'a, C>
47286where
47287 C: 'a,
47288{
47289 hub: &'a CloudHealthcare<C>,
47290 _name: String,
47291 _delegate: Option<&'a mut dyn common::Delegate>,
47292 _additional_params: HashMap<String, String>,
47293 _scopes: BTreeSet<String>,
47294}
47295
47296impl<'a, C> common::CallBuilder for ProjectLocationDatasetDeleteCall<'a, C> {}
47297
47298impl<'a, C> ProjectLocationDatasetDeleteCall<'a, C>
47299where
47300 C: common::Connector,
47301{
47302 /// Perform the operation you have build so far.
47303 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
47304 use std::borrow::Cow;
47305 use std::io::{Read, Seek};
47306
47307 use common::{url::Params, ToParts};
47308 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
47309
47310 let mut dd = common::DefaultDelegate;
47311 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
47312 dlg.begin(common::MethodInfo {
47313 id: "healthcare.projects.locations.datasets.delete",
47314 http_method: hyper::Method::DELETE,
47315 });
47316
47317 for &field in ["alt", "name"].iter() {
47318 if self._additional_params.contains_key(field) {
47319 dlg.finished(false);
47320 return Err(common::Error::FieldClash(field));
47321 }
47322 }
47323
47324 let mut params = Params::with_capacity(3 + self._additional_params.len());
47325 params.push("name", self._name);
47326
47327 params.extend(self._additional_params.iter());
47328
47329 params.push("alt", "json");
47330 let mut url = self.hub._base_url.clone() + "v1/{+name}";
47331 if self._scopes.is_empty() {
47332 self._scopes
47333 .insert(Scope::CloudHealthcare.as_ref().to_string());
47334 }
47335
47336 #[allow(clippy::single_element_loop)]
47337 for &(find_this, param_name) in [("{+name}", "name")].iter() {
47338 url = params.uri_replacement(url, param_name, find_this, true);
47339 }
47340 {
47341 let to_remove = ["name"];
47342 params.remove_params(&to_remove);
47343 }
47344
47345 let url = params.parse_with_url(&url);
47346
47347 loop {
47348 let token = match self
47349 .hub
47350 .auth
47351 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
47352 .await
47353 {
47354 Ok(token) => token,
47355 Err(e) => match dlg.token(e) {
47356 Ok(token) => token,
47357 Err(e) => {
47358 dlg.finished(false);
47359 return Err(common::Error::MissingToken(e));
47360 }
47361 },
47362 };
47363 let mut req_result = {
47364 let client = &self.hub.client;
47365 dlg.pre_request();
47366 let mut req_builder = hyper::Request::builder()
47367 .method(hyper::Method::DELETE)
47368 .uri(url.as_str())
47369 .header(USER_AGENT, self.hub._user_agent.clone());
47370
47371 if let Some(token) = token.as_ref() {
47372 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
47373 }
47374
47375 let request = req_builder
47376 .header(CONTENT_LENGTH, 0_u64)
47377 .body(common::to_body::<String>(None));
47378
47379 client.request(request.unwrap()).await
47380 };
47381
47382 match req_result {
47383 Err(err) => {
47384 if let common::Retry::After(d) = dlg.http_error(&err) {
47385 sleep(d).await;
47386 continue;
47387 }
47388 dlg.finished(false);
47389 return Err(common::Error::HttpError(err));
47390 }
47391 Ok(res) => {
47392 let (mut parts, body) = res.into_parts();
47393 let mut body = common::Body::new(body);
47394 if !parts.status.is_success() {
47395 let bytes = common::to_bytes(body).await.unwrap_or_default();
47396 let error = serde_json::from_str(&common::to_string(&bytes));
47397 let response = common::to_response(parts, bytes.into());
47398
47399 if let common::Retry::After(d) =
47400 dlg.http_failure(&response, error.as_ref().ok())
47401 {
47402 sleep(d).await;
47403 continue;
47404 }
47405
47406 dlg.finished(false);
47407
47408 return Err(match error {
47409 Ok(value) => common::Error::BadRequest(value),
47410 _ => common::Error::Failure(response),
47411 });
47412 }
47413 let response = {
47414 let bytes = common::to_bytes(body).await.unwrap_or_default();
47415 let encoded = common::to_string(&bytes);
47416 match serde_json::from_str(&encoded) {
47417 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
47418 Err(error) => {
47419 dlg.response_json_decode_error(&encoded, &error);
47420 return Err(common::Error::JsonDecodeError(
47421 encoded.to_string(),
47422 error,
47423 ));
47424 }
47425 }
47426 };
47427
47428 dlg.finished(true);
47429 return Ok(response);
47430 }
47431 }
47432 }
47433 }
47434
47435 /// Required. The name of the dataset to delete. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
47436 ///
47437 /// Sets the *name* path property to the given value.
47438 ///
47439 /// Even though the property as already been set when instantiating this call,
47440 /// we provide this method for API completeness.
47441 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetDeleteCall<'a, C> {
47442 self._name = new_value.to_string();
47443 self
47444 }
47445 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
47446 /// while executing the actual API request.
47447 ///
47448 /// ````text
47449 /// It should be used to handle progress information, and to implement a certain level of resilience.
47450 /// ````
47451 ///
47452 /// Sets the *delegate* property to the given value.
47453 pub fn delegate(
47454 mut self,
47455 new_value: &'a mut dyn common::Delegate,
47456 ) -> ProjectLocationDatasetDeleteCall<'a, C> {
47457 self._delegate = Some(new_value);
47458 self
47459 }
47460
47461 /// Set any additional parameter of the query string used in the request.
47462 /// It should be used to set parameters which are not yet available through their own
47463 /// setters.
47464 ///
47465 /// Please note that this method must not be used to set any of the known parameters
47466 /// which have their own setter method. If done anyway, the request will fail.
47467 ///
47468 /// # Additional Parameters
47469 ///
47470 /// * *$.xgafv* (query-string) - V1 error format.
47471 /// * *access_token* (query-string) - OAuth access token.
47472 /// * *alt* (query-string) - Data format for response.
47473 /// * *callback* (query-string) - JSONP
47474 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
47475 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
47476 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
47477 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
47478 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
47479 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
47480 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
47481 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetDeleteCall<'a, C>
47482 where
47483 T: AsRef<str>,
47484 {
47485 self._additional_params
47486 .insert(name.as_ref().to_string(), value.as_ref().to_string());
47487 self
47488 }
47489
47490 /// Identifies the authorization scope for the method you are building.
47491 ///
47492 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
47493 /// [`Scope::CloudHealthcare`].
47494 ///
47495 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
47496 /// tokens for more than one scope.
47497 ///
47498 /// Usually there is more than one suitable scope to authorize an operation, some of which may
47499 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
47500 /// sufficient, a read-write scope will do as well.
47501 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetDeleteCall<'a, C>
47502 where
47503 St: AsRef<str>,
47504 {
47505 self._scopes.insert(String::from(scope.as_ref()));
47506 self
47507 }
47508 /// Identifies the authorization scope(s) for the method you are building.
47509 ///
47510 /// See [`Self::add_scope()`] for details.
47511 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetDeleteCall<'a, C>
47512 where
47513 I: IntoIterator<Item = St>,
47514 St: AsRef<str>,
47515 {
47516 self._scopes
47517 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
47518 self
47519 }
47520
47521 /// Removes all scopes, and no default scope will be used either.
47522 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
47523 /// for details).
47524 pub fn clear_scopes(mut self) -> ProjectLocationDatasetDeleteCall<'a, C> {
47525 self._scopes.clear();
47526 self
47527 }
47528}
47529
47530/// Gets any metadata associated with a dataset.
47531///
47532/// A builder for the *locations.datasets.get* method supported by a *project* resource.
47533/// It is not used directly, but through a [`ProjectMethods`] instance.
47534///
47535/// # Example
47536///
47537/// Instantiate a resource method builder
47538///
47539/// ```test_harness,no_run
47540/// # extern crate hyper;
47541/// # extern crate hyper_rustls;
47542/// # extern crate google_healthcare1 as healthcare1;
47543/// # async fn dox() {
47544/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
47545///
47546/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
47547/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
47548/// # secret,
47549/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
47550/// # ).build().await.unwrap();
47551///
47552/// # let client = hyper_util::client::legacy::Client::builder(
47553/// # hyper_util::rt::TokioExecutor::new()
47554/// # )
47555/// # .build(
47556/// # hyper_rustls::HttpsConnectorBuilder::new()
47557/// # .with_native_roots()
47558/// # .unwrap()
47559/// # .https_or_http()
47560/// # .enable_http1()
47561/// # .build()
47562/// # );
47563/// # let mut hub = CloudHealthcare::new(client, auth);
47564/// // You can configure optional parameters by calling the respective setters at will, and
47565/// // execute the final call using `doit()`.
47566/// // Values shown here are possibly random and not representative !
47567/// let result = hub.projects().locations_datasets_get("name")
47568/// .doit().await;
47569/// # }
47570/// ```
47571pub struct ProjectLocationDatasetGetCall<'a, C>
47572where
47573 C: 'a,
47574{
47575 hub: &'a CloudHealthcare<C>,
47576 _name: String,
47577 _delegate: Option<&'a mut dyn common::Delegate>,
47578 _additional_params: HashMap<String, String>,
47579 _scopes: BTreeSet<String>,
47580}
47581
47582impl<'a, C> common::CallBuilder for ProjectLocationDatasetGetCall<'a, C> {}
47583
47584impl<'a, C> ProjectLocationDatasetGetCall<'a, C>
47585where
47586 C: common::Connector,
47587{
47588 /// Perform the operation you have build so far.
47589 pub async fn doit(mut self) -> common::Result<(common::Response, Dataset)> {
47590 use std::borrow::Cow;
47591 use std::io::{Read, Seek};
47592
47593 use common::{url::Params, ToParts};
47594 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
47595
47596 let mut dd = common::DefaultDelegate;
47597 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
47598 dlg.begin(common::MethodInfo {
47599 id: "healthcare.projects.locations.datasets.get",
47600 http_method: hyper::Method::GET,
47601 });
47602
47603 for &field in ["alt", "name"].iter() {
47604 if self._additional_params.contains_key(field) {
47605 dlg.finished(false);
47606 return Err(common::Error::FieldClash(field));
47607 }
47608 }
47609
47610 let mut params = Params::with_capacity(3 + self._additional_params.len());
47611 params.push("name", self._name);
47612
47613 params.extend(self._additional_params.iter());
47614
47615 params.push("alt", "json");
47616 let mut url = self.hub._base_url.clone() + "v1/{+name}";
47617 if self._scopes.is_empty() {
47618 self._scopes
47619 .insert(Scope::CloudHealthcare.as_ref().to_string());
47620 }
47621
47622 #[allow(clippy::single_element_loop)]
47623 for &(find_this, param_name) in [("{+name}", "name")].iter() {
47624 url = params.uri_replacement(url, param_name, find_this, true);
47625 }
47626 {
47627 let to_remove = ["name"];
47628 params.remove_params(&to_remove);
47629 }
47630
47631 let url = params.parse_with_url(&url);
47632
47633 loop {
47634 let token = match self
47635 .hub
47636 .auth
47637 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
47638 .await
47639 {
47640 Ok(token) => token,
47641 Err(e) => match dlg.token(e) {
47642 Ok(token) => token,
47643 Err(e) => {
47644 dlg.finished(false);
47645 return Err(common::Error::MissingToken(e));
47646 }
47647 },
47648 };
47649 let mut req_result = {
47650 let client = &self.hub.client;
47651 dlg.pre_request();
47652 let mut req_builder = hyper::Request::builder()
47653 .method(hyper::Method::GET)
47654 .uri(url.as_str())
47655 .header(USER_AGENT, self.hub._user_agent.clone());
47656
47657 if let Some(token) = token.as_ref() {
47658 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
47659 }
47660
47661 let request = req_builder
47662 .header(CONTENT_LENGTH, 0_u64)
47663 .body(common::to_body::<String>(None));
47664
47665 client.request(request.unwrap()).await
47666 };
47667
47668 match req_result {
47669 Err(err) => {
47670 if let common::Retry::After(d) = dlg.http_error(&err) {
47671 sleep(d).await;
47672 continue;
47673 }
47674 dlg.finished(false);
47675 return Err(common::Error::HttpError(err));
47676 }
47677 Ok(res) => {
47678 let (mut parts, body) = res.into_parts();
47679 let mut body = common::Body::new(body);
47680 if !parts.status.is_success() {
47681 let bytes = common::to_bytes(body).await.unwrap_or_default();
47682 let error = serde_json::from_str(&common::to_string(&bytes));
47683 let response = common::to_response(parts, bytes.into());
47684
47685 if let common::Retry::After(d) =
47686 dlg.http_failure(&response, error.as_ref().ok())
47687 {
47688 sleep(d).await;
47689 continue;
47690 }
47691
47692 dlg.finished(false);
47693
47694 return Err(match error {
47695 Ok(value) => common::Error::BadRequest(value),
47696 _ => common::Error::Failure(response),
47697 });
47698 }
47699 let response = {
47700 let bytes = common::to_bytes(body).await.unwrap_or_default();
47701 let encoded = common::to_string(&bytes);
47702 match serde_json::from_str(&encoded) {
47703 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
47704 Err(error) => {
47705 dlg.response_json_decode_error(&encoded, &error);
47706 return Err(common::Error::JsonDecodeError(
47707 encoded.to_string(),
47708 error,
47709 ));
47710 }
47711 }
47712 };
47713
47714 dlg.finished(true);
47715 return Ok(response);
47716 }
47717 }
47718 }
47719 }
47720
47721 /// Required. The name of the dataset to read. For example, `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
47722 ///
47723 /// Sets the *name* path property to the given value.
47724 ///
47725 /// Even though the property as already been set when instantiating this call,
47726 /// we provide this method for API completeness.
47727 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetGetCall<'a, C> {
47728 self._name = new_value.to_string();
47729 self
47730 }
47731 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
47732 /// while executing the actual API request.
47733 ///
47734 /// ````text
47735 /// It should be used to handle progress information, and to implement a certain level of resilience.
47736 /// ````
47737 ///
47738 /// Sets the *delegate* property to the given value.
47739 pub fn delegate(
47740 mut self,
47741 new_value: &'a mut dyn common::Delegate,
47742 ) -> ProjectLocationDatasetGetCall<'a, C> {
47743 self._delegate = Some(new_value);
47744 self
47745 }
47746
47747 /// Set any additional parameter of the query string used in the request.
47748 /// It should be used to set parameters which are not yet available through their own
47749 /// setters.
47750 ///
47751 /// Please note that this method must not be used to set any of the known parameters
47752 /// which have their own setter method. If done anyway, the request will fail.
47753 ///
47754 /// # Additional Parameters
47755 ///
47756 /// * *$.xgafv* (query-string) - V1 error format.
47757 /// * *access_token* (query-string) - OAuth access token.
47758 /// * *alt* (query-string) - Data format for response.
47759 /// * *callback* (query-string) - JSONP
47760 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
47761 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
47762 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
47763 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
47764 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
47765 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
47766 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
47767 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetGetCall<'a, C>
47768 where
47769 T: AsRef<str>,
47770 {
47771 self._additional_params
47772 .insert(name.as_ref().to_string(), value.as_ref().to_string());
47773 self
47774 }
47775
47776 /// Identifies the authorization scope for the method you are building.
47777 ///
47778 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
47779 /// [`Scope::CloudHealthcare`].
47780 ///
47781 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
47782 /// tokens for more than one scope.
47783 ///
47784 /// Usually there is more than one suitable scope to authorize an operation, some of which may
47785 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
47786 /// sufficient, a read-write scope will do as well.
47787 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetGetCall<'a, C>
47788 where
47789 St: AsRef<str>,
47790 {
47791 self._scopes.insert(String::from(scope.as_ref()));
47792 self
47793 }
47794 /// Identifies the authorization scope(s) for the method you are building.
47795 ///
47796 /// See [`Self::add_scope()`] for details.
47797 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetGetCall<'a, C>
47798 where
47799 I: IntoIterator<Item = St>,
47800 St: AsRef<str>,
47801 {
47802 self._scopes
47803 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
47804 self
47805 }
47806
47807 /// Removes all scopes, and no default scope will be used either.
47808 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
47809 /// for details).
47810 pub fn clear_scopes(mut self) -> ProjectLocationDatasetGetCall<'a, C> {
47811 self._scopes.clear();
47812 self
47813 }
47814}
47815
47816/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
47817///
47818/// A builder for the *locations.datasets.getIamPolicy* method supported by a *project* resource.
47819/// It is not used directly, but through a [`ProjectMethods`] instance.
47820///
47821/// # Example
47822///
47823/// Instantiate a resource method builder
47824///
47825/// ```test_harness,no_run
47826/// # extern crate hyper;
47827/// # extern crate hyper_rustls;
47828/// # extern crate google_healthcare1 as healthcare1;
47829/// # async fn dox() {
47830/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
47831///
47832/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
47833/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
47834/// # secret,
47835/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
47836/// # ).build().await.unwrap();
47837///
47838/// # let client = hyper_util::client::legacy::Client::builder(
47839/// # hyper_util::rt::TokioExecutor::new()
47840/// # )
47841/// # .build(
47842/// # hyper_rustls::HttpsConnectorBuilder::new()
47843/// # .with_native_roots()
47844/// # .unwrap()
47845/// # .https_or_http()
47846/// # .enable_http1()
47847/// # .build()
47848/// # );
47849/// # let mut hub = CloudHealthcare::new(client, auth);
47850/// // You can configure optional parameters by calling the respective setters at will, and
47851/// // execute the final call using `doit()`.
47852/// // Values shown here are possibly random and not representative !
47853/// let result = hub.projects().locations_datasets_get_iam_policy("resource")
47854/// .options_requested_policy_version(-39)
47855/// .doit().await;
47856/// # }
47857/// ```
47858pub struct ProjectLocationDatasetGetIamPolicyCall<'a, C>
47859where
47860 C: 'a,
47861{
47862 hub: &'a CloudHealthcare<C>,
47863 _resource: String,
47864 _options_requested_policy_version: Option<i32>,
47865 _delegate: Option<&'a mut dyn common::Delegate>,
47866 _additional_params: HashMap<String, String>,
47867 _scopes: BTreeSet<String>,
47868}
47869
47870impl<'a, C> common::CallBuilder for ProjectLocationDatasetGetIamPolicyCall<'a, C> {}
47871
47872impl<'a, C> ProjectLocationDatasetGetIamPolicyCall<'a, C>
47873where
47874 C: common::Connector,
47875{
47876 /// Perform the operation you have build so far.
47877 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
47878 use std::borrow::Cow;
47879 use std::io::{Read, Seek};
47880
47881 use common::{url::Params, ToParts};
47882 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
47883
47884 let mut dd = common::DefaultDelegate;
47885 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
47886 dlg.begin(common::MethodInfo {
47887 id: "healthcare.projects.locations.datasets.getIamPolicy",
47888 http_method: hyper::Method::GET,
47889 });
47890
47891 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
47892 if self._additional_params.contains_key(field) {
47893 dlg.finished(false);
47894 return Err(common::Error::FieldClash(field));
47895 }
47896 }
47897
47898 let mut params = Params::with_capacity(4 + self._additional_params.len());
47899 params.push("resource", self._resource);
47900 if let Some(value) = self._options_requested_policy_version.as_ref() {
47901 params.push("options.requestedPolicyVersion", value.to_string());
47902 }
47903
47904 params.extend(self._additional_params.iter());
47905
47906 params.push("alt", "json");
47907 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
47908 if self._scopes.is_empty() {
47909 self._scopes
47910 .insert(Scope::CloudHealthcare.as_ref().to_string());
47911 }
47912
47913 #[allow(clippy::single_element_loop)]
47914 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
47915 url = params.uri_replacement(url, param_name, find_this, true);
47916 }
47917 {
47918 let to_remove = ["resource"];
47919 params.remove_params(&to_remove);
47920 }
47921
47922 let url = params.parse_with_url(&url);
47923
47924 loop {
47925 let token = match self
47926 .hub
47927 .auth
47928 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
47929 .await
47930 {
47931 Ok(token) => token,
47932 Err(e) => match dlg.token(e) {
47933 Ok(token) => token,
47934 Err(e) => {
47935 dlg.finished(false);
47936 return Err(common::Error::MissingToken(e));
47937 }
47938 },
47939 };
47940 let mut req_result = {
47941 let client = &self.hub.client;
47942 dlg.pre_request();
47943 let mut req_builder = hyper::Request::builder()
47944 .method(hyper::Method::GET)
47945 .uri(url.as_str())
47946 .header(USER_AGENT, self.hub._user_agent.clone());
47947
47948 if let Some(token) = token.as_ref() {
47949 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
47950 }
47951
47952 let request = req_builder
47953 .header(CONTENT_LENGTH, 0_u64)
47954 .body(common::to_body::<String>(None));
47955
47956 client.request(request.unwrap()).await
47957 };
47958
47959 match req_result {
47960 Err(err) => {
47961 if let common::Retry::After(d) = dlg.http_error(&err) {
47962 sleep(d).await;
47963 continue;
47964 }
47965 dlg.finished(false);
47966 return Err(common::Error::HttpError(err));
47967 }
47968 Ok(res) => {
47969 let (mut parts, body) = res.into_parts();
47970 let mut body = common::Body::new(body);
47971 if !parts.status.is_success() {
47972 let bytes = common::to_bytes(body).await.unwrap_or_default();
47973 let error = serde_json::from_str(&common::to_string(&bytes));
47974 let response = common::to_response(parts, bytes.into());
47975
47976 if let common::Retry::After(d) =
47977 dlg.http_failure(&response, error.as_ref().ok())
47978 {
47979 sleep(d).await;
47980 continue;
47981 }
47982
47983 dlg.finished(false);
47984
47985 return Err(match error {
47986 Ok(value) => common::Error::BadRequest(value),
47987 _ => common::Error::Failure(response),
47988 });
47989 }
47990 let response = {
47991 let bytes = common::to_bytes(body).await.unwrap_or_default();
47992 let encoded = common::to_string(&bytes);
47993 match serde_json::from_str(&encoded) {
47994 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
47995 Err(error) => {
47996 dlg.response_json_decode_error(&encoded, &error);
47997 return Err(common::Error::JsonDecodeError(
47998 encoded.to_string(),
47999 error,
48000 ));
48001 }
48002 }
48003 };
48004
48005 dlg.finished(true);
48006 return Ok(response);
48007 }
48008 }
48009 }
48010 }
48011
48012 /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
48013 ///
48014 /// Sets the *resource* path property to the given value.
48015 ///
48016 /// Even though the property as already been set when instantiating this call,
48017 /// we provide this method for API completeness.
48018 pub fn resource(mut self, new_value: &str) -> ProjectLocationDatasetGetIamPolicyCall<'a, C> {
48019 self._resource = new_value.to_string();
48020 self
48021 }
48022 /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
48023 ///
48024 /// Sets the *options.requested policy version* query property to the given value.
48025 pub fn options_requested_policy_version(
48026 mut self,
48027 new_value: i32,
48028 ) -> ProjectLocationDatasetGetIamPolicyCall<'a, C> {
48029 self._options_requested_policy_version = Some(new_value);
48030 self
48031 }
48032 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
48033 /// while executing the actual API request.
48034 ///
48035 /// ````text
48036 /// It should be used to handle progress information, and to implement a certain level of resilience.
48037 /// ````
48038 ///
48039 /// Sets the *delegate* property to the given value.
48040 pub fn delegate(
48041 mut self,
48042 new_value: &'a mut dyn common::Delegate,
48043 ) -> ProjectLocationDatasetGetIamPolicyCall<'a, C> {
48044 self._delegate = Some(new_value);
48045 self
48046 }
48047
48048 /// Set any additional parameter of the query string used in the request.
48049 /// It should be used to set parameters which are not yet available through their own
48050 /// setters.
48051 ///
48052 /// Please note that this method must not be used to set any of the known parameters
48053 /// which have their own setter method. If done anyway, the request will fail.
48054 ///
48055 /// # Additional Parameters
48056 ///
48057 /// * *$.xgafv* (query-string) - V1 error format.
48058 /// * *access_token* (query-string) - OAuth access token.
48059 /// * *alt* (query-string) - Data format for response.
48060 /// * *callback* (query-string) - JSONP
48061 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
48062 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
48063 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
48064 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
48065 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
48066 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
48067 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
48068 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetGetIamPolicyCall<'a, C>
48069 where
48070 T: AsRef<str>,
48071 {
48072 self._additional_params
48073 .insert(name.as_ref().to_string(), value.as_ref().to_string());
48074 self
48075 }
48076
48077 /// Identifies the authorization scope for the method you are building.
48078 ///
48079 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
48080 /// [`Scope::CloudHealthcare`].
48081 ///
48082 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
48083 /// tokens for more than one scope.
48084 ///
48085 /// Usually there is more than one suitable scope to authorize an operation, some of which may
48086 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
48087 /// sufficient, a read-write scope will do as well.
48088 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetGetIamPolicyCall<'a, C>
48089 where
48090 St: AsRef<str>,
48091 {
48092 self._scopes.insert(String::from(scope.as_ref()));
48093 self
48094 }
48095 /// Identifies the authorization scope(s) for the method you are building.
48096 ///
48097 /// See [`Self::add_scope()`] for details.
48098 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetGetIamPolicyCall<'a, C>
48099 where
48100 I: IntoIterator<Item = St>,
48101 St: AsRef<str>,
48102 {
48103 self._scopes
48104 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
48105 self
48106 }
48107
48108 /// Removes all scopes, and no default scope will be used either.
48109 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
48110 /// for details).
48111 pub fn clear_scopes(mut self) -> ProjectLocationDatasetGetIamPolicyCall<'a, C> {
48112 self._scopes.clear();
48113 self
48114 }
48115}
48116
48117/// Lists the health datasets in the current project.
48118///
48119/// A builder for the *locations.datasets.list* method supported by a *project* resource.
48120/// It is not used directly, but through a [`ProjectMethods`] instance.
48121///
48122/// # Example
48123///
48124/// Instantiate a resource method builder
48125///
48126/// ```test_harness,no_run
48127/// # extern crate hyper;
48128/// # extern crate hyper_rustls;
48129/// # extern crate google_healthcare1 as healthcare1;
48130/// # async fn dox() {
48131/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
48132///
48133/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
48134/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
48135/// # secret,
48136/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
48137/// # ).build().await.unwrap();
48138///
48139/// # let client = hyper_util::client::legacy::Client::builder(
48140/// # hyper_util::rt::TokioExecutor::new()
48141/// # )
48142/// # .build(
48143/// # hyper_rustls::HttpsConnectorBuilder::new()
48144/// # .with_native_roots()
48145/// # .unwrap()
48146/// # .https_or_http()
48147/// # .enable_http1()
48148/// # .build()
48149/// # );
48150/// # let mut hub = CloudHealthcare::new(client, auth);
48151/// // You can configure optional parameters by calling the respective setters at will, and
48152/// // execute the final call using `doit()`.
48153/// // Values shown here are possibly random and not representative !
48154/// let result = hub.projects().locations_datasets_list("parent")
48155/// .page_token("et")
48156/// .page_size(-56)
48157/// .doit().await;
48158/// # }
48159/// ```
48160pub struct ProjectLocationDatasetListCall<'a, C>
48161where
48162 C: 'a,
48163{
48164 hub: &'a CloudHealthcare<C>,
48165 _parent: String,
48166 _page_token: Option<String>,
48167 _page_size: Option<i32>,
48168 _delegate: Option<&'a mut dyn common::Delegate>,
48169 _additional_params: HashMap<String, String>,
48170 _scopes: BTreeSet<String>,
48171}
48172
48173impl<'a, C> common::CallBuilder for ProjectLocationDatasetListCall<'a, C> {}
48174
48175impl<'a, C> ProjectLocationDatasetListCall<'a, C>
48176where
48177 C: common::Connector,
48178{
48179 /// Perform the operation you have build so far.
48180 pub async fn doit(mut self) -> common::Result<(common::Response, ListDatasetsResponse)> {
48181 use std::borrow::Cow;
48182 use std::io::{Read, Seek};
48183
48184 use common::{url::Params, ToParts};
48185 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
48186
48187 let mut dd = common::DefaultDelegate;
48188 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
48189 dlg.begin(common::MethodInfo {
48190 id: "healthcare.projects.locations.datasets.list",
48191 http_method: hyper::Method::GET,
48192 });
48193
48194 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
48195 if self._additional_params.contains_key(field) {
48196 dlg.finished(false);
48197 return Err(common::Error::FieldClash(field));
48198 }
48199 }
48200
48201 let mut params = Params::with_capacity(5 + self._additional_params.len());
48202 params.push("parent", self._parent);
48203 if let Some(value) = self._page_token.as_ref() {
48204 params.push("pageToken", value);
48205 }
48206 if let Some(value) = self._page_size.as_ref() {
48207 params.push("pageSize", value.to_string());
48208 }
48209
48210 params.extend(self._additional_params.iter());
48211
48212 params.push("alt", "json");
48213 let mut url = self.hub._base_url.clone() + "v1/{+parent}/datasets";
48214 if self._scopes.is_empty() {
48215 self._scopes
48216 .insert(Scope::CloudHealthcare.as_ref().to_string());
48217 }
48218
48219 #[allow(clippy::single_element_loop)]
48220 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
48221 url = params.uri_replacement(url, param_name, find_this, true);
48222 }
48223 {
48224 let to_remove = ["parent"];
48225 params.remove_params(&to_remove);
48226 }
48227
48228 let url = params.parse_with_url(&url);
48229
48230 loop {
48231 let token = match self
48232 .hub
48233 .auth
48234 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
48235 .await
48236 {
48237 Ok(token) => token,
48238 Err(e) => match dlg.token(e) {
48239 Ok(token) => token,
48240 Err(e) => {
48241 dlg.finished(false);
48242 return Err(common::Error::MissingToken(e));
48243 }
48244 },
48245 };
48246 let mut req_result = {
48247 let client = &self.hub.client;
48248 dlg.pre_request();
48249 let mut req_builder = hyper::Request::builder()
48250 .method(hyper::Method::GET)
48251 .uri(url.as_str())
48252 .header(USER_AGENT, self.hub._user_agent.clone());
48253
48254 if let Some(token) = token.as_ref() {
48255 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
48256 }
48257
48258 let request = req_builder
48259 .header(CONTENT_LENGTH, 0_u64)
48260 .body(common::to_body::<String>(None));
48261
48262 client.request(request.unwrap()).await
48263 };
48264
48265 match req_result {
48266 Err(err) => {
48267 if let common::Retry::After(d) = dlg.http_error(&err) {
48268 sleep(d).await;
48269 continue;
48270 }
48271 dlg.finished(false);
48272 return Err(common::Error::HttpError(err));
48273 }
48274 Ok(res) => {
48275 let (mut parts, body) = res.into_parts();
48276 let mut body = common::Body::new(body);
48277 if !parts.status.is_success() {
48278 let bytes = common::to_bytes(body).await.unwrap_or_default();
48279 let error = serde_json::from_str(&common::to_string(&bytes));
48280 let response = common::to_response(parts, bytes.into());
48281
48282 if let common::Retry::After(d) =
48283 dlg.http_failure(&response, error.as_ref().ok())
48284 {
48285 sleep(d).await;
48286 continue;
48287 }
48288
48289 dlg.finished(false);
48290
48291 return Err(match error {
48292 Ok(value) => common::Error::BadRequest(value),
48293 _ => common::Error::Failure(response),
48294 });
48295 }
48296 let response = {
48297 let bytes = common::to_bytes(body).await.unwrap_or_default();
48298 let encoded = common::to_string(&bytes);
48299 match serde_json::from_str(&encoded) {
48300 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
48301 Err(error) => {
48302 dlg.response_json_decode_error(&encoded, &error);
48303 return Err(common::Error::JsonDecodeError(
48304 encoded.to_string(),
48305 error,
48306 ));
48307 }
48308 }
48309 };
48310
48311 dlg.finished(true);
48312 return Ok(response);
48313 }
48314 }
48315 }
48316 }
48317
48318 /// Required. The name of the project whose datasets should be listed. For example, `projects/{project_id}/locations/{location_id}`.
48319 ///
48320 /// Sets the *parent* path property to the given value.
48321 ///
48322 /// Even though the property as already been set when instantiating this call,
48323 /// we provide this method for API completeness.
48324 pub fn parent(mut self, new_value: &str) -> ProjectLocationDatasetListCall<'a, C> {
48325 self._parent = new_value.to_string();
48326 self
48327 }
48328 /// The next_page_token value returned from a previous List request, if any.
48329 ///
48330 /// Sets the *page token* query property to the given value.
48331 pub fn page_token(mut self, new_value: &str) -> ProjectLocationDatasetListCall<'a, C> {
48332 self._page_token = Some(new_value.to_string());
48333 self
48334 }
48335 /// The maximum number of items to return. If not specified, 100 is used. May not be larger than 1000.
48336 ///
48337 /// Sets the *page size* query property to the given value.
48338 pub fn page_size(mut self, new_value: i32) -> ProjectLocationDatasetListCall<'a, C> {
48339 self._page_size = Some(new_value);
48340 self
48341 }
48342 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
48343 /// while executing the actual API request.
48344 ///
48345 /// ````text
48346 /// It should be used to handle progress information, and to implement a certain level of resilience.
48347 /// ````
48348 ///
48349 /// Sets the *delegate* property to the given value.
48350 pub fn delegate(
48351 mut self,
48352 new_value: &'a mut dyn common::Delegate,
48353 ) -> ProjectLocationDatasetListCall<'a, C> {
48354 self._delegate = Some(new_value);
48355 self
48356 }
48357
48358 /// Set any additional parameter of the query string used in the request.
48359 /// It should be used to set parameters which are not yet available through their own
48360 /// setters.
48361 ///
48362 /// Please note that this method must not be used to set any of the known parameters
48363 /// which have their own setter method. If done anyway, the request will fail.
48364 ///
48365 /// # Additional Parameters
48366 ///
48367 /// * *$.xgafv* (query-string) - V1 error format.
48368 /// * *access_token* (query-string) - OAuth access token.
48369 /// * *alt* (query-string) - Data format for response.
48370 /// * *callback* (query-string) - JSONP
48371 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
48372 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
48373 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
48374 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
48375 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
48376 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
48377 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
48378 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetListCall<'a, C>
48379 where
48380 T: AsRef<str>,
48381 {
48382 self._additional_params
48383 .insert(name.as_ref().to_string(), value.as_ref().to_string());
48384 self
48385 }
48386
48387 /// Identifies the authorization scope for the method you are building.
48388 ///
48389 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
48390 /// [`Scope::CloudHealthcare`].
48391 ///
48392 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
48393 /// tokens for more than one scope.
48394 ///
48395 /// Usually there is more than one suitable scope to authorize an operation, some of which may
48396 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
48397 /// sufficient, a read-write scope will do as well.
48398 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetListCall<'a, C>
48399 where
48400 St: AsRef<str>,
48401 {
48402 self._scopes.insert(String::from(scope.as_ref()));
48403 self
48404 }
48405 /// Identifies the authorization scope(s) for the method you are building.
48406 ///
48407 /// See [`Self::add_scope()`] for details.
48408 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetListCall<'a, C>
48409 where
48410 I: IntoIterator<Item = St>,
48411 St: AsRef<str>,
48412 {
48413 self._scopes
48414 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
48415 self
48416 }
48417
48418 /// Removes all scopes, and no default scope will be used either.
48419 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
48420 /// for details).
48421 pub fn clear_scopes(mut self) -> ProjectLocationDatasetListCall<'a, C> {
48422 self._scopes.clear();
48423 self
48424 }
48425}
48426
48427/// Updates dataset metadata.
48428///
48429/// A builder for the *locations.datasets.patch* method supported by a *project* resource.
48430/// It is not used directly, but through a [`ProjectMethods`] instance.
48431///
48432/// # Example
48433///
48434/// Instantiate a resource method builder
48435///
48436/// ```test_harness,no_run
48437/// # extern crate hyper;
48438/// # extern crate hyper_rustls;
48439/// # extern crate google_healthcare1 as healthcare1;
48440/// use healthcare1::api::Dataset;
48441/// # async fn dox() {
48442/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
48443///
48444/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
48445/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
48446/// # secret,
48447/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
48448/// # ).build().await.unwrap();
48449///
48450/// # let client = hyper_util::client::legacy::Client::builder(
48451/// # hyper_util::rt::TokioExecutor::new()
48452/// # )
48453/// # .build(
48454/// # hyper_rustls::HttpsConnectorBuilder::new()
48455/// # .with_native_roots()
48456/// # .unwrap()
48457/// # .https_or_http()
48458/// # .enable_http1()
48459/// # .build()
48460/// # );
48461/// # let mut hub = CloudHealthcare::new(client, auth);
48462/// // As the method needs a request, you would usually fill it with the desired information
48463/// // into the respective structure. Some of the parts shown here might not be applicable !
48464/// // Values shown here are possibly random and not representative !
48465/// let mut req = Dataset::default();
48466///
48467/// // You can configure optional parameters by calling the respective setters at will, and
48468/// // execute the final call using `doit()`.
48469/// // Values shown here are possibly random and not representative !
48470/// let result = hub.projects().locations_datasets_patch(req, "name")
48471/// .update_mask(FieldMask::new::<&str>(&[]))
48472/// .doit().await;
48473/// # }
48474/// ```
48475pub struct ProjectLocationDatasetPatchCall<'a, C>
48476where
48477 C: 'a,
48478{
48479 hub: &'a CloudHealthcare<C>,
48480 _request: Dataset,
48481 _name: String,
48482 _update_mask: Option<common::FieldMask>,
48483 _delegate: Option<&'a mut dyn common::Delegate>,
48484 _additional_params: HashMap<String, String>,
48485 _scopes: BTreeSet<String>,
48486}
48487
48488impl<'a, C> common::CallBuilder for ProjectLocationDatasetPatchCall<'a, C> {}
48489
48490impl<'a, C> ProjectLocationDatasetPatchCall<'a, C>
48491where
48492 C: common::Connector,
48493{
48494 /// Perform the operation you have build so far.
48495 pub async fn doit(mut self) -> common::Result<(common::Response, Dataset)> {
48496 use std::borrow::Cow;
48497 use std::io::{Read, Seek};
48498
48499 use common::{url::Params, ToParts};
48500 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
48501
48502 let mut dd = common::DefaultDelegate;
48503 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
48504 dlg.begin(common::MethodInfo {
48505 id: "healthcare.projects.locations.datasets.patch",
48506 http_method: hyper::Method::PATCH,
48507 });
48508
48509 for &field in ["alt", "name", "updateMask"].iter() {
48510 if self._additional_params.contains_key(field) {
48511 dlg.finished(false);
48512 return Err(common::Error::FieldClash(field));
48513 }
48514 }
48515
48516 let mut params = Params::with_capacity(5 + self._additional_params.len());
48517 params.push("name", self._name);
48518 if let Some(value) = self._update_mask.as_ref() {
48519 params.push("updateMask", value.to_string());
48520 }
48521
48522 params.extend(self._additional_params.iter());
48523
48524 params.push("alt", "json");
48525 let mut url = self.hub._base_url.clone() + "v1/{+name}";
48526 if self._scopes.is_empty() {
48527 self._scopes
48528 .insert(Scope::CloudHealthcare.as_ref().to_string());
48529 }
48530
48531 #[allow(clippy::single_element_loop)]
48532 for &(find_this, param_name) in [("{+name}", "name")].iter() {
48533 url = params.uri_replacement(url, param_name, find_this, true);
48534 }
48535 {
48536 let to_remove = ["name"];
48537 params.remove_params(&to_remove);
48538 }
48539
48540 let url = params.parse_with_url(&url);
48541
48542 let mut json_mime_type = mime::APPLICATION_JSON;
48543 let mut request_value_reader = {
48544 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
48545 common::remove_json_null_values(&mut value);
48546 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
48547 serde_json::to_writer(&mut dst, &value).unwrap();
48548 dst
48549 };
48550 let request_size = request_value_reader
48551 .seek(std::io::SeekFrom::End(0))
48552 .unwrap();
48553 request_value_reader
48554 .seek(std::io::SeekFrom::Start(0))
48555 .unwrap();
48556
48557 loop {
48558 let token = match self
48559 .hub
48560 .auth
48561 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
48562 .await
48563 {
48564 Ok(token) => token,
48565 Err(e) => match dlg.token(e) {
48566 Ok(token) => token,
48567 Err(e) => {
48568 dlg.finished(false);
48569 return Err(common::Error::MissingToken(e));
48570 }
48571 },
48572 };
48573 request_value_reader
48574 .seek(std::io::SeekFrom::Start(0))
48575 .unwrap();
48576 let mut req_result = {
48577 let client = &self.hub.client;
48578 dlg.pre_request();
48579 let mut req_builder = hyper::Request::builder()
48580 .method(hyper::Method::PATCH)
48581 .uri(url.as_str())
48582 .header(USER_AGENT, self.hub._user_agent.clone());
48583
48584 if let Some(token) = token.as_ref() {
48585 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
48586 }
48587
48588 let request = req_builder
48589 .header(CONTENT_TYPE, json_mime_type.to_string())
48590 .header(CONTENT_LENGTH, request_size as u64)
48591 .body(common::to_body(
48592 request_value_reader.get_ref().clone().into(),
48593 ));
48594
48595 client.request(request.unwrap()).await
48596 };
48597
48598 match req_result {
48599 Err(err) => {
48600 if let common::Retry::After(d) = dlg.http_error(&err) {
48601 sleep(d).await;
48602 continue;
48603 }
48604 dlg.finished(false);
48605 return Err(common::Error::HttpError(err));
48606 }
48607 Ok(res) => {
48608 let (mut parts, body) = res.into_parts();
48609 let mut body = common::Body::new(body);
48610 if !parts.status.is_success() {
48611 let bytes = common::to_bytes(body).await.unwrap_or_default();
48612 let error = serde_json::from_str(&common::to_string(&bytes));
48613 let response = common::to_response(parts, bytes.into());
48614
48615 if let common::Retry::After(d) =
48616 dlg.http_failure(&response, error.as_ref().ok())
48617 {
48618 sleep(d).await;
48619 continue;
48620 }
48621
48622 dlg.finished(false);
48623
48624 return Err(match error {
48625 Ok(value) => common::Error::BadRequest(value),
48626 _ => common::Error::Failure(response),
48627 });
48628 }
48629 let response = {
48630 let bytes = common::to_bytes(body).await.unwrap_or_default();
48631 let encoded = common::to_string(&bytes);
48632 match serde_json::from_str(&encoded) {
48633 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
48634 Err(error) => {
48635 dlg.response_json_decode_error(&encoded, &error);
48636 return Err(common::Error::JsonDecodeError(
48637 encoded.to_string(),
48638 error,
48639 ));
48640 }
48641 }
48642 };
48643
48644 dlg.finished(true);
48645 return Ok(response);
48646 }
48647 }
48648 }
48649 }
48650
48651 ///
48652 /// Sets the *request* property to the given value.
48653 ///
48654 /// Even though the property as already been set when instantiating this call,
48655 /// we provide this method for API completeness.
48656 pub fn request(mut self, new_value: Dataset) -> ProjectLocationDatasetPatchCall<'a, C> {
48657 self._request = new_value;
48658 self
48659 }
48660 /// Identifier. Resource name of the dataset, of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`.
48661 ///
48662 /// Sets the *name* path property to the given value.
48663 ///
48664 /// Even though the property as already been set when instantiating this call,
48665 /// we provide this method for API completeness.
48666 pub fn name(mut self, new_value: &str) -> ProjectLocationDatasetPatchCall<'a, C> {
48667 self._name = new_value.to_string();
48668 self
48669 }
48670 /// Required. The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
48671 ///
48672 /// Sets the *update mask* query property to the given value.
48673 pub fn update_mask(
48674 mut self,
48675 new_value: common::FieldMask,
48676 ) -> ProjectLocationDatasetPatchCall<'a, C> {
48677 self._update_mask = Some(new_value);
48678 self
48679 }
48680 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
48681 /// while executing the actual API request.
48682 ///
48683 /// ````text
48684 /// It should be used to handle progress information, and to implement a certain level of resilience.
48685 /// ````
48686 ///
48687 /// Sets the *delegate* property to the given value.
48688 pub fn delegate(
48689 mut self,
48690 new_value: &'a mut dyn common::Delegate,
48691 ) -> ProjectLocationDatasetPatchCall<'a, C> {
48692 self._delegate = Some(new_value);
48693 self
48694 }
48695
48696 /// Set any additional parameter of the query string used in the request.
48697 /// It should be used to set parameters which are not yet available through their own
48698 /// setters.
48699 ///
48700 /// Please note that this method must not be used to set any of the known parameters
48701 /// which have their own setter method. If done anyway, the request will fail.
48702 ///
48703 /// # Additional Parameters
48704 ///
48705 /// * *$.xgafv* (query-string) - V1 error format.
48706 /// * *access_token* (query-string) - OAuth access token.
48707 /// * *alt* (query-string) - Data format for response.
48708 /// * *callback* (query-string) - JSONP
48709 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
48710 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
48711 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
48712 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
48713 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
48714 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
48715 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
48716 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetPatchCall<'a, C>
48717 where
48718 T: AsRef<str>,
48719 {
48720 self._additional_params
48721 .insert(name.as_ref().to_string(), value.as_ref().to_string());
48722 self
48723 }
48724
48725 /// Identifies the authorization scope for the method you are building.
48726 ///
48727 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
48728 /// [`Scope::CloudHealthcare`].
48729 ///
48730 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
48731 /// tokens for more than one scope.
48732 ///
48733 /// Usually there is more than one suitable scope to authorize an operation, some of which may
48734 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
48735 /// sufficient, a read-write scope will do as well.
48736 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetPatchCall<'a, C>
48737 where
48738 St: AsRef<str>,
48739 {
48740 self._scopes.insert(String::from(scope.as_ref()));
48741 self
48742 }
48743 /// Identifies the authorization scope(s) for the method you are building.
48744 ///
48745 /// See [`Self::add_scope()`] for details.
48746 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetPatchCall<'a, C>
48747 where
48748 I: IntoIterator<Item = St>,
48749 St: AsRef<str>,
48750 {
48751 self._scopes
48752 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
48753 self
48754 }
48755
48756 /// Removes all scopes, and no default scope will be used either.
48757 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
48758 /// for details).
48759 pub fn clear_scopes(mut self) -> ProjectLocationDatasetPatchCall<'a, C> {
48760 self._scopes.clear();
48761 self
48762 }
48763}
48764
48765/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
48766///
48767/// A builder for the *locations.datasets.setIamPolicy* method supported by a *project* resource.
48768/// It is not used directly, but through a [`ProjectMethods`] instance.
48769///
48770/// # Example
48771///
48772/// Instantiate a resource method builder
48773///
48774/// ```test_harness,no_run
48775/// # extern crate hyper;
48776/// # extern crate hyper_rustls;
48777/// # extern crate google_healthcare1 as healthcare1;
48778/// use healthcare1::api::SetIamPolicyRequest;
48779/// # async fn dox() {
48780/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
48781///
48782/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
48783/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
48784/// # secret,
48785/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
48786/// # ).build().await.unwrap();
48787///
48788/// # let client = hyper_util::client::legacy::Client::builder(
48789/// # hyper_util::rt::TokioExecutor::new()
48790/// # )
48791/// # .build(
48792/// # hyper_rustls::HttpsConnectorBuilder::new()
48793/// # .with_native_roots()
48794/// # .unwrap()
48795/// # .https_or_http()
48796/// # .enable_http1()
48797/// # .build()
48798/// # );
48799/// # let mut hub = CloudHealthcare::new(client, auth);
48800/// // As the method needs a request, you would usually fill it with the desired information
48801/// // into the respective structure. Some of the parts shown here might not be applicable !
48802/// // Values shown here are possibly random and not representative !
48803/// let mut req = SetIamPolicyRequest::default();
48804///
48805/// // You can configure optional parameters by calling the respective setters at will, and
48806/// // execute the final call using `doit()`.
48807/// // Values shown here are possibly random and not representative !
48808/// let result = hub.projects().locations_datasets_set_iam_policy(req, "resource")
48809/// .doit().await;
48810/// # }
48811/// ```
48812pub struct ProjectLocationDatasetSetIamPolicyCall<'a, C>
48813where
48814 C: 'a,
48815{
48816 hub: &'a CloudHealthcare<C>,
48817 _request: SetIamPolicyRequest,
48818 _resource: String,
48819 _delegate: Option<&'a mut dyn common::Delegate>,
48820 _additional_params: HashMap<String, String>,
48821 _scopes: BTreeSet<String>,
48822}
48823
48824impl<'a, C> common::CallBuilder for ProjectLocationDatasetSetIamPolicyCall<'a, C> {}
48825
48826impl<'a, C> ProjectLocationDatasetSetIamPolicyCall<'a, C>
48827where
48828 C: common::Connector,
48829{
48830 /// Perform the operation you have build so far.
48831 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
48832 use std::borrow::Cow;
48833 use std::io::{Read, Seek};
48834
48835 use common::{url::Params, ToParts};
48836 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
48837
48838 let mut dd = common::DefaultDelegate;
48839 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
48840 dlg.begin(common::MethodInfo {
48841 id: "healthcare.projects.locations.datasets.setIamPolicy",
48842 http_method: hyper::Method::POST,
48843 });
48844
48845 for &field in ["alt", "resource"].iter() {
48846 if self._additional_params.contains_key(field) {
48847 dlg.finished(false);
48848 return Err(common::Error::FieldClash(field));
48849 }
48850 }
48851
48852 let mut params = Params::with_capacity(4 + self._additional_params.len());
48853 params.push("resource", self._resource);
48854
48855 params.extend(self._additional_params.iter());
48856
48857 params.push("alt", "json");
48858 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
48859 if self._scopes.is_empty() {
48860 self._scopes
48861 .insert(Scope::CloudHealthcare.as_ref().to_string());
48862 }
48863
48864 #[allow(clippy::single_element_loop)]
48865 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
48866 url = params.uri_replacement(url, param_name, find_this, true);
48867 }
48868 {
48869 let to_remove = ["resource"];
48870 params.remove_params(&to_remove);
48871 }
48872
48873 let url = params.parse_with_url(&url);
48874
48875 let mut json_mime_type = mime::APPLICATION_JSON;
48876 let mut request_value_reader = {
48877 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
48878 common::remove_json_null_values(&mut value);
48879 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
48880 serde_json::to_writer(&mut dst, &value).unwrap();
48881 dst
48882 };
48883 let request_size = request_value_reader
48884 .seek(std::io::SeekFrom::End(0))
48885 .unwrap();
48886 request_value_reader
48887 .seek(std::io::SeekFrom::Start(0))
48888 .unwrap();
48889
48890 loop {
48891 let token = match self
48892 .hub
48893 .auth
48894 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
48895 .await
48896 {
48897 Ok(token) => token,
48898 Err(e) => match dlg.token(e) {
48899 Ok(token) => token,
48900 Err(e) => {
48901 dlg.finished(false);
48902 return Err(common::Error::MissingToken(e));
48903 }
48904 },
48905 };
48906 request_value_reader
48907 .seek(std::io::SeekFrom::Start(0))
48908 .unwrap();
48909 let mut req_result = {
48910 let client = &self.hub.client;
48911 dlg.pre_request();
48912 let mut req_builder = hyper::Request::builder()
48913 .method(hyper::Method::POST)
48914 .uri(url.as_str())
48915 .header(USER_AGENT, self.hub._user_agent.clone());
48916
48917 if let Some(token) = token.as_ref() {
48918 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
48919 }
48920
48921 let request = req_builder
48922 .header(CONTENT_TYPE, json_mime_type.to_string())
48923 .header(CONTENT_LENGTH, request_size as u64)
48924 .body(common::to_body(
48925 request_value_reader.get_ref().clone().into(),
48926 ));
48927
48928 client.request(request.unwrap()).await
48929 };
48930
48931 match req_result {
48932 Err(err) => {
48933 if let common::Retry::After(d) = dlg.http_error(&err) {
48934 sleep(d).await;
48935 continue;
48936 }
48937 dlg.finished(false);
48938 return Err(common::Error::HttpError(err));
48939 }
48940 Ok(res) => {
48941 let (mut parts, body) = res.into_parts();
48942 let mut body = common::Body::new(body);
48943 if !parts.status.is_success() {
48944 let bytes = common::to_bytes(body).await.unwrap_or_default();
48945 let error = serde_json::from_str(&common::to_string(&bytes));
48946 let response = common::to_response(parts, bytes.into());
48947
48948 if let common::Retry::After(d) =
48949 dlg.http_failure(&response, error.as_ref().ok())
48950 {
48951 sleep(d).await;
48952 continue;
48953 }
48954
48955 dlg.finished(false);
48956
48957 return Err(match error {
48958 Ok(value) => common::Error::BadRequest(value),
48959 _ => common::Error::Failure(response),
48960 });
48961 }
48962 let response = {
48963 let bytes = common::to_bytes(body).await.unwrap_or_default();
48964 let encoded = common::to_string(&bytes);
48965 match serde_json::from_str(&encoded) {
48966 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
48967 Err(error) => {
48968 dlg.response_json_decode_error(&encoded, &error);
48969 return Err(common::Error::JsonDecodeError(
48970 encoded.to_string(),
48971 error,
48972 ));
48973 }
48974 }
48975 };
48976
48977 dlg.finished(true);
48978 return Ok(response);
48979 }
48980 }
48981 }
48982 }
48983
48984 ///
48985 /// Sets the *request* property to the given value.
48986 ///
48987 /// Even though the property as already been set when instantiating this call,
48988 /// we provide this method for API completeness.
48989 pub fn request(
48990 mut self,
48991 new_value: SetIamPolicyRequest,
48992 ) -> ProjectLocationDatasetSetIamPolicyCall<'a, C> {
48993 self._request = new_value;
48994 self
48995 }
48996 /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
48997 ///
48998 /// Sets the *resource* path property to the given value.
48999 ///
49000 /// Even though the property as already been set when instantiating this call,
49001 /// we provide this method for API completeness.
49002 pub fn resource(mut self, new_value: &str) -> ProjectLocationDatasetSetIamPolicyCall<'a, C> {
49003 self._resource = new_value.to_string();
49004 self
49005 }
49006 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
49007 /// while executing the actual API request.
49008 ///
49009 /// ````text
49010 /// It should be used to handle progress information, and to implement a certain level of resilience.
49011 /// ````
49012 ///
49013 /// Sets the *delegate* property to the given value.
49014 pub fn delegate(
49015 mut self,
49016 new_value: &'a mut dyn common::Delegate,
49017 ) -> ProjectLocationDatasetSetIamPolicyCall<'a, C> {
49018 self._delegate = Some(new_value);
49019 self
49020 }
49021
49022 /// Set any additional parameter of the query string used in the request.
49023 /// It should be used to set parameters which are not yet available through their own
49024 /// setters.
49025 ///
49026 /// Please note that this method must not be used to set any of the known parameters
49027 /// which have their own setter method. If done anyway, the request will fail.
49028 ///
49029 /// # Additional Parameters
49030 ///
49031 /// * *$.xgafv* (query-string) - V1 error format.
49032 /// * *access_token* (query-string) - OAuth access token.
49033 /// * *alt* (query-string) - Data format for response.
49034 /// * *callback* (query-string) - JSONP
49035 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
49036 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
49037 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
49038 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
49039 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
49040 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
49041 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
49042 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDatasetSetIamPolicyCall<'a, C>
49043 where
49044 T: AsRef<str>,
49045 {
49046 self._additional_params
49047 .insert(name.as_ref().to_string(), value.as_ref().to_string());
49048 self
49049 }
49050
49051 /// Identifies the authorization scope for the method you are building.
49052 ///
49053 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
49054 /// [`Scope::CloudHealthcare`].
49055 ///
49056 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
49057 /// tokens for more than one scope.
49058 ///
49059 /// Usually there is more than one suitable scope to authorize an operation, some of which may
49060 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
49061 /// sufficient, a read-write scope will do as well.
49062 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetSetIamPolicyCall<'a, C>
49063 where
49064 St: AsRef<str>,
49065 {
49066 self._scopes.insert(String::from(scope.as_ref()));
49067 self
49068 }
49069 /// Identifies the authorization scope(s) for the method you are building.
49070 ///
49071 /// See [`Self::add_scope()`] for details.
49072 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDatasetSetIamPolicyCall<'a, C>
49073 where
49074 I: IntoIterator<Item = St>,
49075 St: AsRef<str>,
49076 {
49077 self._scopes
49078 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
49079 self
49080 }
49081
49082 /// Removes all scopes, and no default scope will be used either.
49083 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
49084 /// for details).
49085 pub fn clear_scopes(mut self) -> ProjectLocationDatasetSetIamPolicyCall<'a, C> {
49086 self._scopes.clear();
49087 self
49088 }
49089}
49090
49091/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
49092///
49093/// A builder for the *locations.datasets.testIamPermissions* method supported by a *project* resource.
49094/// It is not used directly, but through a [`ProjectMethods`] instance.
49095///
49096/// # Example
49097///
49098/// Instantiate a resource method builder
49099///
49100/// ```test_harness,no_run
49101/// # extern crate hyper;
49102/// # extern crate hyper_rustls;
49103/// # extern crate google_healthcare1 as healthcare1;
49104/// use healthcare1::api::TestIamPermissionsRequest;
49105/// # async fn dox() {
49106/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
49107///
49108/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
49109/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
49110/// # secret,
49111/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
49112/// # ).build().await.unwrap();
49113///
49114/// # let client = hyper_util::client::legacy::Client::builder(
49115/// # hyper_util::rt::TokioExecutor::new()
49116/// # )
49117/// # .build(
49118/// # hyper_rustls::HttpsConnectorBuilder::new()
49119/// # .with_native_roots()
49120/// # .unwrap()
49121/// # .https_or_http()
49122/// # .enable_http1()
49123/// # .build()
49124/// # );
49125/// # let mut hub = CloudHealthcare::new(client, auth);
49126/// // As the method needs a request, you would usually fill it with the desired information
49127/// // into the respective structure. Some of the parts shown here might not be applicable !
49128/// // Values shown here are possibly random and not representative !
49129/// let mut req = TestIamPermissionsRequest::default();
49130///
49131/// // You can configure optional parameters by calling the respective setters at will, and
49132/// // execute the final call using `doit()`.
49133/// // Values shown here are possibly random and not representative !
49134/// let result = hub.projects().locations_datasets_test_iam_permissions(req, "resource")
49135/// .doit().await;
49136/// # }
49137/// ```
49138pub struct ProjectLocationDatasetTestIamPermissionCall<'a, C>
49139where
49140 C: 'a,
49141{
49142 hub: &'a CloudHealthcare<C>,
49143 _request: TestIamPermissionsRequest,
49144 _resource: String,
49145 _delegate: Option<&'a mut dyn common::Delegate>,
49146 _additional_params: HashMap<String, String>,
49147 _scopes: BTreeSet<String>,
49148}
49149
49150impl<'a, C> common::CallBuilder for ProjectLocationDatasetTestIamPermissionCall<'a, C> {}
49151
49152impl<'a, C> ProjectLocationDatasetTestIamPermissionCall<'a, C>
49153where
49154 C: common::Connector,
49155{
49156 /// Perform the operation you have build so far.
49157 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
49158 use std::borrow::Cow;
49159 use std::io::{Read, Seek};
49160
49161 use common::{url::Params, ToParts};
49162 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
49163
49164 let mut dd = common::DefaultDelegate;
49165 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
49166 dlg.begin(common::MethodInfo {
49167 id: "healthcare.projects.locations.datasets.testIamPermissions",
49168 http_method: hyper::Method::POST,
49169 });
49170
49171 for &field in ["alt", "resource"].iter() {
49172 if self._additional_params.contains_key(field) {
49173 dlg.finished(false);
49174 return Err(common::Error::FieldClash(field));
49175 }
49176 }
49177
49178 let mut params = Params::with_capacity(4 + self._additional_params.len());
49179 params.push("resource", self._resource);
49180
49181 params.extend(self._additional_params.iter());
49182
49183 params.push("alt", "json");
49184 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
49185 if self._scopes.is_empty() {
49186 self._scopes
49187 .insert(Scope::CloudHealthcare.as_ref().to_string());
49188 }
49189
49190 #[allow(clippy::single_element_loop)]
49191 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
49192 url = params.uri_replacement(url, param_name, find_this, true);
49193 }
49194 {
49195 let to_remove = ["resource"];
49196 params.remove_params(&to_remove);
49197 }
49198
49199 let url = params.parse_with_url(&url);
49200
49201 let mut json_mime_type = mime::APPLICATION_JSON;
49202 let mut request_value_reader = {
49203 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
49204 common::remove_json_null_values(&mut value);
49205 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
49206 serde_json::to_writer(&mut dst, &value).unwrap();
49207 dst
49208 };
49209 let request_size = request_value_reader
49210 .seek(std::io::SeekFrom::End(0))
49211 .unwrap();
49212 request_value_reader
49213 .seek(std::io::SeekFrom::Start(0))
49214 .unwrap();
49215
49216 loop {
49217 let token = match self
49218 .hub
49219 .auth
49220 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
49221 .await
49222 {
49223 Ok(token) => token,
49224 Err(e) => match dlg.token(e) {
49225 Ok(token) => token,
49226 Err(e) => {
49227 dlg.finished(false);
49228 return Err(common::Error::MissingToken(e));
49229 }
49230 },
49231 };
49232 request_value_reader
49233 .seek(std::io::SeekFrom::Start(0))
49234 .unwrap();
49235 let mut req_result = {
49236 let client = &self.hub.client;
49237 dlg.pre_request();
49238 let mut req_builder = hyper::Request::builder()
49239 .method(hyper::Method::POST)
49240 .uri(url.as_str())
49241 .header(USER_AGENT, self.hub._user_agent.clone());
49242
49243 if let Some(token) = token.as_ref() {
49244 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
49245 }
49246
49247 let request = req_builder
49248 .header(CONTENT_TYPE, json_mime_type.to_string())
49249 .header(CONTENT_LENGTH, request_size as u64)
49250 .body(common::to_body(
49251 request_value_reader.get_ref().clone().into(),
49252 ));
49253
49254 client.request(request.unwrap()).await
49255 };
49256
49257 match req_result {
49258 Err(err) => {
49259 if let common::Retry::After(d) = dlg.http_error(&err) {
49260 sleep(d).await;
49261 continue;
49262 }
49263 dlg.finished(false);
49264 return Err(common::Error::HttpError(err));
49265 }
49266 Ok(res) => {
49267 let (mut parts, body) = res.into_parts();
49268 let mut body = common::Body::new(body);
49269 if !parts.status.is_success() {
49270 let bytes = common::to_bytes(body).await.unwrap_or_default();
49271 let error = serde_json::from_str(&common::to_string(&bytes));
49272 let response = common::to_response(parts, bytes.into());
49273
49274 if let common::Retry::After(d) =
49275 dlg.http_failure(&response, error.as_ref().ok())
49276 {
49277 sleep(d).await;
49278 continue;
49279 }
49280
49281 dlg.finished(false);
49282
49283 return Err(match error {
49284 Ok(value) => common::Error::BadRequest(value),
49285 _ => common::Error::Failure(response),
49286 });
49287 }
49288 let response = {
49289 let bytes = common::to_bytes(body).await.unwrap_or_default();
49290 let encoded = common::to_string(&bytes);
49291 match serde_json::from_str(&encoded) {
49292 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
49293 Err(error) => {
49294 dlg.response_json_decode_error(&encoded, &error);
49295 return Err(common::Error::JsonDecodeError(
49296 encoded.to_string(),
49297 error,
49298 ));
49299 }
49300 }
49301 };
49302
49303 dlg.finished(true);
49304 return Ok(response);
49305 }
49306 }
49307 }
49308 }
49309
49310 ///
49311 /// Sets the *request* property to the given value.
49312 ///
49313 /// Even though the property as already been set when instantiating this call,
49314 /// we provide this method for API completeness.
49315 pub fn request(
49316 mut self,
49317 new_value: TestIamPermissionsRequest,
49318 ) -> ProjectLocationDatasetTestIamPermissionCall<'a, C> {
49319 self._request = new_value;
49320 self
49321 }
49322 /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
49323 ///
49324 /// Sets the *resource* path property to the given value.
49325 ///
49326 /// Even though the property as already been set when instantiating this call,
49327 /// we provide this method for API completeness.
49328 pub fn resource(
49329 mut self,
49330 new_value: &str,
49331 ) -> ProjectLocationDatasetTestIamPermissionCall<'a, C> {
49332 self._resource = new_value.to_string();
49333 self
49334 }
49335 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
49336 /// while executing the actual API request.
49337 ///
49338 /// ````text
49339 /// It should be used to handle progress information, and to implement a certain level of resilience.
49340 /// ````
49341 ///
49342 /// Sets the *delegate* property to the given value.
49343 pub fn delegate(
49344 mut self,
49345 new_value: &'a mut dyn common::Delegate,
49346 ) -> ProjectLocationDatasetTestIamPermissionCall<'a, C> {
49347 self._delegate = Some(new_value);
49348 self
49349 }
49350
49351 /// Set any additional parameter of the query string used in the request.
49352 /// It should be used to set parameters which are not yet available through their own
49353 /// setters.
49354 ///
49355 /// Please note that this method must not be used to set any of the known parameters
49356 /// which have their own setter method. If done anyway, the request will fail.
49357 ///
49358 /// # Additional Parameters
49359 ///
49360 /// * *$.xgafv* (query-string) - V1 error format.
49361 /// * *access_token* (query-string) - OAuth access token.
49362 /// * *alt* (query-string) - Data format for response.
49363 /// * *callback* (query-string) - JSONP
49364 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
49365 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
49366 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
49367 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
49368 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
49369 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
49370 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
49371 pub fn param<T>(
49372 mut self,
49373 name: T,
49374 value: T,
49375 ) -> ProjectLocationDatasetTestIamPermissionCall<'a, C>
49376 where
49377 T: AsRef<str>,
49378 {
49379 self._additional_params
49380 .insert(name.as_ref().to_string(), value.as_ref().to_string());
49381 self
49382 }
49383
49384 /// Identifies the authorization scope for the method you are building.
49385 ///
49386 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
49387 /// [`Scope::CloudHealthcare`].
49388 ///
49389 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
49390 /// tokens for more than one scope.
49391 ///
49392 /// Usually there is more than one suitable scope to authorize an operation, some of which may
49393 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
49394 /// sufficient, a read-write scope will do as well.
49395 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDatasetTestIamPermissionCall<'a, C>
49396 where
49397 St: AsRef<str>,
49398 {
49399 self._scopes.insert(String::from(scope.as_ref()));
49400 self
49401 }
49402 /// Identifies the authorization scope(s) for the method you are building.
49403 ///
49404 /// See [`Self::add_scope()`] for details.
49405 pub fn add_scopes<I, St>(
49406 mut self,
49407 scopes: I,
49408 ) -> ProjectLocationDatasetTestIamPermissionCall<'a, C>
49409 where
49410 I: IntoIterator<Item = St>,
49411 St: AsRef<str>,
49412 {
49413 self._scopes
49414 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
49415 self
49416 }
49417
49418 /// Removes all scopes, and no default scope will be used either.
49419 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
49420 /// for details).
49421 pub fn clear_scopes(mut self) -> ProjectLocationDatasetTestIamPermissionCall<'a, C> {
49422 self._scopes.clear();
49423 self
49424 }
49425}
49426
49427/// Analyze heathcare entity in a document. Its response includes the recognized entity mentions and the relationships between them. AnalyzeEntities uses context aware models to detect entities.
49428///
49429/// A builder for the *locations.services.nlp.analyzeEntities* method supported by a *project* resource.
49430/// It is not used directly, but through a [`ProjectMethods`] instance.
49431///
49432/// # Example
49433///
49434/// Instantiate a resource method builder
49435///
49436/// ```test_harness,no_run
49437/// # extern crate hyper;
49438/// # extern crate hyper_rustls;
49439/// # extern crate google_healthcare1 as healthcare1;
49440/// use healthcare1::api::AnalyzeEntitiesRequest;
49441/// # async fn dox() {
49442/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
49443///
49444/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
49445/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
49446/// # secret,
49447/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
49448/// # ).build().await.unwrap();
49449///
49450/// # let client = hyper_util::client::legacy::Client::builder(
49451/// # hyper_util::rt::TokioExecutor::new()
49452/// # )
49453/// # .build(
49454/// # hyper_rustls::HttpsConnectorBuilder::new()
49455/// # .with_native_roots()
49456/// # .unwrap()
49457/// # .https_or_http()
49458/// # .enable_http1()
49459/// # .build()
49460/// # );
49461/// # let mut hub = CloudHealthcare::new(client, auth);
49462/// // As the method needs a request, you would usually fill it with the desired information
49463/// // into the respective structure. Some of the parts shown here might not be applicable !
49464/// // Values shown here are possibly random and not representative !
49465/// let mut req = AnalyzeEntitiesRequest::default();
49466///
49467/// // You can configure optional parameters by calling the respective setters at will, and
49468/// // execute the final call using `doit()`.
49469/// // Values shown here are possibly random and not representative !
49470/// let result = hub.projects().locations_services_nlp_analyze_entities(req, "nlpService")
49471/// .doit().await;
49472/// # }
49473/// ```
49474pub struct ProjectLocationServiceNlpAnalyzeEntityCall<'a, C>
49475where
49476 C: 'a,
49477{
49478 hub: &'a CloudHealthcare<C>,
49479 _request: AnalyzeEntitiesRequest,
49480 _nlp_service: String,
49481 _delegate: Option<&'a mut dyn common::Delegate>,
49482 _additional_params: HashMap<String, String>,
49483 _scopes: BTreeSet<String>,
49484}
49485
49486impl<'a, C> common::CallBuilder for ProjectLocationServiceNlpAnalyzeEntityCall<'a, C> {}
49487
49488impl<'a, C> ProjectLocationServiceNlpAnalyzeEntityCall<'a, C>
49489where
49490 C: common::Connector,
49491{
49492 /// Perform the operation you have build so far.
49493 pub async fn doit(mut self) -> common::Result<(common::Response, AnalyzeEntitiesResponse)> {
49494 use std::borrow::Cow;
49495 use std::io::{Read, Seek};
49496
49497 use common::{url::Params, ToParts};
49498 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
49499
49500 let mut dd = common::DefaultDelegate;
49501 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
49502 dlg.begin(common::MethodInfo {
49503 id: "healthcare.projects.locations.services.nlp.analyzeEntities",
49504 http_method: hyper::Method::POST,
49505 });
49506
49507 for &field in ["alt", "nlpService"].iter() {
49508 if self._additional_params.contains_key(field) {
49509 dlg.finished(false);
49510 return Err(common::Error::FieldClash(field));
49511 }
49512 }
49513
49514 let mut params = Params::with_capacity(4 + self._additional_params.len());
49515 params.push("nlpService", self._nlp_service);
49516
49517 params.extend(self._additional_params.iter());
49518
49519 params.push("alt", "json");
49520 let mut url = self.hub._base_url.clone() + "v1/{+nlpService}:analyzeEntities";
49521 if self._scopes.is_empty() {
49522 self._scopes
49523 .insert(Scope::CloudHealthcare.as_ref().to_string());
49524 }
49525
49526 #[allow(clippy::single_element_loop)]
49527 for &(find_this, param_name) in [("{+nlpService}", "nlpService")].iter() {
49528 url = params.uri_replacement(url, param_name, find_this, true);
49529 }
49530 {
49531 let to_remove = ["nlpService"];
49532 params.remove_params(&to_remove);
49533 }
49534
49535 let url = params.parse_with_url(&url);
49536
49537 let mut json_mime_type = mime::APPLICATION_JSON;
49538 let mut request_value_reader = {
49539 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
49540 common::remove_json_null_values(&mut value);
49541 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
49542 serde_json::to_writer(&mut dst, &value).unwrap();
49543 dst
49544 };
49545 let request_size = request_value_reader
49546 .seek(std::io::SeekFrom::End(0))
49547 .unwrap();
49548 request_value_reader
49549 .seek(std::io::SeekFrom::Start(0))
49550 .unwrap();
49551
49552 loop {
49553 let token = match self
49554 .hub
49555 .auth
49556 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
49557 .await
49558 {
49559 Ok(token) => token,
49560 Err(e) => match dlg.token(e) {
49561 Ok(token) => token,
49562 Err(e) => {
49563 dlg.finished(false);
49564 return Err(common::Error::MissingToken(e));
49565 }
49566 },
49567 };
49568 request_value_reader
49569 .seek(std::io::SeekFrom::Start(0))
49570 .unwrap();
49571 let mut req_result = {
49572 let client = &self.hub.client;
49573 dlg.pre_request();
49574 let mut req_builder = hyper::Request::builder()
49575 .method(hyper::Method::POST)
49576 .uri(url.as_str())
49577 .header(USER_AGENT, self.hub._user_agent.clone());
49578
49579 if let Some(token) = token.as_ref() {
49580 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
49581 }
49582
49583 let request = req_builder
49584 .header(CONTENT_TYPE, json_mime_type.to_string())
49585 .header(CONTENT_LENGTH, request_size as u64)
49586 .body(common::to_body(
49587 request_value_reader.get_ref().clone().into(),
49588 ));
49589
49590 client.request(request.unwrap()).await
49591 };
49592
49593 match req_result {
49594 Err(err) => {
49595 if let common::Retry::After(d) = dlg.http_error(&err) {
49596 sleep(d).await;
49597 continue;
49598 }
49599 dlg.finished(false);
49600 return Err(common::Error::HttpError(err));
49601 }
49602 Ok(res) => {
49603 let (mut parts, body) = res.into_parts();
49604 let mut body = common::Body::new(body);
49605 if !parts.status.is_success() {
49606 let bytes = common::to_bytes(body).await.unwrap_or_default();
49607 let error = serde_json::from_str(&common::to_string(&bytes));
49608 let response = common::to_response(parts, bytes.into());
49609
49610 if let common::Retry::After(d) =
49611 dlg.http_failure(&response, error.as_ref().ok())
49612 {
49613 sleep(d).await;
49614 continue;
49615 }
49616
49617 dlg.finished(false);
49618
49619 return Err(match error {
49620 Ok(value) => common::Error::BadRequest(value),
49621 _ => common::Error::Failure(response),
49622 });
49623 }
49624 let response = {
49625 let bytes = common::to_bytes(body).await.unwrap_or_default();
49626 let encoded = common::to_string(&bytes);
49627 match serde_json::from_str(&encoded) {
49628 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
49629 Err(error) => {
49630 dlg.response_json_decode_error(&encoded, &error);
49631 return Err(common::Error::JsonDecodeError(
49632 encoded.to_string(),
49633 error,
49634 ));
49635 }
49636 }
49637 };
49638
49639 dlg.finished(true);
49640 return Ok(response);
49641 }
49642 }
49643 }
49644 }
49645
49646 ///
49647 /// Sets the *request* property to the given value.
49648 ///
49649 /// Even though the property as already been set when instantiating this call,
49650 /// we provide this method for API completeness.
49651 pub fn request(
49652 mut self,
49653 new_value: AnalyzeEntitiesRequest,
49654 ) -> ProjectLocationServiceNlpAnalyzeEntityCall<'a, C> {
49655 self._request = new_value;
49656 self
49657 }
49658 /// The resource name of the service of the form: "projects/{project_id}/locations/{location_id}/services/nlp".
49659 ///
49660 /// Sets the *nlp service* path property to the given value.
49661 ///
49662 /// Even though the property as already been set when instantiating this call,
49663 /// we provide this method for API completeness.
49664 pub fn nlp_service(
49665 mut self,
49666 new_value: &str,
49667 ) -> ProjectLocationServiceNlpAnalyzeEntityCall<'a, C> {
49668 self._nlp_service = new_value.to_string();
49669 self
49670 }
49671 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
49672 /// while executing the actual API request.
49673 ///
49674 /// ````text
49675 /// It should be used to handle progress information, and to implement a certain level of resilience.
49676 /// ````
49677 ///
49678 /// Sets the *delegate* property to the given value.
49679 pub fn delegate(
49680 mut self,
49681 new_value: &'a mut dyn common::Delegate,
49682 ) -> ProjectLocationServiceNlpAnalyzeEntityCall<'a, C> {
49683 self._delegate = Some(new_value);
49684 self
49685 }
49686
49687 /// Set any additional parameter of the query string used in the request.
49688 /// It should be used to set parameters which are not yet available through their own
49689 /// setters.
49690 ///
49691 /// Please note that this method must not be used to set any of the known parameters
49692 /// which have their own setter method. If done anyway, the request will fail.
49693 ///
49694 /// # Additional Parameters
49695 ///
49696 /// * *$.xgafv* (query-string) - V1 error format.
49697 /// * *access_token* (query-string) - OAuth access token.
49698 /// * *alt* (query-string) - Data format for response.
49699 /// * *callback* (query-string) - JSONP
49700 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
49701 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
49702 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
49703 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
49704 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
49705 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
49706 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
49707 pub fn param<T>(
49708 mut self,
49709 name: T,
49710 value: T,
49711 ) -> ProjectLocationServiceNlpAnalyzeEntityCall<'a, C>
49712 where
49713 T: AsRef<str>,
49714 {
49715 self._additional_params
49716 .insert(name.as_ref().to_string(), value.as_ref().to_string());
49717 self
49718 }
49719
49720 /// Identifies the authorization scope for the method you are building.
49721 ///
49722 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
49723 /// [`Scope::CloudHealthcare`].
49724 ///
49725 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
49726 /// tokens for more than one scope.
49727 ///
49728 /// Usually there is more than one suitable scope to authorize an operation, some of which may
49729 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
49730 /// sufficient, a read-write scope will do as well.
49731 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceNlpAnalyzeEntityCall<'a, C>
49732 where
49733 St: AsRef<str>,
49734 {
49735 self._scopes.insert(String::from(scope.as_ref()));
49736 self
49737 }
49738 /// Identifies the authorization scope(s) for the method you are building.
49739 ///
49740 /// See [`Self::add_scope()`] for details.
49741 pub fn add_scopes<I, St>(
49742 mut self,
49743 scopes: I,
49744 ) -> ProjectLocationServiceNlpAnalyzeEntityCall<'a, C>
49745 where
49746 I: IntoIterator<Item = St>,
49747 St: AsRef<str>,
49748 {
49749 self._scopes
49750 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
49751 self
49752 }
49753
49754 /// Removes all scopes, and no default scope will be used either.
49755 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
49756 /// for details).
49757 pub fn clear_scopes(mut self) -> ProjectLocationServiceNlpAnalyzeEntityCall<'a, C> {
49758 self._scopes.clear();
49759 self
49760 }
49761}
49762
49763/// Gets information about a location.
49764///
49765/// A builder for the *locations.get* method supported by a *project* resource.
49766/// It is not used directly, but through a [`ProjectMethods`] instance.
49767///
49768/// # Example
49769///
49770/// Instantiate a resource method builder
49771///
49772/// ```test_harness,no_run
49773/// # extern crate hyper;
49774/// # extern crate hyper_rustls;
49775/// # extern crate google_healthcare1 as healthcare1;
49776/// # async fn dox() {
49777/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
49778///
49779/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
49780/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
49781/// # secret,
49782/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
49783/// # ).build().await.unwrap();
49784///
49785/// # let client = hyper_util::client::legacy::Client::builder(
49786/// # hyper_util::rt::TokioExecutor::new()
49787/// # )
49788/// # .build(
49789/// # hyper_rustls::HttpsConnectorBuilder::new()
49790/// # .with_native_roots()
49791/// # .unwrap()
49792/// # .https_or_http()
49793/// # .enable_http1()
49794/// # .build()
49795/// # );
49796/// # let mut hub = CloudHealthcare::new(client, auth);
49797/// // You can configure optional parameters by calling the respective setters at will, and
49798/// // execute the final call using `doit()`.
49799/// // Values shown here are possibly random and not representative !
49800/// let result = hub.projects().locations_get("name")
49801/// .doit().await;
49802/// # }
49803/// ```
49804pub struct ProjectLocationGetCall<'a, C>
49805where
49806 C: 'a,
49807{
49808 hub: &'a CloudHealthcare<C>,
49809 _name: String,
49810 _delegate: Option<&'a mut dyn common::Delegate>,
49811 _additional_params: HashMap<String, String>,
49812 _scopes: BTreeSet<String>,
49813}
49814
49815impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
49816
49817impl<'a, C> ProjectLocationGetCall<'a, C>
49818where
49819 C: common::Connector,
49820{
49821 /// Perform the operation you have build so far.
49822 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
49823 use std::borrow::Cow;
49824 use std::io::{Read, Seek};
49825
49826 use common::{url::Params, ToParts};
49827 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
49828
49829 let mut dd = common::DefaultDelegate;
49830 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
49831 dlg.begin(common::MethodInfo {
49832 id: "healthcare.projects.locations.get",
49833 http_method: hyper::Method::GET,
49834 });
49835
49836 for &field in ["alt", "name"].iter() {
49837 if self._additional_params.contains_key(field) {
49838 dlg.finished(false);
49839 return Err(common::Error::FieldClash(field));
49840 }
49841 }
49842
49843 let mut params = Params::with_capacity(3 + self._additional_params.len());
49844 params.push("name", self._name);
49845
49846 params.extend(self._additional_params.iter());
49847
49848 params.push("alt", "json");
49849 let mut url = self.hub._base_url.clone() + "v1/{+name}";
49850 if self._scopes.is_empty() {
49851 self._scopes
49852 .insert(Scope::CloudHealthcare.as_ref().to_string());
49853 }
49854
49855 #[allow(clippy::single_element_loop)]
49856 for &(find_this, param_name) in [("{+name}", "name")].iter() {
49857 url = params.uri_replacement(url, param_name, find_this, true);
49858 }
49859 {
49860 let to_remove = ["name"];
49861 params.remove_params(&to_remove);
49862 }
49863
49864 let url = params.parse_with_url(&url);
49865
49866 loop {
49867 let token = match self
49868 .hub
49869 .auth
49870 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
49871 .await
49872 {
49873 Ok(token) => token,
49874 Err(e) => match dlg.token(e) {
49875 Ok(token) => token,
49876 Err(e) => {
49877 dlg.finished(false);
49878 return Err(common::Error::MissingToken(e));
49879 }
49880 },
49881 };
49882 let mut req_result = {
49883 let client = &self.hub.client;
49884 dlg.pre_request();
49885 let mut req_builder = hyper::Request::builder()
49886 .method(hyper::Method::GET)
49887 .uri(url.as_str())
49888 .header(USER_AGENT, self.hub._user_agent.clone());
49889
49890 if let Some(token) = token.as_ref() {
49891 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
49892 }
49893
49894 let request = req_builder
49895 .header(CONTENT_LENGTH, 0_u64)
49896 .body(common::to_body::<String>(None));
49897
49898 client.request(request.unwrap()).await
49899 };
49900
49901 match req_result {
49902 Err(err) => {
49903 if let common::Retry::After(d) = dlg.http_error(&err) {
49904 sleep(d).await;
49905 continue;
49906 }
49907 dlg.finished(false);
49908 return Err(common::Error::HttpError(err));
49909 }
49910 Ok(res) => {
49911 let (mut parts, body) = res.into_parts();
49912 let mut body = common::Body::new(body);
49913 if !parts.status.is_success() {
49914 let bytes = common::to_bytes(body).await.unwrap_or_default();
49915 let error = serde_json::from_str(&common::to_string(&bytes));
49916 let response = common::to_response(parts, bytes.into());
49917
49918 if let common::Retry::After(d) =
49919 dlg.http_failure(&response, error.as_ref().ok())
49920 {
49921 sleep(d).await;
49922 continue;
49923 }
49924
49925 dlg.finished(false);
49926
49927 return Err(match error {
49928 Ok(value) => common::Error::BadRequest(value),
49929 _ => common::Error::Failure(response),
49930 });
49931 }
49932 let response = {
49933 let bytes = common::to_bytes(body).await.unwrap_or_default();
49934 let encoded = common::to_string(&bytes);
49935 match serde_json::from_str(&encoded) {
49936 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
49937 Err(error) => {
49938 dlg.response_json_decode_error(&encoded, &error);
49939 return Err(common::Error::JsonDecodeError(
49940 encoded.to_string(),
49941 error,
49942 ));
49943 }
49944 }
49945 };
49946
49947 dlg.finished(true);
49948 return Ok(response);
49949 }
49950 }
49951 }
49952 }
49953
49954 /// Resource name for the location.
49955 ///
49956 /// Sets the *name* path property to the given value.
49957 ///
49958 /// Even though the property as already been set when instantiating this call,
49959 /// we provide this method for API completeness.
49960 pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
49961 self._name = new_value.to_string();
49962 self
49963 }
49964 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
49965 /// while executing the actual API request.
49966 ///
49967 /// ````text
49968 /// It should be used to handle progress information, and to implement a certain level of resilience.
49969 /// ````
49970 ///
49971 /// Sets the *delegate* property to the given value.
49972 pub fn delegate(
49973 mut self,
49974 new_value: &'a mut dyn common::Delegate,
49975 ) -> ProjectLocationGetCall<'a, C> {
49976 self._delegate = Some(new_value);
49977 self
49978 }
49979
49980 /// Set any additional parameter of the query string used in the request.
49981 /// It should be used to set parameters which are not yet available through their own
49982 /// setters.
49983 ///
49984 /// Please note that this method must not be used to set any of the known parameters
49985 /// which have their own setter method. If done anyway, the request will fail.
49986 ///
49987 /// # Additional Parameters
49988 ///
49989 /// * *$.xgafv* (query-string) - V1 error format.
49990 /// * *access_token* (query-string) - OAuth access token.
49991 /// * *alt* (query-string) - Data format for response.
49992 /// * *callback* (query-string) - JSONP
49993 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
49994 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
49995 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
49996 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
49997 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
49998 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
49999 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
50000 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
50001 where
50002 T: AsRef<str>,
50003 {
50004 self._additional_params
50005 .insert(name.as_ref().to_string(), value.as_ref().to_string());
50006 self
50007 }
50008
50009 /// Identifies the authorization scope for the method you are building.
50010 ///
50011 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
50012 /// [`Scope::CloudHealthcare`].
50013 ///
50014 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
50015 /// tokens for more than one scope.
50016 ///
50017 /// Usually there is more than one suitable scope to authorize an operation, some of which may
50018 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
50019 /// sufficient, a read-write scope will do as well.
50020 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
50021 where
50022 St: AsRef<str>,
50023 {
50024 self._scopes.insert(String::from(scope.as_ref()));
50025 self
50026 }
50027 /// Identifies the authorization scope(s) for the method you are building.
50028 ///
50029 /// See [`Self::add_scope()`] for details.
50030 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
50031 where
50032 I: IntoIterator<Item = St>,
50033 St: AsRef<str>,
50034 {
50035 self._scopes
50036 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
50037 self
50038 }
50039
50040 /// Removes all scopes, and no default scope will be used either.
50041 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
50042 /// for details).
50043 pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
50044 self._scopes.clear();
50045 self
50046 }
50047}
50048
50049/// Lists information about the supported locations for this service.
50050///
50051/// A builder for the *locations.list* method supported by a *project* resource.
50052/// It is not used directly, but through a [`ProjectMethods`] instance.
50053///
50054/// # Example
50055///
50056/// Instantiate a resource method builder
50057///
50058/// ```test_harness,no_run
50059/// # extern crate hyper;
50060/// # extern crate hyper_rustls;
50061/// # extern crate google_healthcare1 as healthcare1;
50062/// # async fn dox() {
50063/// # use healthcare1::{CloudHealthcare, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
50064///
50065/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
50066/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
50067/// # secret,
50068/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
50069/// # ).build().await.unwrap();
50070///
50071/// # let client = hyper_util::client::legacy::Client::builder(
50072/// # hyper_util::rt::TokioExecutor::new()
50073/// # )
50074/// # .build(
50075/// # hyper_rustls::HttpsConnectorBuilder::new()
50076/// # .with_native_roots()
50077/// # .unwrap()
50078/// # .https_or_http()
50079/// # .enable_http1()
50080/// # .build()
50081/// # );
50082/// # let mut hub = CloudHealthcare::new(client, auth);
50083/// // You can configure optional parameters by calling the respective setters at will, and
50084/// // execute the final call using `doit()`.
50085/// // Values shown here are possibly random and not representative !
50086/// let result = hub.projects().locations_list("name")
50087/// .page_token("Stet")
50088/// .page_size(-82)
50089/// .filter("ut")
50090/// .doit().await;
50091/// # }
50092/// ```
50093pub struct ProjectLocationListCall<'a, C>
50094where
50095 C: 'a,
50096{
50097 hub: &'a CloudHealthcare<C>,
50098 _name: String,
50099 _page_token: Option<String>,
50100 _page_size: Option<i32>,
50101 _filter: Option<String>,
50102 _delegate: Option<&'a mut dyn common::Delegate>,
50103 _additional_params: HashMap<String, String>,
50104 _scopes: BTreeSet<String>,
50105}
50106
50107impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
50108
50109impl<'a, C> ProjectLocationListCall<'a, C>
50110where
50111 C: common::Connector,
50112{
50113 /// Perform the operation you have build so far.
50114 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
50115 use std::borrow::Cow;
50116 use std::io::{Read, Seek};
50117
50118 use common::{url::Params, ToParts};
50119 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
50120
50121 let mut dd = common::DefaultDelegate;
50122 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
50123 dlg.begin(common::MethodInfo {
50124 id: "healthcare.projects.locations.list",
50125 http_method: hyper::Method::GET,
50126 });
50127
50128 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
50129 if self._additional_params.contains_key(field) {
50130 dlg.finished(false);
50131 return Err(common::Error::FieldClash(field));
50132 }
50133 }
50134
50135 let mut params = Params::with_capacity(6 + self._additional_params.len());
50136 params.push("name", self._name);
50137 if let Some(value) = self._page_token.as_ref() {
50138 params.push("pageToken", value);
50139 }
50140 if let Some(value) = self._page_size.as_ref() {
50141 params.push("pageSize", value.to_string());
50142 }
50143 if let Some(value) = self._filter.as_ref() {
50144 params.push("filter", value);
50145 }
50146
50147 params.extend(self._additional_params.iter());
50148
50149 params.push("alt", "json");
50150 let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
50151 if self._scopes.is_empty() {
50152 self._scopes
50153 .insert(Scope::CloudHealthcare.as_ref().to_string());
50154 }
50155
50156 #[allow(clippy::single_element_loop)]
50157 for &(find_this, param_name) in [("{+name}", "name")].iter() {
50158 url = params.uri_replacement(url, param_name, find_this, true);
50159 }
50160 {
50161 let to_remove = ["name"];
50162 params.remove_params(&to_remove);
50163 }
50164
50165 let url = params.parse_with_url(&url);
50166
50167 loop {
50168 let token = match self
50169 .hub
50170 .auth
50171 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
50172 .await
50173 {
50174 Ok(token) => token,
50175 Err(e) => match dlg.token(e) {
50176 Ok(token) => token,
50177 Err(e) => {
50178 dlg.finished(false);
50179 return Err(common::Error::MissingToken(e));
50180 }
50181 },
50182 };
50183 let mut req_result = {
50184 let client = &self.hub.client;
50185 dlg.pre_request();
50186 let mut req_builder = hyper::Request::builder()
50187 .method(hyper::Method::GET)
50188 .uri(url.as_str())
50189 .header(USER_AGENT, self.hub._user_agent.clone());
50190
50191 if let Some(token) = token.as_ref() {
50192 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
50193 }
50194
50195 let request = req_builder
50196 .header(CONTENT_LENGTH, 0_u64)
50197 .body(common::to_body::<String>(None));
50198
50199 client.request(request.unwrap()).await
50200 };
50201
50202 match req_result {
50203 Err(err) => {
50204 if let common::Retry::After(d) = dlg.http_error(&err) {
50205 sleep(d).await;
50206 continue;
50207 }
50208 dlg.finished(false);
50209 return Err(common::Error::HttpError(err));
50210 }
50211 Ok(res) => {
50212 let (mut parts, body) = res.into_parts();
50213 let mut body = common::Body::new(body);
50214 if !parts.status.is_success() {
50215 let bytes = common::to_bytes(body).await.unwrap_or_default();
50216 let error = serde_json::from_str(&common::to_string(&bytes));
50217 let response = common::to_response(parts, bytes.into());
50218
50219 if let common::Retry::After(d) =
50220 dlg.http_failure(&response, error.as_ref().ok())
50221 {
50222 sleep(d).await;
50223 continue;
50224 }
50225
50226 dlg.finished(false);
50227
50228 return Err(match error {
50229 Ok(value) => common::Error::BadRequest(value),
50230 _ => common::Error::Failure(response),
50231 });
50232 }
50233 let response = {
50234 let bytes = common::to_bytes(body).await.unwrap_or_default();
50235 let encoded = common::to_string(&bytes);
50236 match serde_json::from_str(&encoded) {
50237 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
50238 Err(error) => {
50239 dlg.response_json_decode_error(&encoded, &error);
50240 return Err(common::Error::JsonDecodeError(
50241 encoded.to_string(),
50242 error,
50243 ));
50244 }
50245 }
50246 };
50247
50248 dlg.finished(true);
50249 return Ok(response);
50250 }
50251 }
50252 }
50253 }
50254
50255 /// The resource that owns the locations collection, if applicable.
50256 ///
50257 /// Sets the *name* path property to the given value.
50258 ///
50259 /// Even though the property as already been set when instantiating this call,
50260 /// we provide this method for API completeness.
50261 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
50262 self._name = new_value.to_string();
50263 self
50264 }
50265 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
50266 ///
50267 /// Sets the *page token* query property to the given value.
50268 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
50269 self._page_token = Some(new_value.to_string());
50270 self
50271 }
50272 /// The maximum number of results to return. If not set, the service selects a default.
50273 ///
50274 /// Sets the *page size* query property to the given value.
50275 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
50276 self._page_size = Some(new_value);
50277 self
50278 }
50279 /// A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160).
50280 ///
50281 /// Sets the *filter* query property to the given value.
50282 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
50283 self._filter = Some(new_value.to_string());
50284 self
50285 }
50286 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
50287 /// while executing the actual API request.
50288 ///
50289 /// ````text
50290 /// It should be used to handle progress information, and to implement a certain level of resilience.
50291 /// ````
50292 ///
50293 /// Sets the *delegate* property to the given value.
50294 pub fn delegate(
50295 mut self,
50296 new_value: &'a mut dyn common::Delegate,
50297 ) -> ProjectLocationListCall<'a, C> {
50298 self._delegate = Some(new_value);
50299 self
50300 }
50301
50302 /// Set any additional parameter of the query string used in the request.
50303 /// It should be used to set parameters which are not yet available through their own
50304 /// setters.
50305 ///
50306 /// Please note that this method must not be used to set any of the known parameters
50307 /// which have their own setter method. If done anyway, the request will fail.
50308 ///
50309 /// # Additional Parameters
50310 ///
50311 /// * *$.xgafv* (query-string) - V1 error format.
50312 /// * *access_token* (query-string) - OAuth access token.
50313 /// * *alt* (query-string) - Data format for response.
50314 /// * *callback* (query-string) - JSONP
50315 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
50316 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
50317 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
50318 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
50319 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
50320 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
50321 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
50322 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
50323 where
50324 T: AsRef<str>,
50325 {
50326 self._additional_params
50327 .insert(name.as_ref().to_string(), value.as_ref().to_string());
50328 self
50329 }
50330
50331 /// Identifies the authorization scope for the method you are building.
50332 ///
50333 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
50334 /// [`Scope::CloudHealthcare`].
50335 ///
50336 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
50337 /// tokens for more than one scope.
50338 ///
50339 /// Usually there is more than one suitable scope to authorize an operation, some of which may
50340 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
50341 /// sufficient, a read-write scope will do as well.
50342 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
50343 where
50344 St: AsRef<str>,
50345 {
50346 self._scopes.insert(String::from(scope.as_ref()));
50347 self
50348 }
50349 /// Identifies the authorization scope(s) for the method you are building.
50350 ///
50351 /// See [`Self::add_scope()`] for details.
50352 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
50353 where
50354 I: IntoIterator<Item = St>,
50355 St: AsRef<str>,
50356 {
50357 self._scopes
50358 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
50359 self
50360 }
50361
50362 /// Removes all scopes, and no default scope will be used either.
50363 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
50364 /// for details).
50365 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
50366 self._scopes.clear();
50367 self
50368 }
50369}