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\PostmasterTools\Resource; 19 20use Google\Service\PostmasterTools\ListTrafficStatsResponse; 21use Google\Service\PostmasterTools\TrafficStats; 22 23/** 24 * The "trafficStats" collection of methods. 25 * Typical usage is: 26 * <code> 27 * $gmailpostmastertoolsService = new Google\Service\PostmasterTools(...); 28 * $trafficStats = $gmailpostmastertoolsService->trafficStats; 29 * </code> 30 */ 31class DomainsTrafficStats extends \Google\Service\Resource 32{ 33 /** 34 * Get traffic statistics for a domain on a specific date. Returns 35 * PERMISSION_DENIED if user does not have permission to access TrafficStats for 36 * the domain. (trafficStats.get) 37 * 38 * @param string $name The resource name of the traffic statistics to get. E.g., 39 * domains/mymail.mydomain.com/trafficStats/20160807. 40 * @param array $optParams Optional parameters. 41 * @return TrafficStats 42 */ 43 public function get($name, $optParams = []) 44 { 45 $params = ['name' => $name]; 46 $params = array_merge($params, $optParams); 47 return $this->call('get', [$params], TrafficStats::class); 48 } 49 /** 50 * List traffic statistics for all available days. Returns PERMISSION_DENIED if 51 * user does not have permission to access TrafficStats for the domain. 52 * (trafficStats.listDomainsTrafficStats) 53 * 54 * @param string $parent The resource name of the domain whose traffic 55 * statistics we'd like to list. It should have the form 56 * `domains/{domain_name}`, where domain_name is the fully qualified domain 57 * name. 58 * @param array $optParams Optional parameters. 59 * 60 * @opt_param int endDate.day Day of a month. Must be from 1 to 31 and valid for 61 * the year and month, or 0 to specify a year by itself or a year and month 62 * where the day isn't significant. 63 * @opt_param int endDate.month Month of a year. Must be from 1 to 12, or 0 to 64 * specify a year without a month and day. 65 * @opt_param int endDate.year Year of the date. Must be from 1 to 9999, or 0 to 66 * specify a date without a year. 67 * @opt_param int pageSize Requested page size. Server may return fewer 68 * TrafficStats than requested. If unspecified, server will pick an appropriate 69 * default. 70 * @opt_param string pageToken The next_page_token value returned from a 71 * previous List request, if any. This is the value of 72 * ListTrafficStatsResponse.next_page_token returned from the previous call to 73 * `ListTrafficStats` method. 74 * @opt_param int startDate.day Day of a month. Must be from 1 to 31 and valid 75 * for the year and month, or 0 to specify a year by itself or a year and month 76 * where the day isn't significant. 77 * @opt_param int startDate.month Month of a year. Must be from 1 to 12, or 0 to 78 * specify a year without a month and day. 79 * @opt_param int startDate.year Year of the date. Must be from 1 to 9999, or 0 80 * to specify a date without a year. 81 * @return ListTrafficStatsResponse 82 */ 83 public function listDomainsTrafficStats($parent, $optParams = []) 84 { 85 $params = ['parent' => $parent]; 86 $params = array_merge($params, $optParams); 87 return $this->call('list', [$params], ListTrafficStatsResponse::class); 88 } 89} 90 91// Adding a class alias for backwards compatibility with the previous class name. 92class_alias(DomainsTrafficStats::class, 'Google_Service_PostmasterTools_Resource_DomainsTrafficStats'); 93