PostmasterTools.php 4.9 KB

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