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\AlertCenter\Resource; 19 20use Google\Service\AlertCenter\Alert; 21use Google\Service\AlertCenter\AlertMetadata; 22use Google\Service\AlertCenter\AlertcenterEmpty; 23use Google\Service\AlertCenter\BatchDeleteAlertsRequest; 24use Google\Service\AlertCenter\BatchDeleteAlertsResponse; 25use Google\Service\AlertCenter\BatchUndeleteAlertsRequest; 26use Google\Service\AlertCenter\BatchUndeleteAlertsResponse; 27use Google\Service\AlertCenter\ListAlertsResponse; 28use Google\Service\AlertCenter\UndeleteAlertRequest; 29 30/** 31 * The "alerts" collection of methods. 32 * Typical usage is: 33 * <code> 34 * $alertcenterService = new Google\Service\AlertCenter(...); 35 * $alerts = $alertcenterService->alerts; 36 * </code> 37 */ 38class Alerts extends \Google\Service\Resource 39{ 40 /** 41 * Performs batch delete operation on alerts. (alerts.batchDelete) 42 * 43 * @param BatchDeleteAlertsRequest $postBody 44 * @param array $optParams Optional parameters. 45 * @return BatchDeleteAlertsResponse 46 */ 47 public function batchDelete(BatchDeleteAlertsRequest $postBody, $optParams = []) 48 { 49 $params = ['postBody' => $postBody]; 50 $params = array_merge($params, $optParams); 51 return $this->call('batchDelete', [$params], BatchDeleteAlertsResponse::class); 52 } 53 /** 54 * Performs batch undelete operation on alerts. (alerts.batchUndelete) 55 * 56 * @param BatchUndeleteAlertsRequest $postBody 57 * @param array $optParams Optional parameters. 58 * @return BatchUndeleteAlertsResponse 59 */ 60 public function batchUndelete(BatchUndeleteAlertsRequest $postBody, $optParams = []) 61 { 62 $params = ['postBody' => $postBody]; 63 $params = array_merge($params, $optParams); 64 return $this->call('batchUndelete', [$params], BatchUndeleteAlertsResponse::class); 65 } 66 /** 67 * Marks the specified alert for deletion. An alert that has been marked for 68 * deletion is removed from Alert Center after 30 days. Marking an alert for 69 * deletion has no effect on an alert which has already been marked for 70 * deletion. Attempting to mark a nonexistent alert for deletion results in a 71 * `NOT_FOUND` error. (alerts.delete) 72 * 73 * @param string $alertId Required. The identifier of the alert to delete. 74 * @param array $optParams Optional parameters. 75 * 76 * @opt_param string customerId Optional. The unique identifier of the Google 77 * Workspace organization account of the customer the alert is associated with. 78 * Inferred from the caller identity if not provided. 79 * @return AlertcenterEmpty 80 */ 81 public function delete($alertId, $optParams = []) 82 { 83 $params = ['alertId' => $alertId]; 84 $params = array_merge($params, $optParams); 85 return $this->call('delete', [$params], AlertcenterEmpty::class); 86 } 87 /** 88 * Gets the specified alert. Attempting to get a nonexistent alert returns 89 * `NOT_FOUND` error. (alerts.get) 90 * 91 * @param string $alertId Required. The identifier of the alert to retrieve. 92 * @param array $optParams Optional parameters. 93 * 94 * @opt_param string customerId Optional. The unique identifier of the Google 95 * Workspace organization account of the customer the alert is associated with. 96 * Inferred from the caller identity if not provided. 97 * @return Alert 98 */ 99 public function get($alertId, $optParams = []) 100 { 101 $params = ['alertId' => $alertId]; 102 $params = array_merge($params, $optParams); 103 return $this->call('get', [$params], Alert::class); 104 } 105 /** 106 * Returns the metadata of an alert. Attempting to get metadata for a non- 107 * existent alert returns `NOT_FOUND` error. (alerts.getMetadata) 108 * 109 * @param string $alertId Required. The identifier of the alert this metadata 110 * belongs to. 111 * @param array $optParams Optional parameters. 112 * 113 * @opt_param string customerId Optional. The unique identifier of the Google 114 * Workspace organization account of the customer the alert metadata is 115 * associated with. Inferred from the caller identity if not provided. 116 * @return AlertMetadata 117 */ 118 public function getMetadata($alertId, $optParams = []) 119 { 120 $params = ['alertId' => $alertId]; 121 $params = array_merge($params, $optParams); 122 return $this->call('getMetadata', [$params], AlertMetadata::class); 123 } 124 /** 125 * Lists the alerts. (alerts.listAlerts) 126 * 127 * @param array $optParams Optional parameters. 128 * 129 * @opt_param string customerId Optional. The unique identifier of the Google 130 * Workspace organization account of the customer the alerts are associated 131 * with. Inferred from the caller identity if not provided. 132 * @opt_param string filter Optional. A query string for filtering alert 133 * results. For more details, see [Query filters](https://developers.google.com 134 * /admin-sdk/alertcenter/guides/query-filters) and [Supported query filter 135 * fields](https://developers.google.com/admin-sdk/alertcenter/reference/filter- 136 * fields#alerts.list). 137 * @opt_param string orderBy Optional. The sort order of the list results. If 138 * not specified results may be returned in arbitrary order. You can sort the 139 * results in descending order based on the creation timestamp using 140 * `order_by="create_time desc"`. Currently, supported sorting are `create_time 141 * asc`, `create_time desc`, `update_time desc` 142 * @opt_param int pageSize Optional. The requested page size. Server may return 143 * fewer items than requested. If unspecified, server picks an appropriate 144 * default. 145 * @opt_param string pageToken Optional. A token identifying a page of results 146 * the server should return. If empty, a new iteration is started. To continue 147 * an iteration, pass in the value from the previous ListAlertsResponse's 148 * next_page_token field. 149 * @return ListAlertsResponse 150 */ 151 public function listAlerts($optParams = []) 152 { 153 $params = []; 154 $params = array_merge($params, $optParams); 155 return $this->call('list', [$params], ListAlertsResponse::class); 156 } 157 /** 158 * Restores, or "undeletes", an alert that was marked for deletion within the 159 * past 30 days. Attempting to undelete an alert which was marked for deletion 160 * over 30 days ago (which has been removed from the Alert Center database) or a 161 * nonexistent alert returns a `NOT_FOUND` error. Attempting to undelete an 162 * alert which has not been marked for deletion has no effect. (alerts.undelete) 163 * 164 * @param string $alertId Required. The identifier of the alert to undelete. 165 * @param UndeleteAlertRequest $postBody 166 * @param array $optParams Optional parameters. 167 * @return Alert 168 */ 169 public function undelete($alertId, UndeleteAlertRequest $postBody, $optParams = []) 170 { 171 $params = ['alertId' => $alertId, 'postBody' => $postBody]; 172 $params = array_merge($params, $optParams); 173 return $this->call('undelete', [$params], Alert::class); 174 } 175} 176 177// Adding a class alias for backwards compatibility with the previous class name. 178class_alias(Alerts::class, 'Google_Service_AlertCenter_Resource_Alerts'); 179