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\Dfareporting\Resource; 19 20use Google\Service\Dfareporting\Subaccount; 21use Google\Service\Dfareporting\SubaccountsListResponse; 22 23/** 24 * The "subaccounts" collection of methods. 25 * Typical usage is: 26 * <code> 27 * $dfareportingService = new Google\Service\Dfareporting(...); 28 * $subaccounts = $dfareportingService->subaccounts; 29 * </code> 30 */ 31class Subaccounts extends \Google\Service\Resource 32{ 33 /** 34 * Gets one subaccount by ID. (subaccounts.get) 35 * 36 * @param string $profileId User profile ID associated with this request. 37 * @param string $id Subaccount ID. 38 * @param array $optParams Optional parameters. 39 * @return Subaccount 40 */ 41 public function get($profileId, $id, $optParams = []) 42 { 43 $params = ['profileId' => $profileId, 'id' => $id]; 44 $params = array_merge($params, $optParams); 45 return $this->call('get', [$params], Subaccount::class); 46 } 47 /** 48 * Inserts a new subaccount. (subaccounts.insert) 49 * 50 * @param string $profileId User profile ID associated with this request. 51 * @param Subaccount $postBody 52 * @param array $optParams Optional parameters. 53 * @return Subaccount 54 */ 55 public function insert($profileId, Subaccount $postBody, $optParams = []) 56 { 57 $params = ['profileId' => $profileId, 'postBody' => $postBody]; 58 $params = array_merge($params, $optParams); 59 return $this->call('insert', [$params], Subaccount::class); 60 } 61 /** 62 * Gets a list of subaccounts, possibly filtered. This method supports paging. 63 * (subaccounts.listSubaccounts) 64 * 65 * @param string $profileId User profile ID associated with this request. 66 * @param array $optParams Optional parameters. 67 * 68 * @opt_param string ids Select only subaccounts with these IDs. 69 * @opt_param int maxResults Maximum number of results to return. 70 * @opt_param string pageToken Value of the nextPageToken from the previous 71 * result page. 72 * @opt_param string searchString Allows searching for objects by name or ID. 73 * Wildcards (*) are allowed. For example, "subaccount*2015" will return objects 74 * with names like "subaccount June 2015", "subaccount April 2015", or simply 75 * "subaccount 2015". Most of the searches also add wildcards implicitly at the 76 * start and the end of the search string. For example, a search string of 77 * "subaccount" will match objects with name "my subaccount", "subaccount 2015", 78 * or simply "subaccount" . 79 * @opt_param string sortField Field by which to sort the list. 80 * @opt_param string sortOrder Order of sorted results. 81 * @return SubaccountsListResponse 82 */ 83 public function listSubaccounts($profileId, $optParams = []) 84 { 85 $params = ['profileId' => $profileId]; 86 $params = array_merge($params, $optParams); 87 return $this->call('list', [$params], SubaccountsListResponse::class); 88 } 89 /** 90 * Updates an existing subaccount. This method supports patch semantics. 91 * (subaccounts.patch) 92 * 93 * @param string $profileId User profile ID associated with this request. 94 * @param string $id Subaccount ID. 95 * @param Subaccount $postBody 96 * @param array $optParams Optional parameters. 97 * @return Subaccount 98 */ 99 public function patch($profileId, $id, Subaccount $postBody, $optParams = []) 100 { 101 $params = ['profileId' => $profileId, 'id' => $id, 'postBody' => $postBody]; 102 $params = array_merge($params, $optParams); 103 return $this->call('patch', [$params], Subaccount::class); 104 } 105 /** 106 * Updates an existing subaccount. (subaccounts.update) 107 * 108 * @param string $profileId User profile ID associated with this request. 109 * @param Subaccount $postBody 110 * @param array $optParams Optional parameters. 111 * @return Subaccount 112 */ 113 public function update($profileId, Subaccount $postBody, $optParams = []) 114 { 115 $params = ['profileId' => $profileId, 'postBody' => $postBody]; 116 $params = array_merge($params, $optParams); 117 return $this->call('update', [$params], Subaccount::class); 118 } 119} 120 121// Adding a class alias for backwards compatibility with the previous class name. 122class_alias(Subaccounts::class, 'Google_Service_Dfareporting_Resource_Subaccounts'); 123