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\Analytics\Resource; 19 20use Google\Service\Analytics\Goal; 21use Google\Service\Analytics\Goals; 22 23/** 24 * The "goals" collection of methods. 25 * Typical usage is: 26 * <code> 27 * $analyticsService = new Google\Service\Analytics(...); 28 * $goals = $analyticsService->goals; 29 * </code> 30 */ 31class ManagementGoals extends \Google\Service\Resource 32{ 33 /** 34 * Gets a goal to which the user has access. (goals.get) 35 * 36 * @param string $accountId Account ID to retrieve the goal for. 37 * @param string $webPropertyId Web property ID to retrieve the goal for. 38 * @param string $profileId View (Profile) ID to retrieve the goal for. 39 * @param string $goalId Goal ID to retrieve the goal for. 40 * @param array $optParams Optional parameters. 41 * @return Goal 42 */ 43 public function get($accountId, $webPropertyId, $profileId, $goalId, $optParams = []) 44 { 45 $params = ['accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'goalId' => $goalId]; 46 $params = array_merge($params, $optParams); 47 return $this->call('get', [$params], Goal::class); 48 } 49 /** 50 * Create a new goal. (goals.insert) 51 * 52 * @param string $accountId Account ID to create the goal for. 53 * @param string $webPropertyId Web property ID to create the goal for. 54 * @param string $profileId View (Profile) ID to create the goal for. 55 * @param Goal $postBody 56 * @param array $optParams Optional parameters. 57 * @return Goal 58 */ 59 public function insert($accountId, $webPropertyId, $profileId, Goal $postBody, $optParams = []) 60 { 61 $params = ['accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'postBody' => $postBody]; 62 $params = array_merge($params, $optParams); 63 return $this->call('insert', [$params], Goal::class); 64 } 65 /** 66 * Lists goals to which the user has access. (goals.listManagementGoals) 67 * 68 * @param string $accountId Account ID to retrieve goals for. Can either be a 69 * specific account ID or '~all', which refers to all the accounts that user has 70 * access to. 71 * @param string $webPropertyId Web property ID to retrieve goals for. Can 72 * either be a specific web property ID or '~all', which refers to all the web 73 * properties that user has access to. 74 * @param string $profileId View (Profile) ID to retrieve goals for. Can either 75 * be a specific view (profile) ID or '~all', which refers to all the views 76 * (profiles) that user has access to. 77 * @param array $optParams Optional parameters. 78 * 79 * @opt_param int max-results The maximum number of goals to include in this 80 * response. 81 * @opt_param int start-index An index of the first goal to retrieve. Use this 82 * parameter as a pagination mechanism along with the max-results parameter. 83 * @return Goals 84 */ 85 public function listManagementGoals($accountId, $webPropertyId, $profileId, $optParams = []) 86 { 87 $params = ['accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId]; 88 $params = array_merge($params, $optParams); 89 return $this->call('list', [$params], Goals::class); 90 } 91 /** 92 * Updates an existing goal. This method supports patch semantics. (goals.patch) 93 * 94 * @param string $accountId Account ID to update the goal. 95 * @param string $webPropertyId Web property ID to update the goal. 96 * @param string $profileId View (Profile) ID to update the goal. 97 * @param string $goalId Index of the goal to be updated. 98 * @param Goal $postBody 99 * @param array $optParams Optional parameters. 100 * @return Goal 101 */ 102 public function patch($accountId, $webPropertyId, $profileId, $goalId, Goal $postBody, $optParams = []) 103 { 104 $params = ['accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'goalId' => $goalId, 'postBody' => $postBody]; 105 $params = array_merge($params, $optParams); 106 return $this->call('patch', [$params], Goal::class); 107 } 108 /** 109 * Updates an existing goal. (goals.update) 110 * 111 * @param string $accountId Account ID to update the goal. 112 * @param string $webPropertyId Web property ID to update the goal. 113 * @param string $profileId View (Profile) ID to update the goal. 114 * @param string $goalId Index of the goal to be updated. 115 * @param Goal $postBody 116 * @param array $optParams Optional parameters. 117 * @return Goal 118 */ 119 public function update($accountId, $webPropertyId, $profileId, $goalId, Goal $postBody, $optParams = []) 120 { 121 $params = ['accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'goalId' => $goalId, 'postBody' => $postBody]; 122 $params = array_merge($params, $optParams); 123 return $this->call('update', [$params], Goal::class); 124 } 125} 126 127// Adding a class alias for backwards compatibility with the previous class name. 128class_alias(ManagementGoals::class, 'Google_Service_Analytics_Resource_ManagementGoals'); 129