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\CreateMessageRequest;
21use Google\Service\CloudHealthcare\HealthcareEmpty;
22use Google\Service\CloudHealthcare\IngestMessageRequest;
23use Google\Service\CloudHealthcare\IngestMessageResponse;
24use Google\Service\CloudHealthcare\ListMessagesResponse;
25use Google\Service\CloudHealthcare\Message;
26
27/**
28 * The "messages" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $healthcareService = new Google\Service\CloudHealthcare(...);
32 *   $messages = $healthcareService->messages;
33 *  </code>
34 */
35class ProjectsLocationsDatasetsHl7V2StoresMessages extends \Google\Service\Resource
36{
37  /**
38   * Parses and stores an HL7v2 message. This method triggers an asynchronous
39   * notification to any Pub/Sub topic configured in
40   * Hl7V2Store.Hl7V2NotificationConfig, if the filtering matches the message. If
41   * an MLLP adapter is configured to listen to a Pub/Sub topic, the adapter
42   * transmits the message when a notification is received. (messages.create)
43   *
44   * @param string $parent The name of the dataset this message belongs to.
45   * @param CreateMessageRequest $postBody
46   * @param array $optParams Optional parameters.
47   * @return Message
48   */
49  public function create($parent, CreateMessageRequest $postBody, $optParams = [])
50  {
51    $params = ['parent' => $parent, 'postBody' => $postBody];
52    $params = array_merge($params, $optParams);
53    return $this->call('create', [$params], Message::class);
54  }
55  /**
56   * Deletes an HL7v2 message. (messages.delete)
57   *
58   * @param string $name The resource name of the HL7v2 message to delete.
59   * @param array $optParams Optional parameters.
60   * @return HealthcareEmpty
61   */
62  public function delete($name, $optParams = [])
63  {
64    $params = ['name' => $name];
65    $params = array_merge($params, $optParams);
66    return $this->call('delete', [$params], HealthcareEmpty::class);
67  }
68  /**
69   * Gets an HL7v2 message. (messages.get)
70   *
71   * @param string $name The resource name of the HL7v2 message to retrieve.
72   * @param array $optParams Optional parameters.
73   *
74   * @opt_param string view Specifies which parts of the Message resource to
75   * return in the response. When unspecified, equivalent to FULL.
76   * @return Message
77   */
78  public function get($name, $optParams = [])
79  {
80    $params = ['name' => $name];
81    $params = array_merge($params, $optParams);
82    return $this->call('get', [$params], Message::class);
83  }
84  /**
85   * Parses and stores an HL7v2 message. This method triggers an asynchronous
86   * notification to any Pub/Sub topic configured in
87   * Hl7V2Store.Hl7V2NotificationConfig, if the filtering matches the message. If
88   * an MLLP adapter is configured to listen to a Pub/Sub topic, the adapter
89   * transmits the message when a notification is received. If the method is
90   * successful, it generates a response containing an HL7v2 acknowledgment
91   * (`ACK`) message. If the method encounters an error, it returns a negative
92   * acknowledgment (`NACK`) message. This behavior is suitable for replying to
93   * HL7v2 interface systems that expect these acknowledgments. (messages.ingest)
94   *
95   * @param string $parent The name of the HL7v2 store this message belongs to.
96   * @param IngestMessageRequest $postBody
97   * @param array $optParams Optional parameters.
98   * @return IngestMessageResponse
99   */
100  public function ingest($parent, IngestMessageRequest $postBody, $optParams = [])
101  {
102    $params = ['parent' => $parent, 'postBody' => $postBody];
103    $params = array_merge($params, $optParams);
104    return $this->call('ingest', [$params], IngestMessageResponse::class);
105  }
106  /**
107   * Lists all the messages in the given HL7v2 store with support for filtering.
108   * Note: HL7v2 messages are indexed asynchronously, so there might be a slight
109   * delay between the time a message is created and when it can be found through
110   * a filter. (messages.listProjectsLocationsDatasetsHl7V2StoresMessages)
111   *
112   * @param string $parent Name of the HL7v2 store to retrieve messages from.
113   * @param array $optParams Optional parameters.
114   *
115   * @opt_param string filter Restricts messages returned to those matching a
116   * filter. The following syntax is available: * A string field value can be
117   * written as text inside quotation marks, for example `"query text"`. The only
118   * valid relational operation for text fields is equality (`=`), where text is
119   * searched within the field, rather than having the field be equal to the text.
120   * For example, `"Comment = great"` returns messages with `great` in the comment
121   * field. * A number field value can be written as an integer, a decimal, or an
122   * exponential. The valid relational operators for number fields are the
123   * equality operator (`=`), along with the less than/greater than operators
124   * (`<`, `<=`, `>`, `>=`). Note that there is no inequality (`!=`) operator. You
125   * can prepend the `NOT` operator to an expression to negate it. * A date field
126   * value must be written in `yyyy-mm-dd` form. Fields with date and time use the
127   * RFC3339 time format. Leading zeros are required for one-digit months and
128   * days. The valid relational operators for date fields are the equality
129   * operator (`=`) , along with the less than/greater than operators (`<`, `<=`,
130   * `>`, `>=`). Note that there is no inequality (`!=`) operator. You can prepend
131   * the `NOT` operator to an expression to negate it. * Multiple field query
132   * expressions can be combined in one query by adding `AND` or `OR` operators
133   * between the expressions. If a boolean operator appears within a quoted
134   * string, it is not treated as special, it's just another part of the character
135   * string to be matched. You can prepend the `NOT` operator to an expression to
136   * negate it. Fields/functions available for filtering are: * `message_type`,
137   * from the MSH-9.1 field. For example, `NOT message_type = "ADT"`. *
138   * `send_date` or `sendDate`, the YYYY-MM-DD date the message was sent in the
139   * dataset's time_zone, from the MSH-7 segment. For example, `send_date <
140   * "2017-01-02"`. * `send_time`, the timestamp when the message was sent, using
141   * the RFC3339 time format for comparisons, from the MSH-7 segment. For example,
142   * `send_time < "2017-01-02T00:00:00-05:00"`. * `create_time`, the timestamp
143   * when the message was created in the HL7v2 store. Use the RFC3339 time format
144   * for comparisons. For example, `create_time < "2017-01-02T00:00:00-05:00"`. *
145   * `send_facility`, the care center that the message came from, from the MSH-4
146   * segment. For example, `send_facility = "ABC"`. * `PatientId(value, type)`,
147   * which matches if the message lists a patient having an ID of the given value
148   * and type in the PID-2, PID-3, or PID-4 segments. For example,
149   * `PatientId("123456", "MRN")`. * `labels.x`, a string value of the label with
150   * key `x` as set using the Message.labels map. For example,
151   * `labels."priority"="high"`. The operator `:*` can be used to assert the
152   * existence of a label. For example, `labels."priority":*`.
153   * @opt_param string orderBy Orders messages returned by the specified order_by
154   * clause. Syntax:
155   * https://cloud.google.com/apis/design/design_patterns#sorting_order Fields
156   * available for ordering are: * `send_time`
157   * @opt_param int pageSize Limit on the number of messages to return in a single
158   * response. If not specified, 100 is used. May not be larger than 1000.
159   * @opt_param string pageToken The next_page_token value returned from the
160   * previous List request, if any.
161   * @opt_param string view Specifies the parts of the Message to return in the
162   * response. When unspecified, equivalent to BASIC. Setting this to anything
163   * other than BASIC with a `page_size` larger than the default can generate a
164   * large response, which impacts the performance of this method.
165   * @return ListMessagesResponse
166   */
167  public function listProjectsLocationsDatasetsHl7V2StoresMessages($parent, $optParams = [])
168  {
169    $params = ['parent' => $parent];
170    $params = array_merge($params, $optParams);
171    return $this->call('list', [$params], ListMessagesResponse::class);
172  }
173  /**
174   * Update the message. The contents of the message in Message.data and data
175   * extracted from the contents such as Message.create_time cannot be altered.
176   * Only the Message.labels field is allowed to be updated. The labels in the
177   * request are merged with the existing set of labels. Existing labels with the
178   * same keys are updated. (messages.patch)
179   *
180   * @param string $name Resource name of the Message, of the form `projects/{proj
181   * ect_id}/datasets/{dataset_id}/hl7V2Stores/{hl7_v2_store_id}/messages/{message
182   * _id}`. Assigned by the server.
183   * @param Message $postBody
184   * @param array $optParams Optional parameters.
185   *
186   * @opt_param string updateMask The update mask applies to the resource. For the
187   * `FieldMask` definition, see https://developers.google.com/protocol-
188   * buffers/docs/reference/google.protobuf#fieldmask
189   * @return Message
190   */
191  public function patch($name, Message $postBody, $optParams = [])
192  {
193    $params = ['name' => $name, 'postBody' => $postBody];
194    $params = array_merge($params, $optParams);
195    return $this->call('patch', [$params], Message::class);
196  }
197}
198
199// Adding a class alias for backwards compatibility with the previous class name.
200class_alias(ProjectsLocationsDatasetsHl7V2StoresMessages::class, 'Google_Service_CloudHealthcare_Resource_ProjectsLocationsDatasetsHl7V2StoresMessages');
201