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\Storage\Resource; 19 20use Google\Service\Storage\Notification; 21use Google\Service\Storage\Notifications as NotificationsModel; 22 23/** 24 * The "notifications" collection of methods. 25 * Typical usage is: 26 * <code> 27 * $storageService = new Google\Service\Storage(...); 28 * $notifications = $storageService->notifications; 29 * </code> 30 */ 31class Notifications extends \Google\Service\Resource 32{ 33 /** 34 * Permanently deletes a notification subscription. (notifications.delete) 35 * 36 * @param string $bucket The parent bucket of the notification. 37 * @param string $notification ID of the notification to delete. 38 * @param array $optParams Optional parameters. 39 * 40 * @opt_param string userProject The project to be billed for this request. 41 * Required for Requester Pays buckets. 42 */ 43 public function delete($bucket, $notification, $optParams = []) 44 { 45 $params = ['bucket' => $bucket, 'notification' => $notification]; 46 $params = array_merge($params, $optParams); 47 return $this->call('delete', [$params]); 48 } 49 /** 50 * View a notification configuration. (notifications.get) 51 * 52 * @param string $bucket The parent bucket of the notification. 53 * @param string $notification Notification ID 54 * @param array $optParams Optional parameters. 55 * 56 * @opt_param string userProject The project to be billed for this request. 57 * Required for Requester Pays buckets. 58 * @return Notification 59 */ 60 public function get($bucket, $notification, $optParams = []) 61 { 62 $params = ['bucket' => $bucket, 'notification' => $notification]; 63 $params = array_merge($params, $optParams); 64 return $this->call('get', [$params], Notification::class); 65 } 66 /** 67 * Creates a notification subscription for a given bucket. 68 * (notifications.insert) 69 * 70 * @param string $bucket The parent bucket of the notification. 71 * @param Notification $postBody 72 * @param array $optParams Optional parameters. 73 * 74 * @opt_param string userProject The project to be billed for this request. 75 * Required for Requester Pays buckets. 76 * @return Notification 77 */ 78 public function insert($bucket, Notification $postBody, $optParams = []) 79 { 80 $params = ['bucket' => $bucket, 'postBody' => $postBody]; 81 $params = array_merge($params, $optParams); 82 return $this->call('insert', [$params], Notification::class); 83 } 84 /** 85 * Retrieves a list of notification subscriptions for a given bucket. 86 * (notifications.listNotifications) 87 * 88 * @param string $bucket Name of a Google Cloud Storage bucket. 89 * @param array $optParams Optional parameters. 90 * 91 * @opt_param string userProject The project to be billed for this request. 92 * Required for Requester Pays buckets. 93 * @return NotificationsModel 94 */ 95 public function listNotifications($bucket, $optParams = []) 96 { 97 $params = ['bucket' => $bucket]; 98 $params = array_merge($params, $optParams); 99 return $this->call('list', [$params], NotificationsModel::class); 100 } 101} 102 103// Adding a class alias for backwards compatibility with the previous class name. 104class_alias(Notifications::class, 'Google_Service_Storage_Resource_Notifications'); 105