1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\CloudHealthcare\Resource;
19
20use Google\Service\CloudHealthcare\ActivateConsentRequest;
21use Google\Service\CloudHealthcare\Consent;
22use Google\Service\CloudHealthcare\HealthcareEmpty;
23use Google\Service\CloudHealthcare\ListConsentRevisionsResponse;
24use Google\Service\CloudHealthcare\ListConsentsResponse;
25use Google\Service\CloudHealthcare\RejectConsentRequest;
26use Google\Service\CloudHealthcare\RevokeConsentRequest;
27
28/**
29 * The "consents" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $healthcareService = new Google\Service\CloudHealthcare(...);
33 *   $consents = $healthcareService->consents;
34 *  </code>
35 */
36class ProjectsLocationsDatasetsConsentStoresConsents extends \Google\Service\Resource
37{
38  /**
39   * Activates the latest revision of the specified Consent by committing a new
40   * revision with `state` updated to `ACTIVE`. If the latest revision of the
41   * specified Consent is in the `ACTIVE` state, no new revision is committed. A
42   * FAILED_PRECONDITION error occurs if the latest revision of the specified
43   * Consent is in the `REJECTED` or `REVOKED` state. (consents.activate)
44   *
45   * @param string $name Required. The resource name of the Consent to activate,
46   * of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_
47   * id}/consentStores/{consent_store_id}/consents/{consent_id}`. An
48   * INVALID_ARGUMENT error occurs if `revision_id` is specified in the name.
49   * @param ActivateConsentRequest $postBody
50   * @param array $optParams Optional parameters.
51   * @return Consent
52   */
53  public function activate($name, ActivateConsentRequest $postBody, $optParams = [])
54  {
55    $params = ['name' => $name, 'postBody' => $postBody];
56    $params = array_merge($params, $optParams);
57    return $this->call('activate', [$params], Consent::class);
58  }
59  /**
60   * Creates a new Consent in the parent consent store. (consents.create)
61   *
62   * @param string $parent Required. Name of the consent store.
63   * @param Consent $postBody
64   * @param array $optParams Optional parameters.
65   * @return Consent
66   */
67  public function create($parent, Consent $postBody, $optParams = [])
68  {
69    $params = ['parent' => $parent, 'postBody' => $postBody];
70    $params = array_merge($params, $optParams);
71    return $this->call('create', [$params], Consent::class);
72  }
73  /**
74   * Deletes the Consent and its revisions. To keep a record of the Consent but
75   * mark it inactive, see [RevokeConsent]. To delete a revision of a Consent, see
76   * [DeleteConsentRevision]. This operation does not delete the related Consent
77   * artifact. (consents.delete)
78   *
79   * @param string $name Required. The resource name of the Consent to delete, of
80   * the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}
81   * /consentStores/{consent_store_id}/consents/{consent_id}`. An INVALID_ARGUMENT
82   * error occurs if `revision_id` is specified in the name.
83   * @param array $optParams Optional parameters.
84   * @return HealthcareEmpty
85   */
86  public function delete($name, $optParams = [])
87  {
88    $params = ['name' => $name];
89    $params = array_merge($params, $optParams);
90    return $this->call('delete', [$params], HealthcareEmpty::class);
91  }
92  /**
93   * Deletes the specified revision of a Consent. An INVALID_ARGUMENT error occurs
94   * if the specified revision is the latest revision. (consents.deleteRevision)
95   *
96   * @param string $name Required. The resource name of the Consent revision to
97   * delete, of the form `projects/{project_id}/locations/{location_id}/datasets/{
98   * dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}@{revision_
99   * id}`. An INVALID_ARGUMENT error occurs if `revision_id` is not specified in
100   * the name.
101   * @param array $optParams Optional parameters.
102   * @return HealthcareEmpty
103   */
104  public function deleteRevision($name, $optParams = [])
105  {
106    $params = ['name' => $name];
107    $params = array_merge($params, $optParams);
108    return $this->call('deleteRevision', [$params], HealthcareEmpty::class);
109  }
110  /**
111   * Gets the specified revision of a Consent, or the latest revision if
112   * `revision_id` is not specified in the resource name. (consents.get)
113   *
114   * @param string $name Required. The resource name of the Consent to retrieve,
115   * of the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_
116   * id}/consentStores/{consent_store_id}/consents/{consent_id}`. In order to
117   * retrieve a previous revision of the Consent, also provide the revision ID: `p
118   * rojects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentSto
119   * res/{consent_store_id}/consents/{consent_id}@{revision_id}`
120   * @param array $optParams Optional parameters.
121   * @return Consent
122   */
123  public function get($name, $optParams = [])
124  {
125    $params = ['name' => $name];
126    $params = array_merge($params, $optParams);
127    return $this->call('get', [$params], Consent::class);
128  }
129  /**
130   * Lists the Consent in the given consent store, returning each Consent's latest
131   * revision. (consents.listProjectsLocationsDatasetsConsentStoresConsents)
132   *
133   * @param string $parent Required. Name of the consent store to retrieve
134   * Consents from.
135   * @param array $optParams Optional parameters.
136   *
137   * @opt_param string filter Optional. Restricts the Consents returned to those
138   * matching a filter. The following syntax is available: * A string field value
139   * can be written as text inside quotation marks, for example `"query text"`.
140   * The only valid relational operation for text fields is equality (`=`), where
141   * text is searched within the field, rather than having the field be equal to
142   * the text. For example, `"Comment = great"` returns messages with `great` in
143   * the comment field. * A number field value can be written as an integer, a
144   * decimal, or an exponential. The valid relational operators for number fields
145   * are the equality operator (`=`), along with the less than/greater than
146   * operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`)
147   * operator. You can prepend the `NOT` operator to an expression to negate it. *
148   * A date field value must be written in `yyyy-mm-dd` form. Fields with date and
149   * time use the RFC3339 time format. Leading zeros are required for one-digit
150   * months and days. The valid relational operators for date fields are the
151   * equality operator (`=`) , along with the less than/greater than operators
152   * (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You
153   * can prepend the `NOT` operator to an expression to negate it. * Multiple
154   * field query expressions can be combined in one query by adding `AND` or `OR`
155   * operators between the expressions. If a boolean operator appears within a
156   * quoted string, it is not treated as special, it's just another part of the
157   * character string to be matched. You can prepend the `NOT` operator to an
158   * expression to negate it. The fields available for filtering are: - user_id.
159   * For example, `filter='user_id="user123"'`. - consent_artifact - state -
160   * revision_create_time - metadata. For example,
161   * `filter=Metadata(\"testkey\")=\"value\"` or
162   * `filter=HasMetadata(\"testkey\")`.
163   * @opt_param int pageSize Optional. Limit on the number of Consents to return
164   * in a single response. If not specified, 100 is used. May not be larger than
165   * 1000.
166   * @opt_param string pageToken Optional. The next_page_token value returned from
167   * the previous List request, if any.
168   * @return ListConsentsResponse
169   */
170  public function listProjectsLocationsDatasetsConsentStoresConsents($parent, $optParams = [])
171  {
172    $params = ['parent' => $parent];
173    $params = array_merge($params, $optParams);
174    return $this->call('list', [$params], ListConsentsResponse::class);
175  }
176  /**
177   * Lists the revisions of the specified Consent in reverse chronological order.
178   * (consents.listRevisions)
179   *
180   * @param string $name Required. The resource name of the Consent to retrieve
181   * revisions for.
182   * @param array $optParams Optional parameters.
183   *
184   * @opt_param string filter Optional. Restricts the revisions returned to those
185   * matching a filter. The following syntax is available: * A string field value
186   * can be written as text inside quotation marks, for example `"query text"`.
187   * The only valid relational operation for text fields is equality (`=`), where
188   * text is searched within the field, rather than having the field be equal to
189   * the text. For example, `"Comment = great"` returns messages with `great` in
190   * the comment field. * A number field value can be written as an integer, a
191   * decimal, or an exponential. The valid relational operators for number fields
192   * are the equality operator (`=`), along with the less than/greater than
193   * operators (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`)
194   * operator. You can prepend the `NOT` operator to an expression to negate it. *
195   * A date field value must be written in `yyyy-mm-dd` form. Fields with date and
196   * time use the RFC3339 time format. Leading zeros are required for one-digit
197   * months and days. The valid relational operators for date fields are the
198   * equality operator (`=`) , along with the less than/greater than operators
199   * (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You
200   * can prepend the `NOT` operator to an expression to negate it. * Multiple
201   * field query expressions can be combined in one query by adding `AND` or `OR`
202   * operators between the expressions. If a boolean operator appears within a
203   * quoted string, it is not treated as special, it's just another part of the
204   * character string to be matched. You can prepend the `NOT` operator to an
205   * expression to negate it. Fields available for filtering are: - user_id. For
206   * example, `filter='user_id="user123"'`. - consent_artifact - state -
207   * revision_create_time - metadata. For example,
208   * `filter=Metadata(\"testkey\")=\"value\"` or
209   * `filter=HasMetadata(\"testkey\")`.
210   * @opt_param int pageSize Optional. Limit on the number of revisions to return
211   * in a single response. If not specified, 100 is used. May not be larger than
212   * 1000.
213   * @opt_param string pageToken Optional. Token to retrieve the next page of
214   * results or empty if there are no more results in the list.
215   * @return ListConsentRevisionsResponse
216   */
217  public function listRevisions($name, $optParams = [])
218  {
219    $params = ['name' => $name];
220    $params = array_merge($params, $optParams);
221    return $this->call('listRevisions', [$params], ListConsentRevisionsResponse::class);
222  }
223  /**
224   * Updates the latest revision of the specified Consent by committing a new
225   * revision with the changes. A FAILED_PRECONDITION error occurs if the latest
226   * revision of the specified Consent is in the `REJECTED` or `REVOKED` state.
227   * (consents.patch)
228   *
229   * @param string $name Resource name of the Consent, of the form `projects/{proj
230   * ect_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_
231   * store_id}/consents/{consent_id}`. Cannot be changed after creation.
232   * @param Consent $postBody
233   * @param array $optParams Optional parameters.
234   *
235   * @opt_param string updateMask Required. The update mask to apply to the
236   * resource. For the `FieldMask` definition, see https://developers.google.com
237   * /protocol-buffers/docs/reference/google.protobuf#fieldmask. Only the
238   * `user_id`, `policies`, `consent_artifact`, and `metadata` fields can be
239   * updated.
240   * @return Consent
241   */
242  public function patch($name, Consent $postBody, $optParams = [])
243  {
244    $params = ['name' => $name, 'postBody' => $postBody];
245    $params = array_merge($params, $optParams);
246    return $this->call('patch', [$params], Consent::class);
247  }
248  /**
249   * Rejects the latest revision of the specified Consent by committing a new
250   * revision with `state` updated to `REJECTED`. If the latest revision of the
251   * specified Consent is in the `REJECTED` state, no new revision is committed. A
252   * FAILED_PRECONDITION error occurs if the latest revision of the specified
253   * Consent is in the `ACTIVE` or `REVOKED` state. (consents.reject)
254   *
255   * @param string $name Required. The resource name of the Consent to reject, of
256   * the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}
257   * /consentStores/{consent_store_id}/consents/{consent_id}`. An INVALID_ARGUMENT
258   * error occurs if `revision_id` is specified in the name.
259   * @param RejectConsentRequest $postBody
260   * @param array $optParams Optional parameters.
261   * @return Consent
262   */
263  public function reject($name, RejectConsentRequest $postBody, $optParams = [])
264  {
265    $params = ['name' => $name, 'postBody' => $postBody];
266    $params = array_merge($params, $optParams);
267    return $this->call('reject', [$params], Consent::class);
268  }
269  /**
270   * Revokes the latest revision of the specified Consent by committing a new
271   * revision with `state` updated to `REVOKED`. If the latest revision of the
272   * specified Consent is in the `REVOKED` state, no new revision is committed. A
273   * FAILED_PRECONDITION error occurs if the latest revision of the given consent
274   * is in `DRAFT` or `REJECTED` state. (consents.revoke)
275   *
276   * @param string $name Required. The resource name of the Consent to revoke, of
277   * the form `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}
278   * /consentStores/{consent_store_id}/consents/{consent_id}`. An INVALID_ARGUMENT
279   * error occurs if `revision_id` is specified in the name.
280   * @param RevokeConsentRequest $postBody
281   * @param array $optParams Optional parameters.
282   * @return Consent
283   */
284  public function revoke($name, RevokeConsentRequest $postBody, $optParams = [])
285  {
286    $params = ['name' => $name, 'postBody' => $postBody];
287    $params = array_merge($params, $optParams);
288    return $this->call('revoke', [$params], Consent::class);
289  }
290}
291
292// Adding a class alias for backwards compatibility with the previous class name.
293class_alias(ProjectsLocationsDatasetsConsentStoresConsents::class, 'Google_Service_CloudHealthcare_Resource_ProjectsLocationsDatasetsConsentStoresConsents');
294