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\Essentialcontacts\Resource;
19
20use Google\Service\Essentialcontacts\GoogleCloudEssentialcontactsV1ComputeContactsResponse;
21use Google\Service\Essentialcontacts\GoogleCloudEssentialcontactsV1Contact;
22use Google\Service\Essentialcontacts\GoogleCloudEssentialcontactsV1ListContactsResponse;
23use Google\Service\Essentialcontacts\GoogleCloudEssentialcontactsV1SendTestMessageRequest;
24use Google\Service\Essentialcontacts\GoogleProtobufEmpty;
25
26/**
27 * The "contacts" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $essentialcontactsService = new Google\Service\Essentialcontacts(...);
31 *   $contacts = $essentialcontactsService->contacts;
32 *  </code>
33 */
34class FoldersContacts extends \Google\Service\Resource
35{
36  /**
37   * Lists all contacts for the resource that are subscribed to the specified
38   * notification categories, including contacts inherited from any parent
39   * resources. (contacts.compute)
40   *
41   * @param string $parent Required. The name of the resource to compute contacts
42   * for. Format: organizations/{organization_id}, folders/{folder_id} or
43   * projects/{project_id}
44   * @param array $optParams Optional parameters.
45   *
46   * @opt_param string notificationCategories The categories of notifications to
47   * compute contacts for. If ALL is included in this list, contacts subscribed to
48   * any notification category will be returned.
49   * @opt_param int pageSize Optional. The maximum number of results to return
50   * from this request. Non-positive values are ignored. The presence of
51   * `next_page_token` in the response indicates that more results might be
52   * available. If not specified, the default page_size is 100.
53   * @opt_param string pageToken Optional. If present, retrieves the next batch of
54   * results from the preceding call to this method. `page_token` must be the
55   * value of `next_page_token` from the previous response. The values of other
56   * method parameters should be identical to those in the previous call.
57   * @return GoogleCloudEssentialcontactsV1ComputeContactsResponse
58   */
59  public function compute($parent, $optParams = [])
60  {
61    $params = ['parent' => $parent];
62    $params = array_merge($params, $optParams);
63    return $this->call('compute', [$params], GoogleCloudEssentialcontactsV1ComputeContactsResponse::class);
64  }
65  /**
66   * Adds a new contact for a resource. (contacts.create)
67   *
68   * @param string $parent Required. The resource to save this contact for.
69   * Format: organizations/{organization_id}, folders/{folder_id} or
70   * projects/{project_id}
71   * @param GoogleCloudEssentialcontactsV1Contact $postBody
72   * @param array $optParams Optional parameters.
73   * @return GoogleCloudEssentialcontactsV1Contact
74   */
75  public function create($parent, GoogleCloudEssentialcontactsV1Contact $postBody, $optParams = [])
76  {
77    $params = ['parent' => $parent, 'postBody' => $postBody];
78    $params = array_merge($params, $optParams);
79    return $this->call('create', [$params], GoogleCloudEssentialcontactsV1Contact::class);
80  }
81  /**
82   * Deletes a contact. (contacts.delete)
83   *
84   * @param string $name Required. The name of the contact to delete. Format:
85   * organizations/{organization_id}/contacts/{contact_id},
86   * folders/{folder_id}/contacts/{contact_id} or
87   * projects/{project_id}/contacts/{contact_id}
88   * @param array $optParams Optional parameters.
89   * @return GoogleProtobufEmpty
90   */
91  public function delete($name, $optParams = [])
92  {
93    $params = ['name' => $name];
94    $params = array_merge($params, $optParams);
95    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
96  }
97  /**
98   * Gets a single contact. (contacts.get)
99   *
100   * @param string $name Required. The name of the contact to retrieve. Format:
101   * organizations/{organization_id}/contacts/{contact_id},
102   * folders/{folder_id}/contacts/{contact_id} or
103   * projects/{project_id}/contacts/{contact_id}
104   * @param array $optParams Optional parameters.
105   * @return GoogleCloudEssentialcontactsV1Contact
106   */
107  public function get($name, $optParams = [])
108  {
109    $params = ['name' => $name];
110    $params = array_merge($params, $optParams);
111    return $this->call('get', [$params], GoogleCloudEssentialcontactsV1Contact::class);
112  }
113  /**
114   * Lists the contacts that have been set on a resource.
115   * (contacts.listFoldersContacts)
116   *
117   * @param string $parent Required. The parent resource name. Format:
118   * organizations/{organization_id}, folders/{folder_id} or projects/{project_id}
119   * @param array $optParams Optional parameters.
120   *
121   * @opt_param int pageSize Optional. The maximum number of results to return
122   * from this request. Non-positive values are ignored. The presence of
123   * `next_page_token` in the response indicates that more results might be
124   * available. If not specified, the default page_size is 100.
125   * @opt_param string pageToken Optional. If present, retrieves the next batch of
126   * results from the preceding call to this method. `page_token` must be the
127   * value of `next_page_token` from the previous response. The values of other
128   * method parameters should be identical to those in the previous call.
129   * @return GoogleCloudEssentialcontactsV1ListContactsResponse
130   */
131  public function listFoldersContacts($parent, $optParams = [])
132  {
133    $params = ['parent' => $parent];
134    $params = array_merge($params, $optParams);
135    return $this->call('list', [$params], GoogleCloudEssentialcontactsV1ListContactsResponse::class);
136  }
137  /**
138   * Updates a contact. Note: A contact's email address cannot be changed.
139   * (contacts.patch)
140   *
141   * @param string $name The identifier for the contact. Format:
142   * {resource_type}/{resource_id}/contacts/{contact_id}
143   * @param GoogleCloudEssentialcontactsV1Contact $postBody
144   * @param array $optParams Optional parameters.
145   *
146   * @opt_param string updateMask Optional. The update mask applied to the
147   * resource. For the `FieldMask` definition, see https://developers.google.com
148   * /protocol-buffers/docs/reference/google.protobuf#fieldmask
149   * @return GoogleCloudEssentialcontactsV1Contact
150   */
151  public function patch($name, GoogleCloudEssentialcontactsV1Contact $postBody, $optParams = [])
152  {
153    $params = ['name' => $name, 'postBody' => $postBody];
154    $params = array_merge($params, $optParams);
155    return $this->call('patch', [$params], GoogleCloudEssentialcontactsV1Contact::class);
156  }
157  /**
158   * Allows a contact admin to send a test message to contact to verify that it
159   * has been configured correctly. (contacts.sendTestMessage)
160   *
161   * @param string $resource Required. The name of the resource to send the test
162   * message for. All contacts must either be set directly on this resource or
163   * inherited from another resource that is an ancestor of this one. Format:
164   * organizations/{organization_id}, folders/{folder_id} or projects/{project_id}
165   * @param GoogleCloudEssentialcontactsV1SendTestMessageRequest $postBody
166   * @param array $optParams Optional parameters.
167   * @return GoogleProtobufEmpty
168   */
169  public function sendTestMessage($resource, GoogleCloudEssentialcontactsV1SendTestMessageRequest $postBody, $optParams = [])
170  {
171    $params = ['resource' => $resource, 'postBody' => $postBody];
172    $params = array_merge($params, $optParams);
173    return $this->call('sendTestMessage', [$params], GoogleProtobufEmpty::class);
174  }
175}
176
177// Adding a class alias for backwards compatibility with the previous class name.
178class_alias(FoldersContacts::class, 'Google_Service_Essentialcontacts_Resource_FoldersContacts');
179