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;
19
20use Google\Client;
21
22/**
23 * Service definition for PostmasterTools (v1).
24 *
25 * <p>
26 * The Postmaster Tools API is a RESTful API that provides programmatic access
27 * to email traffic metrics (like spam reports, delivery errors etc) otherwise
28 * available through the Gmail Postmaster Tools UI currently.</p>
29 *
30 * <p>
31 * For more information about this service, see the API
32 * <a href="https://developers.google.com/gmail/postmaster" target="_blank">Documentation</a>
33 * </p>
34 *
35 * @author Google, Inc.
36 */
37class PostmasterTools extends \Google\Service
38{
39  /** See email traffic metrics for the domains you have registered in Gmail Postmaster Tools. */
40  const POSTMASTER_READONLY =
41      "https://www.googleapis.com/auth/postmaster.readonly";
42
43  public $domains;
44  public $domains_trafficStats;
45
46  /**
47   * Constructs the internal representation of the PostmasterTools service.
48   *
49   * @param Client|array $clientOrConfig The client used to deliver requests, or a
50   *                                     config array to pass to a new Client instance.
51   * @param string $rootUrl The root URL used for requests to the service.
52   */
53  public function __construct($clientOrConfig = [], $rootUrl = null)
54  {
55    parent::__construct($clientOrConfig);
56    $this->rootUrl = $rootUrl ?: 'https://gmailpostmastertools.googleapis.com/';
57    $this->servicePath = '';
58    $this->batchPath = 'batch';
59    $this->version = 'v1';
60    $this->serviceName = 'gmailpostmastertools';
61
62    $this->domains = new PostmasterTools\Resource\Domains(
63        $this,
64        $this->serviceName,
65        'domains',
66        [
67          'methods' => [
68            'get' => [
69              'path' => 'v1/{+name}',
70              'httpMethod' => 'GET',
71              'parameters' => [
72                'name' => [
73                  'location' => 'path',
74                  'type' => 'string',
75                  'required' => true,
76                ],
77              ],
78            ],'list' => [
79              'path' => 'v1/domains',
80              'httpMethod' => 'GET',
81              'parameters' => [
82                'pageSize' => [
83                  'location' => 'query',
84                  'type' => 'integer',
85                ],
86                'pageToken' => [
87                  'location' => 'query',
88                  'type' => 'string',
89                ],
90              ],
91            ],
92          ]
93        ]
94    );
95    $this->domains_trafficStats = new PostmasterTools\Resource\DomainsTrafficStats(
96        $this,
97        $this->serviceName,
98        'trafficStats',
99        [
100          'methods' => [
101            'get' => [
102              'path' => 'v1/{+name}',
103              'httpMethod' => 'GET',
104              'parameters' => [
105                'name' => [
106                  'location' => 'path',
107                  'type' => 'string',
108                  'required' => true,
109                ],
110              ],
111            ],'list' => [
112              'path' => 'v1/{+parent}/trafficStats',
113              'httpMethod' => 'GET',
114              'parameters' => [
115                'parent' => [
116                  'location' => 'path',
117                  'type' => 'string',
118                  'required' => true,
119                ],
120                'endDate.day' => [
121                  'location' => 'query',
122                  'type' => 'integer',
123                ],
124                'endDate.month' => [
125                  'location' => 'query',
126                  'type' => 'integer',
127                ],
128                'endDate.year' => [
129                  'location' => 'query',
130                  'type' => 'integer',
131                ],
132                'pageSize' => [
133                  'location' => 'query',
134                  'type' => 'integer',
135                ],
136                'pageToken' => [
137                  'location' => 'query',
138                  'type' => 'string',
139                ],
140                'startDate.day' => [
141                  'location' => 'query',
142                  'type' => 'integer',
143                ],
144                'startDate.month' => [
145                  'location' => 'query',
146                  'type' => 'integer',
147                ],
148                'startDate.year' => [
149                  'location' => 'query',
150                  'type' => 'integer',
151                ],
152              ],
153            ],
154          ]
155        ]
156    );
157  }
158}
159
160// Adding a class alias for backwards compatibility with the previous class name.
161class_alias(PostmasterTools::class, 'Google_Service_PostmasterTools');
162