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\Directory\Resource; 19 20use Google\Service\Directory\Alias; 21use Google\Service\Directory\Aliases; 22use Google\Service\Directory\Channel; 23 24/** 25 * The "aliases" collection of methods. 26 * Typical usage is: 27 * <code> 28 * $adminService = new Google\Service\Directory(...); 29 * $aliases = $adminService->aliases; 30 * </code> 31 */ 32class UsersAliases extends \Google\Service\Resource 33{ 34 /** 35 * Removes an alias. (aliases.delete) 36 * 37 * @param string $userKey Identifies the user in the API request. The value can 38 * be the user's primary email address, alias email address, or unique user ID. 39 * @param string $alias The alias to be removed. 40 * @param array $optParams Optional parameters. 41 */ 42 public function delete($userKey, $alias, $optParams = []) 43 { 44 $params = ['userKey' => $userKey, 'alias' => $alias]; 45 $params = array_merge($params, $optParams); 46 return $this->call('delete', [$params]); 47 } 48 /** 49 * Adds an alias. (aliases.insert) 50 * 51 * @param string $userKey Identifies the user in the API request. The value can 52 * be the user's primary email address, alias email address, or unique user ID. 53 * @param Alias $postBody 54 * @param array $optParams Optional parameters. 55 * @return Alias 56 */ 57 public function insert($userKey, Alias $postBody, $optParams = []) 58 { 59 $params = ['userKey' => $userKey, 'postBody' => $postBody]; 60 $params = array_merge($params, $optParams); 61 return $this->call('insert', [$params], Alias::class); 62 } 63 /** 64 * Lists all aliases for a user. (aliases.listUsersAliases) 65 * 66 * @param string $userKey Identifies the user in the API request. The value can 67 * be the user's primary email address, alias email address, or unique user ID. 68 * @param array $optParams Optional parameters. 69 * 70 * @opt_param string event Events to watch for. 71 * @return Aliases 72 */ 73 public function listUsersAliases($userKey, $optParams = []) 74 { 75 $params = ['userKey' => $userKey]; 76 $params = array_merge($params, $optParams); 77 return $this->call('list', [$params], Aliases::class); 78 } 79 /** 80 * Watches for changes in users list. (aliases.watch) 81 * 82 * @param string $userKey Email or immutable ID of the user 83 * @param Channel $postBody 84 * @param array $optParams Optional parameters. 85 * 86 * @opt_param string event Events to watch for. 87 * @return Channel 88 */ 89 public function watch($userKey, Channel $postBody, $optParams = []) 90 { 91 $params = ['userKey' => $userKey, 'postBody' => $postBody]; 92 $params = array_merge($params, $optParams); 93 return $this->call('watch', [$params], Channel::class); 94 } 95} 96 97// Adding a class alias for backwards compatibility with the previous class name. 98class_alias(UsersAliases::class, 'Google_Service_Directory_Resource_UsersAliases'); 99