Skip to content

Commit ba60428

Browse files
1 parent 2f6b2ea commit ba60428

28 files changed

Lines changed: 2134 additions & 86 deletions

src/PostmasterTools.php

Lines changed: 44 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Google\Client;
2121

2222
/**
23-
* Service definition for PostmasterTools (v1).
23+
* Service definition for PostmasterTools (v2).
2424
*
2525
* <p>
2626
* The Postmaster Tools API is a RESTful API that provides programmatic access
@@ -36,12 +36,19 @@
3636
*/
3737
class PostmasterTools extends \Google\Service
3838
{
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";
39+
/** Get email traffic metrics, manage domains, and manage domain users for the domains you have registered with Postmaster Tools. */
40+
const POSTMASTER =
41+
"https://www.googleapis.com/auth/postmaster";
42+
/** View and manage the domains you have registered with Postmaster Tools. */
43+
const POSTMASTER_DOMAIN =
44+
"https://www.googleapis.com/auth/postmaster.domain";
45+
/** Get email traffic metrics for the domains you have registered with Postmaster Tools. */
46+
const POSTMASTER_TRAFFIC_READONLY =
47+
"https://www.googleapis.com/auth/postmaster.traffic.readonly";
4248

49+
public $domainStats;
4350
public $domains;
44-
public $domains_trafficStats;
51+
public $domains_domainStats;
4552
public $rootUrlTemplate;
4653

4754
/**
@@ -58,17 +65,41 @@ public function __construct($clientOrConfig = [], $rootUrl = null)
5865
$this->rootUrlTemplate = $rootUrl ?: 'https://gmailpostmastertools.UNIVERSE_DOMAIN/';
5966
$this->servicePath = '';
6067
$this->batchPath = 'batch';
61-
$this->version = 'v1';
68+
$this->version = 'v2';
6269
$this->serviceName = 'gmailpostmastertools';
6370

71+
$this->domainStats = new PostmasterTools\Resource\DomainStats(
72+
$this,
73+
$this->serviceName,
74+
'domainStats',
75+
[
76+
'methods' => [
77+
'batchQuery' => [
78+
'path' => 'v2/domainStats:batchQuery',
79+
'httpMethod' => 'POST',
80+
'parameters' => [],
81+
],
82+
]
83+
]
84+
);
6485
$this->domains = new PostmasterTools\Resource\Domains(
6586
$this,
6687
$this->serviceName,
6788
'domains',
6889
[
6990
'methods' => [
7091
'get' => [
71-
'path' => 'v1/{+name}',
92+
'path' => 'v2/{+name}',
93+
'httpMethod' => 'GET',
94+
'parameters' => [
95+
'name' => [
96+
'location' => 'path',
97+
'type' => 'string',
98+
'required' => true,
99+
],
100+
],
101+
],'getComplianceStatus' => [
102+
'path' => 'v2/{+name}',
72103
'httpMethod' => 'GET',
73104
'parameters' => [
74105
'name' => [
@@ -78,7 +109,7 @@ public function __construct($clientOrConfig = [], $rootUrl = null)
78109
],
79110
],
80111
],'list' => [
81-
'path' => 'v1/domains',
112+
'path' => 'v2/domains',
82113
'httpMethod' => 'GET',
83114
'parameters' => [
84115
'pageSize' => [
@@ -94,63 +125,21 @@ public function __construct($clientOrConfig = [], $rootUrl = null)
94125
]
95126
]
96127
);
97-
$this->domains_trafficStats = new PostmasterTools\Resource\DomainsTrafficStats(
128+
$this->domains_domainStats = new PostmasterTools\Resource\DomainsDomainStats(
98129
$this,
99130
$this->serviceName,
100-
'trafficStats',
131+
'domainStats',
101132
[
102133
'methods' => [
103-
'get' => [
104-
'path' => 'v1/{+name}',
105-
'httpMethod' => 'GET',
106-
'parameters' => [
107-
'name' => [
108-
'location' => 'path',
109-
'type' => 'string',
110-
'required' => true,
111-
],
112-
],
113-
],'list' => [
114-
'path' => 'v1/{+parent}/trafficStats',
115-
'httpMethod' => 'GET',
134+
'query' => [
135+
'path' => 'v2/{+parent}/domainStats:query',
136+
'httpMethod' => 'POST',
116137
'parameters' => [
117138
'parent' => [
118139
'location' => 'path',
119140
'type' => 'string',
120141
'required' => true,
121142
],
122-
'endDate.day' => [
123-
'location' => 'query',
124-
'type' => 'integer',
125-
],
126-
'endDate.month' => [
127-
'location' => 'query',
128-
'type' => 'integer',
129-
],
130-
'endDate.year' => [
131-
'location' => 'query',
132-
'type' => 'integer',
133-
],
134-
'pageSize' => [
135-
'location' => 'query',
136-
'type' => 'integer',
137-
],
138-
'pageToken' => [
139-
'location' => 'query',
140-
'type' => 'string',
141-
],
142-
'startDate.day' => [
143-
'location' => 'query',
144-
'type' => 'integer',
145-
],
146-
'startDate.month' => [
147-
'location' => 'query',
148-
'type' => 'integer',
149-
],
150-
'startDate.year' => [
151-
'location' => 'query',
152-
'type' => 'integer',
153-
],
154143
],
155144
],
156145
]

src/PostmasterTools/BaseMetric.php

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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+
18+
namespace Google\Service\PostmasterTools;
19+
20+
class BaseMetric extends \Google\Model
21+
{
22+
/**
23+
* Unspecified standard metric. This value should not be used directly.
24+
*/
25+
public const STANDARD_METRIC_STANDARD_METRIC_UNSPECIFIED = 'STANDARD_METRIC_UNSPECIFIED';
26+
/**
27+
* Predefined metric for Feedback Loop (FBL) id.
28+
*/
29+
public const STANDARD_METRIC_FEEDBACK_LOOP_ID = 'FEEDBACK_LOOP_ID';
30+
/**
31+
* Predefined metric for Feedback Loop (FBL) spam rate. Filter must be of type
32+
* feedback_loop_id = "" where is one valid feedback loop ids.
33+
*/
34+
public const STANDARD_METRIC_FEEDBACK_LOOP_SPAM_RATE = 'FEEDBACK_LOOP_SPAM_RATE';
35+
/**
36+
* Predefined metric for spam rate.
37+
*/
38+
public const STANDARD_METRIC_SPAM_RATE = 'SPAM_RATE';
39+
/**
40+
* The success rate of authentication mechanisms (DKIM, SPF, DMARC). Filter
41+
* must be of type auth_type = "" where is one of: [spf, dkim, dmarc]
42+
*/
43+
public const STANDARD_METRIC_AUTH_SUCCESS_RATE = 'AUTH_SUCCESS_RATE';
44+
/**
45+
* The rate of messages that were TLS encrypted in transit Filter must be of
46+
* type traffic_direction = "" where is one of: [inbound, outbound]
47+
*/
48+
public const STANDARD_METRIC_TLS_ENCRYPTION_MESSAGE_COUNT = 'TLS_ENCRYPTION_MESSAGE_COUNT';
49+
/**
50+
* The rate of messages that were TLS encrypted in transit Filter must be of
51+
* type traffic_direction = "" where is one of: [inbound, outbound]
52+
*/
53+
public const STANDARD_METRIC_TLS_ENCRYPTION_RATE = 'TLS_ENCRYPTION_RATE';
54+
/**
55+
* The total count of delivery errors encountered (temporary or permanent
56+
* rejects). The `filter` field supports a limited syntax. Supported formats
57+
* are: * Empty: No filter is applied. * `error_type` = "" * `error_type` = ""
58+
* AND `error_reason` = "" If an empty filter is provided, the metric will be
59+
* aggregated across all error types and reasons. If only `error_type` is
60+
* specified, the metric will be aggregated across all reasons for that type.
61+
* Supported values: * reject * temp_fail Supported values depend on the : *
62+
* For 'reject': [bad_attachment, bad_or_missing_ptr_record, ip_in_rbls,
63+
* low_domain_reputation, low_ip_reputation, spammy_content,
64+
* stamp_policy_error, other] * For 'temp_fail': [anomalous_traffic_pattern,
65+
* other]
66+
*/
67+
public const STANDARD_METRIC_DELIVERY_ERROR_COUNT = 'DELIVERY_ERROR_COUNT';
68+
/**
69+
* Delivery error rate for the specified delivery error type. The `filter`
70+
* field supports a limited syntax. Supported formats are: * Empty: No filter
71+
* is applied. * `error_type` = "" * `error_type` = "" AND `error_reason` = ""
72+
* If an empty filter is provided, the metric will be aggregated across all
73+
* error types and reasons. If only `error_type` is specified, the metric will
74+
* be aggregated across all reasons for that type. Supported values: * reject
75+
* * temp_fail Supported values depend on the : * For 'reject':
76+
* [bad_attachment, bad_or_missing_ptr_record, ip_in_rbls,
77+
* low_domain_reputation, low_ip_reputation, spammy_content,
78+
* stamp_policy_error, other] * For 'temp_fail': [anomalous_traffic_pattern,
79+
* other]
80+
*/
81+
public const STANDARD_METRIC_DELIVERY_ERROR_RATE = 'DELIVERY_ERROR_RATE';
82+
/**
83+
* A predefined standard metric.
84+
*
85+
* @var string
86+
*/
87+
public $standardMetric;
88+
89+
/**
90+
* A predefined standard metric.
91+
*
92+
* Accepted values: STANDARD_METRIC_UNSPECIFIED, FEEDBACK_LOOP_ID,
93+
* FEEDBACK_LOOP_SPAM_RATE, SPAM_RATE, AUTH_SUCCESS_RATE,
94+
* TLS_ENCRYPTION_MESSAGE_COUNT, TLS_ENCRYPTION_RATE, DELIVERY_ERROR_COUNT,
95+
* DELIVERY_ERROR_RATE
96+
*
97+
* @param self::STANDARD_METRIC_* $standardMetric
98+
*/
99+
public function setStandardMetric($standardMetric)
100+
{
101+
$this->standardMetric = $standardMetric;
102+
}
103+
/**
104+
* @return self::STANDARD_METRIC_*
105+
*/
106+
public function getStandardMetric()
107+
{
108+
return $this->standardMetric;
109+
}
110+
}
111+
112+
// Adding a class alias for backwards compatibility with the previous class name.
113+
class_alias(BaseMetric::class, 'Google_Service_PostmasterTools_BaseMetric');
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
18+
namespace Google\Service\PostmasterTools;
19+
20+
class BatchQueryDomainStatsRequest extends \Google\Collection
21+
{
22+
protected $collection_key = 'requests';
23+
protected $requestsType = QueryDomainStatsRequest::class;
24+
protected $requestsDataType = 'array';
25+
26+
/**
27+
* Required. A list of individual query requests. Each request can be for a
28+
* different domain. A maximum of 100 requests can be included in a single
29+
* batch.
30+
*
31+
* @param QueryDomainStatsRequest[] $requests
32+
*/
33+
public function setRequests($requests)
34+
{
35+
$this->requests = $requests;
36+
}
37+
/**
38+
* @return QueryDomainStatsRequest[]
39+
*/
40+
public function getRequests()
41+
{
42+
return $this->requests;
43+
}
44+
}
45+
46+
// Adding a class alias for backwards compatibility with the previous class name.
47+
class_alias(BatchQueryDomainStatsRequest::class, 'Google_Service_PostmasterTools_BatchQueryDomainStatsRequest');
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
18+
namespace Google\Service\PostmasterTools;
19+
20+
class BatchQueryDomainStatsResponse extends \Google\Collection
21+
{
22+
protected $collection_key = 'results';
23+
protected $resultsType = BatchQueryDomainStatsResult::class;
24+
protected $resultsDataType = 'array';
25+
26+
/**
27+
* A list of responses, one for each query in the
28+
* BatchQueryDomainStatsRequest. The order of responses will correspond to the
29+
* order of requests.
30+
*
31+
* @param BatchQueryDomainStatsResult[] $results
32+
*/
33+
public function setResults($results)
34+
{
35+
$this->results = $results;
36+
}
37+
/**
38+
* @return BatchQueryDomainStatsResult[]
39+
*/
40+
public function getResults()
41+
{
42+
return $this->results;
43+
}
44+
}
45+
46+
// Adding a class alias for backwards compatibility with the previous class name.
47+
class_alias(BatchQueryDomainStatsResponse::class, 'Google_Service_PostmasterTools_BatchQueryDomainStatsResponse');

0 commit comments

Comments
 (0)