FirebaseCloudMessaging.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 FirebaseCloudMessaging (v1).
  21. *
  22. * <p>
  23. * FCM send API that provides a cross-platform messaging solution to reliably
  24. * deliver messages.</p>
  25. *
  26. * <p>
  27. * For more information about this service, see the API
  28. * <a href="https://firebase.google.com/docs/cloud-messaging" target="_blank">Documentation</a>
  29. * </p>
  30. *
  31. * @author Google, Inc.
  32. */
  33. class FirebaseCloudMessaging extends \Google\Service
  34. {
  35. /** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.. */
  36. const CLOUD_PLATFORM =
  37. "https://www.googleapis.com/auth/cloud-platform";
  38. /** Send messages and manage messaging subscriptions for your Firebase applications. */
  39. const FIREBASE_MESSAGING =
  40. "https://www.googleapis.com/auth/firebase.messaging";
  41. public $projects_messages;
  42. public $rootUrlTemplate;
  43. /**
  44. * Constructs the internal representation of the FirebaseCloudMessaging
  45. * service.
  46. *
  47. * @param Client|array $clientOrConfig The client used to deliver requests, or a
  48. * config array to pass to a new Client instance.
  49. * @param string $rootUrl The root URL used for requests to the service.
  50. */
  51. public function __construct($clientOrConfig = [], $rootUrl = null)
  52. {
  53. parent::__construct($clientOrConfig);
  54. $this->rootUrl = $rootUrl ?: 'https://fcm.googleapis.com/';
  55. $this->rootUrlTemplate = $rootUrl ?: 'https://fcm.UNIVERSE_DOMAIN/';
  56. $this->servicePath = '';
  57. $this->batchPath = 'batch';
  58. $this->version = 'v1';
  59. $this->serviceName = 'fcm';
  60. $this->projects_messages = new FirebaseCloudMessaging\Resource\ProjectsMessages(
  61. $this,
  62. $this->serviceName,
  63. 'messages',
  64. [
  65. 'methods' => [
  66. 'send' => [
  67. 'path' => 'v1/{+parent}/messages:send',
  68. 'httpMethod' => 'POST',
  69. 'parameters' => [
  70. 'parent' => [
  71. 'location' => 'path',
  72. 'type' => 'string',
  73. 'required' => true,
  74. ],
  75. ],
  76. ],
  77. ]
  78. ]
  79. );
  80. }
  81. }
  82. // Adding a class alias for backwards compatibility with the previous class name.
  83. class_alias(FirebaseCloudMessaging::class, 'Google_Service_FirebaseCloudMessaging');